Completed
Push — master ( 029a3f...057a2a )
by Yannick
07:22
created
require/class.Spotter.php 2 patches
Indentation   +1457 added lines, -1457 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();
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	}
150 150
 
151 151
 	/**
152
-	* Executes the SQL statements to get the spotter information
153
-	*
154
-	* @param String $query the SQL query
155
-	* @param Array $params parameter of the query
156
-	* @param String $limitQuery the limit query
157
-	* @return Array the spotter information
158
-	*
159
-	*/
152
+	 * Executes the SQL statements to get the spotter information
153
+	 *
154
+	 * @param String $query the SQL query
155
+	 * @param Array $params parameter of the query
156
+	 * @param String $limitQuery the limit query
157
+	 * @return Array the spotter information
158
+	 *
159
+	 */
160 160
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
161 161
 	{
162 162
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -323,11 +323,11 @@  discard block
 block discarded – undo
323 323
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
324 324
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
325 325
 					} else $temp_array['aircraft_shadow'] = 'default.png';
326
-                                } else {
327
-                            		$temp_array['aircraft_shadow'] = 'default.png';
326
+								} else {
327
+									$temp_array['aircraft_shadow'] = 'default.png';
328 328
 					$temp_array['aircraft_name'] = 'N/A';
329 329
 					$temp_array['aircraft_manufacturer'] = 'N/A';
330
-                            	}
330
+								}
331 331
 			}
332 332
 			$fromsource = NULL;
333 333
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -523,11 +523,11 @@  discard block
 block discarded – undo
523 523
 	
524 524
 	
525 525
 	/**
526
-	* Gets all the spotter information
527
-	*
528
-	* @return Array the spotter information
529
-	*
530
-	*/
526
+	 * Gets all the spotter information
527
+	 *
528
+	 * @return Array the spotter information
529
+	 *
530
+	 */
531 531
 	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())
532 532
 	{
533 533
 		global $globalTimezone, $globalDBdriver;
@@ -874,11 +874,11 @@  discard block
 block discarded – undo
874 874
 	
875 875
 	
876 876
 	/**
877
-	* Gets all the spotter information based on the latest data entry
878
-	*
879
-	* @return Array the spotter information
880
-	*
881
-	*/
877
+	 * Gets all the spotter information based on the latest data entry
878
+	 *
879
+	 * @return Array the spotter information
880
+	 *
881
+	 */
882 882
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
883 883
 	{
884 884
 		global $global_query;
@@ -917,12 +917,12 @@  discard block
 block discarded – undo
917 917
 	}
918 918
     
919 919
     
920
-    /**
921
-	* Gets all the spotter information based on a user's latitude and longitude
922
-	*
923
-	* @return Array the spotter information
924
-	*
925
-	*/
920
+	/**
921
+	 * Gets all the spotter information based on a user's latitude and longitude
922
+	 *
923
+	 * @return Array the spotter information
924
+	 *
925
+	 */
926 926
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
927 927
 	{
928 928
 		date_default_timezone_set('UTC');
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 				return false;
951 951
 			}
952 952
 		}
953
-    		$additional_query = '';
953
+			$additional_query = '';
954 954
 		if ($interval != "")
955 955
 		{
956 956
 			if (!is_string($interval))
@@ -990,12 +990,12 @@  discard block
 block discarded – undo
990 990
 	}
991 991
     
992 992
     
993
-    /**
994
-	* Gets all the spotter information sorted by the newest aircraft type
995
-	*
996
-	* @return Array the spotter information
997
-	*
998
-	*/
993
+	/**
994
+	 * Gets all the spotter information sorted by the newest aircraft type
995
+	 *
996
+	 * @return Array the spotter information
997
+	 *
998
+	 */
999 999
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1000 1000
 	{
1001 1001
 		global $global_query;
@@ -1036,11 +1036,11 @@  discard block
 block discarded – undo
1036 1036
     
1037 1037
     
1038 1038
 	/**
1039
-	* Gets all the spotter information sorted by the newest aircraft registration
1040
-	*
1041
-	* @return Array the spotter information
1042
-	*
1043
-	*/
1039
+	 * Gets all the spotter information sorted by the newest aircraft registration
1040
+	 *
1041
+	 * @return Array the spotter information
1042
+	 *
1043
+	 */
1044 1044
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1045 1045
 	{
1046 1046
 		global $global_query;
@@ -1080,11 +1080,11 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
 
1082 1082
 	/**
1083
-	* Gets all the spotter information sorted by the newest airline
1084
-	*
1085
-	* @return Array the spotter information
1086
-	*
1087
-	*/
1083
+	 * Gets all the spotter information sorted by the newest airline
1084
+	 *
1085
+	 * @return Array the spotter information
1086
+	 *
1087
+	 */
1088 1088
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1089 1089
 	{
1090 1090
 		global $global_query;
@@ -1123,12 +1123,12 @@  discard block
 block discarded – undo
1123 1123
 	}
1124 1124
     
1125 1125
     
1126
-    /**
1127
-	* Gets all the spotter information sorted by the newest departure airport
1128
-	*
1129
-	* @return Array the spotter information
1130
-	*
1131
-	*/
1126
+	/**
1127
+	 * Gets all the spotter information sorted by the newest departure airport
1128
+	 *
1129
+	 * @return Array the spotter information
1130
+	 *
1131
+	 */
1132 1132
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1133 1133
 	{
1134 1134
 		global $global_query;
@@ -1170,11 +1170,11 @@  discard block
 block discarded – undo
1170 1170
 
1171 1171
 
1172 1172
 	/**
1173
-	* Gets all the spotter information sorted by the newest arrival airport
1174
-	*
1175
-	* @return Array the spotter information
1176
-	*
1177
-	*/
1173
+	 * Gets all the spotter information sorted by the newest arrival airport
1174
+	 *
1175
+	 * @return Array the spotter information
1176
+	 *
1177
+	 */
1178 1178
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1179 1179
 	{
1180 1180
 		global $global_query;
@@ -1213,11 +1213,11 @@  discard block
 block discarded – undo
1213 1213
 	
1214 1214
 
1215 1215
 	/**
1216
-	* Gets all the spotter information based on the spotter id
1217
-	*
1218
-	* @return Array the spotter information
1219
-	*
1220
-	*/
1216
+	 * Gets all the spotter information based on the spotter id
1217
+	 *
1218
+	 * @return Array the spotter information
1219
+	 *
1220
+	 */
1221 1221
 	public function getSpotterDataByID($id = '')
1222 1222
 	{
1223 1223
 		global $global_query;
@@ -1239,11 +1239,11 @@  discard block
 block discarded – undo
1239 1239
 	
1240 1240
 	
1241 1241
 	/**
1242
-	* Gets all the spotter information based on the callsign
1243
-	*
1244
-	* @return Array the spotter information
1245
-	*
1246
-	*/
1242
+	 * Gets all the spotter information based on the callsign
1243
+	 *
1244
+	 * @return Array the spotter information
1245
+	 *
1246
+	 */
1247 1247
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
1248 1248
 	{
1249 1249
 		global $global_query;
@@ -1295,11 +1295,11 @@  discard block
 block discarded – undo
1295 1295
 	}
1296 1296
 	
1297 1297
 	/**
1298
-	* Gets all the spotter information based on the owner
1299
-	*
1300
-	* @return Array the spotter information
1301
-	*
1302
-	*/
1298
+	 * Gets all the spotter information based on the owner
1299
+	 *
1300
+	 * @return Array the spotter information
1301
+	 *
1302
+	 */
1303 1303
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1304 1304
 	{
1305 1305
 		global $global_query;
@@ -1352,11 +1352,11 @@  discard block
 block discarded – undo
1352 1352
 	}
1353 1353
 	
1354 1354
 	/**
1355
-	* Gets all the spotter information based on the pilot
1356
-	*
1357
-	* @return Array the spotter information
1358
-	*
1359
-	*/
1355
+	 * Gets all the spotter information based on the pilot
1356
+	 *
1357
+	 * @return Array the spotter information
1358
+	 *
1359
+	 */
1360 1360
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1361 1361
 	{
1362 1362
 		global $global_query;
@@ -1405,11 +1405,11 @@  discard block
 block discarded – undo
1405 1405
 	
1406 1406
 	
1407 1407
 	/**
1408
-	* Gets all the spotter information based on the aircraft type
1409
-	*
1410
-	* @return Array the spotter information
1411
-	*
1412
-	*/
1408
+	 * Gets all the spotter information based on the aircraft type
1409
+	 *
1410
+	 * @return Array the spotter information
1411
+	 *
1412
+	 */
1413 1413
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1414 1414
 	{
1415 1415
 		global $global_query;
@@ -1463,11 +1463,11 @@  discard block
 block discarded – undo
1463 1463
 	
1464 1464
 	
1465 1465
 	/**
1466
-	* Gets all the spotter information based on the aircraft registration
1467
-	*
1468
-	* @return Array the spotter information
1469
-	*
1470
-	*/
1466
+	 * Gets all the spotter information based on the aircraft registration
1467
+	 *
1468
+	 * @return Array the spotter information
1469
+	 *
1470
+	 */
1471 1471
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1472 1472
 	{
1473 1473
 		global $global_query;
@@ -1524,11 +1524,11 @@  discard block
 block discarded – undo
1524 1524
 	
1525 1525
 	
1526 1526
 	/**
1527
-	* Gets all the spotter information based on the airline
1528
-	*
1529
-	* @return Array the spotter information
1530
-	*
1531
-	*/
1527
+	 * Gets all the spotter information based on the airline
1528
+	 *
1529
+	 * @return Array the spotter information
1530
+	 *
1531
+	 */
1532 1532
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1533 1533
 	{
1534 1534
 		global $global_query;
@@ -1581,11 +1581,11 @@  discard block
 block discarded – undo
1581 1581
 	
1582 1582
 	
1583 1583
 	/**
1584
-	* Gets all the spotter information based on the airport
1585
-	*
1586
-	* @return Array the spotter information
1587
-	*
1588
-	*/
1584
+	 * Gets all the spotter information based on the airport
1585
+	 *
1586
+	 * @return Array the spotter information
1587
+	 *
1588
+	 */
1589 1589
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1590 1590
 	{
1591 1591
 		global $global_query;
@@ -1639,11 +1639,11 @@  discard block
 block discarded – undo
1639 1639
 
1640 1640
 
1641 1641
 	/**
1642
-	* Gets all the spotter information based on the date
1643
-	*
1644
-	* @return Array the spotter information
1645
-	*
1646
-	*/
1642
+	 * Gets all the spotter information based on the date
1643
+	 *
1644
+	 * @return Array the spotter information
1645
+	 *
1646
+	 */
1647 1647
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1648 1648
 	{
1649 1649
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1707,11 +1707,11 @@  discard block
 block discarded – undo
1707 1707
 
1708 1708
 
1709 1709
 	/**
1710
-	* Gets all the spotter information based on the country name
1711
-	*
1712
-	* @return Array the spotter information
1713
-	*
1714
-	*/
1710
+	 * Gets all the spotter information based on the country name
1711
+	 *
1712
+	 * @return Array the spotter information
1713
+	 *
1714
+	 */
1715 1715
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1716 1716
 	{
1717 1717
 		global $global_query;
@@ -1765,11 +1765,11 @@  discard block
 block discarded – undo
1765 1765
 	
1766 1766
 	
1767 1767
 	/**
1768
-	* Gets all the spotter information based on the manufacturer name
1769
-	*
1770
-	* @return Array the spotter information
1771
-	*
1772
-	*/
1768
+	 * Gets all the spotter information based on the manufacturer name
1769
+	 *
1770
+	 * @return Array the spotter information
1771
+	 *
1772
+	 */
1773 1773
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1774 1774
 	{
1775 1775
 		global $global_query;
@@ -1825,13 +1825,13 @@  discard block
 block discarded – undo
1825 1825
   
1826 1826
   
1827 1827
 	/**
1828
-	* Gets a list of all aircraft that take a route
1829
-	*
1830
-	* @param String $departure_airport_icao ICAO code of departure airport
1831
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1832
-	* @return Array the spotter information
1833
-	*
1834
-	*/
1828
+	 * Gets a list of all aircraft that take a route
1829
+	 *
1830
+	 * @param String $departure_airport_icao ICAO code of departure airport
1831
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1832
+	 * @return Array the spotter information
1833
+	 *
1834
+	 */
1835 1835
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1836 1836
 	{
1837 1837
 		global $global_query;
@@ -1900,11 +1900,11 @@  discard block
 block discarded – undo
1900 1900
 	
1901 1901
 	
1902 1902
 	/**
1903
-	* Gets all the spotter information based on the special column in the table
1904
-	*
1905
-	* @return Array the spotter information
1906
-	*
1907
-	*/
1903
+	 * Gets all the spotter information based on the special column in the table
1904
+	 *
1905
+	 * @return Array the spotter information
1906
+	 *
1907
+	 */
1908 1908
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1909 1909
 	{
1910 1910
 		global $global_query;
@@ -1943,11 +1943,11 @@  discard block
 block discarded – undo
1943 1943
 	}
1944 1944
 
1945 1945
 	/**
1946
-	* Gets all the highlight based on a aircraft registration
1947
-	*
1948
-	* @return String the highlight text
1949
-	*
1950
-	*/
1946
+	 * Gets all the highlight based on a aircraft registration
1947
+	 *
1948
+	 * @return String the highlight text
1949
+	 *
1950
+	 */
1951 1951
 	public function getHighlightByRegistration($registration,$filter = array())
1952 1952
 	{
1953 1953
 		global $global_query;
@@ -1969,13 +1969,13 @@  discard block
 block discarded – undo
1969 1969
 
1970 1970
 	
1971 1971
 	/**
1972
-	* Gets the squawk usage from squawk code
1973
-	*
1974
-	* @param String $squawk squawk code
1975
-	* @param String $country country
1976
-	* @return String usage
1977
-	*
1978
-	*/
1972
+	 * Gets the squawk usage from squawk code
1973
+	 *
1974
+	 * @param String $squawk squawk code
1975
+	 * @param String $country country
1976
+	 * @return String usage
1977
+	 *
1978
+	 */
1979 1979
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1980 1980
 	{
1981 1981
 		
@@ -1996,12 +1996,12 @@  discard block
 block discarded – undo
1996 1996
 	}
1997 1997
 
1998 1998
 	/**
1999
-	* Gets the airport icao from the iata
2000
-	*
2001
-	* @param String $airport_iata the iata code of the airport
2002
-	* @return String airport iata
2003
-	*
2004
-	*/
1999
+	 * Gets the airport icao from the iata
2000
+	 *
2001
+	 * @param String $airport_iata the iata code of the airport
2002
+	 * @return String airport iata
2003
+	 *
2004
+	 */
2005 2005
 	public function getAirportIcao($airport_iata = '')
2006 2006
 	{
2007 2007
 		
@@ -2021,14 +2021,14 @@  discard block
 block discarded – undo
2021 2021
 	}
2022 2022
 
2023 2023
 	/**
2024
-	* Gets the airport distance
2025
-	*
2026
-	* @param String $airport_icao the icao code of the airport
2027
-	* @param Float $latitude the latitude
2028
-	* @param Float $longitude the longitude
2029
-	* @return Float distance to the airport
2030
-	*
2031
-	*/
2024
+	 * Gets the airport distance
2025
+	 *
2026
+	 * @param String $airport_icao the icao code of the airport
2027
+	 * @param Float $latitude the latitude
2028
+	 * @param Float $longitude the longitude
2029
+	 * @return Float distance to the airport
2030
+	 *
2031
+	 */
2032 2032
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2033 2033
 	{
2034 2034
 		
@@ -2049,12 +2049,12 @@  discard block
 block discarded – undo
2049 2049
 	}
2050 2050
 	
2051 2051
 	/**
2052
-	* Gets the airport info based on the icao
2053
-	*
2054
-	* @param String $airport the icao code of the airport
2055
-	* @return Array airport information
2056
-	*
2057
-	*/
2052
+	 * Gets the airport info based on the icao
2053
+	 *
2054
+	 * @param String $airport the icao code of the airport
2055
+	 * @return Array airport information
2056
+	 *
2057
+	 */
2058 2058
 	public function getAllAirportInfo($airport = '')
2059 2059
 	{
2060 2060
 		
@@ -2100,12 +2100,12 @@  discard block
 block discarded – undo
2100 2100
 	}
2101 2101
 	
2102 2102
 	/**
2103
-	* Gets the airport info based on the country
2104
-	*
2105
-	* @param Array $countries Airports countries
2106
-	* @return Array airport information
2107
-	*
2108
-	*/
2103
+	 * Gets the airport info based on the country
2104
+	 *
2105
+	 * @param Array $countries Airports countries
2106
+	 * @return Array airport information
2107
+	 *
2108
+	 */
2109 2109
 	public function getAllAirportInfobyCountry($countries)
2110 2110
 	{
2111 2111
 		$lst_countries = '';
@@ -2143,12 +2143,12 @@  discard block
 block discarded – undo
2143 2143
 	}
2144 2144
 	
2145 2145
 	/**
2146
-	* Gets airports info based on the coord
2147
-	*
2148
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2149
-	* @return Array airport information
2150
-	*
2151
-	*/
2146
+	 * Gets airports info based on the coord
2147
+	 *
2148
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2149
+	 * @return Array airport information
2150
+	 *
2151
+	 */
2152 2152
 	public function getAllAirportInfobyCoord($coord)
2153 2153
 	{
2154 2154
 		global $globalDBdriver;
@@ -2179,12 +2179,12 @@  discard block
 block discarded – undo
2179 2179
 	}
2180 2180
 
2181 2181
 	/**
2182
-	* Gets waypoints info based on the coord
2183
-	*
2184
-	* @param Array $coord waypoints coord
2185
-	* @return Array airport information
2186
-	*
2187
-	*/
2182
+	 * Gets waypoints info based on the coord
2183
+	 *
2184
+	 * @param Array $coord waypoints coord
2185
+	 * @return Array airport information
2186
+	 *
2187
+	 */
2188 2188
 	public function getAllWaypointsInfobyCoord($coord)
2189 2189
 	{
2190 2190
 		if (is_array($coord)) {
@@ -2218,12 +2218,12 @@  discard block
 block discarded – undo
2218 2218
 	
2219 2219
 	
2220 2220
 	/**
2221
-	* Gets the airline info based on the icao code or iata code
2222
-	*
2223
-	* @param String $airline_icao the iata code of the airport
2224
-	* @return Array airport information
2225
-	*
2226
-	*/
2221
+	 * Gets the airline info based on the icao code or iata code
2222
+	 *
2223
+	 * @param String $airline_icao the iata code of the airport
2224
+	 * @return Array airport information
2225
+	 *
2226
+	 */
2227 2227
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2228 2228
 	{
2229 2229
 		global $globalUseRealAirlines;
@@ -2254,7 +2254,7 @@  discard block
 block discarded – undo
2254 2254
 			} else {
2255 2255
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2256 2256
 			}
2257
-                        /*
2257
+						/*
2258 2258
 			$airline_array = array();
2259 2259
 			$temp_array = array();
2260 2260
 		
@@ -2287,12 +2287,12 @@  discard block
 block discarded – undo
2287 2287
 	}
2288 2288
 	
2289 2289
 	/**
2290
-	* Gets the airline info based on the airline name
2291
-	*
2292
-	* @param String $airline_name the name of the airline
2293
-	* @return Array airline information
2294
-	*
2295
-	*/
2290
+	 * Gets the airline info based on the airline name
2291
+	 *
2292
+	 * @param String $airline_name the name of the airline
2293
+	 * @return Array airline information
2294
+	 *
2295
+	 */
2296 2296
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2297 2297
 	{
2298 2298
 		global $globalUseRealAirlines;
@@ -2320,12 +2320,12 @@  discard block
 block discarded – undo
2320 2320
 	
2321 2321
 	
2322 2322
 	/**
2323
-	* Gets the aircraft info based on the aircraft type
2324
-	*
2325
-	* @param String $aircraft_type the aircraft type
2326
-	* @return Array aircraft information
2327
-	*
2328
-	*/
2323
+	 * Gets the aircraft info based on the aircraft type
2324
+	 *
2325
+	 * @param String $aircraft_type the aircraft type
2326
+	 * @return Array aircraft information
2327
+	 *
2328
+	 */
2329 2329
 	public function getAllAircraftInfo($aircraft_type)
2330 2330
 	{
2331 2331
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2357,12 +2357,12 @@  discard block
 block discarded – undo
2357 2357
 	}
2358 2358
 
2359 2359
 	/**
2360
-	* Gets the aircraft icao based on the aircraft name/type
2361
-	*
2362
-	* @param String $aircraft_type the aircraft type
2363
-	* @return String aircraft information
2364
-	*
2365
-	*/
2360
+	 * Gets the aircraft icao based on the aircraft name/type
2361
+	 *
2362
+	 * @param String $aircraft_type the aircraft type
2363
+	 * @return String aircraft information
2364
+	 *
2365
+	 */
2366 2366
 	public function getAircraftIcao($aircraft_type)
2367 2367
 	{
2368 2368
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2387,12 +2387,12 @@  discard block
 block discarded – undo
2387 2387
 	}
2388 2388
 	
2389 2389
 	/**
2390
-	* Gets the aircraft info based on the aircraft modes
2391
-	*
2392
-	* @param String $aircraft_modes the aircraft ident (hex)
2393
-	* @return String aircraft type
2394
-	*
2395
-	*/
2390
+	 * Gets the aircraft info based on the aircraft modes
2391
+	 *
2392
+	 * @param String $aircraft_modes the aircraft ident (hex)
2393
+	 * @return String aircraft type
2394
+	 *
2395
+	 */
2396 2396
 	public function getAllAircraftType($aircraft_modes)
2397 2397
 	{
2398 2398
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2412,12 +2412,12 @@  discard block
 block discarded – undo
2412 2412
 	}
2413 2413
 
2414 2414
 	/**
2415
-	* Gets the aircraft info based on the aircraft registration
2416
-	*
2417
-	* @param String $registration the aircraft registration
2418
-	* @return String aircraft type
2419
-	*
2420
-	*/
2415
+	 * Gets the aircraft info based on the aircraft registration
2416
+	 *
2417
+	 * @param String $registration the aircraft registration
2418
+	 * @return String aircraft type
2419
+	 *
2420
+	 */
2421 2421
 	public function getAllAircraftTypeByRegistration($registration)
2422 2422
 	{
2423 2423
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2435,12 +2435,12 @@  discard block
 block discarded – undo
2435 2435
 	}
2436 2436
 
2437 2437
 	/**
2438
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2439
-	*
2440
-	* @param String $registration the aircraft registration
2441
-	* @return Array spotter_id and flightaware_id
2442
-	*
2443
-	*/
2438
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2439
+	 *
2440
+	 * @param String $registration the aircraft registration
2441
+	 * @return Array spotter_id and flightaware_id
2442
+	 *
2443
+	 */
2444 2444
 	public function getAllIDByRegistration($registration)
2445 2445
 	{
2446 2446
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2459,12 +2459,12 @@  discard block
 block discarded – undo
2459 2459
 	}
2460 2460
 
2461 2461
 	/**
2462
-	* Gets correct aircraft operator code
2463
-	*
2464
-	* @param String $operator the aircraft operator code (callsign)
2465
-	* @return String aircraft operator code
2466
-	*
2467
-	*/
2462
+	 * Gets correct aircraft operator code
2463
+	 *
2464
+	 * @param String $operator the aircraft operator code (callsign)
2465
+	 * @return String aircraft operator code
2466
+	 *
2467
+	 */
2468 2468
 	public function getOperator($operator)
2469 2469
 	{
2470 2470
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2481,16 +2481,16 @@  discard block
 block discarded – undo
2481 2481
 	}
2482 2482
 
2483 2483
 	/**
2484
-	* Gets the aircraft route based on the aircraft callsign
2485
-	*
2486
-	* @param String $callsign the aircraft callsign
2487
-	* @return Array aircraft type
2488
-	*
2489
-	*/
2484
+	 * Gets the aircraft route based on the aircraft callsign
2485
+	 *
2486
+	 * @param String $callsign the aircraft callsign
2487
+	 * @return Array aircraft type
2488
+	 *
2489
+	 */
2490 2490
 	public function getRouteInfo($callsign)
2491 2491
 	{
2492 2492
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2493
-                if ($callsign == '') return array();
2493
+				if ($callsign == '') return array();
2494 2494
 		$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";
2495 2495
 		
2496 2496
 		$sth = $this->db->prepare($query);
@@ -2504,12 +2504,12 @@  discard block
 block discarded – undo
2504 2504
 	}
2505 2505
 	
2506 2506
 	/**
2507
-	* Gets the aircraft info based on the aircraft registration
2508
-	*
2509
-	* @param String $registration the aircraft registration
2510
-	* @return Array aircraft information
2511
-	*
2512
-	*/
2507
+	 * Gets the aircraft info based on the aircraft registration
2508
+	 *
2509
+	 * @param String $registration the aircraft registration
2510
+	 * @return Array aircraft information
2511
+	 *
2512
+	 */
2513 2513
 	public function getAircraftInfoByRegistration($registration)
2514 2514
 	{
2515 2515
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2536,12 +2536,12 @@  discard block
 block discarded – undo
2536 2536
 	}
2537 2537
 	
2538 2538
 	/**
2539
-	* Gets the aircraft owner & base based on the aircraft registration
2540
-	*
2541
-	* @param String $registration the aircraft registration
2542
-	* @return Array aircraft information
2543
-	*
2544
-	*/
2539
+	 * Gets the aircraft owner & base based on the aircraft registration
2540
+	 *
2541
+	 * @param String $registration the aircraft registration
2542
+	 * @return Array aircraft information
2543
+	 *
2544
+	 */
2545 2545
 	public function getAircraftOwnerByRegistration($registration)
2546 2546
 	{
2547 2547
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2558,11 +2558,11 @@  discard block
 block discarded – undo
2558 2558
 	
2559 2559
   
2560 2560
   /**
2561
-	* Gets all flights (but with only little info)
2562
-	*
2563
-	* @return Array basic flight information
2564
-	*
2565
-	*/
2561
+   * Gets all flights (but with only little info)
2562
+   *
2563
+   * @return Array basic flight information
2564
+   *
2565
+   */
2566 2566
 	public function getAllFlightsforSitemap()
2567 2567
 	{
2568 2568
 		//$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 ";
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
 		
2571 2571
 		$sth = $this->db->prepare($query);
2572 2572
 		$sth->execute();
2573
-                  /*
2573
+				  /*
2574 2574
 		$flight_array = array();
2575 2575
 		$temp_array = array();
2576 2576
 		
@@ -2592,11 +2592,11 @@  discard block
 block discarded – undo
2592 2592
 	}
2593 2593
   
2594 2594
 	/**
2595
-	* Gets a list of all aircraft manufacturers
2596
-	*
2597
-	* @return Array list of aircraft types
2598
-	*
2599
-	*/
2595
+	 * Gets a list of all aircraft manufacturers
2596
+	 *
2597
+	 * @return Array list of aircraft types
2598
+	 *
2599
+	 */
2600 2600
 	public function getAllManufacturers()
2601 2601
 	{
2602 2602
 		/*
@@ -2625,11 +2625,11 @@  discard block
 block discarded – undo
2625 2625
   
2626 2626
   
2627 2627
   /**
2628
-	* Gets a list of all aircraft types
2629
-	*
2630
-	* @return Array list of aircraft types
2631
-	*
2632
-	*/
2628
+   * Gets a list of all aircraft types
2629
+   *
2630
+   * @return Array list of aircraft types
2631
+   *
2632
+   */
2633 2633
 	public function getAllAircraftTypes($filters = array())
2634 2634
 	{
2635 2635
 		/*
@@ -2664,11 +2664,11 @@  discard block
 block discarded – undo
2664 2664
 	
2665 2665
 	
2666 2666
 	/**
2667
-	* Gets a list of all aircraft registrations
2668
-	*
2669
-	* @return Array list of aircraft registrations
2670
-	*
2671
-	*/
2667
+	 * Gets a list of all aircraft registrations
2668
+	 *
2669
+	 * @return Array list of aircraft registrations
2670
+	 *
2671
+	 */
2672 2672
 	public function getAllAircraftRegistrations($filters = array())
2673 2673
 	{
2674 2674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2693,12 +2693,12 @@  discard block
 block discarded – undo
2693 2693
 	}
2694 2694
 
2695 2695
 	/**
2696
-	* Gets all source name
2697
-	*
2698
-	* @param String type format of source
2699
-	* @return Array list of source name
2700
-	*
2701
-	*/
2696
+	 * Gets all source name
2697
+	 *
2698
+	 * @param String type format of source
2699
+	 * @return Array list of source name
2700
+	 *
2701
+	 */
2702 2702
 	public function getAllSourceName($type = '',$filters = array())
2703 2703
 	{
2704 2704
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2729,11 +2729,11 @@  discard block
 block discarded – undo
2729 2729
 
2730 2730
 
2731 2731
 	/**
2732
-	* Gets a list of all airline names
2733
-	*
2734
-	* @return Array list of airline names
2735
-	*
2736
-	*/
2732
+	 * Gets a list of all airline names
2733
+	 *
2734
+	 * @return Array list of airline names
2735
+	 *
2736
+	 */
2737 2737
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2738 2738
 	{
2739 2739
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2782,11 +2782,11 @@  discard block
 block discarded – undo
2782 2782
 	}
2783 2783
 	
2784 2784
 	/**
2785
-	* Gets a list of all alliance names
2786
-	*
2787
-	* @return Array list of alliance names
2788
-	*
2789
-	*/
2785
+	 * Gets a list of all alliance names
2786
+	 *
2787
+	 * @return Array list of alliance names
2788
+	 *
2789
+	 */
2790 2790
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2791 2791
 	{
2792 2792
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2811,11 +2811,11 @@  discard block
 block discarded – undo
2811 2811
 	}
2812 2812
 	
2813 2813
 	/**
2814
-	* Gets a list of all airline countries
2815
-	*
2816
-	* @return Array list of airline countries
2817
-	*
2818
-	*/
2814
+	 * Gets a list of all airline countries
2815
+	 *
2816
+	 * @return Array list of airline countries
2817
+	 *
2818
+	 */
2819 2819
 	public function getAllAirlineCountries($filters = array())
2820 2820
 	{
2821 2821
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2843,11 +2843,11 @@  discard block
 block discarded – undo
2843 2843
 	
2844 2844
 	
2845 2845
 	/**
2846
-	* Gets a list of all departure & arrival names
2847
-	*
2848
-	* @return Array list of airport names
2849
-	*
2850
-	*/
2846
+	 * Gets a list of all departure & arrival names
2847
+	 *
2848
+	 * @return Array list of airport names
2849
+	 *
2850
+	 */
2851 2851
 	public function getAllAirportNames($filters = array())
2852 2852
 	{
2853 2853
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2895,11 +2895,11 @@  discard block
 block discarded – undo
2895 2895
 	} 
2896 2896
 
2897 2897
 	/**
2898
-	* Gets a list of all owner names
2899
-	*
2900
-	* @return Array list of owner names
2901
-	*
2902
-	*/
2898
+	 * Gets a list of all owner names
2899
+	 *
2900
+	 * @return Array list of owner names
2901
+	 *
2902
+	 */
2903 2903
 	public function getAllOwnerNames($filters = array())
2904 2904
 	{
2905 2905
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2913,11 +2913,11 @@  discard block
 block discarded – undo
2913 2913
 	} 
2914 2914
 
2915 2915
 	/**
2916
-	* Gets a list of all pilot names and pilot ids
2917
-	*
2918
-	* @return Array list of pilot names and pilot ids
2919
-	*
2920
-	*/
2916
+	 * Gets a list of all pilot names and pilot ids
2917
+	 *
2918
+	 * @return Array list of pilot names and pilot ids
2919
+	 *
2920
+	 */
2921 2921
 	public function getAllPilotNames($filters = array())
2922 2922
 	{
2923 2923
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2932,11 +2932,11 @@  discard block
 block discarded – undo
2932 2932
 	
2933 2933
 	
2934 2934
 	/**
2935
-	* Gets a list of all departure & arrival airport countries
2936
-	*
2937
-	* @return Array list of airport countries
2938
-	*
2939
-	*/
2935
+	 * Gets a list of all departure & arrival airport countries
2936
+	 *
2937
+	 * @return Array list of airport countries
2938
+	 *
2939
+	 */
2940 2940
 	public function getAllAirportCountries($filters = array())
2941 2941
 	{
2942 2942
 		$airport_array = array();
@@ -2984,11 +2984,11 @@  discard block
 block discarded – undo
2984 2984
 	
2985 2985
 	
2986 2986
 	/**
2987
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2988
-	*
2989
-	* @return Array list of countries
2990
-	*
2991
-	*/
2987
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2988
+	 *
2989
+	 * @return Array list of countries
2990
+	 *
2991
+	 */
2992 2992
 	public function getAllCountries($filters = array())
2993 2993
 	{
2994 2994
 		$Connection= new Connection($this->db);
@@ -3065,11 +3065,11 @@  discard block
 block discarded – undo
3065 3065
 	
3066 3066
 	
3067 3067
 	/**
3068
-	* Gets a list of all idents/callsigns
3069
-	*
3070
-	* @return Array list of ident/callsign names
3071
-	*
3072
-	*/
3068
+	 * Gets a list of all idents/callsigns
3069
+	 *
3070
+	 * @return Array list of ident/callsign names
3071
+	 *
3072
+	 */
3073 3073
 	public function getAllIdents($filters = array())
3074 3074
 	{
3075 3075
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3093,9 +3093,9 @@  discard block
 block discarded – undo
3093 3093
 	}
3094 3094
 
3095 3095
 	/**
3096
-	* Get a list of flights from airport since 7 days
3097
-	* @return Array number, icao, name and city of airports
3098
-	*/
3096
+	 * Get a list of flights from airport since 7 days
3097
+	 * @return Array number, icao, name and city of airports
3098
+	 */
3099 3099
 
3100 3100
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3101 3101
 		global $globalTimezone, $globalDBdriver;
@@ -3126,9 +3126,9 @@  discard block
 block discarded – undo
3126 3126
 	}
3127 3127
 
3128 3128
 	/**
3129
-	* Get a list of flights from airport since 7 days
3130
-	* @return Array number, icao, name and city of airports
3131
-	*/
3129
+	 * Get a list of flights from airport since 7 days
3130
+	 * @return Array number, icao, name and city of airports
3131
+	 */
3132 3132
 
3133 3133
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3134 3134
 		global $globalTimezone, $globalDBdriver;
@@ -3158,9 +3158,9 @@  discard block
 block discarded – undo
3158 3158
 	}
3159 3159
 
3160 3160
 	/**
3161
-	* Get a list of flights from detected airport since 7 days
3162
-	* @return Array number, icao, name and city of airports
3163
-	*/
3161
+	 * Get a list of flights from detected airport since 7 days
3162
+	 * @return Array number, icao, name and city of airports
3163
+	 */
3164 3164
 
3165 3165
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3166 3166
 		global $globalTimezone, $globalDBdriver;
@@ -3198,9 +3198,9 @@  discard block
 block discarded – undo
3198 3198
 	}
3199 3199
 
3200 3200
 	/**
3201
-	* Get a list of flights from detected airport since 7 days
3202
-	* @return Array number, icao, name and city of airports
3203
-	*/
3201
+	 * Get a list of flights from detected airport since 7 days
3202
+	 * @return Array number, icao, name and city of airports
3203
+	 */
3204 3204
 
3205 3205
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3206 3206
 		global $globalTimezone, $globalDBdriver;
@@ -3242,9 +3242,9 @@  discard block
 block discarded – undo
3242 3242
 
3243 3243
 
3244 3244
 	/**
3245
-	* Get a list of flights to airport since 7 days
3246
-	* @return Array number, icao, name and city of airports
3247
-	*/
3245
+	 * Get a list of flights to airport since 7 days
3246
+	 * @return Array number, icao, name and city of airports
3247
+	 */
3248 3248
 
3249 3249
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3250 3250
 		global $globalTimezone, $globalDBdriver;
@@ -3277,9 +3277,9 @@  discard block
 block discarded – undo
3277 3277
 
3278 3278
 
3279 3279
 	/**
3280
-	* Get a list of flights detected to airport since 7 days
3281
-	* @return Array number, icao, name and city of airports
3282
-	*/
3280
+	 * Get a list of flights detected to airport since 7 days
3281
+	 * @return Array number, icao, name and city of airports
3282
+	 */
3283 3283
 
3284 3284
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3285 3285
 		global $globalTimezone, $globalDBdriver;
@@ -3320,9 +3320,9 @@  discard block
 block discarded – undo
3320 3320
 
3321 3321
 
3322 3322
 	/**
3323
-	* Get a list of flights to airport since 7 days
3324
-	* @return Array number, icao, name and city of airports
3325
-	*/
3323
+	 * Get a list of flights to airport since 7 days
3324
+	 * @return Array number, icao, name and city of airports
3325
+	 */
3326 3326
 
3327 3327
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3328 3328
 		global $globalTimezone, $globalDBdriver;
@@ -3354,9 +3354,9 @@  discard block
 block discarded – undo
3354 3354
 
3355 3355
 
3356 3356
 	/**
3357
-	* Get a list of flights detected to airport since 7 days
3358
-	* @return Array number, icao, name and city of airports
3359
-	*/
3357
+	 * Get a list of flights detected to airport since 7 days
3358
+	 * @return Array number, icao, name and city of airports
3359
+	 */
3360 3360
 
3361 3361
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3362 3362
 		global $globalTimezone, $globalDBdriver;
@@ -3400,11 +3400,11 @@  discard block
 block discarded – undo
3400 3400
 
3401 3401
 
3402 3402
 	/**
3403
-	* Gets a list of all dates
3404
-	*
3405
-	* @return Array list of date names
3406
-	*
3407
-	*/
3403
+	 * Gets a list of all dates
3404
+	 *
3405
+	 * @return Array list of date names
3406
+	 *
3407
+	 */
3408 3408
 	public function getAllDates()
3409 3409
 	{
3410 3410
 		global $globalTimezone, $globalDBdriver;
@@ -3445,11 +3445,11 @@  discard block
 block discarded – undo
3445 3445
 	
3446 3446
 	
3447 3447
 	/**
3448
-	* Gets all route combinations
3449
-	*
3450
-	* @return Array the route list
3451
-	*
3452
-	*/
3448
+	 * Gets all route combinations
3449
+	 *
3450
+	 * @return Array the route list
3451
+	 *
3452
+	 */
3453 3453
 	public function getAllRoutes()
3454 3454
 	{
3455 3455
 		$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 
@@ -3475,13 +3475,13 @@  discard block
 block discarded – undo
3475 3475
 	}
3476 3476
 
3477 3477
 	/**
3478
-	* Update ident spotter data
3479
-	*
3480
-	* @param String $flightaware_id the ID from flightaware
3481
-	* @param String $ident the flight ident
3482
-	* @return String success or false
3483
-	*
3484
-	*/	
3478
+	 * Update ident spotter data
3479
+	 *
3480
+	 * @param String $flightaware_id the ID from flightaware
3481
+	 * @param String $ident the flight ident
3482
+	 * @return String success or false
3483
+	 *
3484
+	 */	
3485 3485
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3486 3486
 	{
3487 3487
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3502,14 +3502,14 @@  discard block
 block discarded – undo
3502 3502
 		} else {
3503 3503
 			$airline_array = $this->getAllAirlineInfo("NA");
3504 3504
 		}
3505
-                $airline_name = $airline_array[0]['name'];
3506
-                $airline_icao = $airline_array[0]['icao'];
3507
-                $airline_country = $airline_array[0]['country'];
3508
-                $airline_type = $airline_array[0]['type'];
3505
+				$airline_name = $airline_array[0]['name'];
3506
+				$airline_icao = $airline_array[0]['icao'];
3507
+				$airline_country = $airline_array[0]['country'];
3508
+				$airline_type = $airline_array[0]['type'];
3509 3509
 
3510 3510
 
3511 3511
 		$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';
3512
-                $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);
3512
+				$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);
3513 3513
 
3514 3514
 		try {
3515 3515
 			$sth = $this->db->prepare($query);
@@ -3522,19 +3522,19 @@  discard block
 block discarded – undo
3522 3522
 
3523 3523
 	}
3524 3524
 	/**
3525
-	* Update latest spotter data
3526
-	*
3527
-	* @param String $flightaware_id the ID from flightaware
3528
-	* @param String $ident the flight ident
3529
-	* @param String $arrival_airport_icao the arrival airport
3530
-	* @return String success or false
3531
-	*
3532
-	*/	
3525
+	 * Update latest spotter data
3526
+	 *
3527
+	 * @param String $flightaware_id the ID from flightaware
3528
+	 * @param String $ident the flight ident
3529
+	 * @param String $arrival_airport_icao the arrival airport
3530
+	 * @return String success or false
3531
+	 *
3532
+	 */	
3533 3533
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3534 3534
 	{
3535 3535
 		if ($groundspeed == '') $groundspeed = NULL;
3536 3536
 		$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';
3537
-                $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);
3537
+				$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);
3538 3538
 
3539 3539
 		try {
3540 3540
 			$sth = $this->db->prepare($query);
@@ -3548,32 +3548,32 @@  discard block
 block discarded – undo
3548 3548
 	}
3549 3549
 
3550 3550
 	/**
3551
-	* Adds a new spotter data
3552
-	*
3553
-	* @param String $flightaware_id the ID from flightaware
3554
-	* @param String $ident the flight ident
3555
-	* @param String $aircraft_icao the aircraft type
3556
-	* @param String $departure_airport_icao the departure airport
3557
-	* @param String $arrival_airport_icao the arrival airport
3558
-	* @param String $latitude latitude of flight
3559
-	* @param String $longitude latitude of flight
3560
-	* @param String $waypoints waypoints of flight
3561
-	* @param String $altitude altitude of flight
3562
-	* @param String $heading heading of flight
3563
-	* @param String $groundspeed speed of flight
3564
-	* @param String $date date of flight
3565
-	* @param String $departure_airport_time departure time of flight
3566
-	* @param String $arrival_airport_time arrival time of flight
3567
-	* @param String $squawk squawk code of flight
3568
-	* @param String $route_stop route stop of flight
3569
-	* @param String $highlight highlight or not
3570
-	* @param String $ModeS ModesS code of flight
3571
-	* @param String $registration registration code of flight
3572
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3573
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3574
-	* @param String $verticalrate vertival rate of flight
3575
-	* @return String success or false
3576
-	*/
3551
+	 * Adds a new spotter data
3552
+	 *
3553
+	 * @param String $flightaware_id the ID from flightaware
3554
+	 * @param String $ident the flight ident
3555
+	 * @param String $aircraft_icao the aircraft type
3556
+	 * @param String $departure_airport_icao the departure airport
3557
+	 * @param String $arrival_airport_icao the arrival airport
3558
+	 * @param String $latitude latitude of flight
3559
+	 * @param String $longitude latitude of flight
3560
+	 * @param String $waypoints waypoints of flight
3561
+	 * @param String $altitude altitude of flight
3562
+	 * @param String $heading heading of flight
3563
+	 * @param String $groundspeed speed of flight
3564
+	 * @param String $date date of flight
3565
+	 * @param String $departure_airport_time departure time of flight
3566
+	 * @param String $arrival_airport_time arrival time of flight
3567
+	 * @param String $squawk squawk code of flight
3568
+	 * @param String $route_stop route stop of flight
3569
+	 * @param String $highlight highlight or not
3570
+	 * @param String $ModeS ModesS code of flight
3571
+	 * @param String $registration registration code of flight
3572
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3573
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3574
+	 * @param String $verticalrate vertival rate of flight
3575
+	 * @return String success or false
3576
+	 */
3577 3577
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3578 3578
 	{
3579 3579
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3788,8 +3788,8 @@  discard block
 block discarded – undo
3788 3788
     
3789 3789
 		if ($globalIVAO && $aircraft_icao != '')
3790 3790
 		{
3791
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792
-            		else $airline_icao = '';
3791
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792
+					else $airline_icao = '';
3793 3793
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3794 3794
 			if (!isset($image_array[0]['registration']))
3795 3795
 			{
@@ -3820,53 +3820,53 @@  discard block
 block discarded – undo
3820 3820
 	
3821 3821
 		if (count($airline_array) == 0) 
3822 3822
 		{
3823
-                        $airline_array = $this->getAllAirlineInfo('NA');
3824
-                }
3825
-                if (count($aircraft_array) == 0) 
3826
-                {
3827
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3828
-                }
3829
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3830
-                {
3831
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3832
-                }
3833
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3834
-                {
3835
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3836
-                }
3837
-                if ($registration == '') $registration = 'NA';
3838
-                if ($latitude == '' && $longitude == '') {
3839
-            		$latitude = 0;
3840
-            		$longitude = 0;
3841
-            	}
3842
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3843
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3844
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3847
-                $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) 
3823
+						$airline_array = $this->getAllAirlineInfo('NA');
3824
+				}
3825
+				if (count($aircraft_array) == 0) 
3826
+				{
3827
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3828
+				}
3829
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3830
+				{
3831
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3832
+				}
3833
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3834
+				{
3835
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3836
+				}
3837
+				if ($registration == '') $registration = 'NA';
3838
+				if ($latitude == '' && $longitude == '') {
3839
+					$latitude = 0;
3840
+					$longitude = 0;
3841
+				}
3842
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3843
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3844
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3847
+				$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) 
3848 3848
                 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)";
3849 3849
 
3850
-                $airline_name = $airline_array[0]['name'];
3851
-                $airline_icao = $airline_array[0]['icao'];
3852
-                $airline_country = $airline_array[0]['country'];
3853
-                $airline_type = $airline_array[0]['type'];
3850
+				$airline_name = $airline_array[0]['name'];
3851
+				$airline_icao = $airline_array[0]['icao'];
3852
+				$airline_country = $airline_array[0]['country'];
3853
+				$airline_type = $airline_array[0]['type'];
3854 3854
 		if ($airline_type == '') {
3855 3855
 			$timeelapsed = microtime(true);
3856 3856
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3857 3857
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3858 3858
 		}
3859 3859
 		if ($airline_type == null) $airline_type = '';
3860
-                $aircraft_type = $aircraft_array[0]['type'];
3861
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3862
-                $departure_airport_name = $departure_airport_array[0]['name'];
3863
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3864
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3860
+				$aircraft_type = $aircraft_array[0]['type'];
3861
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3862
+				$departure_airport_name = $departure_airport_array[0]['name'];
3863
+			$departure_airport_city = $departure_airport_array[0]['city'];
3864
+				$departure_airport_country = $departure_airport_array[0]['country'];
3865 3865
                 
3866
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3867
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3868
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3869
-                $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);
3866
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3867
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3868
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3869
+				$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);
3870 3870
 
3871 3871
 		try {
3872 3872
 		        
@@ -3874,7 +3874,7 @@  discard block
 block discarded – undo
3874 3874
 			$sth->execute($query_values);
3875 3875
 			$this->db = null;
3876 3876
 		} catch (PDOException $e) {
3877
-		    return "error : ".$e->getMessage();
3877
+			return "error : ".$e->getMessage();
3878 3878
 		}
3879 3879
 		
3880 3880
 		return "success";
@@ -3883,11 +3883,11 @@  discard block
 block discarded – undo
3883 3883
 	
3884 3884
   
3885 3885
 	/**
3886
-	* Gets the aircraft ident within the last hour
3887
-	*
3888
-	* @return String the ident
3889
-	*
3890
-	*/
3886
+	 * Gets the aircraft ident within the last hour
3887
+	 *
3888
+	 * @return String the ident
3889
+	 *
3890
+	 */
3891 3891
 	public function getIdentFromLastHour($ident)
3892 3892
 	{
3893 3893
 		global $globalDBdriver, $globalTimezone;
@@ -3903,11 +3903,11 @@  discard block
 block discarded – undo
3903 3903
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3904 3904
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3905 3905
 			$query_data = array(':ident' => $ident);
3906
-    		}
3906
+			}
3907 3907
 		
3908 3908
 		$sth = $this->db->prepare($query);
3909 3909
 		$sth->execute($query_data);
3910
-    		$ident_result='';
3910
+			$ident_result='';
3911 3911
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3912 3912
 		{
3913 3913
 			$ident_result = $row['ident'];
@@ -3918,11 +3918,11 @@  discard block
 block discarded – undo
3918 3918
 	
3919 3919
 	
3920 3920
 	/**
3921
-	* Gets the aircraft data from the last 20 seconds
3922
-	*
3923
-	* @return Array the spotter data
3924
-	*
3925
-	*/
3921
+	 * Gets the aircraft data from the last 20 seconds
3922
+	 *
3923
+	 * @return Array the spotter data
3924
+	 *
3925
+	 */
3926 3926
 	public function getRealTimeData($q = '')
3927 3927
 	{
3928 3928
 		global $globalDBdriver;
@@ -3966,11 +3966,11 @@  discard block
 block discarded – undo
3966 3966
 	
3967 3967
 	
3968 3968
 	 /**
3969
-	* Gets all airlines that have flown over
3970
-	*
3971
-	* @return Array the airline list
3972
-	*
3973
-	*/
3969
+	  * Gets all airlines that have flown over
3970
+	  *
3971
+	  * @return Array the airline list
3972
+	  *
3973
+	  */
3974 3974
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3975 3975
 	{
3976 3976
 		global $globalDBdriver;
@@ -3984,7 +3984,7 @@  discard block
 block discarded – undo
3984 3984
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
3985 3985
 			}
3986 3986
 		}
3987
-                if ($sincedate != '') {
3987
+				if ($sincedate != '') {
3988 3988
 			if ($globalDBdriver == 'mysql') {
3989 3989
 				$query .= " AND spotter_output.date > '".$sincedate."'";
3990 3990
 			} else {
@@ -4038,26 +4038,26 @@  discard block
 block discarded – undo
4038 4038
 	}
4039 4039
 
4040 4040
 	 /**
4041
-	* Gets all pilots that have flown over
4042
-	*
4043
-	* @return Array the pilots list
4044
-	*
4045
-	*/
4041
+	  * Gets all pilots that have flown over
4042
+	  *
4043
+	  * @return Array the pilots list
4044
+	  *
4045
+	  */
4046 4046
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4047 4047
 	{
4048 4048
 		global $globalDBdriver;
4049 4049
 		$filter_query = $this->getFilter($filters,true,true);
4050 4050
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4051 4051
 			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 <> ''";
4052
-                if ($olderthanmonths > 0) {
4053
-            		if ($globalDBdriver == 'mysql') {
4052
+				if ($olderthanmonths > 0) {
4053
+					if ($globalDBdriver == 'mysql') {
4054 4054
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4055 4055
 			} else {
4056 4056
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4057 4057
 			}
4058 4058
 		}
4059
-                if ($sincedate != '') {
4060
-            		if ($globalDBdriver == 'mysql') {
4059
+				if ($sincedate != '') {
4060
+					if ($globalDBdriver == 'mysql') {
4061 4061
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4062 4062
 			} else {
4063 4063
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4112,25 +4112,25 @@  discard block
 block discarded – undo
4112 4112
 	}
4113 4113
 	
4114 4114
 	/**
4115
-	* Gets all pilots that have flown over
4116
-	*
4117
-	* @return Array the pilots list
4118
-	*
4119
-	*/
4115
+	 * Gets all pilots that have flown over
4116
+	 *
4117
+	 * @return Array the pilots list
4118
+	 *
4119
+	 */
4120 4120
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4121 4121
 	{
4122 4122
 		global $globalDBdriver;
4123 4123
 		$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
4124 4124
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4125
-                if ($olderthanmonths > 0) {
4126
-            		if ($globalDBdriver == 'mysql') {
4125
+				if ($olderthanmonths > 0) {
4126
+					if ($globalDBdriver == 'mysql') {
4127 4127
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4128 4128
 			} else {
4129 4129
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4130 4130
 			}
4131 4131
 		}
4132
-                if ($sincedate != '') {
4133
-            		if ($globalDBdriver == 'mysql') {
4132
+				if ($sincedate != '') {
4133
+					if ($globalDBdriver == 'mysql') {
4134 4134
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4135 4135
 			} else {
4136 4136
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4159,26 +4159,26 @@  discard block
 block discarded – undo
4159 4159
 	}
4160 4160
 	
4161 4161
 	 /**
4162
-	* Gets all owner that have flown over
4163
-	*
4164
-	* @return Array the pilots list
4165
-	*
4166
-	*/
4162
+	  * Gets all owner that have flown over
4163
+	  *
4164
+	  * @return Array the pilots list
4165
+	  *
4166
+	  */
4167 4167
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4168 4168
 	{
4169 4169
 		global $globalDBdriver;
4170 4170
 		$filter_query = $this->getFilter($filters,true,true);
4171 4171
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4172 4172
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4173
-                if ($olderthanmonths > 0) {
4174
-            		if ($globalDBdriver == 'mysql') {
4173
+				if ($olderthanmonths > 0) {
4174
+					if ($globalDBdriver == 'mysql') {
4175 4175
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4176 4176
 			} else {
4177 4177
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4178 4178
 			}
4179 4179
 		}
4180
-                if ($sincedate != '') {
4181
-            		if ($globalDBdriver == 'mysql') {
4180
+				if ($sincedate != '') {
4181
+					if ($globalDBdriver == 'mysql') {
4182 4182
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4183 4183
 			} else {
4184 4184
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4229,26 +4229,26 @@  discard block
 block discarded – undo
4229 4229
 	}
4230 4230
 	
4231 4231
 	 /**
4232
-	* Gets all owner that have flown over
4233
-	*
4234
-	* @return Array the pilots list
4235
-	*
4236
-	*/
4232
+	  * Gets all owner that have flown over
4233
+	  *
4234
+	  * @return Array the pilots list
4235
+	  *
4236
+	  */
4237 4237
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4238 4238
 	{
4239 4239
 		global $globalDBdriver;
4240 4240
 		$filter_query = $this->getFilter($filters,true,true);
4241 4241
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4242 4242
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4243
-                if ($olderthanmonths > 0) {
4244
-            		if ($globalDBdriver == 'mysql') {
4243
+				if ($olderthanmonths > 0) {
4244
+					if ($globalDBdriver == 'mysql') {
4245 4245
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4246 4246
 			} else {
4247 4247
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4248 4248
 			}
4249 4249
 		}
4250
-                if ($sincedate != '') {
4251
-            		if ($globalDBdriver == 'mysql') {
4250
+				if ($sincedate != '') {
4251
+					if ($globalDBdriver == 'mysql') {
4252 4252
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4253 4253
 			} else {
4254 4254
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4275,11 +4275,11 @@  discard block
 block discarded – undo
4275 4275
 	}
4276 4276
 
4277 4277
 	/**
4278
-	* Gets all airlines that have flown over by aircraft
4279
-	*
4280
-	* @return Array the airline list
4281
-	*
4282
-	*/
4278
+	 * Gets all airlines that have flown over by aircraft
4279
+	 *
4280
+	 * @return Array the airline list
4281
+	 *
4282
+	 */
4283 4283
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4284 4284
 	{
4285 4285
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4311,11 +4311,11 @@  discard block
 block discarded – undo
4311 4311
 
4312 4312
 
4313 4313
 	/**
4314
-	* Gets all airline countries that have flown over by aircraft
4315
-	*
4316
-	* @return Array the airline country list
4317
-	*
4318
-	*/
4314
+	 * Gets all airline countries that have flown over by aircraft
4315
+	 *
4316
+	 * @return Array the airline country list
4317
+	 *
4318
+	 */
4319 4319
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4320 4320
 	{
4321 4321
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4347,11 +4347,11 @@  discard block
 block discarded – undo
4347 4347
 	
4348 4348
 	
4349 4349
 	/**
4350
-	* Gets all airlines that have flown over by airport
4351
-	*
4352
-	* @return Array the airline list
4353
-	*
4354
-	*/
4350
+	 * Gets all airlines that have flown over by airport
4351
+	 *
4352
+	 * @return Array the airline list
4353
+	 *
4354
+	 */
4355 4355
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4356 4356
 	{
4357 4357
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4382,11 +4382,11 @@  discard block
 block discarded – undo
4382 4382
 
4383 4383
 
4384 4384
 	/**
4385
-	* Gets all airline countries that have flown over by airport icao
4386
-	*
4387
-	* @return Array the airline country list
4388
-	*
4389
-	*/
4385
+	 * Gets all airline countries that have flown over by airport icao
4386
+	 *
4387
+	 * @return Array the airline country list
4388
+	 *
4389
+	 */
4390 4390
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4391 4391
 	{
4392 4392
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4416,11 +4416,11 @@  discard block
 block discarded – undo
4416 4416
 
4417 4417
 
4418 4418
 	/**
4419
-	* Gets all airlines that have flown over by aircraft manufacturer
4420
-	*
4421
-	* @return Array the airline list
4422
-	*
4423
-	*/
4419
+	 * Gets all airlines that have flown over by aircraft manufacturer
4420
+	 *
4421
+	 * @return Array the airline list
4422
+	 *
4423
+	 */
4424 4424
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4425 4425
 	{
4426 4426
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4451,11 +4451,11 @@  discard block
 block discarded – undo
4451 4451
 
4452 4452
 
4453 4453
 	/**
4454
-	* Gets all airline countries that have flown over by aircraft manufacturer
4455
-	*
4456
-	* @return Array the airline country list
4457
-	*
4458
-	*/
4454
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4455
+	 *
4456
+	 * @return Array the airline country list
4457
+	 *
4458
+	 */
4459 4459
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4460 4460
 	{
4461 4461
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4484,11 +4484,11 @@  discard block
 block discarded – undo
4484 4484
 
4485 4485
 
4486 4486
 	/**
4487
-	* Gets all airlines that have flown over by date
4488
-	*
4489
-	* @return Array the airline list
4490
-	*
4491
-	*/
4487
+	 * Gets all airlines that have flown over by date
4488
+	 *
4489
+	 * @return Array the airline list
4490
+	 *
4491
+	 */
4492 4492
 	public function countAllAirlinesByDate($date,$filters = array())
4493 4493
 	{
4494 4494
 		global $globalTimezone, $globalDBdriver;
@@ -4532,11 +4532,11 @@  discard block
 block discarded – undo
4532 4532
 	
4533 4533
 	
4534 4534
 	/**
4535
-	* Gets all airline countries that have flown over by date
4536
-	*
4537
-	* @return Array the airline country list
4538
-	*
4539
-	*/
4535
+	 * Gets all airline countries that have flown over by date
4536
+	 *
4537
+	 * @return Array the airline country list
4538
+	 *
4539
+	 */
4540 4540
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4541 4541
 	{
4542 4542
 		global $globalTimezone, $globalDBdriver;
@@ -4579,11 +4579,11 @@  discard block
 block discarded – undo
4579 4579
 
4580 4580
 
4581 4581
 	/**
4582
-	* Gets all airlines that have flown over by ident/callsign
4583
-	*
4584
-	* @return Array the airline list
4585
-	*
4586
-	*/
4582
+	 * Gets all airlines that have flown over by ident/callsign
4583
+	 *
4584
+	 * @return Array the airline list
4585
+	 *
4586
+	 */
4587 4587
 	public function countAllAirlinesByIdent($ident,$filters = array())
4588 4588
 	{
4589 4589
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4600,11 +4600,11 @@  discard block
 block discarded – undo
4600 4600
 	}
4601 4601
 
4602 4602
 	/**
4603
-	* Gets all airlines by owner
4604
-	*
4605
-	* @return Array the airline list
4606
-	*
4607
-	*/
4603
+	 * Gets all airlines by owner
4604
+	 *
4605
+	 * @return Array the airline list
4606
+	 *
4607
+	 */
4608 4608
 	public function countAllAirlinesByOwner($owner,$filters = array())
4609 4609
 	{
4610 4610
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4621,11 +4621,11 @@  discard block
 block discarded – undo
4621 4621
 	}
4622 4622
 
4623 4623
 	/**
4624
-	* Gets flight duration by owner
4625
-	*
4626
-	* @return String Duration of all flights
4627
-	*
4628
-	*/
4624
+	 * Gets flight duration by owner
4625
+	 *
4626
+	 * @return String Duration of all flights
4627
+	 *
4628
+	 */
4629 4629
 	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4630 4630
 	{
4631 4631
 		global $globalDBdriver;
@@ -4670,11 +4670,11 @@  discard block
 block discarded – undo
4670 4670
 	}
4671 4671
 
4672 4672
 	/**
4673
-	* Count flights by owner
4674
-	*
4675
-	* @return String Duration of all flights
4676
-	*
4677
-	*/
4673
+	 * Count flights by owner
4674
+	 *
4675
+	 * @return String Duration of all flights
4676
+	 *
4677
+	 */
4678 4678
 	public function countFlightsByOwner($owner,$filters = array())
4679 4679
 	{
4680 4680
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4690,11 +4690,11 @@  discard block
 block discarded – undo
4690 4690
 	}
4691 4691
 
4692 4692
 	/**
4693
-	* Count flights by pilot
4694
-	*
4695
-	* @return String Duration of all flights
4696
-	*
4697
-	*/
4693
+	 * Count flights by pilot
4694
+	 *
4695
+	 * @return String Duration of all flights
4696
+	 *
4697
+	 */
4698 4698
 	public function countFlightsByPilot($pilot,$filters = array())
4699 4699
 	{
4700 4700
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4710,11 +4710,11 @@  discard block
 block discarded – undo
4710 4710
 	}
4711 4711
 
4712 4712
 	/**
4713
-	* Gets flight duration by pilot
4714
-	*
4715
-	* @return String Duration of all flights
4716
-	*
4717
-	*/
4713
+	 * Gets flight duration by pilot
4714
+	 *
4715
+	 * @return String Duration of all flights
4716
+	 *
4717
+	 */
4718 4718
 	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4719 4719
 	{
4720 4720
 		global $globalDBdriver;
@@ -4759,11 +4759,11 @@  discard block
 block discarded – undo
4759 4759
 	}
4760 4760
 
4761 4761
 	/**
4762
-	* Gets all airlines used by pilot
4763
-	*
4764
-	* @return Array the airline list
4765
-	*
4766
-	*/
4762
+	 * Gets all airlines used by pilot
4763
+	 *
4764
+	 * @return Array the airline list
4765
+	 *
4766
+	 */
4767 4767
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4768 4768
 	{
4769 4769
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4780,11 +4780,11 @@  discard block
 block discarded – undo
4780 4780
 	}
4781 4781
 
4782 4782
 	/**
4783
-	* Gets all airlines that have flown over by route
4784
-	*
4785
-	* @return Array the airline list
4786
-	*
4787
-	*/
4783
+	 * Gets all airlines that have flown over by route
4784
+	 *
4785
+	 * @return Array the airline list
4786
+	 *
4787
+	 */
4788 4788
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4789 4789
 	{
4790 4790
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4816,11 +4816,11 @@  discard block
 block discarded – undo
4816 4816
 	}
4817 4817
 
4818 4818
 	/**
4819
-	* Gets all airline countries that have flown over by route
4820
-	*
4821
-	* @return Array the airline country list
4822
-	*
4823
-	*/
4819
+	 * Gets all airline countries that have flown over by route
4820
+	 *
4821
+	 * @return Array the airline country list
4822
+	 *
4823
+	 */
4824 4824
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4825 4825
 	{
4826 4826
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4852,11 +4852,11 @@  discard block
 block discarded – undo
4852 4852
 
4853 4853
 
4854 4854
 	/**
4855
-	* Gets all airlines that have flown over by country
4856
-	*
4857
-	* @return Array the airline list
4858
-	*
4859
-	*/
4855
+	 * Gets all airlines that have flown over by country
4856
+	 *
4857
+	 * @return Array the airline list
4858
+	 *
4859
+	 */
4860 4860
 	public function countAllAirlinesByCountry($country,$filters = array())
4861 4861
 	{
4862 4862
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4886,11 +4886,11 @@  discard block
 block discarded – undo
4886 4886
 
4887 4887
 
4888 4888
 	/**
4889
-	* Gets all airline countries that have flown over by country
4890
-	*
4891
-	* @return Array the airline country list
4892
-	*
4893
-	*/
4889
+	 * Gets all airline countries that have flown over by country
4890
+	 *
4891
+	 * @return Array the airline country list
4892
+	 *
4893
+	 */
4894 4894
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4895 4895
 	{
4896 4896
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4919,11 +4919,11 @@  discard block
 block discarded – undo
4919 4919
 
4920 4920
 
4921 4921
 	/**
4922
-	* Gets all airlines countries
4923
-	*
4924
-	* @return Array the airline country list
4925
-	*
4926
-	*/
4922
+	 * Gets all airlines countries
4923
+	 *
4924
+	 * @return Array the airline country list
4925
+	 *
4926
+	 */
4927 4927
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4928 4928
 	{
4929 4929
 		global $globalDBdriver;
@@ -4978,11 +4978,11 @@  discard block
 block discarded – undo
4978 4978
 	}
4979 4979
 
4980 4980
 	/**
4981
-	* Gets all number of flight over countries
4982
-	*
4983
-	* @return Array the airline country list
4984
-	*
4985
-	*/
4981
+	 * Gets all number of flight over countries
4982
+	 *
4983
+	 * @return Array the airline country list
4984
+	 *
4985
+	 */
4986 4986
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4987 4987
 	{
4988 4988
 		global $globalDBdriver;
@@ -5004,15 +5004,15 @@  discard block
 block discarded – undo
5004 5004
 		$SpotterLive = new SpotterLive();
5005 5005
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5006 5006
 		$filter_query .= ' over_country IS NOT NULL';
5007
-                if ($olderthanmonths > 0) {
5007
+				if ($olderthanmonths > 0) {
5008 5008
 			if ($globalDBdriver == 'mysql') {
5009 5009
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5010 5010
 			} else {
5011 5011
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5012 5012
 			}
5013 5013
 		}
5014
-                if ($sincedate != '') {
5015
-            		if ($globalDBdriver == 'mysql') {
5014
+				if ($sincedate != '') {
5015
+					if ($globalDBdriver == 'mysql') {
5016 5016
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5017 5017
 			} else {
5018 5018
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5042,11 +5042,11 @@  discard block
 block discarded – undo
5042 5042
 	
5043 5043
 	
5044 5044
 	/**
5045
-	* Gets all aircraft types that have flown over
5046
-	*
5047
-	* @return Array the aircraft list
5048
-	*
5049
-	*/
5045
+	 * Gets all aircraft types that have flown over
5046
+	 *
5047
+	 * @return Array the aircraft list
5048
+	 *
5049
+	 */
5050 5050
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5051 5051
 	{
5052 5052
 		global $globalDBdriver;
@@ -5116,11 +5116,11 @@  discard block
 block discarded – undo
5116 5116
 	}
5117 5117
 
5118 5118
 	/**
5119
-	* Gets all aircraft types that have flown over by airline
5120
-	*
5121
-	* @return Array the aircraft list
5122
-	*
5123
-	*/
5119
+	 * Gets all aircraft types that have flown over by airline
5120
+	 *
5121
+	 * @return Array the aircraft list
5122
+	 *
5123
+	 */
5124 5124
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5125 5125
 	{
5126 5126
 		global $globalDBdriver;
@@ -5191,11 +5191,11 @@  discard block
 block discarded – undo
5191 5191
 	}
5192 5192
 
5193 5193
 	/**
5194
-	* Gets all aircraft types that have flown over by months
5195
-	*
5196
-	* @return Array the aircraft list
5197
-	*
5198
-	*/
5194
+	 * Gets all aircraft types that have flown over by months
5195
+	 *
5196
+	 * @return Array the aircraft list
5197
+	 *
5198
+	 */
5199 5199
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5200 5200
 	{
5201 5201
 		global $globalDBdriver;
@@ -5239,11 +5239,11 @@  discard block
 block discarded – undo
5239 5239
 
5240 5240
 
5241 5241
 	/**
5242
-	* Gets all aircraft registration that have flown over by aircaft icao
5243
-	*
5244
-	* @return Array the aircraft list
5245
-	*
5246
-	*/
5242
+	 * Gets all aircraft registration that have flown over by aircaft icao
5243
+	 *
5244
+	 * @return Array the aircraft list
5245
+	 *
5246
+	 */
5247 5247
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5248 5248
 	{
5249 5249
 		$Image = new Image($this->db);
@@ -5282,11 +5282,11 @@  discard block
 block discarded – undo
5282 5282
 
5283 5283
 
5284 5284
 	/**
5285
-	* Gets all aircraft types that have flown over by airline icao
5286
-	*
5287
-	* @return Array the aircraft list
5288
-	*
5289
-	*/
5285
+	 * Gets all aircraft types that have flown over by airline icao
5286
+	 *
5287
+	 * @return Array the aircraft list
5288
+	 *
5289
+	 */
5290 5290
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5291 5291
 	{
5292 5292
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5315,11 +5315,11 @@  discard block
 block discarded – undo
5315 5315
 
5316 5316
 
5317 5317
 	/**
5318
-	* Gets all aircraft registration that have flown over by airline icao
5319
-	*
5320
-	* @return Array the aircraft list
5321
-	*
5322
-	*/
5318
+	 * Gets all aircraft registration that have flown over by airline icao
5319
+	 *
5320
+	 * @return Array the aircraft list
5321
+	 *
5322
+	 */
5323 5323
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5324 5324
 	{
5325 5325
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5357,11 +5357,11 @@  discard block
 block discarded – undo
5357 5357
 
5358 5358
 
5359 5359
 	/**
5360
-	* Gets all aircraft manufacturer that have flown over by airline icao
5361
-	*
5362
-	* @return Array the aircraft list
5363
-	*
5364
-	*/
5360
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5361
+	 *
5362
+	 * @return Array the aircraft list
5363
+	 *
5364
+	 */
5365 5365
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5366 5366
 	{
5367 5367
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5389,11 +5389,11 @@  discard block
 block discarded – undo
5389 5389
 
5390 5390
 
5391 5391
 	/**
5392
-	* Gets all aircraft types that have flown over by airline icao
5393
-	*
5394
-	* @return Array the aircraft list
5395
-	*
5396
-	*/
5392
+	 * Gets all aircraft types that have flown over by airline icao
5393
+	 *
5394
+	 * @return Array the aircraft list
5395
+	 *
5396
+	 */
5397 5397
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5398 5398
 	{
5399 5399
 		$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 registration that have flown over by airport icao
5426
-	*
5427
-	* @return Array the aircraft list
5428
-	*
5429
-	*/
5425
+	 * Gets all aircraft registration that have flown over by airport icao
5426
+	 *
5427
+	 * @return Array the aircraft list
5428
+	 *
5429
+	 */
5430 5430
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5431 5431
 	{
5432 5432
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5463,11 +5463,11 @@  discard block
 block discarded – undo
5463 5463
 	
5464 5464
 	
5465 5465
 	/**
5466
-	* Gets all aircraft manufacturer that have flown over by airport icao
5467
-	*
5468
-	* @return Array the aircraft list
5469
-	*
5470
-	*/
5466
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5467
+	 *
5468
+	 * @return Array the aircraft list
5469
+	 *
5470
+	 */
5471 5471
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5472 5472
 	{
5473 5473
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5493,11 +5493,11 @@  discard block
 block discarded – undo
5493 5493
 	}
5494 5494
 
5495 5495
 	/**
5496
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5497
-	*
5498
-	* @return Array the aircraft list
5499
-	*
5500
-	*/
5496
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5497
+	 *
5498
+	 * @return Array the aircraft list
5499
+	 *
5500
+	 */
5501 5501
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5502 5502
 	{
5503 5503
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5524,11 +5524,11 @@  discard block
 block discarded – undo
5524 5524
 
5525 5525
 
5526 5526
 	/**
5527
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5528
-	*
5529
-	* @return Array the aircraft list
5530
-	*
5531
-	*/
5527
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5528
+	 *
5529
+	 * @return Array the aircraft list
5530
+	 *
5531
+	 */
5532 5532
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5533 5533
 	{
5534 5534
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5564,11 +5564,11 @@  discard block
 block discarded – undo
5564 5564
 	}
5565 5565
 
5566 5566
 	/**
5567
-	* Gets all aircraft types that have flown over by date
5568
-	*
5569
-	* @return Array the aircraft list
5570
-	*
5571
-	*/
5567
+	 * Gets all aircraft types that have flown over by date
5568
+	 *
5569
+	 * @return Array the aircraft list
5570
+	 *
5571
+	 */
5572 5572
 	public function countAllAircraftTypesByDate($date,$filters = array())
5573 5573
 	{
5574 5574
 		global $globalTimezone, $globalDBdriver;
@@ -5610,11 +5610,11 @@  discard block
 block discarded – undo
5610 5610
 
5611 5611
 
5612 5612
 	/**
5613
-	* Gets all aircraft registration that have flown over by date
5614
-	*
5615
-	* @return Array the aircraft list
5616
-	*
5617
-	*/
5613
+	 * Gets all aircraft registration that have flown over by date
5614
+	 *
5615
+	 * @return Array the aircraft list
5616
+	 *
5617
+	 */
5618 5618
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5619 5619
 	{
5620 5620
 		global $globalTimezone, $globalDBdriver;
@@ -5665,11 +5665,11 @@  discard block
 block discarded – undo
5665 5665
 
5666 5666
 
5667 5667
 	/**
5668
-	* Gets all aircraft manufacturer that have flown over by date
5669
-	*
5670
-	* @return Array the aircraft manufacturer list
5671
-	*
5672
-	*/
5668
+	 * Gets all aircraft manufacturer that have flown over by date
5669
+	 *
5670
+	 * @return Array the aircraft manufacturer list
5671
+	 *
5672
+	 */
5673 5673
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5674 5674
 	{
5675 5675
 		global $globalTimezone, $globalDBdriver;
@@ -5711,11 +5711,11 @@  discard block
 block discarded – undo
5711 5711
 
5712 5712
 
5713 5713
 	/**
5714
-	* Gets all aircraft types that have flown over by ident/callsign
5715
-	*
5716
-	* @return Array the aircraft list
5717
-	*
5718
-	*/
5714
+	 * Gets all aircraft types that have flown over by ident/callsign
5715
+	 *
5716
+	 * @return Array the aircraft list
5717
+	 *
5718
+	 */
5719 5719
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5720 5720
 	{
5721 5721
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5743,11 +5743,11 @@  discard block
 block discarded – undo
5743 5743
 	}
5744 5744
 
5745 5745
 	/**
5746
-	* Gets all aircraft types that have flown over by pilot
5747
-	*
5748
-	* @return Array the aircraft list
5749
-	*
5750
-	*/
5746
+	 * Gets all aircraft types that have flown over by pilot
5747
+	 *
5748
+	 * @return Array the aircraft list
5749
+	 *
5750
+	 */
5751 5751
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5752 5752
 	{
5753 5753
 		global $globalDBdriver;
@@ -5793,11 +5793,11 @@  discard block
 block discarded – undo
5793 5793
 	}
5794 5794
 
5795 5795
 	/**
5796
-	* Gets all aircraft types that have flown over by owner
5797
-	*
5798
-	* @return Array the aircraft list
5799
-	*
5800
-	*/
5796
+	 * Gets all aircraft types that have flown over by owner
5797
+	 *
5798
+	 * @return Array the aircraft list
5799
+	 *
5800
+	 */
5801 5801
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5802 5802
 	{
5803 5803
 		global $globalDBdriver;
@@ -5842,11 +5842,11 @@  discard block
 block discarded – undo
5842 5842
 	}
5843 5843
 
5844 5844
 	/**
5845
-	* Gets all aircraft registration that have flown over by ident/callsign
5846
-	*
5847
-	* @return Array the aircraft list
5848
-	*
5849
-	*/
5845
+	 * Gets all aircraft registration that have flown over by ident/callsign
5846
+	 *
5847
+	 * @return Array the aircraft list
5848
+	 *
5849
+	 */
5850 5850
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5851 5851
 	{
5852 5852
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5885,11 +5885,11 @@  discard block
 block discarded – undo
5885 5885
 	}
5886 5886
 
5887 5887
 	/**
5888
-	* Gets all aircraft registration that have flown over by owner
5889
-	*
5890
-	* @return Array the aircraft list
5891
-	*
5892
-	*/
5888
+	 * Gets all aircraft registration that have flown over by owner
5889
+	 *
5890
+	 * @return Array the aircraft list
5891
+	 *
5892
+	 */
5893 5893
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5894 5894
 	{
5895 5895
 		global $globalDBdriver;
@@ -5960,11 +5960,11 @@  discard block
 block discarded – undo
5960 5960
 	}
5961 5961
 
5962 5962
 	/**
5963
-	* Gets all aircraft registration that have flown over by pilot
5964
-	*
5965
-	* @return Array the aircraft list
5966
-	*
5967
-	*/
5963
+	 * Gets all aircraft registration that have flown over by pilot
5964
+	 *
5965
+	 * @return Array the aircraft list
5966
+	 *
5967
+	 */
5968 5968
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5969 5969
 	{
5970 5970
 		global $globalDBdriver;
@@ -6036,11 +6036,11 @@  discard block
 block discarded – undo
6036 6036
 
6037 6037
 
6038 6038
 	/**
6039
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6040
-	*
6041
-	* @return Array the aircraft manufacturer list
6042
-	*
6043
-	*/
6039
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6040
+	 *
6041
+	 * @return Array the aircraft manufacturer list
6042
+	 *
6043
+	 */
6044 6044
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6045 6045
 	{
6046 6046
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6065,11 +6065,11 @@  discard block
 block discarded – undo
6065 6065
 	}
6066 6066
 
6067 6067
 	/**
6068
-	* Gets all aircraft manufacturer that have flown over by owner
6069
-	*
6070
-	* @return Array the aircraft manufacturer list
6071
-	*
6072
-	*/
6068
+	 * Gets all aircraft manufacturer that have flown over by owner
6069
+	 *
6070
+	 * @return Array the aircraft manufacturer list
6071
+	 *
6072
+	 */
6073 6073
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6074 6074
 	{
6075 6075
 		global $globalDBdriver;
@@ -6117,11 +6117,11 @@  discard block
 block discarded – undo
6117 6117
 	}
6118 6118
 
6119 6119
 	/**
6120
-	* Gets all aircraft manufacturer that have flown over by pilot
6121
-	*
6122
-	* @return Array the aircraft manufacturer list
6123
-	*
6124
-	*/
6120
+	 * Gets all aircraft manufacturer that have flown over by pilot
6121
+	 *
6122
+	 * @return Array the aircraft manufacturer list
6123
+	 *
6124
+	 */
6125 6125
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6126 6126
 	{
6127 6127
 		global $globalDBdriver;
@@ -6170,11 +6170,11 @@  discard block
 block discarded – undo
6170 6170
 
6171 6171
 
6172 6172
 	/**
6173
-	* Gets all aircraft types that have flown over by route
6174
-	*
6175
-	* @return Array the aircraft list
6176
-	*
6177
-	*/
6173
+	 * Gets all aircraft types that have flown over by route
6174
+	 *
6175
+	 * @return Array the aircraft list
6176
+	 *
6177
+	 */
6178 6178
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6179 6179
 	{
6180 6180
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6203,11 +6203,11 @@  discard block
 block discarded – undo
6203 6203
 	}
6204 6204
 
6205 6205
 	/**
6206
-	* Gets all aircraft registration that have flown over by route
6207
-	*
6208
-	* @return Array the aircraft list
6209
-	*
6210
-	*/
6206
+	 * Gets all aircraft registration that have flown over by route
6207
+	 *
6208
+	 * @return Array the aircraft list
6209
+	 *
6210
+	 */
6211 6211
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6212 6212
 	{
6213 6213
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6249,11 +6249,11 @@  discard block
 block discarded – undo
6249 6249
 	
6250 6250
 	
6251 6251
 	/**
6252
-	* Gets all aircraft manufacturer that have flown over by route
6253
-	*
6254
-	* @return Array the aircraft manufacturer list
6255
-	*
6256
-	*/
6252
+	 * Gets all aircraft manufacturer that have flown over by route
6253
+	 *
6254
+	 * @return Array the aircraft manufacturer list
6255
+	 *
6256
+	 */
6257 6257
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6258 6258
 	{
6259 6259
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6287,11 +6287,11 @@  discard block
 block discarded – undo
6287 6287
 	
6288 6288
 	
6289 6289
 	/**
6290
-	* Gets all aircraft types that have flown over by country
6291
-	*
6292
-	* @return Array the aircraft list
6293
-	*
6294
-	*/
6290
+	 * Gets all aircraft types that have flown over by country
6291
+	 *
6292
+	 * @return Array the aircraft list
6293
+	 *
6294
+	 */
6295 6295
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6296 6296
 	{
6297 6297
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6322,11 +6322,11 @@  discard block
 block discarded – undo
6322 6322
 
6323 6323
 
6324 6324
 	/**
6325
-	* Gets all aircraft registration that have flown over by country
6326
-	*
6327
-	* @return Array the aircraft list
6328
-	*
6329
-	*/
6325
+	 * Gets all aircraft registration that have flown over by country
6326
+	 *
6327
+	 * @return Array the aircraft list
6328
+	 *
6329
+	 */
6330 6330
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6331 6331
 	{
6332 6332
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6366,11 +6366,11 @@  discard block
 block discarded – undo
6366 6366
 	
6367 6367
 	
6368 6368
 	/**
6369
-	* Gets all aircraft manufacturer that have flown over by country
6370
-	*
6371
-	* @return Array the aircraft manufacturer list
6372
-	*
6373
-	*/
6369
+	 * Gets all aircraft manufacturer that have flown over by country
6370
+	 *
6371
+	 * @return Array the aircraft manufacturer list
6372
+	 *
6373
+	 */
6374 6374
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6375 6375
 	{
6376 6376
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6401,18 +6401,18 @@  discard block
 block discarded – undo
6401 6401
 	
6402 6402
 	
6403 6403
 	/**
6404
-	* Gets all aircraft manufacturers that have flown over
6405
-	*
6406
-	* @return Array the aircraft list
6407
-	*
6408
-	*/
6404
+	 * Gets all aircraft manufacturers that have flown over
6405
+	 *
6406
+	 * @return Array the aircraft list
6407
+	 *
6408
+	 */
6409 6409
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6410 6410
 	{
6411 6411
 		global $globalDBdriver;
6412 6412
 		$filter_query = $this->getFilter($filters,true,true);
6413 6413
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6414 6414
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6415
-                $query_values = array();
6415
+				$query_values = array();
6416 6416
 		if ($year != '') {
6417 6417
 			if ($globalDBdriver == 'mysql') {
6418 6418
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6465,11 +6465,11 @@  discard block
 block discarded – undo
6465 6465
 	
6466 6466
 	
6467 6467
 	/**
6468
-	* Gets all aircraft registrations that have flown over
6469
-	*
6470
-	* @return Array the aircraft list
6471
-	*
6472
-	*/
6468
+	 * Gets all aircraft registrations that have flown over
6469
+	 *
6470
+	 * @return Array the aircraft list
6471
+	 *
6472
+	 */
6473 6473
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6474 6474
 	{
6475 6475
 		global $globalDBdriver;
@@ -6477,15 +6477,15 @@  discard block
 block discarded – undo
6477 6477
 		$filter_query = $this->getFilter($filters,true,true);
6478 6478
 		$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    
6479 6479
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6480
-                if ($olderthanmonths > 0) {
6481
-            		if ($globalDBdriver == 'mysql') {
6480
+				if ($olderthanmonths > 0) {
6481
+					if ($globalDBdriver == 'mysql') {
6482 6482
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6483 6483
 			} else {
6484 6484
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6485 6485
 			}
6486 6486
 		}
6487
-                if ($sincedate != '') {
6488
-            		if ($globalDBdriver == 'mysql') {
6487
+				if ($sincedate != '') {
6488
+					if ($globalDBdriver == 'mysql') {
6489 6489
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6490 6490
 			} else {
6491 6491
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6550,11 +6550,11 @@  discard block
 block discarded – undo
6550 6550
 
6551 6551
 
6552 6552
 	/**
6553
-	* Gets all aircraft registrations that have flown over
6554
-	*
6555
-	* @return Array the aircraft list
6556
-	*
6557
-	*/
6553
+	 * Gets all aircraft registrations that have flown over
6554
+	 *
6555
+	 * @return Array the aircraft list
6556
+	 *
6557
+	 */
6558 6558
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6559 6559
 	{
6560 6560
 		global $globalDBdriver;
@@ -6562,15 +6562,15 @@  discard block
 block discarded – undo
6562 6562
 		$Image = new Image($this->db);
6563 6563
 		$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    
6564 6564
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6565
-                if ($olderthanmonths > 0) {
6566
-            		if ($globalDBdriver == 'mysql') {
6565
+				if ($olderthanmonths > 0) {
6566
+					if ($globalDBdriver == 'mysql') {
6567 6567
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6568 6568
 			} else {
6569 6569
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6570 6570
 			}
6571 6571
 		}
6572
-                if ($sincedate != '') {
6573
-            		if ($globalDBdriver == 'mysql') {
6572
+				if ($sincedate != '') {
6573
+					if ($globalDBdriver == 'mysql') {
6574 6574
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6575 6575
 			} else {
6576 6576
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6579,7 +6579,7 @@  discard block
 block discarded – undo
6579 6579
 
6580 6580
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6581 6581
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6582
-                $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";
6582
+				$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";
6583 6583
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6584 6584
 		
6585 6585
 		$sth = $this->db->prepare($query);
@@ -6611,26 +6611,26 @@  discard block
 block discarded – undo
6611 6611
 	
6612 6612
 	
6613 6613
 	/**
6614
-	* Gets all departure airports of the airplanes that have flown over
6615
-	*
6616
-	* @return Array the airport list
6617
-	*
6618
-	*/
6614
+	 * Gets all departure airports of the airplanes that have flown over
6615
+	 *
6616
+	 * @return Array the airport list
6617
+	 *
6618
+	 */
6619 6619
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6620 6620
 	{
6621 6621
 		global $globalDBdriver;
6622 6622
 		$filter_query = $this->getFilter($filters,true,true);
6623 6623
 		$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 
6624 6624
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6625
-                if ($olderthanmonths > 0) {
6626
-            		if ($globalDBdriver == 'mysql') {
6625
+				if ($olderthanmonths > 0) {
6626
+					if ($globalDBdriver == 'mysql') {
6627 6627
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6628 6628
 			} else {
6629 6629
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6630 6630
 			}
6631
-                }
6632
-                if ($sincedate != '') {
6633
-            		if ($globalDBdriver == 'mysql') {
6631
+				}
6632
+				if ($sincedate != '') {
6633
+					if ($globalDBdriver == 'mysql') {
6634 6634
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6635 6635
 			} else {
6636 6636
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6664,7 +6664,7 @@  discard block
 block discarded – undo
6664 6664
 				$query_values = array_merge($query_values,array(':day' => $day));
6665 6665
 			}
6666 6666
 		}
6667
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6667
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6668 6668
 				ORDER BY airport_departure_icao_count DESC";
6669 6669
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6670 6670
 
@@ -6687,35 +6687,35 @@  discard block
 block discarded – undo
6687 6687
 	}
6688 6688
 
6689 6689
 	/**
6690
-	* Gets all departure airports of the airplanes that have flown over
6691
-	*
6692
-	* @return Array the airport list
6693
-	*
6694
-	*/
6690
+	 * Gets all departure airports of the airplanes that have flown over
6691
+	 *
6692
+	 * @return Array the airport list
6693
+	 *
6694
+	 */
6695 6695
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6696 6696
 	{
6697 6697
 		global $globalDBdriver;
6698 6698
 		$filter_query = $this->getFilter($filters,true,true);
6699 6699
 		$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 
6700 6700
 			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 <> '' ";
6701
-                if ($olderthanmonths > 0) {
6702
-            		if ($globalDBdriver == 'mysql') {
6701
+				if ($olderthanmonths > 0) {
6702
+					if ($globalDBdriver == 'mysql') {
6703 6703
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6704 6704
 			} else {
6705 6705
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6706 6706
 			}
6707
-                }
6708
-                if ($sincedate != '') {
6709
-            		if ($globalDBdriver == 'mysql') {
6707
+				}
6708
+				if ($sincedate != '') {
6709
+					if ($globalDBdriver == 'mysql') {
6710 6710
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6711 6711
 			} else {
6712 6712
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6713 6713
 			}
6714 6714
 		}
6715 6715
 
6716
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6717
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6718
-                $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
6716
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6717
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6718
+				$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
6719 6719
 				ORDER BY airport_departure_icao_count DESC";
6720 6720
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6721 6721
       
@@ -6740,26 +6740,26 @@  discard block
 block discarded – undo
6740 6740
 	}
6741 6741
 
6742 6742
 	/**
6743
-	* Gets all detected departure airports of the airplanes that have flown over
6744
-	*
6745
-	* @return Array the airport list
6746
-	*
6747
-	*/
6743
+	 * Gets all detected departure airports of the airplanes that have flown over
6744
+	 *
6745
+	 * @return Array the airport list
6746
+	 *
6747
+	 */
6748 6748
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6749 6749
 	{
6750 6750
 		global $globalDBdriver;
6751 6751
 		$filter_query = $this->getFilter($filters,true,true);
6752 6752
 		$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
6753 6753
 				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";
6754
-                if ($olderthanmonths > 0) {
6755
-            		if ($globalDBdriver == 'mysql') {
6754
+				if ($olderthanmonths > 0) {
6755
+					if ($globalDBdriver == 'mysql') {
6756 6756
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6757 6757
 			} else {
6758 6758
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6759 6759
 			}
6760
-                }
6761
-                if ($sincedate != '') {
6762
-            		if ($globalDBdriver == 'mysql') {
6760
+				}
6761
+				if ($sincedate != '') {
6762
+					if ($globalDBdriver == 'mysql') {
6763 6763
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6764 6764
 			} else {
6765 6765
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6793,10 +6793,10 @@  discard block
 block discarded – undo
6793 6793
 				$query_values = array_merge($query_values,array(':day' => $day));
6794 6794
 			}
6795 6795
 		}
6796
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6796
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6797 6797
 				ORDER BY airport_departure_icao_count DESC";
6798 6798
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6799
-    		//echo $query;
6799
+			//echo $query;
6800 6800
 		$sth = $this->db->prepare($query);
6801 6801
 		$sth->execute($query_values);
6802 6802
       
@@ -6817,35 +6817,35 @@  discard block
 block discarded – undo
6817 6817
 	}
6818 6818
 	
6819 6819
 	/**
6820
-	* Gets all detected departure airports of the airplanes that have flown over
6821
-	*
6822
-	* @return Array the airport list
6823
-	*
6824
-	*/
6820
+	 * Gets all detected departure airports of the airplanes that have flown over
6821
+	 *
6822
+	 * @return Array the airport list
6823
+	 *
6824
+	 */
6825 6825
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6826 6826
 	{
6827 6827
 		global $globalDBdriver;
6828 6828
 		$filter_query = $this->getFilter($filters,true,true);
6829 6829
 		$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
6830 6830
 				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 ";
6831
-                if ($olderthanmonths > 0) {
6832
-            		if ($globalDBdriver == 'mysql') {
6831
+				if ($olderthanmonths > 0) {
6832
+					if ($globalDBdriver == 'mysql') {
6833 6833
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6834 6834
 			} else {
6835 6835
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6836 6836
 			}
6837
-                }
6838
-                if ($sincedate != '') {
6839
-            		if ($globalDBdriver == 'mysql') {
6837
+				}
6838
+				if ($sincedate != '') {
6839
+					if ($globalDBdriver == 'mysql') {
6840 6840
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6841 6841
 			} else {
6842 6842
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6843 6843
 			}
6844 6844
 		}
6845 6845
 
6846
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6847
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6848
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6846
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6847
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6848
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6849 6849
 				ORDER BY airport_departure_icao_count DESC";
6850 6850
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6851 6851
       
@@ -6870,11 +6870,11 @@  discard block
 block discarded – undo
6870 6870
 	}	
6871 6871
 	
6872 6872
 	/**
6873
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6874
-	*
6875
-	* @return Array the airport list
6876
-	*
6877
-	*/
6873
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6874
+	 *
6875
+	 * @return Array the airport list
6876
+	 *
6877
+	 */
6878 6878
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6879 6879
 	{
6880 6880
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6908,11 +6908,11 @@  discard block
 block discarded – undo
6908 6908
 	
6909 6909
 	
6910 6910
 	/**
6911
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6912
-	*
6913
-	* @return Array the airport list
6914
-	*
6915
-	*/
6911
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6912
+	 *
6913
+	 * @return Array the airport list
6914
+	 *
6915
+	 */
6916 6916
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6917 6917
 	{
6918 6918
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6943,11 +6943,11 @@  discard block
 block discarded – undo
6943 6943
 	
6944 6944
 	
6945 6945
 	/**
6946
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6947
-	*
6948
-	* @return Array the airport list
6949
-	*
6950
-	*/
6946
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6947
+	 *
6948
+	 * @return Array the airport list
6949
+	 *
6950
+	 */
6951 6951
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6952 6952
 	{
6953 6953
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6980,11 +6980,11 @@  discard block
 block discarded – undo
6980 6980
 	
6981 6981
 	
6982 6982
 	/**
6983
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6984
-	*
6985
-	* @return Array the airport list
6986
-	*
6987
-	*/
6983
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6984
+	 *
6985
+	 * @return Array the airport list
6986
+	 *
6987
+	 */
6988 6988
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6989 6989
 	{
6990 6990
 		$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 of the airplanes that have flown over based on an aircraft registration
7018
-	*
7019
-	* @return Array the airport list
7020
-	*
7021
-	*/
7017
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7018
+	 *
7019
+	 * @return Array the airport list
7020
+	 *
7021
+	 */
7022 7022
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7023 7023
 	{
7024 7024
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7051,11 +7051,11 @@  discard block
 block discarded – undo
7051 7051
 	
7052 7052
 	
7053 7053
 	/**
7054
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7055
-	*
7056
-	* @return Array the airport list
7057
-	*
7058
-	*/
7054
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7055
+	 *
7056
+	 * @return Array the airport list
7057
+	 *
7058
+	 */
7059 7059
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7060 7060
 	{
7061 7061
 		$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 of the airplanes that have flown over based on an arrivl airport icao
7089
-	*
7090
-	* @return Array the airport list
7091
-	*
7092
-	*/
7088
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7089
+	 *
7090
+	 * @return Array the airport list
7091
+	 *
7092
+	 */
7093 7093
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7094 7094
 	{
7095 7095
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7122,11 +7122,11 @@  discard block
 block discarded – undo
7122 7122
 	
7123 7123
 	
7124 7124
 	/**
7125
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7126
-	*
7127
-	* @return Array the airport list
7128
-	*
7129
-	*/
7125
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7126
+	 *
7127
+	 * @return Array the airport list
7128
+	 *
7129
+	 */
7130 7130
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7131 7131
 	{
7132 7132
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7157,11 +7157,11 @@  discard block
 block discarded – undo
7157 7157
 	
7158 7158
 	
7159 7159
 	/**
7160
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7161
-	*
7162
-	* @return Array the airport list
7163
-	*
7164
-	*/
7160
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7161
+	 *
7162
+	 * @return Array the airport list
7163
+	 *
7164
+	 */
7165 7165
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7166 7166
 	{
7167 7167
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7194,11 +7194,11 @@  discard block
 block discarded – undo
7194 7194
 	
7195 7195
 	
7196 7196
 	/**
7197
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7198
-	*
7199
-	* @return Array the airport list
7200
-	*
7201
-	*/
7197
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7198
+	 *
7199
+	 * @return Array the airport list
7200
+	 *
7201
+	 */
7202 7202
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7203 7203
 	{
7204 7204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7228,11 +7228,11 @@  discard block
 block discarded – undo
7228 7228
 	
7229 7229
 	
7230 7230
 	/**
7231
-	* Gets all departure airports of the airplanes that have flown over based on a date
7232
-	*
7233
-	* @return Array the airport list
7234
-	*
7235
-	*/
7231
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7232
+	 *
7233
+	 * @return Array the airport list
7234
+	 *
7235
+	 */
7236 7236
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7237 7237
 	{
7238 7238
 		global $globalTimezone, $globalDBdriver;
@@ -7278,11 +7278,11 @@  discard block
 block discarded – undo
7278 7278
 	
7279 7279
 	
7280 7280
 	/**
7281
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7282
-	*
7283
-	* @return Array the airport list
7284
-	*
7285
-	*/
7281
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7282
+	 *
7283
+	 * @return Array the airport list
7284
+	 *
7285
+	 */
7286 7286
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7287 7287
 	{
7288 7288
 		global $globalTimezone, $globalDBdriver;
@@ -7325,11 +7325,11 @@  discard block
 block discarded – undo
7325 7325
 	
7326 7326
 	
7327 7327
 	/**
7328
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7329
-	*
7330
-	* @return Array the airport list
7331
-	*
7332
-	*/
7328
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7329
+	 *
7330
+	 * @return Array the airport list
7331
+	 *
7332
+	 */
7333 7333
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7334 7334
 	{
7335 7335
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7361,11 +7361,11 @@  discard block
 block discarded – undo
7361 7361
 	}
7362 7362
 	
7363 7363
 	/**
7364
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7365
-	*
7366
-	* @return Array the airport list
7367
-	*
7368
-	*/
7364
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7365
+	 *
7366
+	 * @return Array the airport list
7367
+	 *
7368
+	 */
7369 7369
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7370 7370
 	{
7371 7371
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7397,11 +7397,11 @@  discard block
 block discarded – undo
7397 7397
 	}
7398 7398
 	
7399 7399
 	/**
7400
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7401
-	*
7402
-	* @return Array the airport list
7403
-	*
7404
-	*/
7400
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7401
+	 *
7402
+	 * @return Array the airport list
7403
+	 *
7404
+	 */
7405 7405
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7406 7406
 	{
7407 7407
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7434,11 +7434,11 @@  discard block
 block discarded – undo
7434 7434
 	
7435 7435
 	
7436 7436
 	/**
7437
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7438
-	*
7439
-	* @return Array the airport list
7440
-	*
7441
-	*/
7437
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7438
+	 *
7439
+	 * @return Array the airport list
7440
+	 *
7441
+	 */
7442 7442
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7443 7443
 	{
7444 7444
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7467,11 +7467,11 @@  discard block
 block discarded – undo
7467 7467
 	}
7468 7468
 	
7469 7469
 	/**
7470
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7471
-	*
7472
-	* @return Array the airport list
7473
-	*
7474
-	*/
7470
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7471
+	 *
7472
+	 * @return Array the airport list
7473
+	 *
7474
+	 */
7475 7475
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7476 7476
 	{
7477 7477
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7487,11 +7487,11 @@  discard block
 block discarded – undo
7487 7487
 	}
7488 7488
 	
7489 7489
 	/**
7490
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7491
-	*
7492
-	* @return Array the airport list
7493
-	*
7494
-	*/
7490
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7491
+	 *
7492
+	 * @return Array the airport list
7493
+	 *
7494
+	 */
7495 7495
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7496 7496
 	{
7497 7497
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7509,11 +7509,11 @@  discard block
 block discarded – undo
7509 7509
 	
7510 7510
 	
7511 7511
 	/**
7512
-	* Gets all departure airports of the airplanes that have flown over based on a country
7513
-	*
7514
-	* @return Array the airport list
7515
-	*
7516
-	*/
7512
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7513
+	 *
7514
+	 * @return Array the airport list
7515
+	 *
7516
+	 */
7517 7517
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7518 7518
 	{
7519 7519
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7547,11 +7547,11 @@  discard block
 block discarded – undo
7547 7547
 
7548 7548
 
7549 7549
 	/**
7550
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7551
-	*
7552
-	* @return Array the airport list
7553
-	*
7554
-	*/
7550
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7551
+	 *
7552
+	 * @return Array the airport list
7553
+	 *
7554
+	 */
7555 7555
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7556 7556
 	{
7557 7557
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7581,31 +7581,31 @@  discard block
 block discarded – undo
7581 7581
 	
7582 7582
 
7583 7583
 	/**
7584
-	* Gets all arrival airports of the airplanes that have flown over
7585
-	*
7586
-	* @param Boolean $limit Limit result to 10 or not
7587
-	* @param Integer $olderthanmonths Only show result older than x months
7588
-	* @param String $sincedate Only show result since x date
7589
-	* @param Boolean $icaoaskey Show result by ICAO
7590
-	* @param Array $filters Filter used here
7591
-	* @return Array the airport list
7592
-	*
7593
-	*/
7584
+	 * Gets all arrival airports of the airplanes that have flown over
7585
+	 *
7586
+	 * @param Boolean $limit Limit result to 10 or not
7587
+	 * @param Integer $olderthanmonths Only show result older than x months
7588
+	 * @param String $sincedate Only show result since x date
7589
+	 * @param Boolean $icaoaskey Show result by ICAO
7590
+	 * @param Array $filters Filter used here
7591
+	 * @return Array the airport list
7592
+	 *
7593
+	 */
7594 7594
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7595 7595
 	{
7596 7596
 		global $globalDBdriver;
7597 7597
 		$filter_query = $this->getFilter($filters,true,true);
7598 7598
 		$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 
7599 7599
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7600
-                if ($olderthanmonths > 0) {
7601
-            		if ($globalDBdriver == 'mysql') {
7600
+				if ($olderthanmonths > 0) {
7601
+					if ($globalDBdriver == 'mysql') {
7602 7602
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7603 7603
 			} else {
7604 7604
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7605 7605
 			}
7606 7606
 		}
7607
-                if ($sincedate != '') {
7608
-            		if ($globalDBdriver == 'mysql') {
7607
+				if ($sincedate != '') {
7608
+					if ($globalDBdriver == 'mysql') {
7609 7609
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7610 7610
 			} else {
7611 7611
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7639,7 +7639,7 @@  discard block
 block discarded – undo
7639 7639
 				$query_values = array_merge($query_values,array(':day' => $day));
7640 7640
 			}
7641 7641
 		}
7642
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7642
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7643 7643
 					ORDER BY airport_arrival_icao_count DESC";
7644 7644
 		if ($limit) $query .= " LIMIT 10";
7645 7645
       
@@ -7668,35 +7668,35 @@  discard block
 block discarded – undo
7668 7668
 	}
7669 7669
 
7670 7670
 	/**
7671
-	* Gets all arrival airports of the airplanes that have flown over
7672
-	*
7673
-	* @return Array the airport list
7674
-	*
7675
-	*/
7671
+	 * Gets all arrival airports of the airplanes that have flown over
7672
+	 *
7673
+	 * @return Array the airport list
7674
+	 *
7675
+	 */
7676 7676
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7677 7677
 	{
7678 7678
 		global $globalDBdriver;
7679 7679
 		$filter_query = $this->getFilter($filters,true,true);
7680 7680
 		$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 
7681 7681
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7682
-                if ($olderthanmonths > 0) {
7683
-            		if ($globalDBdriver == 'mysql') {
7682
+				if ($olderthanmonths > 0) {
7683
+					if ($globalDBdriver == 'mysql') {
7684 7684
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7685 7685
 			} else {
7686 7686
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7687 7687
 			}
7688 7688
 		}
7689
-                if ($sincedate != '') {
7690
-            		if ($globalDBdriver == 'mysql') {
7689
+				if ($sincedate != '') {
7690
+					if ($globalDBdriver == 'mysql') {
7691 7691
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7692 7692
 			} else {
7693 7693
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7694 7694
 			}
7695 7695
 		}
7696 7696
 
7697
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7698
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7699
-                $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
7697
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7698
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7699
+				$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
7700 7700
 					ORDER BY airport_arrival_icao_count DESC";
7701 7701
 		if ($limit) $query .= " LIMIT 10";
7702 7702
       
@@ -7727,26 +7727,26 @@  discard block
 block discarded – undo
7727 7727
 
7728 7728
 
7729 7729
 	/**
7730
-	* Gets all detected arrival airports of the airplanes that have flown over
7731
-	*
7732
-	* @return Array the airport list
7733
-	*
7734
-	*/
7730
+	 * Gets all detected arrival airports of the airplanes that have flown over
7731
+	 *
7732
+	 * @return Array the airport list
7733
+	 *
7734
+	 */
7735 7735
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7736 7736
 	{
7737 7737
 		global $globalDBdriver;
7738 7738
 		$filter_query = $this->getFilter($filters,true,true);
7739 7739
 		$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 
7740 7740
 			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";
7741
-                if ($olderthanmonths > 0) {
7742
-            		if ($globalDBdriver == 'mysql') {
7741
+				if ($olderthanmonths > 0) {
7742
+					if ($globalDBdriver == 'mysql') {
7743 7743
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7744 7744
 			} else {
7745 7745
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7746 7746
 			}
7747 7747
 		}
7748
-                if ($sincedate != '') {
7749
-            		if ($globalDBdriver == 'mysql') {
7748
+				if ($sincedate != '') {
7749
+					if ($globalDBdriver == 'mysql') {
7750 7750
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7751 7751
 			} else {
7752 7752
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7780,7 +7780,7 @@  discard block
 block discarded – undo
7780 7780
 				$query_values = array_merge($query_values,array(':day' => $day));
7781 7781
 			}
7782 7782
 		}
7783
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7783
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7784 7784
 					ORDER BY airport_arrival_icao_count DESC";
7785 7785
 		if ($limit) $query .= " LIMIT 10";
7786 7786
       
@@ -7808,35 +7808,35 @@  discard block
 block discarded – undo
7808 7808
 	}
7809 7809
 	
7810 7810
 	/**
7811
-	* Gets all detected arrival airports of the airplanes that have flown over
7812
-	*
7813
-	* @return Array the airport list
7814
-	*
7815
-	*/
7811
+	 * Gets all detected arrival airports of the airplanes that have flown over
7812
+	 *
7813
+	 * @return Array the airport list
7814
+	 *
7815
+	 */
7816 7816
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7817 7817
 	{
7818 7818
 		global $globalDBdriver;
7819 7819
 		$filter_query = $this->getFilter($filters,true,true);
7820 7820
 		$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 
7821 7821
 			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 ";
7822
-                if ($olderthanmonths > 0) {
7823
-            		if ($globalDBdriver == 'mysql') {
7822
+				if ($olderthanmonths > 0) {
7823
+					if ($globalDBdriver == 'mysql') {
7824 7824
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7825 7825
 			} else {
7826 7826
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7827 7827
 			}
7828 7828
 		}
7829
-                if ($sincedate != '') {
7830
-            		if ($globalDBdriver == 'mysql') {
7829
+				if ($sincedate != '') {
7830
+					if ($globalDBdriver == 'mysql') {
7831 7831
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7832 7832
 			} else {
7833 7833
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7834 7834
 			}
7835 7835
 		}
7836 7836
 
7837
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7838
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7839
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7837
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7838
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7839
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7840 7840
 					ORDER BY airport_arrival_icao_count DESC";
7841 7841
 		if ($limit) $query .= " LIMIT 10";
7842 7842
       
@@ -7866,11 +7866,11 @@  discard block
 block discarded – undo
7866 7866
 	}	
7867 7867
 	
7868 7868
 	/**
7869
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7870
-	*
7871
-	* @return Array the airport list
7872
-	*
7873
-	*/
7869
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7870
+	 *
7871
+	 * @return Array the airport list
7872
+	 *
7873
+	 */
7874 7874
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7875 7875
 	{
7876 7876
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7902,11 +7902,11 @@  discard block
 block discarded – undo
7902 7902
 	
7903 7903
 	
7904 7904
 	/**
7905
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7906
-	*
7907
-	* @return Array the airport list
7908
-	*
7909
-	*/
7905
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7906
+	 *
7907
+	 * @return Array the airport list
7908
+	 *
7909
+	 */
7910 7910
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7911 7911
 	{
7912 7912
 		$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 of the airplanes that have flown over based on an aircraft icao
7941
-	*
7942
-	* @return Array the airport list
7943
-	*
7944
-	*/
7940
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7941
+	 *
7942
+	 * @return Array the airport list
7943
+	 *
7944
+	 */
7945 7945
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7946 7946
 	{
7947 7947
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7975,11 +7975,11 @@  discard block
 block discarded – undo
7975 7975
 	
7976 7976
 	
7977 7977
 	/**
7978
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7979
-	*
7980
-	* @return Array the airport list
7981
-	*
7982
-	*/
7978
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7979
+	 *
7980
+	 * @return Array the airport list
7981
+	 *
7982
+	 */
7983 7983
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7984 7984
 	{
7985 7985
 		$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 of the airplanes that have flown over based on an aircraft registration
8013
-	*
8014
-	* @return Array the airport list
8015
-	*
8016
-	*/
8012
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8013
+	 *
8014
+	 * @return Array the airport list
8015
+	 *
8016
+	 */
8017 8017
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8018 8018
 	{
8019 8019
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8047,11 +8047,11 @@  discard block
 block discarded – undo
8047 8047
 	
8048 8048
 	
8049 8049
 	/**
8050
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8051
-	*
8052
-	* @return Array the airport list
8053
-	*
8054
-	*/
8050
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8051
+	 *
8052
+	 * @return Array the airport list
8053
+	 *
8054
+	 */
8055 8055
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8056 8056
 	{
8057 8057
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8082,11 +8082,11 @@  discard block
 block discarded – undo
8082 8082
 	
8083 8083
 	
8084 8084
 	/**
8085
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8086
-	*
8087
-	* @return Array the airport list
8088
-	*
8089
-	*/
8085
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8086
+	 *
8087
+	 * @return Array the airport list
8088
+	 *
8089
+	 */
8090 8090
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8091 8091
 	{
8092 8092
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8119,11 +8119,11 @@  discard block
 block discarded – undo
8119 8119
 	
8120 8120
 	
8121 8121
 	/**
8122
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8123
-	*
8124
-	* @return Array the airport list
8125
-	*
8126
-	*/
8122
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8123
+	 *
8124
+	 * @return Array the airport list
8125
+	 *
8126
+	 */
8127 8127
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8128 8128
 	{
8129 8129
 		$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 of the airplanes that have flown over based on a aircraft manufacturer
8157
-	*
8158
-	* @return Array the airport list
8159
-	*
8160
-	*/
8156
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8157
+	 *
8158
+	 * @return Array the airport list
8159
+	 *
8160
+	 */
8161 8161
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8162 8162
 	{
8163 8163
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8191,11 +8191,11 @@  discard block
 block discarded – undo
8191 8191
 	
8192 8192
 	
8193 8193
 	/**
8194
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8195
-	*
8196
-	* @return Array the airport list
8197
-	*
8198
-	*/
8194
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8195
+	 *
8196
+	 * @return Array the airport list
8197
+	 *
8198
+	 */
8199 8199
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8200 8200
 	{
8201 8201
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8226,11 +8226,11 @@  discard block
 block discarded – undo
8226 8226
 	
8227 8227
 	
8228 8228
 	/**
8229
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8230
-	*
8231
-	* @return Array the airport list
8232
-	*
8233
-	*/
8229
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8230
+	 *
8231
+	 * @return Array the airport list
8232
+	 *
8233
+	 */
8234 8234
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8235 8235
 	{
8236 8236
 		global $globalTimezone, $globalDBdriver;
@@ -8276,11 +8276,11 @@  discard block
 block discarded – undo
8276 8276
 	
8277 8277
 	
8278 8278
 	/**
8279
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8280
-	*
8281
-	* @return Array the airport list
8282
-	*
8283
-	*/
8279
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8280
+	 *
8281
+	 * @return Array the airport list
8282
+	 *
8283
+	 */
8284 8284
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8285 8285
 	{
8286 8286
 		global $globalTimezone, $globalDBdriver;
@@ -8323,11 +8323,11 @@  discard block
 block discarded – undo
8323 8323
 	
8324 8324
 	
8325 8325
 	/**
8326
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8327
-	*
8328
-	* @return Array the airport list
8329
-	*
8330
-	*/
8326
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8327
+	 *
8328
+	 * @return Array the airport list
8329
+	 *
8330
+	 */
8331 8331
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8332 8332
 	{
8333 8333
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8359,11 +8359,11 @@  discard block
 block discarded – undo
8359 8359
 	}
8360 8360
 	
8361 8361
 	/**
8362
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8363
-	*
8364
-	* @return Array the airport list
8365
-	*
8366
-	*/
8362
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8363
+	 *
8364
+	 * @return Array the airport list
8365
+	 *
8366
+	 */
8367 8367
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8368 8368
 	{
8369 8369
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8394,11 +8394,11 @@  discard block
 block discarded – undo
8394 8394
 	}
8395 8395
 
8396 8396
 	/**
8397
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8398
-	*
8399
-	* @return Array the airport list
8400
-	*
8401
-	*/
8397
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8398
+	 *
8399
+	 * @return Array the airport list
8400
+	 *
8401
+	 */
8402 8402
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8403 8403
 	{
8404 8404
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8429,11 +8429,11 @@  discard block
 block discarded – undo
8429 8429
 	}
8430 8430
 	
8431 8431
 	/**
8432
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8433
-	*
8434
-	* @return Array the airport list
8435
-	*
8436
-	*/
8432
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8433
+	 *
8434
+	 * @return Array the airport list
8435
+	 *
8436
+	 */
8437 8437
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8438 8438
 	{
8439 8439
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8462,11 +8462,11 @@  discard block
 block discarded – undo
8462 8462
 	}
8463 8463
 	
8464 8464
 	/**
8465
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8466
-	*
8467
-	* @return Array the airport list
8468
-	*
8469
-	*/
8465
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8466
+	 *
8467
+	 * @return Array the airport list
8468
+	 *
8469
+	 */
8470 8470
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8471 8471
 	{
8472 8472
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8482,11 +8482,11 @@  discard block
 block discarded – undo
8482 8482
 	}
8483 8483
 	
8484 8484
 	/**
8485
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8486
-	*
8487
-	* @return Array the airport list
8488
-	*
8489
-	*/
8485
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8486
+	 *
8487
+	 * @return Array the airport list
8488
+	 *
8489
+	 */
8490 8490
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8491 8491
 	{
8492 8492
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8504,11 +8504,11 @@  discard block
 block discarded – undo
8504 8504
 	
8505 8505
 	
8506 8506
 	/**
8507
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8508
-	*
8509
-	* @return Array the airport list
8510
-	*
8511
-	*/
8507
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8508
+	 *
8509
+	 * @return Array the airport list
8510
+	 *
8511
+	 */
8512 8512
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8513 8513
 	{
8514 8514
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8541,11 +8541,11 @@  discard block
 block discarded – undo
8541 8541
 	
8542 8542
 	
8543 8543
 	/**
8544
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8545
-	*
8546
-	* @return Array the airport list
8547
-	*
8548
-	*/
8544
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8545
+	 *
8546
+	 * @return Array the airport list
8547
+	 *
8548
+	 */
8549 8549
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8550 8550
 	{
8551 8551
 		global $globalDBdriver;
@@ -8577,11 +8577,11 @@  discard block
 block discarded – undo
8577 8577
 
8578 8578
 
8579 8579
 	/**
8580
-	* Counts all airport departure countries
8581
-	*
8582
-	* @return Array the airport departure list
8583
-	*
8584
-	*/
8580
+	 * Counts all airport departure countries
8581
+	 *
8582
+	 * @return Array the airport departure list
8583
+	 *
8584
+	 */
8585 8585
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8586 8586
 	{
8587 8587
 		global $globalDBdriver;
@@ -8640,11 +8640,11 @@  discard block
 block discarded – undo
8640 8640
 	
8641 8641
 	
8642 8642
 	/**
8643
-	* Counts all airport arrival countries
8644
-	*
8645
-	* @return Array the airport arrival list
8646
-	*
8647
-	*/
8643
+	 * Counts all airport arrival countries
8644
+	 *
8645
+	 * @return Array the airport arrival list
8646
+	 *
8647
+	 */
8648 8648
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8649 8649
 	{
8650 8650
 		global $globalDBdriver;
@@ -8706,11 +8706,11 @@  discard block
 block discarded – undo
8706 8706
 
8707 8707
 
8708 8708
 	/**
8709
-	* Gets all route combinations
8710
-	*
8711
-	* @return Array the route list
8712
-	*
8713
-	*/
8709
+	 * Gets all route combinations
8710
+	 *
8711
+	 * @return Array the route list
8712
+	 *
8713
+	 */
8714 8714
 	public function countAllRoutes($filters = array())
8715 8715
 	{
8716 8716
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8749,11 +8749,11 @@  discard block
 block discarded – undo
8749 8749
 	
8750 8750
 	
8751 8751
 	/**
8752
-	* Gets all route combinations based on an aircraft
8753
-	*
8754
-	* @return Array the route list
8755
-	*
8756
-	*/
8752
+	 * Gets all route combinations based on an aircraft
8753
+	 *
8754
+	 * @return Array the route list
8755
+	 *
8756
+	 */
8757 8757
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8758 8758
 	{
8759 8759
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8789,11 +8789,11 @@  discard block
 block discarded – undo
8789 8789
 	
8790 8790
 	
8791 8791
 	/**
8792
-	* Gets all route combinations based on an aircraft registration
8793
-	*
8794
-	* @return Array the route list
8795
-	*
8796
-	*/
8792
+	 * Gets all route combinations based on an aircraft registration
8793
+	 *
8794
+	 * @return Array the route list
8795
+	 *
8796
+	 */
8797 8797
 	public function countAllRoutesByRegistration($registration, $filters = array())
8798 8798
 	{
8799 8799
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8831,11 +8831,11 @@  discard block
 block discarded – undo
8831 8831
 	
8832 8832
 	
8833 8833
 	/**
8834
-	* Gets all route combinations based on an airline
8835
-	*
8836
-	* @return Array the route list
8837
-	*
8838
-	*/
8834
+	 * Gets all route combinations based on an airline
8835
+	 *
8836
+	 * @return Array the route list
8837
+	 *
8838
+	 */
8839 8839
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8840 8840
 	{
8841 8841
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8873,11 +8873,11 @@  discard block
 block discarded – undo
8873 8873
 	
8874 8874
 	
8875 8875
 	/**
8876
-	* Gets all route combinations based on an airport
8877
-	*
8878
-	* @return Array the route list
8879
-	*
8880
-	*/
8876
+	 * Gets all route combinations based on an airport
8877
+	 *
8878
+	 * @return Array the route list
8879
+	 *
8880
+	 */
8881 8881
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8882 8882
 	{
8883 8883
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8914,11 +8914,11 @@  discard block
 block discarded – undo
8914 8914
 	
8915 8915
 	
8916 8916
 	/**
8917
-	* Gets all route combinations based on an country
8918
-	*
8919
-	* @return Array the route list
8920
-	*
8921
-	*/
8917
+	 * Gets all route combinations based on an country
8918
+	 *
8919
+	 * @return Array the route list
8920
+	 *
8921
+	 */
8922 8922
 	public function countAllRoutesByCountry($country, $filters = array())
8923 8923
 	{
8924 8924
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8954,11 +8954,11 @@  discard block
 block discarded – undo
8954 8954
 
8955 8955
 
8956 8956
 	/**
8957
-	* Gets all route combinations based on an date
8958
-	*
8959
-	* @return Array the route list
8960
-	*
8961
-	*/
8957
+	 * Gets all route combinations based on an date
8958
+	 *
8959
+	 * @return Array the route list
8960
+	 *
8961
+	 */
8962 8962
 	public function countAllRoutesByDate($date, $filters = array())
8963 8963
 	{
8964 8964
 		global $globalTimezone, $globalDBdriver;
@@ -9008,11 +9008,11 @@  discard block
 block discarded – undo
9008 9008
 	
9009 9009
 	
9010 9010
 	/**
9011
-	* Gets all route combinations based on an ident/callsign
9012
-	*
9013
-	* @return Array the route list
9014
-	*
9015
-	*/
9011
+	 * Gets all route combinations based on an ident/callsign
9012
+	 *
9013
+	 * @return Array the route list
9014
+	 *
9015
+	 */
9016 9016
 	public function countAllRoutesByIdent($ident, $filters = array())
9017 9017
 	{
9018 9018
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9048,11 +9048,11 @@  discard block
 block discarded – undo
9048 9048
 	}
9049 9049
 	
9050 9050
 	/**
9051
-	* Gets all route combinations based on an owner
9052
-	*
9053
-	* @return Array the route list
9054
-	*
9055
-	*/
9051
+	 * Gets all route combinations based on an owner
9052
+	 *
9053
+	 * @return Array the route list
9054
+	 *
9055
+	 */
9056 9056
 	public function countAllRoutesByOwner($owner,$filters = array())
9057 9057
 	{
9058 9058
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9088,11 +9088,11 @@  discard block
 block discarded – undo
9088 9088
 	}
9089 9089
 	
9090 9090
 	/**
9091
-	* Gets all route combinations based on a pilot
9092
-	*
9093
-	* @return Array the route list
9094
-	*
9095
-	*/
9091
+	 * Gets all route combinations based on a pilot
9092
+	 *
9093
+	 * @return Array the route list
9094
+	 *
9095
+	 */
9096 9096
 	public function countAllRoutesByPilot($pilot,$filters = array())
9097 9097
 	{
9098 9098
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9129,11 +9129,11 @@  discard block
 block discarded – undo
9129 9129
 	
9130 9130
 	
9131 9131
 	/**
9132
-	* Gets all route combinations based on an manufacturer
9133
-	*
9134
-	* @return Array the route list
9135
-	*
9136
-	*/
9132
+	 * Gets all route combinations based on an manufacturer
9133
+	 *
9134
+	 * @return Array the route list
9135
+	 *
9136
+	 */
9137 9137
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9138 9138
 	{
9139 9139
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9171,11 +9171,11 @@  discard block
 block discarded – undo
9171 9171
 	
9172 9172
 	
9173 9173
 	/**
9174
-	* Gets all route combinations with waypoints
9175
-	*
9176
-	* @return Array the route list
9177
-	*
9178
-	*/
9174
+	 * Gets all route combinations with waypoints
9175
+	 *
9176
+	 * @return Array the route list
9177
+	 *
9178
+	 */
9179 9179
 	public function countAllRoutesWithWaypoints($filters = array())
9180 9180
 	{
9181 9181
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9212,11 +9212,11 @@  discard block
 block discarded – undo
9212 9212
 	}
9213 9213
 	
9214 9214
 	/**
9215
-	* Gets all callsigns that have flown over
9216
-	*
9217
-	* @return Array the callsign list
9218
-	*
9219
-	*/
9215
+	 * Gets all callsigns that have flown over
9216
+	 *
9217
+	 * @return Array the callsign list
9218
+	 *
9219
+	 */
9220 9220
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9221 9221
 	{
9222 9222
 		global $globalDBdriver;
@@ -9282,11 +9282,11 @@  discard block
 block discarded – undo
9282 9282
 	}
9283 9283
 
9284 9284
 	/**
9285
-	* Gets all callsigns that have flown over
9286
-	*
9287
-	* @return Array the callsign list
9288
-	*
9289
-	*/
9285
+	 * Gets all callsigns that have flown over
9286
+	 *
9287
+	 * @return Array the callsign list
9288
+	 *
9289
+	 */
9290 9290
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9291 9291
 	{
9292 9292
 		global $globalDBdriver;
@@ -9327,11 +9327,11 @@  discard block
 block discarded – undo
9327 9327
 
9328 9328
 
9329 9329
 	/**
9330
-	* Counts all dates
9331
-	*
9332
-	* @return Array the date list
9333
-	*
9334
-	*/
9330
+	 * Counts all dates
9331
+	 *
9332
+	 * @return Array the date list
9333
+	 *
9334
+	 */
9335 9335
 	public function countAllDates($filters = array())
9336 9336
 	{
9337 9337
 		global $globalTimezone, $globalDBdriver;
@@ -9376,11 +9376,11 @@  discard block
 block discarded – undo
9376 9376
 	}
9377 9377
 	
9378 9378
 	/**
9379
-	* Counts all dates
9380
-	*
9381
-	* @return Array the date list
9382
-	*
9383
-	*/
9379
+	 * Counts all dates
9380
+	 *
9381
+	 * @return Array the date list
9382
+	 *
9383
+	 */
9384 9384
 	public function countAllDatesByAirlines($filters = array())
9385 9385
 	{
9386 9386
 		global $globalTimezone, $globalDBdriver;
@@ -9425,11 +9425,11 @@  discard block
 block discarded – undo
9425 9425
 	}	
9426 9426
 	
9427 9427
 	/**
9428
-	* Counts all dates during the last 7 days
9429
-	*
9430
-	* @return Array the date list
9431
-	*
9432
-	*/
9428
+	 * Counts all dates during the last 7 days
9429
+	 *
9430
+	 * @return Array the date list
9431
+	 *
9432
+	 */
9433 9433
 	public function countAllDatesLast7Days($filters = array())
9434 9434
 	{
9435 9435
 		global $globalTimezone, $globalDBdriver;
@@ -9451,7 +9451,7 @@  discard block
 block discarded – undo
9451 9451
 			$query .= " GROUP BY date_name 
9452 9452
 								ORDER BY date_name ASC";
9453 9453
 			$query_data = array(':offset' => $offset);
9454
-    		}
9454
+			}
9455 9455
 		
9456 9456
 		$sth = $this->db->prepare($query);
9457 9457
 		$sth->execute($query_data);
@@ -9471,11 +9471,11 @@  discard block
 block discarded – undo
9471 9471
 	}
9472 9472
 
9473 9473
 	/**
9474
-	* Counts all dates during the last month
9475
-	*
9476
-	* @return Array the date list
9477
-	*
9478
-	*/
9474
+	 * Counts all dates during the last month
9475
+	 *
9476
+	 * @return Array the date list
9477
+	 *
9478
+	 */
9479 9479
 	public function countAllDatesLastMonth($filters = array())
9480 9480
 	{
9481 9481
 		global $globalTimezone, $globalDBdriver;
@@ -9497,7 +9497,7 @@  discard block
 block discarded – undo
9497 9497
 			$query .= " GROUP BY date_name 
9498 9498
 								ORDER BY date_name ASC";
9499 9499
 			$query_data = array(':offset' => $offset);
9500
-    		}
9500
+			}
9501 9501
 		
9502 9502
 		$sth = $this->db->prepare($query);
9503 9503
 		$sth->execute($query_data);
@@ -9518,11 +9518,11 @@  discard block
 block discarded – undo
9518 9518
 
9519 9519
 
9520 9520
 	/**
9521
-	* Counts all dates during the last month
9522
-	*
9523
-	* @return Array the date list
9524
-	*
9525
-	*/
9521
+	 * Counts all dates during the last month
9522
+	 *
9523
+	 * @return Array the date list
9524
+	 *
9525
+	 */
9526 9526
 	public function countAllDatesLastMonthByAirlines($filters = array())
9527 9527
 	{
9528 9528
 		global $globalTimezone, $globalDBdriver;
@@ -9545,7 +9545,7 @@  discard block
 block discarded – undo
9545 9545
 								GROUP BY spotter_output.airline_icao, date_name 
9546 9546
 								ORDER BY date_name ASC";
9547 9547
 			$query_data = array(':offset' => $offset);
9548
-    		}
9548
+			}
9549 9549
 		
9550 9550
 		$sth = $this->db->prepare($query);
9551 9551
 		$sth->execute($query_data);
@@ -9567,11 +9567,11 @@  discard block
 block discarded – undo
9567 9567
 	
9568 9568
 
9569 9569
 	/**
9570
-	* Counts all month
9571
-	*
9572
-	* @return Array the month list
9573
-	*
9574
-	*/
9570
+	 * Counts all month
9571
+	 *
9572
+	 * @return Array the month list
9573
+	 *
9574
+	 */
9575 9575
 	public function countAllMonths($filters = array())
9576 9576
 	{
9577 9577
 		global $globalTimezone, $globalDBdriver;
@@ -9613,11 +9613,11 @@  discard block
 block discarded – undo
9613 9613
 	}
9614 9614
 
9615 9615
 	/**
9616
-	* Counts all month
9617
-	*
9618
-	* @return Array the month list
9619
-	*
9620
-	*/
9616
+	 * Counts all month
9617
+	 *
9618
+	 * @return Array the month list
9619
+	 *
9620
+	 */
9621 9621
 	public function countAllMonthsByAirlines($filters = array())
9622 9622
 	{
9623 9623
 		global $globalTimezone, $globalDBdriver;
@@ -9662,11 +9662,11 @@  discard block
 block discarded – undo
9662 9662
 	}
9663 9663
 
9664 9664
 	/**
9665
-	* Counts all military month
9666
-	*
9667
-	* @return Array the month list
9668
-	*
9669
-	*/
9665
+	 * Counts all military month
9666
+	 *
9667
+	 * @return Array the month list
9668
+	 *
9669
+	 */
9670 9670
 	public function countAllMilitaryMonths($filters = array())
9671 9671
 	{
9672 9672
 		global $globalTimezone, $globalDBdriver;
@@ -9707,11 +9707,11 @@  discard block
 block discarded – undo
9707 9707
 	}
9708 9708
 	
9709 9709
 	/**
9710
-	* Counts all month owners
9711
-	*
9712
-	* @return Array the month list
9713
-	*
9714
-	*/
9710
+	 * Counts all month owners
9711
+	 *
9712
+	 * @return Array the month list
9713
+	 *
9714
+	 */
9715 9715
 	public function countAllMonthsOwners($filters = array())
9716 9716
 	{
9717 9717
 		global $globalTimezone, $globalDBdriver;
@@ -9753,11 +9753,11 @@  discard block
 block discarded – undo
9753 9753
 	}
9754 9754
 	
9755 9755
 	/**
9756
-	* Counts all month owners
9757
-	*
9758
-	* @return Array the month list
9759
-	*
9760
-	*/
9756
+	 * Counts all month owners
9757
+	 *
9758
+	 * @return Array the month list
9759
+	 *
9760
+	 */
9761 9761
 	public function countAllMonthsOwnersByAirlines($filters = array())
9762 9762
 	{
9763 9763
 		global $globalTimezone, $globalDBdriver;
@@ -9800,11 +9800,11 @@  discard block
 block discarded – undo
9800 9800
 	}
9801 9801
 
9802 9802
 	/**
9803
-	* Counts all month pilot
9804
-	*
9805
-	* @return Array the month list
9806
-	*
9807
-	*/
9803
+	 * Counts all month pilot
9804
+	 *
9805
+	 * @return Array the month list
9806
+	 *
9807
+	 */
9808 9808
 	public function countAllMonthsPilots($filters = array())
9809 9809
 	{
9810 9810
 		global $globalTimezone, $globalDBdriver;
@@ -9846,11 +9846,11 @@  discard block
 block discarded – undo
9846 9846
 	}
9847 9847
 	
9848 9848
 	/**
9849
-	* Counts all month pilot
9850
-	*
9851
-	* @return Array the month list
9852
-	*
9853
-	*/
9849
+	 * Counts all month pilot
9850
+	 *
9851
+	 * @return Array the month list
9852
+	 *
9853
+	 */
9854 9854
 	public function countAllMonthsPilotsByAirlines($filters = array())
9855 9855
 	{
9856 9856
 		global $globalTimezone, $globalDBdriver;
@@ -9893,11 +9893,11 @@  discard block
 block discarded – undo
9893 9893
 	}
9894 9894
 
9895 9895
 	/**
9896
-	* Counts all month airline
9897
-	*
9898
-	* @return Array the month list
9899
-	*
9900
-	*/
9896
+	 * Counts all month airline
9897
+	 *
9898
+	 * @return Array the month list
9899
+	 *
9900
+	 */
9901 9901
 	public function countAllMonthsAirlines($filters = array())
9902 9902
 	{
9903 9903
 		global $globalTimezone, $globalDBdriver;
@@ -9939,11 +9939,11 @@  discard block
 block discarded – undo
9939 9939
 	}
9940 9940
 	
9941 9941
 	/**
9942
-	* Counts all month aircraft
9943
-	*
9944
-	* @return Array the month list
9945
-	*
9946
-	*/
9942
+	 * Counts all month aircraft
9943
+	 *
9944
+	 * @return Array the month list
9945
+	 *
9946
+	 */
9947 9947
 	public function countAllMonthsAircrafts($filters = array())
9948 9948
 	{
9949 9949
 		global $globalTimezone, $globalDBdriver;
@@ -9986,11 +9986,11 @@  discard block
 block discarded – undo
9986 9986
 	
9987 9987
 
9988 9988
 	/**
9989
-	* Counts all month aircraft
9990
-	*
9991
-	* @return Array the month list
9992
-	*
9993
-	*/
9989
+	 * Counts all month aircraft
9990
+	 *
9991
+	 * @return Array the month list
9992
+	 *
9993
+	 */
9994 9994
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9995 9995
 	{
9996 9996
 		global $globalTimezone, $globalDBdriver;
@@ -10033,11 +10033,11 @@  discard block
 block discarded – undo
10033 10033
 	}
10034 10034
 
10035 10035
 	/**
10036
-	* Counts all month real arrival
10037
-	*
10038
-	* @return Array the month list
10039
-	*
10040
-	*/
10036
+	 * Counts all month real arrival
10037
+	 *
10038
+	 * @return Array the month list
10039
+	 *
10040
+	 */
10041 10041
 	public function countAllMonthsRealArrivals($filters = array())
10042 10042
 	{
10043 10043
 		global $globalTimezone, $globalDBdriver;
@@ -10080,11 +10080,11 @@  discard block
 block discarded – undo
10080 10080
 	
10081 10081
 
10082 10082
 	/**
10083
-	* Counts all month real arrival
10084
-	*
10085
-	* @return Array the month list
10086
-	*
10087
-	*/
10083
+	 * Counts all month real arrival
10084
+	 *
10085
+	 * @return Array the month list
10086
+	 *
10087
+	 */
10088 10088
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10089 10089
 	{
10090 10090
 		global $globalTimezone, $globalDBdriver;
@@ -10128,11 +10128,11 @@  discard block
 block discarded – undo
10128 10128
 	
10129 10129
 
10130 10130
 	/**
10131
-	* Counts all dates during the last year
10132
-	*
10133
-	* @return Array the date list
10134
-	*
10135
-	*/
10131
+	 * Counts all dates during the last year
10132
+	 *
10133
+	 * @return Array the date list
10134
+	 *
10135
+	 */
10136 10136
 	public function countAllMonthsLastYear($filters)
10137 10137
 	{
10138 10138
 		global $globalTimezone, $globalDBdriver;
@@ -10154,7 +10154,7 @@  discard block
 block discarded – undo
10154 10154
 			$query .= " GROUP BY year_name, month_name
10155 10155
 								ORDER BY year_name, month_name ASC";
10156 10156
 			$query_data = array(':offset' => $offset);
10157
-    		}
10157
+			}
10158 10158
 		
10159 10159
 		$sth = $this->db->prepare($query);
10160 10160
 		$sth->execute($query_data);
@@ -10177,11 +10177,11 @@  discard block
 block discarded – undo
10177 10177
 	
10178 10178
 	
10179 10179
 	/**
10180
-	* Counts all hours
10181
-	*
10182
-	* @return Array the hour list
10183
-	*
10184
-	*/
10180
+	 * Counts all hours
10181
+	 *
10182
+	 * @return Array the hour list
10183
+	 *
10184
+	 */
10185 10185
 	public function countAllHours($orderby,$filters = array())
10186 10186
 	{
10187 10187
 		global $globalTimezone, $globalDBdriver;
@@ -10242,11 +10242,11 @@  discard block
 block discarded – undo
10242 10242
 	}
10243 10243
 	
10244 10244
 	/**
10245
-	* Counts all hours
10246
-	*
10247
-	* @return Array the hour list
10248
-	*
10249
-	*/
10245
+	 * Counts all hours
10246
+	 *
10247
+	 * @return Array the hour list
10248
+	 *
10249
+	 */
10250 10250
 	public function countAllHoursByAirlines($orderby, $filters = array())
10251 10251
 	{
10252 10252
 		global $globalTimezone, $globalDBdriver;
@@ -10309,11 +10309,11 @@  discard block
 block discarded – undo
10309 10309
 
10310 10310
 
10311 10311
 	/**
10312
-	* Counts all hours by airline
10313
-	*
10314
-	* @return Array the hour list
10315
-	*
10316
-	*/
10312
+	 * Counts all hours by airline
10313
+	 *
10314
+	 * @return Array the hour list
10315
+	 *
10316
+	 */
10317 10317
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10318 10318
 	{
10319 10319
 		global $globalTimezone, $globalDBdriver;
@@ -10359,11 +10359,11 @@  discard block
 block discarded – undo
10359 10359
 	
10360 10360
 	
10361 10361
 	/**
10362
-	* Counts all hours by aircraft
10363
-	*
10364
-	* @return Array the hour list
10365
-	*
10366
-	*/
10362
+	 * Counts all hours by aircraft
10363
+	 *
10364
+	 * @return Array the hour list
10365
+	 *
10366
+	 */
10367 10367
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10368 10368
 	{
10369 10369
 		global $globalTimezone, $globalDBdriver;
@@ -10406,11 +10406,11 @@  discard block
 block discarded – undo
10406 10406
 	
10407 10407
 	
10408 10408
 	/**
10409
-	* Counts all hours by aircraft registration
10410
-	*
10411
-	* @return Array the hour list
10412
-	*
10413
-	*/
10409
+	 * Counts all hours by aircraft registration
10410
+	 *
10411
+	 * @return Array the hour list
10412
+	 *
10413
+	 */
10414 10414
 	public function countAllHoursByRegistration($registration, $filters = array())
10415 10415
 	{
10416 10416
 		global $globalTimezone, $globalDBdriver;
@@ -10453,11 +10453,11 @@  discard block
 block discarded – undo
10453 10453
 	
10454 10454
 	
10455 10455
 	/**
10456
-	* Counts all hours by airport
10457
-	*
10458
-	* @return Array the hour list
10459
-	*
10460
-	*/
10456
+	 * Counts all hours by airport
10457
+	 *
10458
+	 * @return Array the hour list
10459
+	 *
10460
+	 */
10461 10461
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10462 10462
 	{
10463 10463
 		global $globalTimezone, $globalDBdriver;
@@ -10501,11 +10501,11 @@  discard block
 block discarded – undo
10501 10501
 	
10502 10502
 	
10503 10503
 	/**
10504
-	* Counts all hours by manufacturer
10505
-	*
10506
-	* @return Array the hour list
10507
-	*
10508
-	*/
10504
+	 * Counts all hours by manufacturer
10505
+	 *
10506
+	 * @return Array the hour list
10507
+	 *
10508
+	 */
10509 10509
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10510 10510
 	{
10511 10511
 		global $globalTimezone, $globalDBdriver;
@@ -10549,11 +10549,11 @@  discard block
 block discarded – undo
10549 10549
 	
10550 10550
 	
10551 10551
 	/**
10552
-	* Counts all hours by date
10553
-	*
10554
-	* @return Array the hour list
10555
-	*
10556
-	*/
10552
+	 * Counts all hours by date
10553
+	 *
10554
+	 * @return Array the hour list
10555
+	 *
10556
+	 */
10557 10557
 	public function countAllHoursByDate($date, $filters = array())
10558 10558
 	{
10559 10559
 		global $globalTimezone, $globalDBdriver;
@@ -10597,11 +10597,11 @@  discard block
 block discarded – undo
10597 10597
 	
10598 10598
 	
10599 10599
 	/**
10600
-	* Counts all hours by a ident/callsign
10601
-	*
10602
-	* @return Array the hour list
10603
-	*
10604
-	*/
10600
+	 * Counts all hours by a ident/callsign
10601
+	 *
10602
+	 * @return Array the hour list
10603
+	 *
10604
+	 */
10605 10605
 	public function countAllHoursByIdent($ident, $filters = array())
10606 10606
 	{
10607 10607
 		global $globalTimezone, $globalDBdriver;
@@ -10644,11 +10644,11 @@  discard block
 block discarded – undo
10644 10644
 	}
10645 10645
 	
10646 10646
 	/**
10647
-	* Counts all hours by a owner
10648
-	*
10649
-	* @return Array the hour list
10650
-	*
10651
-	*/
10647
+	 * Counts all hours by a owner
10648
+	 *
10649
+	 * @return Array the hour list
10650
+	 *
10651
+	 */
10652 10652
 	public function countAllHoursByOwner($owner, $filters = array())
10653 10653
 	{
10654 10654
 		global $globalTimezone, $globalDBdriver;
@@ -10691,11 +10691,11 @@  discard block
 block discarded – undo
10691 10691
 	}
10692 10692
 	
10693 10693
 	/**
10694
-	* Counts all hours by a pilot
10695
-	*
10696
-	* @return Array the hour list
10697
-	*
10698
-	*/
10694
+	 * Counts all hours by a pilot
10695
+	 *
10696
+	 * @return Array the hour list
10697
+	 *
10698
+	 */
10699 10699
 	public function countAllHoursByPilot($pilot, $filters = array())
10700 10700
 	{
10701 10701
 		global $globalTimezone, $globalDBdriver;
@@ -10740,11 +10740,11 @@  discard block
 block discarded – undo
10740 10740
 	
10741 10741
 	
10742 10742
 	/**
10743
-	* Counts all hours by route
10744
-	*
10745
-	* @return Array the hour list
10746
-	*
10747
-	*/
10743
+	 * Counts all hours by route
10744
+	 *
10745
+	 * @return Array the hour list
10746
+	 *
10747
+	 */
10748 10748
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10749 10749
 	{
10750 10750
 		global $globalTimezone, $globalDBdriver;
@@ -10788,11 +10788,11 @@  discard block
 block discarded – undo
10788 10788
 	
10789 10789
 	
10790 10790
 	/**
10791
-	* Counts all hours by country
10792
-	*
10793
-	* @return Array the hour list
10794
-	*
10795
-	*/
10791
+	 * Counts all hours by country
10792
+	 *
10793
+	 * @return Array the hour list
10794
+	 *
10795
+	 */
10796 10796
 	public function countAllHoursByCountry($country, $filters = array())
10797 10797
 	{
10798 10798
 		global $globalTimezone, $globalDBdriver;
@@ -10837,11 +10837,11 @@  discard block
 block discarded – undo
10837 10837
 
10838 10838
 
10839 10839
 	/**
10840
-	* Counts all aircraft that have flown over
10841
-	*
10842
-	* @return Integer the number of aircrafts
10843
-	*
10844
-	*/
10840
+	 * Counts all aircraft that have flown over
10841
+	 *
10842
+	 * @return Integer the number of aircrafts
10843
+	 *
10844
+	 */
10845 10845
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10846 10846
 	{
10847 10847
 		global $globalDBdriver;
@@ -10874,11 +10874,11 @@  discard block
 block discarded – undo
10874 10874
 	}
10875 10875
 
10876 10876
 	/**
10877
-	* Counts all flight that really arrival
10878
-	*
10879
-	* @return Integer the number of aircrafts
10880
-	*
10881
-	*/
10877
+	 * Counts all flight that really arrival
10878
+	 *
10879
+	 * @return Integer the number of aircrafts
10880
+	 *
10881
+	 */
10882 10882
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10883 10883
 	{
10884 10884
 		global $globalDBdriver;
@@ -10911,11 +10911,11 @@  discard block
 block discarded – undo
10911 10911
 	}
10912 10912
 
10913 10913
 	/**
10914
-	* Counts all pilots that have flown over
10915
-	*
10916
-	* @return Integer the number of pilots
10917
-	*
10918
-	*/
10914
+	 * Counts all pilots that have flown over
10915
+	 *
10916
+	 * @return Integer the number of pilots
10917
+	 *
10918
+	 */
10919 10919
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10920 10920
 	{
10921 10921
 		global $globalDBdriver;
@@ -10947,11 +10947,11 @@  discard block
 block discarded – undo
10947 10947
 	}
10948 10948
 
10949 10949
 	/**
10950
-	* Counts all owners that have flown over
10951
-	*
10952
-	* @return Integer the number of owners
10953
-	*
10954
-	*/
10950
+	 * Counts all owners that have flown over
10951
+	 *
10952
+	 * @return Integer the number of owners
10953
+	 *
10954
+	 */
10955 10955
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10956 10956
 	{
10957 10957
 		global $globalDBdriver;
@@ -10984,11 +10984,11 @@  discard block
 block discarded – undo
10984 10984
 	
10985 10985
 	
10986 10986
 	/**
10987
-	* Counts all flights that have flown over
10988
-	*
10989
-	* @return Integer the number of flights
10990
-	*
10991
-	*/
10987
+	 * Counts all flights that have flown over
10988
+	 *
10989
+	 * @return Integer the number of flights
10990
+	 *
10991
+	 */
10992 10992
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
10993 10993
 	{
10994 10994
 		global $globalDBdriver;
@@ -11022,11 +11022,11 @@  discard block
 block discarded – undo
11022 11022
 	}
11023 11023
 	
11024 11024
 	/**
11025
-	* Counts all military flights that have flown over
11026
-	*
11027
-	* @return Integer the number of flights
11028
-	*
11029
-	*/
11025
+	 * Counts all military flights that have flown over
11026
+	 *
11027
+	 * @return Integer the number of flights
11028
+	 *
11029
+	 */
11030 11030
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11031 11031
 	{
11032 11032
 		global $globalDBdriver;
@@ -11061,11 +11061,11 @@  discard block
 block discarded – undo
11061 11061
 	
11062 11062
 	
11063 11063
 	/**
11064
-	* Counts all airlines that have flown over
11065
-	*
11066
-	* @return Integer the number of airlines
11067
-	*
11068
-	*/
11064
+	 * Counts all airlines that have flown over
11065
+	 *
11066
+	 * @return Integer the number of airlines
11067
+	 *
11068
+	 */
11069 11069
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11070 11070
 	{
11071 11071
 		global $globalDBdriver;
@@ -11092,8 +11092,8 @@  discard block
 block discarded – undo
11092 11092
 				$query_values = array_merge($query_values,array(':month' => $month));
11093 11093
 			}
11094 11094
 		}
11095
-                if ($query == '') $queryi .= $this->getFilter($filters);
11096
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11095
+				if ($query == '') $queryi .= $this->getFilter($filters);
11096
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11097 11097
 
11098 11098
 
11099 11099
 		$sth = $this->db->prepare($queryi);
@@ -11103,11 +11103,11 @@  discard block
 block discarded – undo
11103 11103
 
11104 11104
   
11105 11105
 	/**
11106
-	* Counts all hours of today
11107
-	*
11108
-	* @return Array the hour list
11109
-	*
11110
-	*/
11106
+	 * Counts all hours of today
11107
+	 *
11108
+	 * @return Array the hour list
11109
+	 *
11110
+	 */
11111 11111
 	public function countAllHoursFromToday($filters = array())
11112 11112
 	{
11113 11113
 		global $globalTimezone, $globalDBdriver;
@@ -11147,11 +11147,11 @@  discard block
 block discarded – undo
11147 11147
 	}
11148 11148
     
11149 11149
 	/**
11150
-	* Gets all the spotter information based on calculated upcoming flights
11151
-	*
11152
-	* @return Array the spotter information
11153
-	*
11154
-	*/
11150
+	 * Gets all the spotter information based on calculated upcoming flights
11151
+	 *
11152
+	 * @return Array the spotter information
11153
+	 *
11154
+	 */
11155 11155
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11156 11156
 	{
11157 11157
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11226,12 +11226,12 @@  discard block
 block discarded – undo
11226 11226
 	}
11227 11227
     
11228 11228
     
11229
-     /**
11230
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11231
-	*
11232
-	* @return Integer the Barrie Spotter ID
11229
+	 /**
11230
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11231
+	  *
11232
+	  * @return Integer the Barrie Spotter ID
11233 11233
 q	*
11234
-	*/
11234
+	  */
11235 11235
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11236 11236
 	{
11237 11237
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11252,13 +11252,13 @@  discard block
 block discarded – undo
11252 11252
   
11253 11253
  
11254 11254
 	/**
11255
-	* Parses a date string
11256
-	*
11257
-	* @param String $dateString the date string
11258
-	* @param String $timezone the timezone of a user
11259
-	* @return Array the time information
11260
-	*
11261
-	*/
11255
+	 * Parses a date string
11256
+	 *
11257
+	 * @param String $dateString the date string
11258
+	 * @param String $timezone the timezone of a user
11259
+	 * @return Array the time information
11260
+	 *
11261
+	 */
11262 11262
 	public function parseDateString($dateString, $timezone = '')
11263 11263
 	{
11264 11264
 		$time_array = array();
@@ -11294,12 +11294,12 @@  discard block
 block discarded – undo
11294 11294
 	
11295 11295
 	
11296 11296
 	/**
11297
-	* Parses the direction degrees to working
11298
-	*
11299
-	* @param Float $direction the direction in degrees
11300
-	* @return Array the direction information
11301
-	*
11302
-	*/
11297
+	 * Parses the direction degrees to working
11298
+	 *
11299
+	 * @param Float $direction the direction in degrees
11300
+	 * @return Array the direction information
11301
+	 *
11302
+	 */
11303 11303
 	public function parseDirection($direction = 0)
11304 11304
 	{
11305 11305
 		if ($direction == '') $direction = 0;
@@ -11378,12 +11378,12 @@  discard block
 block discarded – undo
11378 11378
 	
11379 11379
 	
11380 11380
 	/**
11381
-	* Gets the aircraft registration
11382
-	*
11383
-	* @param String $flightaware_id the flight aware id
11384
-	* @return String the aircraft registration
11385
-	*
11386
-	*/
11381
+	 * Gets the aircraft registration
11382
+	 *
11383
+	 * @param String $flightaware_id the flight aware id
11384
+	 * @return String the aircraft registration
11385
+	 *
11386
+	 */
11387 11387
 	
11388 11388
 	public function getAircraftRegistration($flightaware_id)
11389 11389
 	{
@@ -11412,12 +11412,12 @@  discard block
 block discarded – undo
11412 11412
 
11413 11413
 
11414 11414
 	/**
11415
-	* Gets the aircraft registration from ModeS
11416
-	*
11417
-	* @param String $aircraft_modes the flight ModeS in hex
11418
-	* @return String the aircraft registration
11419
-	*
11420
-	*/
11415
+	 * Gets the aircraft registration from ModeS
11416
+	 *
11417
+	 * @param String $aircraft_modes the flight ModeS in hex
11418
+	 * @return String the aircraft registration
11419
+	 *
11420
+	 */
11421 11421
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11422 11422
 	{
11423 11423
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11430,19 +11430,19 @@  discard block
 block discarded – undo
11430 11430
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11431 11431
 		$sth->closeCursor();
11432 11432
 		if (count($row) > 0) {
11433
-		    //return $row['Registration'];
11434
-		    return $row['registration'];
11433
+			//return $row['Registration'];
11434
+			return $row['registration'];
11435 11435
 		} else return '';
11436 11436
 	
11437 11437
 	}
11438 11438
 
11439 11439
 	/**
11440
-	* Gets the aircraft type from ModeS
11441
-	*
11442
-	* @param String $aircraft_modes the flight ModeS in hex
11443
-	* @return String the aircraft type
11444
-	*
11445
-	*/
11440
+	 * Gets the aircraft type from ModeS
11441
+	 *
11442
+	 * @param String $aircraft_modes the flight ModeS in hex
11443
+	 * @return String the aircraft type
11444
+	 *
11445
+	 */
11446 11446
 	public function getAircraftTypeBymodeS($aircraft_modes)
11447 11447
 	{
11448 11448
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11455,19 +11455,19 @@  discard block
 block discarded – undo
11455 11455
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11456 11456
 		$sth->closeCursor();
11457 11457
 		if (count($row) > 0) {
11458
-		    if ($row['type_flight'] == null) return '';
11459
-		    else return $row['type_flight'];
11458
+			if ($row['type_flight'] == null) return '';
11459
+			else return $row['type_flight'];
11460 11460
 		} else return '';
11461 11461
 	
11462 11462
 	}
11463 11463
 
11464 11464
 	/**
11465
-	* Gets Country from latitude/longitude
11466
-	*
11467
-	* @param Float $latitude latitute of the flight
11468
-	* @param Float $longitude longitute of the flight
11469
-	* @return String the countrie
11470
-	*/
11465
+	 * Gets Country from latitude/longitude
11466
+	 *
11467
+	 * @param Float $latitude latitute of the flight
11468
+	 * @param Float $longitude longitute of the flight
11469
+	 * @return String the countrie
11470
+	 */
11471 11471
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11472 11472
 	{
11473 11473
 		global $globalDBdriver, $globalDebug;
@@ -11504,11 +11504,11 @@  discard block
 block discarded – undo
11504 11504
 	}
11505 11505
 
11506 11506
 	/**
11507
-	* Gets Country from iso2
11508
-	*
11509
-	* @param String $iso2 ISO2 country code
11510
-	* @return String the countrie
11511
-	*/
11507
+	 * Gets Country from iso2
11508
+	 *
11509
+	 * @param String $iso2 ISO2 country code
11510
+	 * @return String the countrie
11511
+	 */
11512 11512
 	public function getCountryFromISO2($iso2)
11513 11513
 	{
11514 11514
 		global $globalDBdriver, $globalDebug;
@@ -11536,12 +11536,12 @@  discard block
 block discarded – undo
11536 11536
 	}
11537 11537
 
11538 11538
 	/**
11539
-	* converts the registration code using the country prefix
11540
-	*
11541
-	* @param String $registration the aircraft registration
11542
-	* @return String the aircraft registration
11543
-	*
11544
-	*/
11539
+	 * converts the registration code using the country prefix
11540
+	 *
11541
+	 * @param String $registration the aircraft registration
11542
+	 * @return String the aircraft registration
11543
+	 *
11544
+	 */
11545 11545
 	public function convertAircraftRegistration($registration)
11546 11546
 	{
11547 11547
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11593,12 +11593,12 @@  discard block
 block discarded – undo
11593 11593
 	}
11594 11594
 
11595 11595
 	/**
11596
-	* Country from the registration code
11597
-	*
11598
-	* @param String $registration the aircraft registration
11599
-	* @return String the country
11600
-	*
11601
-	*/
11596
+	 * Country from the registration code
11597
+	 *
11598
+	 * @param String $registration the aircraft registration
11599
+	 * @return String the country
11600
+	 *
11601
+	 */
11602 11602
 	public function countryFromAircraftRegistration($registration)
11603 11603
 	{
11604 11604
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11617,8 +11617,8 @@  discard block
 block discarded – undo
11617 11617
 				$country = $row['country'];
11618 11618
 			}
11619 11619
 		} else {
11620
-    			$registration_1 = substr($registration, 0, 1);
11621
-		        $registration_2 = substr($registration, 0, 2);
11620
+				$registration_1 = substr($registration, 0, 1);
11621
+				$registration_2 = substr($registration, 0, 2);
11622 11622
 
11623 11623
 			$country = '';
11624 11624
 			//first get the prefix based on two characters
@@ -11654,12 +11654,12 @@  discard block
 block discarded – undo
11654 11654
 	}
11655 11655
 
11656 11656
 	/**
11657
-	* Registration prefix from the registration code
11658
-	*
11659
-	* @param String $registration the aircraft registration
11660
-	* @return String the registration prefix
11661
-	*
11662
-	*/
11657
+	 * Registration prefix from the registration code
11658
+	 *
11659
+	 * @param String $registration the aircraft registration
11660
+	 * @return String the registration prefix
11661
+	 *
11662
+	 */
11663 11663
 	public function registrationPrefixFromAircraftRegistration($registration)
11664 11664
 	{
11665 11665
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11678,8 +11678,8 @@  discard block
 block discarded – undo
11678 11678
 				//$country = $row['country'];
11679 11679
 			}
11680 11680
 		} else {
11681
-    			$registration_1 = substr($registration, 0, 1);
11682
-		        $registration_2 = substr($registration, 0, 2);
11681
+				$registration_1 = substr($registration, 0, 1);
11682
+				$registration_2 = substr($registration, 0, 2);
11683 11683
 
11684 11684
 			//first get the prefix based on two characters
11685 11685
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11715,12 +11715,12 @@  discard block
 block discarded – undo
11715 11715
 
11716 11716
 
11717 11717
 	/**
11718
-	* Country from the registration code
11719
-	*
11720
-	* @param String $registration the aircraft registration
11721
-	* @return String the country
11722
-	*
11723
-	*/
11718
+	 * Country from the registration code
11719
+	 *
11720
+	 * @param String $registration the aircraft registration
11721
+	 * @return String the country
11722
+	 *
11723
+	 */
11724 11724
 	public function countryFromAircraftRegistrationCode($registration)
11725 11725
 	{
11726 11726
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11737,11 +11737,11 @@  discard block
 block discarded – undo
11737 11737
 	}
11738 11738
 	
11739 11739
 	/**
11740
-	* Set a new highlight value for a flight
11741
-	*
11742
-	* @param String $flightaware_id flightaware_id from spotter_output table
11743
-	* @param String $highlight New highlight value
11744
-	*/
11740
+	 * Set a new highlight value for a flight
11741
+	 *
11742
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11743
+	 * @param String $highlight New highlight value
11744
+	 */
11745 11745
 	public function setHighlightFlight($flightaware_id,$highlight) {
11746 11746
 		
11747 11747
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11750,12 +11750,12 @@  discard block
 block discarded – undo
11750 11750
 	}
11751 11751
 
11752 11752
 	/**
11753
-	* Set a new highlight value for a flight by Registration
11754
-	*
11755
-	* @param String $registration Registration of the aircraft
11756
-	* @param String $date Date of spotted aircraft
11757
-	* @param String $highlight New highlight value
11758
-	*/
11753
+	 * Set a new highlight value for a flight by Registration
11754
+	 *
11755
+	 * @param String $registration Registration of the aircraft
11756
+	 * @param String $date Date of spotted aircraft
11757
+	 * @param String $highlight New highlight value
11758
+	 */
11759 11759
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11760 11760
 		if ($date == '') {
11761 11761
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11769,12 +11769,12 @@  discard block
 block discarded – undo
11769 11769
 	}
11770 11770
 	
11771 11771
 	/**
11772
-	* Gets the short url from bit.ly
11773
-	*
11774
-	* @param String $url the full url
11775
-	* @return String the bit.ly url
11776
-	*
11777
-	*/
11772
+	 * Gets the short url from bit.ly
11773
+	 *
11774
+	 * @param String $url the full url
11775
+	 * @return String the bit.ly url
11776
+	 *
11777
+	 */
11778 11778
 	public function getBitlyURL($url)
11779 11779
 	{
11780 11780
 		global $globalBitlyAccessToken;
@@ -12063,11 +12063,11 @@  discard block
 block discarded – undo
12063 12063
 			$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 
12064 12064
 	                      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)) 
12065 12065
 	                      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;";
12066
-                } else {
12066
+				} else {
12067 12067
 			$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 
12068 12068
 	                      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)) 
12069 12069
 	                      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;";
12070
-    		}
12070
+			}
12071 12071
 		$sth = $this->db->prepare($query);
12072 12072
 		$sth->execute();
12073 12073
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1343 added lines, -1343 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,45 +59,45 @@  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
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
73 73
 		$filter_query_join = '';
74 74
 		$filter_query_where = '';
75
-		foreach($filters as $flt) {
75
+		foreach ($filters as $flt) {
76 76
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
77 77
 				if ($flt['airlines'][0] != '') {
78 78
 					if (isset($flt['source'])) {
79
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
79
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
80 80
 					} else {
81
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
81
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
82 82
 					}
83 83
 				}
84 84
 			}
85 85
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
86 86
 				if (isset($flt['source'])) {
87
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
87
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
88 88
 				} else {
89
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
89
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
90 90
 				}
91 91
 			}
92 92
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
93 93
 				if (isset($flt['source'])) {
94
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
94
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
95 95
 				}
96 96
 			}
97 97
 		}
98 98
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
99 99
 			if ($filter['airlines'][0] != '') {
100
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
100
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
101 101
 			}
102 102
 		}
103 103
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
108 108
 		}
109 109
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
110
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
110
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
111 111
 			}
112 112
 		if (isset($filter['source']) && !empty($filter['source'])) {
113
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
113
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
114 114
 		}
115 115
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
116 116
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
119
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
120 120
 		}
121 121
 		if (isset($filter['year']) && $filter['year'] != '') {
122 122
 			if ($globalDBdriver == 'mysql') {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
143 143
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
144 144
 		if ($filter_query_where != '') {
145
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
145
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
146 146
 		}
147 147
 		$filter_query = $filter_query_join.$filter_query_where;
148 148
 		return $filter_query;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	* @return Array the spotter information
158 158
 	*
159 159
 	*/
160
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
160
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
161 161
 	{
162 162
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
163 163
 		$Image = new Image($this->db);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			$sth = $this->db->prepare($query.$limitQuery);
188 188
 			$sth->execute($params);
189 189
 		} catch (PDOException $e) {
190
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
190
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
191 191
 			exit();
192 192
 		}
193 193
 		
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$spotter_array = array();
198 198
 		
199 199
 
200
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
200
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
201 201
 		{
202 202
 			$num_rows++;
203 203
 			$temp_array = array();
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
242 242
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
243 243
 				$temp_array['route_stop'] = $row['route_stop'];
244
-				$allroute = explode(' ',$row['route_stop']);
244
+				$allroute = explode(' ', $row['route_stop']);
245 245
 				foreach ($allroute as $route) {
246 246
 					$route_airport_array = $this->getAllAirportInfo($route);
247 247
 					if (isset($route_airport_array[0]['name'])) {
@@ -294,16 +294,16 @@  discard block
 block discarded – undo
294 294
 				{
295 295
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
296 296
 				} else {
297
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
297
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
298 298
 				}
299 299
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
300
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
301
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
300
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
301
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
302 302
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
303 303
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
304 304
 					$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
305
-					$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
306
-					$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
305
+					$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
306
+					$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
307 307
 					$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
308 308
 				}
309 309
 			}
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
339 339
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
340 340
 					if (is_numeric(substr($row['ident'], 2, 1))) {
341
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
341
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
342 342
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
343
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
343
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
344 344
 					} else {
345 345
 						$airline_array = $this->getAllAirlineInfo('NA');
346 346
 					}
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 				}
378 378
 			}
379 379
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
380
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
380
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
381 381
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
382 382
 				if (count($acars_array) > 0) {
383 383
 					$temp_array['acars'] = $acars_array;
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
395 395
 			}
396 396
 
397
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
397
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
398 398
 			{
399 399
 				if ($globalIVAO) {
400
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
401
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
400
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
401
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
402 402
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
403 403
 				if (count($image_array) > 0) {
404 404
 					$temp_array['image'] = $image_array[0]['image'];
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
423 423
 			}
424 424
 			
425
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
425
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
426 426
 				if ($schedules === true) {
427 427
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
428 428
 					//print_r($schedule_array);
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
504 504
 			if (isset($row['squawk'])) {
505 505
 				$temp_array['squawk'] = $row['squawk'];
506 506
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
507
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
508
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
507
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
508
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
509 509
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
510
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
511
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
512
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
510
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
511
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
512
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
513 513
 			}
514 514
     			
515 515
 			$temp_array['query_number_rows'] = $num_rows;
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	* @return Array the spotter information
529 529
 	*
530 530
 	*/
531
-	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())
531
+	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())
532 532
 	{
533 533
 		global $globalTimezone, $globalDBdriver;
534 534
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 
539 539
 		$query_values = array();
540 540
 		$additional_query = '';
541
-		$filter_query = $this->getFilter($filters,true,true);
541
+		$filter_query = $this->getFilter($filters, true, true);
542 542
 		if ($q != "")
543 543
 		{
544 544
 			if (!is_string($q))
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
 				return false;
547 547
 			} else {
548 548
 				$q_array = explode(" ", $q);
549
-				foreach ($q_array as $q_item){
550
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
549
+				foreach ($q_array as $q_item) {
550
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
551 551
 					$additional_query .= " AND (";
552 552
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
553 553
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -579,37 +579,37 @@  discard block
 block discarded – undo
579 579
 
580 580
 		if ($registration != "")
581 581
 		{
582
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
582
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
583 583
 			if (!is_string($registration))
584 584
 			{
585 585
 				return false;
586 586
 			} else {
587 587
 				$additional_query .= " AND spotter_output.registration = :registration";
588
-				$query_values = array_merge($query_values,array(':registration' => $registration));
588
+				$query_values = array_merge($query_values, array(':registration' => $registration));
589 589
 			}
590 590
 		}
591 591
 
592 592
 		if ($aircraft_icao != "")
593 593
 		{
594
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
594
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
595 595
 			if (!is_string($aircraft_icao))
596 596
 			{
597 597
 				return false;
598 598
 			} else {
599 599
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
600
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
600
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
601 601
 			}
602 602
 		}
603 603
 
604 604
 		if ($aircraft_manufacturer != "")
605 605
 		{
606
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
606
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
607 607
 			if (!is_string($aircraft_manufacturer))
608 608
 			{
609 609
 				return false;
610 610
 			} else {
611 611
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
612
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
612
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
613 613
 			}
614 614
 		}
615 615
 
@@ -625,25 +625,25 @@  discard block
 block discarded – undo
625 625
 
626 626
 		if ($airline_icao != "")
627 627
 		{
628
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
628
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
629 629
 			if (!is_string($airline_icao))
630 630
 			{
631 631
 				return false;
632 632
 			} else {
633 633
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
634
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
634
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
635 635
 			}
636 636
 		}
637 637
 
638 638
 		if ($airline_country != "")
639 639
 		{
640
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
640
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
641 641
 			if (!is_string($airline_country))
642 642
 			{
643 643
 				return false;
644 644
 			} else {
645 645
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
646
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
646
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
647 647
 			}
648 648
 		}
649 649
 
@@ -670,31 +670,31 @@  discard block
 block discarded – undo
670 670
 
671 671
 		if ($airport != "")
672 672
 		{
673
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
673
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
674 674
 			if (!is_string($airport))
675 675
 			{
676 676
 				return false;
677 677
 			} else {
678 678
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
679
-				$query_values = array_merge($query_values,array(':airport' => $airport));
679
+				$query_values = array_merge($query_values, array(':airport' => $airport));
680 680
 			}
681 681
 		}
682 682
 
683 683
 		if ($airport_country != "")
684 684
 		{
685
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
685
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
686 686
 			if (!is_string($airport_country))
687 687
 			{
688 688
 				return false;
689 689
 			} else {
690 690
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
691
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
691
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
692 692
 			}
693 693
 		}
694 694
     
695 695
 		if ($callsign != "")
696 696
 		{
697
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
697
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
698 698
 			if (!is_string($callsign))
699 699
 			{
700 700
 				return false;
@@ -702,79 +702,79 @@  discard block
 block discarded – undo
702 702
 				$translate = $Translation->ident2icao($callsign);
703 703
 				if ($translate != $callsign) {
704 704
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
705
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
705
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
706 706
 				} else {
707 707
 					$additional_query .= " AND spotter_output.ident = :callsign";
708
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
708
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
709 709
 				}
710 710
 			}
711 711
 		}
712 712
 
713 713
 		if ($owner != "")
714 714
 		{
715
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
715
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
716 716
 			if (!is_string($owner))
717 717
 			{
718 718
 				return false;
719 719
 			} else {
720 720
 				$additional_query .= " AND spotter_output.owner_name = :owner";
721
-				$query_values = array_merge($query_values,array(':owner' => $owner));
721
+				$query_values = array_merge($query_values, array(':owner' => $owner));
722 722
 			}
723 723
 		}
724 724
 
725 725
 		if ($pilot_name != "")
726 726
 		{
727
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
727
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
728 728
 			if (!is_string($pilot_name))
729 729
 			{
730 730
 				return false;
731 731
 			} else {
732 732
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
733
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
733
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
734 734
 			}
735 735
 		}
736 736
 
737 737
 		if ($pilot_id != "")
738 738
 		{
739
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
739
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
740 740
 			if (!is_string($pilot_id))
741 741
 			{
742 742
 				return false;
743 743
 			} else {
744 744
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
745
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
745
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
746 746
 			}
747 747
 		}
748 748
 
749 749
 		if ($departure_airport_route != "")
750 750
 		{
751
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
751
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
752 752
 			if (!is_string($departure_airport_route))
753 753
 			{
754 754
 				return false;
755 755
 			} else {
756 756
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
757
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
757
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
758 758
 			}
759 759
 		}
760 760
 
761 761
 		if ($arrival_airport_route != "")
762 762
 		{
763
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
763
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
764 764
 			if (!is_string($arrival_airport_route))
765 765
 			{
766 766
 				return false;
767 767
 			} else {
768 768
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
769
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
769
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
770 770
 			}
771 771
 		}
772 772
 
773 773
 		if ($altitude != "")
774 774
 		{
775 775
 			$altitude_array = explode(",", $altitude);
776
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
777
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
776
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
777
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
778 778
 
779 779
 			if ($altitude_array[1] != "")
780 780
 			{                
@@ -790,8 +790,8 @@  discard block
 block discarded – undo
790 790
 		if ($date_posted != "")
791 791
 		{
792 792
 			$date_array = explode(",", $date_posted);
793
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
794
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
793
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
794
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
795 795
 
796 796
 			if ($globalTimezone != '') {
797 797
 				date_default_timezone_set($globalTimezone);
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 		{
823 823
 			$limit_array = explode(",", $limit);
824 824
 			
825
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
826
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
825
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
826
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
827 827
 			
828 828
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
829 829
 			{
@@ -852,23 +852,23 @@  discard block
 block discarded – undo
852 852
 
853 853
 
854 854
 		if ($origLat != "" && $origLon != "" && $dist != "") {
855
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
855
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
856 856
 
857 857
 			if ($globalDBdriver == 'mysql') {
858
-				$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 
858
+				$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 
859 859
 						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)) 
860 860
 						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;
861 861
 			} else {
862
-				$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 
862
+				$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 
863 863
 						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)) 
864 864
 						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;
865 865
 			}
866 866
 		} else {		
867
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
867
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
868 868
 					".$additional_query."
869 869
 					".$orderby_query;
870 870
 		}
871
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
871
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
872 872
 		return $spotter_array;
873 873
 	}
874 874
 	
@@ -891,8 +891,8 @@  discard block
 block discarded – undo
891 891
 		{
892 892
 			$limit_array = explode(",", $limit);
893 893
 			
894
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
895
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
894
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
895
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
896 896
 			
897 897
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
898 898
 			{
@@ -909,9 +909,9 @@  discard block
 block discarded – undo
909 909
 			$orderby_query = " ORDER BY spotter_output.date DESC";
910 910
 		}
911 911
 
912
-		$query  = $global_query.$filter_query." ".$orderby_query;
912
+		$query = $global_query.$filter_query." ".$orderby_query;
913 913
 
914
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
914
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
915 915
 
916 916
 		return $spotter_array;
917 917
 	}
@@ -957,34 +957,34 @@  discard block
 block discarded – undo
957 957
 			{
958 958
 				return false;
959 959
 			} else {
960
-				if ($interval == "30m"){
960
+				if ($interval == "30m") {
961 961
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
962
-				} else if ($interval == "1h"){
962
+				} else if ($interval == "1h") {
963 963
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
964
-				} else if ($interval == "3h"){
964
+				} else if ($interval == "3h") {
965 965
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
966
-				} else if ($interval == "6h"){
966
+				} else if ($interval == "6h") {
967 967
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
968
-				} else if ($interval == "12h"){
968
+				} else if ($interval == "12h") {
969 969
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
970
-				} else if ($interval == "24h"){
970
+				} else if ($interval == "24h") {
971 971
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
972
-				} else if ($interval == "7d"){
972
+				} else if ($interval == "7d") {
973 973
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
974
-				} else if ($interval == "30d"){
974
+				} else if ($interval == "30d") {
975 975
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
976 976
 				} 
977 977
 			}
978 978
 		}
979 979
 
980
-		$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 
980
+		$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 
981 981
                    WHERE spotter_output.latitude <> '' 
982 982
 				   AND spotter_output.longitude <> '' 
983 983
                    ".$additional_query."
984 984
                    HAVING distance < :radius  
985 985
 				   ORDER BY distance";
986 986
 
987
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
987
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
988 988
 
989 989
 		return $spotter_array;
990 990
 	}
@@ -996,21 +996,21 @@  discard block
 block discarded – undo
996 996
 	* @return Array the spotter information
997 997
 	*
998 998
 	*/
999
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
999
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
1000 1000
 	{
1001 1001
 		global $global_query;
1002 1002
 		
1003 1003
 		date_default_timezone_set('UTC');
1004 1004
 
1005
-		$filter_query = $this->getFilter($filter,true,true);
1005
+		$filter_query = $this->getFilter($filter, true, true);
1006 1006
 
1007 1007
 		$limit_query = '';
1008 1008
 		if ($limit != "")
1009 1009
 		{
1010 1010
 			$limit_array = explode(",", $limit);
1011 1011
 			
1012
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1013
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1012
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1013
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1014 1014
 			
1015 1015
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1016 1016
 			{
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1028 1028
 		}
1029 1029
 
1030
-		$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;
1030
+		$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;
1031 1031
 
1032 1032
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1033 1033
 
@@ -1046,15 +1046,15 @@  discard block
 block discarded – undo
1046 1046
 		global $global_query;
1047 1047
 		
1048 1048
 		date_default_timezone_set('UTC');
1049
-		$filter_query = $this->getFilter($filter,true,true);
1049
+		$filter_query = $this->getFilter($filter, true, true);
1050 1050
 
1051 1051
 		$limit_query = '';
1052 1052
 		if ($limit != "")
1053 1053
 		{
1054 1054
 			$limit_array = explode(",", $limit);
1055 1055
 			
1056
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1057
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1056
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1057
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1058 1058
 			
1059 1059
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1060 1060
 			{
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1072 1072
 		}
1073 1073
 
1074
-		$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;
1074
+		$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;
1075 1075
 
1076 1076
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1077 1077
 
@@ -1085,20 +1085,20 @@  discard block
 block discarded – undo
1085 1085
 	* @return Array the spotter information
1086 1086
 	*
1087 1087
 	*/
1088
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1088
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1089 1089
 	{
1090 1090
 		global $global_query;
1091 1091
 		
1092 1092
 		date_default_timezone_set('UTC');
1093
-		$filter_query = $this->getFilter($filter,true,true);
1093
+		$filter_query = $this->getFilter($filter, true, true);
1094 1094
 		
1095 1095
 		$limit_query = '';
1096 1096
 		if ($limit != "")
1097 1097
 		{
1098 1098
 			$limit_array = explode(",", $limit);
1099 1099
 			
1100
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1101
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1100
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1101
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1102 1102
 			
1103 1103
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1104 1104
 			{
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1116 1116
 		}
1117 1117
 
1118
-		$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;
1118
+		$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;
1119 1119
 
1120 1120
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1121 1121
 
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 		
1136 1136
 		date_default_timezone_set('UTC');
1137 1137
 		
1138
-		$filter_query = $this->getFilter($filter,true,true);
1138
+		$filter_query = $this->getFilter($filter, true, true);
1139 1139
 		
1140 1140
 		$limit_query = '';
1141 1141
 		
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
 		{
1144 1144
 			$limit_array = explode(",", $limit);
1145 1145
 			
1146
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1147
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1146
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1147
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1148 1148
 			
1149 1149
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1150 1150
 			{
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1162 1162
 		}
1163 1163
 
1164
-		$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;
1164
+		$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;
1165 1165
 
1166 1166
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1167 1167
 
@@ -1180,14 +1180,14 @@  discard block
 block discarded – undo
1180 1180
 		global $global_query;
1181 1181
 		
1182 1182
 		date_default_timezone_set('UTC');
1183
-		$filter_query = $this->getFilter($filter,true,true);
1183
+		$filter_query = $this->getFilter($filter, true, true);
1184 1184
 		$limit_query = '';
1185 1185
 		if ($limit != "")
1186 1186
 		{
1187 1187
 			$limit_array = explode(",", $limit);
1188 1188
 			
1189
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1190
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1189
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1190
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1191 1191
 			
1192 1192
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1193 1193
 			{
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1205 1205
 		}
1206 1206
 
1207
-		$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;
1207
+		$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;
1208 1208
 
1209 1209
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1210 1210
 
@@ -1228,9 +1228,9 @@  discard block
 block discarded – undo
1228 1228
 		$query_values = array(':id' => $id);
1229 1229
 
1230 1230
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1231
-		$query  = $global_query." WHERE ".$additional_query." ";
1231
+		$query = $global_query." WHERE ".$additional_query." ";
1232 1232
 
1233
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1233
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1234 1234
 
1235 1235
 		return $spotter_array;
1236 1236
 	}
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 		$query_values = array();
1254 1254
 		$limit_query = '';
1255 1255
 		$additional_query = '';
1256
-		$filter_query = $this->getFilter($filter,true,true);
1256
+		$filter_query = $this->getFilter($filter, true, true);
1257 1257
 		if ($ident != "")
1258 1258
 		{
1259 1259
 			if (!is_string($ident))
@@ -1269,8 +1269,8 @@  discard block
 block discarded – undo
1269 1269
 		{
1270 1270
 			$limit_array = explode(",", $limit);
1271 1271
 			
1272
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1273
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1272
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1273
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1274 1274
 			
1275 1275
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1276 1276
 			{
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 		$query_values = array();
1310 1310
 		$limit_query = '';
1311 1311
 		$additional_query = '';
1312
-		$filter_query = $this->getFilter($filter,true,true);
1312
+		$filter_query = $this->getFilter($filter, true, true);
1313 1313
 		if ($owner != "")
1314 1314
 		{
1315 1315
 			if (!is_string($owner))
@@ -1325,8 +1325,8 @@  discard block
 block discarded – undo
1325 1325
 		{
1326 1326
 			$limit_array = explode(",", $limit);
1327 1327
 			
1328
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1329
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1328
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1329
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1330 1330
 			
1331 1331
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1332 1332
 			{
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 		$query_values = array();
1367 1367
 		$limit_query = '';
1368 1368
 		$additional_query = '';
1369
-		$filter_query = $this->getFilter($filter,true,true);
1369
+		$filter_query = $this->getFilter($filter, true, true);
1370 1370
 		if ($pilot != "")
1371 1371
 		{
1372 1372
 			$additional_query = " AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
@@ -1377,8 +1377,8 @@  discard block
 block discarded – undo
1377 1377
 		{
1378 1378
 			$limit_array = explode(",", $limit);
1379 1379
 			
1380
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1381
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1380
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1381
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1382 1382
 			
1383 1383
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1384 1384
 			{
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
 		$query_values = array();
1420 1420
 		$limit_query = '';
1421 1421
 		$additional_query = '';
1422
-		$filter_query = $this->getFilter($filter,true,true);
1422
+		$filter_query = $this->getFilter($filter, true, true);
1423 1423
 		
1424 1424
 		if ($aircraft_type != "")
1425 1425
 		{
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
 		{
1437 1437
 			$limit_array = explode(",", $limit);
1438 1438
 			
1439
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1440
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1439
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1440
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1441 1441
 			
1442 1442
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1443 1443
 			{
@@ -1493,8 +1493,8 @@  discard block
 block discarded – undo
1493 1493
 		{
1494 1494
 			$limit_array = explode(",", $limit);
1495 1495
 			
1496
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1497
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1496
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1497
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1498 1498
 			
1499 1499
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1500 1500
 			{
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 		} else {
1511 1511
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1512 1512
 		}
1513
-		$filter_query = $this->getFilter($filter,true,true);
1513
+		$filter_query = $this->getFilter($filter, true, true);
1514 1514
 
1515 1515
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1516 1516
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 	* @return Array the spotter information
1530 1530
 	*
1531 1531
 	*/
1532
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1532
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1533 1533
 	{
1534 1534
 		global $global_query;
1535 1535
 		
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
 		$query_values = array();
1539 1539
 		$limit_query = '';
1540 1540
 		$additional_query = '';
1541
-		$filter_query = $this->getFilter($filters,true,true);
1541
+		$filter_query = $this->getFilter($filters, true, true);
1542 1542
 		
1543 1543
 		if ($airline != "")
1544 1544
 		{
@@ -1555,8 +1555,8 @@  discard block
 block discarded – undo
1555 1555
 		{
1556 1556
 			$limit_array = explode(",", $limit);
1557 1557
 			
1558
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1559
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1558
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1559
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1560 1560
 			
1561 1561
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1562 1562
 			{
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
 	* @return Array the spotter information
1587 1587
 	*
1588 1588
 	*/
1589
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1589
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1590 1590
 	{
1591 1591
 		global $global_query;
1592 1592
 		
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 		$query_values = array();
1595 1595
 		$limit_query = '';
1596 1596
 		$additional_query = '';
1597
-		$filter_query = $this->getFilter($filters,true,true);
1597
+		$filter_query = $this->getFilter($filters, true, true);
1598 1598
 		
1599 1599
 		if ($airport != "")
1600 1600
 		{
@@ -1611,8 +1611,8 @@  discard block
 block discarded – undo
1611 1611
 		{
1612 1612
 			$limit_array = explode(",", $limit);
1613 1613
 			
1614
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1615
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1614
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1615
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1616 1616
 			
1617 1617
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1618 1618
 			{
@@ -1644,7 +1644,7 @@  discard block
 block discarded – undo
1644 1644
 	* @return Array the spotter information
1645 1645
 	*
1646 1646
 	*/
1647
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1647
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1648 1648
 	{
1649 1649
 		global $global_query, $globalTimezone, $globalDBdriver;
1650 1650
 		
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 		$limit_query = '';
1653 1653
 		$additional_query = '';
1654 1654
 
1655
-		$filter_query = $this->getFilter($filter,true,true);
1655
+		$filter_query = $this->getFilter($filter, true, true);
1656 1656
 		
1657 1657
 		if ($date != "")
1658 1658
 		{
@@ -1681,8 +1681,8 @@  discard block
 block discarded – undo
1681 1681
 		{
1682 1682
 			$limit_array = explode(",", $limit);
1683 1683
 			
1684
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1685
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1684
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1685
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1686 1686
 			
1687 1687
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1688 1688
 			{
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 	* @return Array the spotter information
1713 1713
 	*
1714 1714
 	*/
1715
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1715
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1716 1716
 	{
1717 1717
 		global $global_query;
1718 1718
 		
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
 		$query_values = array();
1722 1722
 		$limit_query = '';
1723 1723
 		$additional_query = '';
1724
-		$filter_query = $this->getFilter($filters,true,true);
1724
+		$filter_query = $this->getFilter($filters, true, true);
1725 1725
 		if ($country != "")
1726 1726
 		{
1727 1727
 			if (!is_string($country))
@@ -1738,8 +1738,8 @@  discard block
 block discarded – undo
1738 1738
 		{
1739 1739
 			$limit_array = explode(",", $limit);
1740 1740
 			
1741
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1742
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1741
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1742
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1743 1743
 			
1744 1744
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1745 1745
 			{
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
 		$query_values = array();
1780 1780
 		$additional_query = '';
1781 1781
 		$limit_query = '';
1782
-		$filter_query = $this->getFilter($filters,true,true);
1782
+		$filter_query = $this->getFilter($filters, true, true);
1783 1783
 		
1784 1784
 		if ($aircraft_manufacturer != "")
1785 1785
 		{
@@ -1796,8 +1796,8 @@  discard block
 block discarded – undo
1796 1796
 		{
1797 1797
 			$limit_array = explode(",", $limit);
1798 1798
 			
1799
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1800
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1799
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1800
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1801 1801
 			
1802 1802
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1803 1803
 			{
@@ -1839,14 +1839,14 @@  discard block
 block discarded – undo
1839 1839
 		$query_values = array();
1840 1840
 		$additional_query = '';
1841 1841
 		$limit_query = '';
1842
-		$filter_query = $this->getFilter($filters,true,true);
1842
+		$filter_query = $this->getFilter($filters, true, true);
1843 1843
 		if ($departure_airport_icao != "")
1844 1844
 		{
1845 1845
 			if (!is_string($departure_airport_icao))
1846 1846
 			{
1847 1847
 				return false;
1848 1848
 			} else {
1849
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1849
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1850 1850
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1851 1851
 				//$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";
1852 1852
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1859,10 +1859,10 @@  discard block
 block discarded – undo
1859 1859
 			{
1860 1860
 				return false;
1861 1861
 			} else {
1862
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1862
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1863 1863
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1864 1864
 				//$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)";
1865
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1865
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1866 1866
 			}
1867 1867
 		}
1868 1868
 		
@@ -1870,8 +1870,8 @@  discard block
 block discarded – undo
1870 1870
 		{
1871 1871
 			$limit_array = explode(",", $limit);
1872 1872
 			
1873
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1874
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1873
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1874
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1875 1875
 			
1876 1876
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1877 1877
 			{
@@ -1910,15 +1910,15 @@  discard block
 block discarded – undo
1910 1910
 		global $global_query;
1911 1911
 		
1912 1912
 		date_default_timezone_set('UTC');
1913
-		$filter_query = $this->getFilter($filter,true,true);
1913
+		$filter_query = $this->getFilter($filter, true, true);
1914 1914
 		$limit_query = '';
1915 1915
 		
1916 1916
 		if ($limit != "")
1917 1917
 		{
1918 1918
 			$limit_array = explode(",", $limit);
1919 1919
 			
1920
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1921
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1920
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1921
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1922 1922
 			
1923 1923
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1924 1924
 			{
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1936 1936
 		}
1937 1937
 
1938
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1938
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1939 1939
 
1940 1940
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1941 1941
 
@@ -1948,19 +1948,19 @@  discard block
 block discarded – undo
1948 1948
 	* @return String the highlight text
1949 1949
 	*
1950 1950
 	*/
1951
-	public function getHighlightByRegistration($registration,$filter = array())
1951
+	public function getHighlightByRegistration($registration, $filter = array())
1952 1952
 	{
1953 1953
 		global $global_query;
1954 1954
 		
1955 1955
 		date_default_timezone_set('UTC');
1956
-		$filter_query = $this->getFilter($filter,true,true);
1957
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1956
+		$filter_query = $this->getFilter($filter, true, true);
1957
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1958 1958
 		
1959
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1959
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1960 1960
 		$sth = $this->db->prepare($query);
1961 1961
 		$sth->execute(array(':registration' => $registration));
1962 1962
 
1963
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1963
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1964 1964
 		{
1965 1965
 			$highlight = $row['highlight'];
1966 1966
 		}
@@ -1976,14 +1976,14 @@  discard block
 block discarded – undo
1976 1976
 	* @return String usage
1977 1977
 	*
1978 1978
 	*/
1979
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1979
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1980 1980
 	{
1981 1981
 		
1982
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1983
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1982
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1983
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1984 1984
 
1985 1985
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1986
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1986
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1987 1987
 		
1988 1988
 		$sth = $this->db->prepare($query);
1989 1989
 		$sth->execute($query_values);
@@ -2005,9 +2005,9 @@  discard block
 block discarded – undo
2005 2005
 	public function getAirportIcao($airport_iata = '')
2006 2006
 	{
2007 2007
 		
2008
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
2008
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
2009 2009
 
2010
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2010
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2011 2011
 		$query_values = array(':airport' => $airport_iata);
2012 2012
 		
2013 2013
 		$sth = $this->db->prepare($query);
@@ -2029,12 +2029,12 @@  discard block
 block discarded – undo
2029 2029
 	* @return Float distance to the airport
2030 2030
 	*
2031 2031
 	*/
2032
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2032
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2033 2033
 	{
2034 2034
 		
2035
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2035
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2036 2036
 
2037
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2037
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2038 2038
 		$query_values = array(':airport' => $airport_icao);
2039 2039
 		$sth = $this->db->prepare($query);
2040 2040
 		$sth->execute($query_values);
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
 			$airport_latitude = $row['latitude'];
2045 2045
 			$airport_longitude = $row['longitude'];
2046 2046
 			$Common = new Common();
2047
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2047
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2048 2048
 		} else return '';
2049 2049
 	}
2050 2050
 	
@@ -2058,11 +2058,11 @@  discard block
 block discarded – undo
2058 2058
 	public function getAllAirportInfo($airport = '')
2059 2059
 	{
2060 2060
 		
2061
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2061
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2062 2062
 
2063 2063
 		$query_values = array();
2064 2064
 		if ($airport == 'NA') {
2065
-			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' => ''));
2065
+			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' => ''));
2066 2066
 		} elseif ($airport == '') {
2067 2067
 			$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";
2068 2068
 		} else {
@@ -2110,14 +2110,14 @@  discard block
 block discarded – undo
2110 2110
 	{
2111 2111
 		$lst_countries = '';
2112 2112
 		foreach ($countries as $country) {
2113
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2113
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2114 2114
 			if ($lst_countries == '') {
2115 2115
 				$lst_countries = "'".$country."'";
2116 2116
 			} else {
2117 2117
 				$lst_countries .= ",'".$country."'";
2118 2118
 			}
2119 2119
 		}
2120
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2120
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2121 2121
 		
2122 2122
 		$sth = $this->db->prepare($query);
2123 2123
 		$sth->execute();
@@ -2125,7 +2125,7 @@  discard block
 block discarded – undo
2125 2125
 		$airport_array = array();
2126 2126
 		$temp_array = array();
2127 2127
 		
2128
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2128
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2129 2129
 		{
2130 2130
 			$temp_array['name'] = $row['name'];
2131 2131
 			$temp_array['city'] = $row['city'];
@@ -2153,10 +2153,10 @@  discard block
 block discarded – undo
2153 2153
 	{
2154 2154
 		global $globalDBdriver;
2155 2155
 		if (is_array($coord)) {
2156
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2157
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2158
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2159
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2156
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2157
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2158
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2159
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2160 2160
 		} else return array();
2161 2161
 		if ($globalDBdriver == 'mysql') {
2162 2162
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
     
2169 2169
 		$airport_array = array();
2170 2170
 		
2171
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2171
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2172 2172
 		{
2173 2173
 			$temp_array = $row;
2174 2174
 
@@ -2188,13 +2188,13 @@  discard block
 block discarded – undo
2188 2188
 	public function getAllWaypointsInfobyCoord($coord)
2189 2189
 	{
2190 2190
 		if (is_array($coord)) {
2191
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2192
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2193
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2194
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2191
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2192
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2193
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2194
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2195 2195
 		} else return array();
2196 2196
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2197
-		$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.")";
2197
+		$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.")";
2198 2198
 		//$query  = "SELECT waypoints.* FROM waypoints";
2199 2199
 		//$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";
2200 2200
 		//$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;
@@ -2206,7 +2206,7 @@  discard block
 block discarded – undo
2206 2206
     
2207 2207
 		$waypoints_array = array();
2208 2208
 		
2209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2210 2210
 		{
2211 2211
 			$temp_array = $row;
2212 2212
 
@@ -2228,10 +2228,10 @@  discard block
 block discarded – undo
2228 2228
 	{
2229 2229
 		global $globalUseRealAirlines;
2230 2230
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2231
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2231
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2232 2232
 		if ($airline_icao == 'NA') {
2233 2233
 			$airline_array = array();
2234
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2234
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2235 2235
 			return $airline_array;
2236 2236
 		} else {
2237 2237
 			if (strlen($airline_icao) == 2) {
@@ -2252,7 +2252,7 @@  discard block
 block discarded – undo
2252 2252
 			if ($fromsource === NULL) {
2253 2253
 				$sth->execute(array(':airline_icao' => $airline_icao));
2254 2254
 			} else {
2255
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2255
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2256 2256
 			}
2257 2257
                         /*
2258 2258
 			$airline_array = array();
@@ -2297,13 +2297,13 @@  discard block
 block discarded – undo
2297 2297
 	{
2298 2298
 		global $globalUseRealAirlines;
2299 2299
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2300
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2301
-		$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";
2300
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2301
+		$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";
2302 2302
 		$sth = $this->db->prepare($query);
2303 2303
 		if ($fromsource === NULL) {
2304 2304
 			$sth->execute(array(':airline_name' => $airline_name));
2305 2305
 		} else {
2306
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2306
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2307 2307
 		}
2308 2308
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2309 2309
 		if (empty($result) && $fromsource !== NULL) {
@@ -2328,12 +2328,12 @@  discard block
 block discarded – undo
2328 2328
 	*/
2329 2329
 	public function getAllAircraftInfo($aircraft_type)
2330 2330
 	{
2331
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2331
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2332 2332
 
2333 2333
 		if ($aircraft_type == 'NA') {
2334
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2334
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2335 2335
 		}
2336
-		$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";
2336
+		$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";
2337 2337
 		
2338 2338
 		$sth = $this->db->prepare($query);
2339 2339
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
 	*/
2366 2366
 	public function getAircraftIcao($aircraft_type)
2367 2367
 	{
2368
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2368
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2369 2369
 		$all_aircraft = array('737-300' => 'B733',
2370 2370
 				'777-200' => 'B772',
2371 2371
 				'777-200ER' => 'B772',
@@ -2377,10 +2377,10 @@  discard block
 block discarded – undo
2377 2377
 				'A380' => 'A388');
2378 2378
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2379 2379
 
2380
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2380
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2381 2381
 		$aircraft_type = strtoupper($aircraft_type);
2382 2382
 		$sth = $this->db->prepare($query);
2383
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2383
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2384 2384
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2385 2385
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2386 2386
 		else return '';
@@ -2395,9 +2395,9 @@  discard block
 block discarded – undo
2395 2395
 	*/
2396 2396
 	public function getAllAircraftType($aircraft_modes)
2397 2397
 	{
2398
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2398
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2399 2399
 
2400
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2400
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2401 2401
 		
2402 2402
 		$sth = $this->db->prepare($query);
2403 2403
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2420,9 +2420,9 @@  discard block
 block discarded – undo
2420 2420
 	*/
2421 2421
 	public function getAllAircraftTypeByRegistration($registration)
2422 2422
 	{
2423
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2423
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2424 2424
 
2425
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2425
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2426 2426
 		
2427 2427
 		$sth = $this->db->prepare($query);
2428 2428
 		$sth->execute(array(':registration' => $registration));
@@ -2443,9 +2443,9 @@  discard block
 block discarded – undo
2443 2443
 	*/
2444 2444
 	public function getAllIDByRegistration($registration)
2445 2445
 	{
2446
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2446
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2447 2447
 
2448
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2448
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2449 2449
 		
2450 2450
 		$sth = $this->db->prepare($query);
2451 2451
 		$sth->execute(array(':registration' => $registration));
@@ -2453,7 +2453,7 @@  discard block
 block discarded – undo
2453 2453
 		$idarray = array();
2454 2454
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2455 2455
 			$date = $row['date'];
2456
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2456
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2457 2457
 		}
2458 2458
 		return $idarray;
2459 2459
 	}
@@ -2467,8 +2467,8 @@  discard block
 block discarded – undo
2467 2467
 	*/
2468 2468
 	public function getOperator($operator)
2469 2469
 	{
2470
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2471
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2470
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2471
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2472 2472
 		
2473 2473
 		$sth = $this->db->prepare($query);
2474 2474
 		$sth->execute(array(':operator' => $operator));
@@ -2489,9 +2489,9 @@  discard block
 block discarded – undo
2489 2489
 	*/
2490 2490
 	public function getRouteInfo($callsign)
2491 2491
 	{
2492
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2492
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2493 2493
                 if ($callsign == '') return array();
2494
-		$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";
2494
+		$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";
2495 2495
 		
2496 2496
 		$sth = $this->db->prepare($query);
2497 2497
 		$sth->execute(array(':callsign' => $callsign));
@@ -2512,9 +2512,9 @@  discard block
 block discarded – undo
2512 2512
 	*/
2513 2513
 	public function getAircraftInfoByRegistration($registration)
2514 2514
 	{
2515
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2515
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2516 2516
 
2517
-		$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";
2517
+		$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";
2518 2518
 		
2519 2519
 		$sth = $this->db->prepare($query);
2520 2520
 		$sth->execute(array(':registration' => $registration));
@@ -2522,7 +2522,7 @@  discard block
 block discarded – undo
2522 2522
 		$aircraft_array = array();
2523 2523
 		$temp_array = array();
2524 2524
 		
2525
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2525
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2526 2526
 		{
2527 2527
 			$temp_array['airline_icao'] = $row['airline_icao'];
2528 2528
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2544,7 +2544,7 @@  discard block
 block discarded – undo
2544 2544
 	*/
2545 2545
 	public function getAircraftOwnerByRegistration($registration)
2546 2546
 	{
2547
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2547
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2548 2548
 		$Connection = new Connection($this->db);
2549 2549
 		if ($Connection->tableExists('aircraft_owner')) {
2550 2550
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2566,7 +2566,7 @@  discard block
 block discarded – undo
2566 2566
 	public function getAllFlightsforSitemap()
2567 2567
 	{
2568 2568
 		//$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 ";
2569
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2569
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2570 2570
 		
2571 2571
 		$sth = $this->db->prepare($query);
2572 2572
 		$sth->execute();
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
 		$manufacturer_array = array();
2614 2614
 		$temp_array = array();
2615 2615
 		
2616
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2616
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2617 2617
 		{
2618 2618
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2619 2619
 
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
 		$aircraft_array = array();
2651 2651
 		$temp_array = array();
2652 2652
 		
2653
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2653
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2654 2654
 		{
2655 2655
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2656 2656
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2671,8 +2671,8 @@  discard block
 block discarded – undo
2671 2671
 	*/
2672 2672
 	public function getAllAircraftRegistrations($filters = array())
2673 2673
 	{
2674
-		$filter_query = $this->getFilter($filters,true,true);
2675
-		$query  = "SELECT DISTINCT spotter_output.registration 
2674
+		$filter_query = $this->getFilter($filters, true, true);
2675
+		$query = "SELECT DISTINCT spotter_output.registration 
2676 2676
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2677 2677
 				ORDER BY spotter_output.registration ASC";
2678 2678
 
@@ -2682,7 +2682,7 @@  discard block
 block discarded – undo
2682 2682
 		$aircraft_array = array();
2683 2683
 		$temp_array = array();
2684 2684
 		
2685
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2685
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2686 2686
 		{
2687 2687
 			$temp_array['registration'] = $row['registration'];
2688 2688
 
@@ -2699,11 +2699,11 @@  discard block
 block discarded – undo
2699 2699
 	* @return Array list of source name
2700 2700
 	*
2701 2701
 	*/
2702
-	public function getAllSourceName($type = '',$filters = array())
2702
+	public function getAllSourceName($type = '', $filters = array())
2703 2703
 	{
2704
-		$filter_query = $this->getFilter($filters,true,true);
2704
+		$filter_query = $this->getFilter($filters, true, true);
2705 2705
 		$query_values = array();
2706
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2706
+		$query = "SELECT DISTINCT spotter_output.source_name 
2707 2707
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2708 2708
 		if ($type != '') {
2709 2709
 			$query_values = array(':type' => $type);
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
 		$source_array = array();
2719 2719
 		$temp_array = array();
2720 2720
 		
2721
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2721
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2722 2722
 		{
2723 2723
 			$temp_array['source_name'] = $row['source_name'];
2724 2724
 			$source_array[] = $temp_array;
@@ -2734,11 +2734,11 @@  discard block
 block discarded – undo
2734 2734
 	* @return Array list of airline names
2735 2735
 	*
2736 2736
 	*/
2737
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2737
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2738 2738
 	{
2739
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2740
-		$filter_query = $this->getFilter($filters,true,true);
2741
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2739
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2740
+		$filter_query = $this->getFilter($filters, true, true);
2741
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2742 2742
 		if ($airline_type == '' || $airline_type == 'all') {
2743 2743
 			/*
2744 2744
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2757,7 +2757,7 @@  discard block
 block discarded – undo
2757 2757
 				$query_data = array(':forsource' => $forsource);
2758 2758
 			}
2759 2759
 		} else {
2760
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2760
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2761 2761
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2762 2762
 					AND spotter_output.airline_type = :airline_type 
2763 2763
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2770,7 +2770,7 @@  discard block
 block discarded – undo
2770 2770
 		$airline_array = array();
2771 2771
 		$temp_array = array();
2772 2772
 		
2773
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2773
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2774 2774
 		{
2775 2775
 			$temp_array['airline_icao'] = $row['airline_icao'];
2776 2776
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2787,10 +2787,10 @@  discard block
 block discarded – undo
2787 2787
 	* @return Array list of alliance names
2788 2788
 	*
2789 2789
 	*/
2790
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2790
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2791 2791
 	{
2792
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2793
-		$filter_query = $this->getFilter($filters,true,true);
2792
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2793
+		$filter_query = $this->getFilter($filters, true, true);
2794 2794
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2795 2795
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2796 2796
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2818,8 +2818,8 @@  discard block
 block discarded – undo
2818 2818
 	*/
2819 2819
 	public function getAllAirlineCountries($filters = array())
2820 2820
 	{
2821
-		$filter_query = $this->getFilter($filters,true,true);
2822
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2821
+		$filter_query = $this->getFilter($filters, true, true);
2822
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2823 2823
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2824 2824
 				ORDER BY spotter_output.airline_country ASC";
2825 2825
 		
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
 		$airline_array = array();
2831 2831
 		$temp_array = array();
2832 2832
 		
2833
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2833
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2834 2834
 		{
2835 2835
 			$temp_array['airline_country'] = $row['airline_country'];
2836 2836
 
@@ -2850,9 +2850,9 @@  discard block
 block discarded – undo
2850 2850
 	*/
2851 2851
 	public function getAllAirportNames($filters = array())
2852 2852
 	{
2853
-		$filter_query = $this->getFilter($filters,true,true);
2853
+		$filter_query = $this->getFilter($filters, true, true);
2854 2854
 		$airport_array = array();
2855
-		$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
2855
+		$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
2856 2856
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2857 2857
 				ORDER BY spotter_output.departure_airport_city ASC";
2858 2858
 		
@@ -2861,7 +2861,7 @@  discard block
 block discarded – undo
2861 2861
 		$sth->execute();
2862 2862
 
2863 2863
 		$temp_array = array();
2864
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2864
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2865 2865
 		{
2866 2866
 			$temp_array['airport_icao'] = $row['airport_icao'];
2867 2867
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2871,14 +2871,14 @@  discard block
 block discarded – undo
2871 2871
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2872 2872
 		}
2873 2873
 
2874
-		$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
2874
+		$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
2875 2875
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2876 2876
 								ORDER BY spotter_output.arrival_airport_city ASC";
2877 2877
 					
2878 2878
 		$sth = $this->db->prepare($query);
2879 2879
 		$sth->execute();
2880 2880
 
2881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2882 2882
 			{
2883 2883
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2884 2884
 		//	{
@@ -2902,8 +2902,8 @@  discard block
 block discarded – undo
2902 2902
 	*/
2903 2903
 	public function getAllOwnerNames($filters = array())
2904 2904
 	{
2905
-		$filter_query = $this->getFilter($filters,true,true);
2906
-		$query  = "SELECT DISTINCT spotter_output.owner_name
2905
+		$filter_query = $this->getFilter($filters, true, true);
2906
+		$query = "SELECT DISTINCT spotter_output.owner_name
2907 2907
 				FROM spotter_output".$filter_query." spotter_output.owner_name <> '' 
2908 2908
 				ORDER BY spotter_output.owner_name ASC";
2909 2909
 		
@@ -2920,8 +2920,8 @@  discard block
 block discarded – undo
2920 2920
 	*/
2921 2921
 	public function getAllPilotNames($filters = array())
2922 2922
 	{
2923
-		$filter_query = $this->getFilter($filters,true,true);
2924
-		$query  = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2923
+		$filter_query = $this->getFilter($filters, true, true);
2924
+		$query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2925 2925
 				FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' 
2926 2926
 				ORDER BY spotter_output.pilot_name ASC";
2927 2927
 		
@@ -2954,21 +2954,21 @@  discard block
 block discarded – undo
2954 2954
    
2955 2955
 		$temp_array = array();
2956 2956
 		
2957
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2957
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2958 2958
 		{
2959 2959
 			$temp_array['airport_country'] = $row['airport_country'];
2960 2960
 
2961 2961
 			$airport_array[$row['airport_country']] = $temp_array;
2962 2962
 		}
2963
-		$filter_query = $this->getFilter($filters,true,true);
2964
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2963
+		$filter_query = $this->getFilter($filters, true, true);
2964
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2965 2965
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2966 2966
 								ORDER BY spotter_output.arrival_airport_country ASC";
2967 2967
 					
2968 2968
 		$sth = $this->db->prepare($query);
2969 2969
 		$sth->execute();
2970 2970
 		
2971
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2971
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2972 2972
 		{
2973 2973
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2974 2974
 			{
@@ -2991,9 +2991,9 @@  discard block
 block discarded – undo
2991 2991
 	*/
2992 2992
 	public function getAllCountries($filters = array())
2993 2993
 	{
2994
-		$Connection= new Connection($this->db);
2994
+		$Connection = new Connection($this->db);
2995 2995
 		if ($Connection->tableExists('countries')) {
2996
-			$query  = "SELECT countries.name AS airport_country
2996
+			$query = "SELECT countries.name AS airport_country
2997 2997
 				FROM countries
2998 2998
 				ORDER BY countries.name ASC";
2999 2999
 			$sth = $this->db->prepare($query);
@@ -3002,14 +3002,14 @@  discard block
 block discarded – undo
3002 3002
 			$temp_array = array();
3003 3003
 			$country_array = array();
3004 3004
 		
3005
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3005
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3006 3006
 			{
3007 3007
 				$temp_array['country'] = $row['airport_country'];
3008 3008
 				$country_array[$row['airport_country']] = $temp_array;
3009 3009
 			}
3010 3010
 		} else {
3011
-			$filter_query = $this->getFilter($filters,true,true);
3012
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3011
+			$filter_query = $this->getFilter($filters, true, true);
3012
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3013 3013
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
3014 3014
 								ORDER BY spotter_output.departure_airport_country ASC";
3015 3015
 
@@ -3018,20 +3018,20 @@  discard block
 block discarded – undo
3018 3018
    
3019 3019
 			$temp_array = array();
3020 3020
 			$country_array = array();
3021
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3021
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3022 3022
 			{
3023 3023
 				$temp_array['country'] = $row['airport_country'];
3024 3024
 				$country_array[$row['airport_country']] = $temp_array;
3025 3025
 			}
3026 3026
 
3027
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3027
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3028 3028
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
3029 3029
 								ORDER BY spotter_output.arrival_airport_country ASC";
3030 3030
 					
3031 3031
 		$sth = $this->db->prepare($query);
3032 3032
 		$sth->execute();
3033 3033
 		
3034
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3034
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3035 3035
 		{
3036 3036
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
3037 3037
 			{
@@ -3041,14 +3041,14 @@  discard block
 block discarded – undo
3041 3041
 			}
3042 3042
 		}
3043 3043
 		
3044
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3044
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3045 3045
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
3046 3046
 								ORDER BY spotter_output.airline_country ASC";
3047 3047
 					
3048 3048
 		$sth = $this->db->prepare($query);
3049 3049
 		$sth->execute();
3050 3050
 		
3051
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3051
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3052 3052
 		{
3053 3053
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
3054 3054
 			{
@@ -3072,8 +3072,8 @@  discard block
 block discarded – undo
3072 3072
 	*/
3073 3073
 	public function getAllIdents($filters = array())
3074 3074
 	{
3075
-		$filter_query = $this->getFilter($filters,true,true);
3076
-		$query  = "SELECT DISTINCT spotter_output.ident
3075
+		$filter_query = $this->getFilter($filters, true, true);
3076
+		$query = "SELECT DISTINCT spotter_output.ident
3077 3077
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3078 3078
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3079 3079
 
@@ -3083,7 +3083,7 @@  discard block
 block discarded – undo
3083 3083
 		$ident_array = array();
3084 3084
 		$temp_array = array();
3085 3085
 		
3086
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3086
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3087 3087
 		{
3088 3088
 			$temp_array['ident'] = $row['ident'];
3089 3089
 			$ident_array[] = $temp_array;
@@ -3097,9 +3097,9 @@  discard block
 block discarded – undo
3097 3097
 	* @return Array number, icao, name and city of airports
3098 3098
 	*/
3099 3099
 
3100
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3100
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3101 3101
 		global $globalTimezone, $globalDBdriver;
3102
-		$filter_query = $this->getFilter($filters,true,true);
3102
+		$filter_query = $this->getFilter($filters, true, true);
3103 3103
 		if ($globalTimezone != '') {
3104 3104
 			date_default_timezone_set($globalTimezone);
3105 3105
 			$datetime = new DateTime();
@@ -3164,7 +3164,7 @@  discard block
 block discarded – undo
3164 3164
 
3165 3165
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3166 3166
 		global $globalTimezone, $globalDBdriver;
3167
-		$filter_query = $this->getFilter($filters,true,true);
3167
+		$filter_query = $this->getFilter($filters, true, true);
3168 3168
 		if ($globalTimezone != '') {
3169 3169
 			date_default_timezone_set($globalTimezone);
3170 3170
 			$datetime = new DateTime();
@@ -3248,7 +3248,7 @@  discard block
 block discarded – undo
3248 3248
 
3249 3249
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3250 3250
 		global $globalTimezone, $globalDBdriver;
3251
-		$filter_query = $this->getFilter($filters,true,true);
3251
+		$filter_query = $this->getFilter($filters, true, true);
3252 3252
 		if ($globalTimezone != '') {
3253 3253
 			date_default_timezone_set($globalTimezone);
3254 3254
 			$datetime = new DateTime();
@@ -3281,9 +3281,9 @@  discard block
 block discarded – undo
3281 3281
 	* @return Array number, icao, name and city of airports
3282 3282
 	*/
3283 3283
 
3284
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3284
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3285 3285
 		global $globalTimezone, $globalDBdriver;
3286
-		$filter_query = $this->getFilter($filters,true,true);
3286
+		$filter_query = $this->getFilter($filters, true, true);
3287 3287
 		if ($globalTimezone != '') {
3288 3288
 			date_default_timezone_set($globalTimezone);
3289 3289
 			$datetime = new DateTime();
@@ -3415,12 +3415,12 @@  discard block
 block discarded – undo
3415 3415
 		} else $offset = '+00:00';
3416 3416
 
3417 3417
 		if ($globalDBdriver == 'mysql') {
3418
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3418
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3419 3419
 								FROM spotter_output
3420 3420
 								WHERE spotter_output.date <> '' 
3421 3421
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3422 3422
 		} else {
3423
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3423
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3424 3424
 								FROM spotter_output
3425 3425
 								WHERE spotter_output.date <> '' 
3426 3426
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3432,7 +3432,7 @@  discard block
 block discarded – undo
3432 3432
 		$date_array = array();
3433 3433
 		$temp_array = array();
3434 3434
 		
3435
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3435
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3436 3436
 		{
3437 3437
 			$temp_array['date'] = $row['date'];
3438 3438
 
@@ -3452,7 +3452,7 @@  discard block
 block discarded – undo
3452 3452
 	*/
3453 3453
 	public function getAllRoutes()
3454 3454
 	{
3455
-		$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 
3455
+		$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 
3456 3456
 				FROM spotter_output
3457 3457
 				WHERE spotter_output.ident <> '' 
3458 3458
 				GROUP BY route
@@ -3463,7 +3463,7 @@  discard block
 block discarded – undo
3463 3463
 
3464 3464
 		$routes_array = array();
3465 3465
 		$temp_array = array();
3466
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3466
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3467 3467
 		{
3468 3468
 			$temp_array['route'] = $row['route'];
3469 3469
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3482,21 +3482,21 @@  discard block
 block discarded – undo
3482 3482
 	* @return String success or false
3483 3483
 	*
3484 3484
 	*/	
3485
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3485
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3486 3486
 	{
3487 3487
 		if (!is_numeric(substr($ident, 0, 3)))
3488 3488
 		{
3489 3489
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3490
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3490
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3491 3491
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3492
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3492
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3493 3493
 			} else {
3494 3494
 				$airline_array = $this->getAllAirlineInfo("NA");
3495 3495
 			}
3496 3496
 			if (count($airline_array) == 0) {
3497 3497
 				$airline_array = $this->getAllAirlineInfo("NA");
3498 3498
 			}
3499
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3499
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3500 3500
 				$airline_array = $this->getAllAirlineInfo("NA");
3501 3501
 			}
3502 3502
 		} else {
@@ -3509,7 +3509,7 @@  discard block
 block discarded – undo
3509 3509
 
3510 3510
 
3511 3511
 		$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';
3512
-                $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);
3512
+                $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);
3513 3513
 
3514 3514
 		try {
3515 3515
 			$sth = $this->db->prepare($query);
@@ -3530,11 +3530,11 @@  discard block
 block discarded – undo
3530 3530
 	* @return String success or false
3531 3531
 	*
3532 3532
 	*/	
3533
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3533
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3534 3534
 	{
3535 3535
 		if ($groundspeed == '') $groundspeed = NULL;
3536 3536
 		$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';
3537
-                $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);
3537
+                $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);
3538 3538
 
3539 3539
 		try {
3540 3540
 			$sth = $this->db->prepare($query);
@@ -3574,7 +3574,7 @@  discard block
 block discarded – undo
3574 3574
 	* @param String $verticalrate vertival rate of flight
3575 3575
 	* @return String success or false
3576 3576
 	*/
3577
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3577
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '')
3578 3578
 	{
3579 3579
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3580 3580
 		
@@ -3598,13 +3598,13 @@  discard block
 block discarded – undo
3598 3598
 				if ($ModeS != '') {
3599 3599
 					$timeelapsed = microtime(true);
3600 3600
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3601
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3601
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3602 3602
 				} else {
3603
-					$myhex = explode('-',$flightaware_id);
3603
+					$myhex = explode('-', $flightaware_id);
3604 3604
 					if (count($myhex) > 0) {
3605 3605
 						$timeelapsed = microtime(true);
3606 3606
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3607
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3607
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3608 3608
 					}
3609 3609
 				}
3610 3610
 			}
@@ -3626,24 +3626,24 @@  discard block
 block discarded – undo
3626 3626
 				{
3627 3627
 					$timeelapsed = microtime(true);
3628 3628
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3629
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3629
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3630 3630
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3631
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3631
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3632 3632
 					} else {
3633 3633
 						$airline_array = $this->getAllAirlineInfo("NA");
3634 3634
 					}
3635 3635
 					if (count($airline_array) == 0) {
3636 3636
 						$airline_array = $this->getAllAirlineInfo("NA");
3637 3637
 					}
3638
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3638
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3639 3639
 						$airline_array = $this->getAllAirlineInfo("NA");
3640 3640
 					}
3641
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3641
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3642 3642
 
3643 3643
 				} else {
3644 3644
 					$timeelapsed = microtime(true);
3645 3645
 					$airline_array = $this->getAllAirlineInfo("NA");
3646
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3646
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3647 3647
 				}
3648 3648
 			}
3649 3649
 		} else $airline_array = array();
@@ -3660,27 +3660,27 @@  discard block
 block discarded – undo
3660 3660
 				{
3661 3661
 					$timeelapsed = microtime(true);
3662 3662
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3663
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3663
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3664 3664
 				} else {
3665 3665
 					$timeelapsed = microtime(true);
3666 3666
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3667
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3667
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3668 3668
 				}
3669 3669
 			}
3670 3670
 		} else {
3671 3671
 			if ($ModeS != '') {
3672 3672
 				$timeelapsed = microtime(true);
3673 3673
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3674
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3674
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3675 3675
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3676 3676
 				{
3677 3677
 					$timeelapsed = microtime(true);
3678 3678
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3679
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3679
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3680 3680
 				} else {
3681 3681
 					$timeelapsed = microtime(true);
3682 3682
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3683
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3683
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3684 3684
 				}
3685 3685
 			}
3686 3686
 		}
@@ -3696,7 +3696,7 @@  discard block
 block discarded – undo
3696 3696
 			} else {
3697 3697
 				$timeelapsed = microtime(true);
3698 3698
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3699
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3699
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3700 3700
 			}
3701 3701
 		}
3702 3702
 		
@@ -3711,7 +3711,7 @@  discard block
 block discarded – undo
3711 3711
 			} else {
3712 3712
 				$timeelapsed = microtime(true);
3713 3713
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3714
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3714
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3715 3715
 			}
3716 3716
 		}
3717 3717
 
@@ -3764,7 +3764,7 @@  discard block
 block discarded – undo
3764 3764
 		}
3765 3765
 
3766 3766
     
3767
-		if ($date == "" || strtotime($date) < time()-20*60)
3767
+		if ($date == "" || strtotime($date) < time() - 20*60)
3768 3768
 		{
3769 3769
 			$date = date("Y-m-d H:i:s", time());
3770 3770
 		}
@@ -3774,7 +3774,7 @@  discard block
 block discarded – undo
3774 3774
 		{
3775 3775
 			$timeelapsed = microtime(true);
3776 3776
 			$image_array = $Image->getSpotterImage($registration);
3777
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3777
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3778 3778
 			if (!isset($image_array[0]['registration']))
3779 3779
 			{
3780 3780
 				//echo "Add image !!!! \n";
@@ -3782,7 +3782,7 @@  discard block
 block discarded – undo
3782 3782
 			}
3783 3783
 			$timeelapsed = microtime(true);
3784 3784
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3785
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3785
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3786 3786
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3787 3787
 		}
3788 3788
     
@@ -3790,33 +3790,33 @@  discard block
 block discarded – undo
3790 3790
 		{
3791 3791
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792 3792
             		else $airline_icao = '';
3793
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3793
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3794 3794
 			if (!isset($image_array[0]['registration']))
3795 3795
 			{
3796 3796
 				//echo "Add image !!!! \n";
3797
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3797
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3798 3798
 			}
3799 3799
 		}
3800 3800
     
3801
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3802
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3803
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3804
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3805
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3806
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3807
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3808
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3809
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3810
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3811
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3812
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3813
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3814
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3815
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3816
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3817
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3818
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3819
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3801
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3802
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3803
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3804
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3805
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3806
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3807
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3808
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3809
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3810
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3811
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3812
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3813
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3814
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3815
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3816
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3817
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3818
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3819
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3820 3820
 	
3821 3821
 		if (count($airline_array) == 0) 
3822 3822
 		{
@@ -3844,7 +3844,7 @@  discard block
 block discarded – undo
3844 3844
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845 3845
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846 3846
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3847
-                $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) 
3847
+                $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) 
3848 3848
                 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)";
3849 3849
 
3850 3850
                 $airline_name = $airline_array[0]['name'];
@@ -3854,7 +3854,7 @@  discard block
 block discarded – undo
3854 3854
 		if ($airline_type == '') {
3855 3855
 			$timeelapsed = microtime(true);
3856 3856
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3857
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3857
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3858 3858
 		}
3859 3859
 		if ($airline_type == null) $airline_type = '';
3860 3860
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3866,7 +3866,7 @@  discard block
 block discarded – undo
3866 3866
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3867 3867
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3868 3868
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3869
-                $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);
3869
+                $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);
3870 3870
 
3871 3871
 		try {
3872 3872
 		        
@@ -3892,13 +3892,13 @@  discard block
 block discarded – undo
3892 3892
 	{
3893 3893
 		global $globalDBdriver, $globalTimezone;
3894 3894
 		if ($globalDBdriver == 'mysql') {
3895
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3895
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3896 3896
 								WHERE spotter_output.ident = :ident 
3897 3897
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3898 3898
 								AND spotter_output.date < UTC_TIMESTAMP()";
3899 3899
 			$query_data = array(':ident' => $ident);
3900 3900
 		} else {
3901
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3901
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3902 3902
 								WHERE spotter_output.ident = :ident 
3903 3903
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3904 3904
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3907,8 +3907,8 @@  discard block
 block discarded – undo
3907 3907
 		
3908 3908
 		$sth = $this->db->prepare($query);
3909 3909
 		$sth->execute($query_data);
3910
-    		$ident_result='';
3911
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3910
+    		$ident_result = '';
3911
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3912 3912
 		{
3913 3913
 			$ident_result = $row['ident'];
3914 3914
 		}
@@ -3934,8 +3934,8 @@  discard block
 block discarded – undo
3934 3934
 				return false;
3935 3935
 			} else {
3936 3936
 				$q_array = explode(" ", $q);
3937
-				foreach ($q_array as $q_item){
3938
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3937
+				foreach ($q_array as $q_item) {
3938
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3939 3939
 					$additional_query .= " AND (";
3940 3940
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3941 3941
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3950,11 +3950,11 @@  discard block
 block discarded – undo
3950 3950
 			}
3951 3951
 		}
3952 3952
 		if ($globalDBdriver == 'mysql') {
3953
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3953
+			$query = "SELECT spotter_output.* FROM spotter_output 
3954 3954
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3955 3955
 				AND spotter_output.date < UTC_TIMESTAMP()";
3956 3956
 		} else {
3957
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3957
+			$query = "SELECT spotter_output.* FROM spotter_output 
3958 3958
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3959 3959
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3960 3960
 		}
@@ -3971,11 +3971,11 @@  discard block
 block discarded – undo
3971 3971
 	* @return Array the airline list
3972 3972
 	*
3973 3973
 	*/
3974
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3974
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3975 3975
 	{
3976 3976
 		global $globalDBdriver;
3977
-		$filter_query = $this->getFilter($filters,true,true);
3978
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3977
+		$filter_query = $this->getFilter($filters, true, true);
3978
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3979 3979
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
3980 3980
 		if ($olderthanmonths > 0) {
3981 3981
 			if ($globalDBdriver == 'mysql') {
@@ -3995,28 +3995,28 @@  discard block
 block discarded – undo
3995 3995
 		if ($year != '') {
3996 3996
 			if ($globalDBdriver == 'mysql') {
3997 3997
 				$query .= " AND YEAR(spotter_output.date) = :year";
3998
-				$query_values = array_merge($query_values,array(':year' => $year));
3998
+				$query_values = array_merge($query_values, array(':year' => $year));
3999 3999
 			} else {
4000 4000
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4001
-				$query_values = array_merge($query_values,array(':year' => $year));
4001
+				$query_values = array_merge($query_values, array(':year' => $year));
4002 4002
 			}
4003 4003
 		}
4004 4004
 		if ($month != '') {
4005 4005
 			if ($globalDBdriver == 'mysql') {
4006 4006
 				$query .= " AND MONTH(spotter_output.date) = :month";
4007
-				$query_values = array_merge($query_values,array(':month' => $month));
4007
+				$query_values = array_merge($query_values, array(':month' => $month));
4008 4008
 			} else {
4009 4009
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4010
-				$query_values = array_merge($query_values,array(':month' => $month));
4010
+				$query_values = array_merge($query_values, array(':month' => $month));
4011 4011
 			}
4012 4012
 		}
4013 4013
 		if ($day != '') {
4014 4014
 			if ($globalDBdriver == 'mysql') {
4015 4015
 				$query .= " AND DAY(spotter_output.date) = :day";
4016
-				$query_values = array_merge($query_values,array(':day' => $day));
4016
+				$query_values = array_merge($query_values, array(':day' => $day));
4017 4017
 			} else {
4018 4018
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4019
-				$query_values = array_merge($query_values,array(':day' => $day));
4019
+				$query_values = array_merge($query_values, array(':day' => $day));
4020 4020
 			}
4021 4021
 		}
4022 4022
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -4026,7 +4026,7 @@  discard block
 block discarded – undo
4026 4026
 		$sth->execute($query_values);
4027 4027
 		$airline_array = array();
4028 4028
 		$temp_array = array();
4029
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4029
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4030 4030
 		{
4031 4031
 			$temp_array['airline_name'] = $row['airline_name'];
4032 4032
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4043,11 +4043,11 @@  discard block
 block discarded – undo
4043 4043
 	* @return Array the pilots list
4044 4044
 	*
4045 4045
 	*/
4046
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4046
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4047 4047
 	{
4048 4048
 		global $globalDBdriver;
4049
-		$filter_query = $this->getFilter($filters,true,true);
4050
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4049
+		$filter_query = $this->getFilter($filters, true, true);
4050
+		$query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4051 4051
 			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 <> ''";
4052 4052
                 if ($olderthanmonths > 0) {
4053 4053
             		if ($globalDBdriver == 'mysql') {
@@ -4067,28 +4067,28 @@  discard block
 block discarded – undo
4067 4067
 		if ($year != '') {
4068 4068
 			if ($globalDBdriver == 'mysql') {
4069 4069
 				$query .= " AND YEAR(spotter_output.date) = :year";
4070
-				$query_values = array_merge($query_values,array(':year' => $year));
4070
+				$query_values = array_merge($query_values, array(':year' => $year));
4071 4071
 			} else {
4072 4072
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4073
-				$query_values = array_merge($query_values,array(':year' => $year));
4073
+				$query_values = array_merge($query_values, array(':year' => $year));
4074 4074
 			}
4075 4075
 		}
4076 4076
 		if ($month != '') {
4077 4077
 			if ($globalDBdriver == 'mysql') {
4078 4078
 				$query .= " AND MONTH(spotter_output.date) = :month";
4079
-				$query_values = array_merge($query_values,array(':month' => $month));
4079
+				$query_values = array_merge($query_values, array(':month' => $month));
4080 4080
 			} else {
4081 4081
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4082
-				$query_values = array_merge($query_values,array(':month' => $month));
4082
+				$query_values = array_merge($query_values, array(':month' => $month));
4083 4083
 			}
4084 4084
 		}
4085 4085
 		if ($day != '') {
4086 4086
 			if ($globalDBdriver == 'mysql') {
4087 4087
 				$query .= " AND DAY(spotter_output.date) = :day";
4088
-				$query_values = array_merge($query_values,array(':day' => $day));
4088
+				$query_values = array_merge($query_values, array(':day' => $day));
4089 4089
 			} else {
4090 4090
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4091
-				$query_values = array_merge($query_values,array(':day' => $day));
4091
+				$query_values = array_merge($query_values, array(':day' => $day));
4092 4092
 			}
4093 4093
 		}
4094 4094
 		
@@ -4100,7 +4100,7 @@  discard block
 block discarded – undo
4100 4100
 		$sth->execute($query_values);
4101 4101
 		$airline_array = array();
4102 4102
 		$temp_array = array();
4103
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4103
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4104 4104
 		{
4105 4105
 			$temp_array['pilot_name'] = $row['pilot_name'];
4106 4106
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4120,7 +4120,7 @@  discard block
 block discarded – undo
4120 4120
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4121 4121
 	{
4122 4122
 		global $globalDBdriver;
4123
-		$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
4123
+		$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
4124 4124
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4125 4125
                 if ($olderthanmonths > 0) {
4126 4126
             		if ($globalDBdriver == 'mysql') {
@@ -4146,7 +4146,7 @@  discard block
 block discarded – undo
4146 4146
 		$airline_array = array();
4147 4147
 		$temp_array = array();
4148 4148
         
4149
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4149
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4150 4150
 		{
4151 4151
 			$temp_array['pilot_name'] = $row['pilot_name'];
4152 4152
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4164,11 +4164,11 @@  discard block
 block discarded – undo
4164 4164
 	* @return Array the pilots list
4165 4165
 	*
4166 4166
 	*/
4167
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4167
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4168 4168
 	{
4169 4169
 		global $globalDBdriver;
4170
-		$filter_query = $this->getFilter($filters,true,true);
4171
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4170
+		$filter_query = $this->getFilter($filters, true, true);
4171
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4172 4172
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4173 4173
                 if ($olderthanmonths > 0) {
4174 4174
             		if ($globalDBdriver == 'mysql') {
@@ -4188,28 +4188,28 @@  discard block
 block discarded – undo
4188 4188
 		if ($year != '') {
4189 4189
 			if ($globalDBdriver == 'mysql') {
4190 4190
 				$query .= " AND YEAR(spotter_output.date) = :year";
4191
-				$query_values = array_merge($query_values,array(':year' => $year));
4191
+				$query_values = array_merge($query_values, array(':year' => $year));
4192 4192
 			} else {
4193 4193
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4194
-				$query_values = array_merge($query_values,array(':year' => $year));
4194
+				$query_values = array_merge($query_values, array(':year' => $year));
4195 4195
 			}
4196 4196
 		}
4197 4197
 		if ($month != '') {
4198 4198
 			if ($globalDBdriver == 'mysql') {
4199 4199
 				$query .= " AND MONTH(spotter_output.date) = :month";
4200
-				$query_values = array_merge($query_values,array(':month' => $month));
4200
+				$query_values = array_merge($query_values, array(':month' => $month));
4201 4201
 			} else {
4202 4202
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4203
-				$query_values = array_merge($query_values,array(':month' => $month));
4203
+				$query_values = array_merge($query_values, array(':month' => $month));
4204 4204
 			}
4205 4205
 		}
4206 4206
 		if ($day != '') {
4207 4207
 			if ($globalDBdriver == 'mysql') {
4208 4208
 				$query .= " AND DAY(spotter_output.date) = :day";
4209
-				$query_values = array_merge($query_values,array(':day' => $day));
4209
+				$query_values = array_merge($query_values, array(':day' => $day));
4210 4210
 			} else {
4211 4211
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4212
-				$query_values = array_merge($query_values,array(':day' => $day));
4212
+				$query_values = array_merge($query_values, array(':day' => $day));
4213 4213
 			}
4214 4214
 		}
4215 4215
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4219,7 +4219,7 @@  discard block
 block discarded – undo
4219 4219
 		$sth->execute($query_values);
4220 4220
 		$airline_array = array();
4221 4221
 		$temp_array = array();
4222
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4222
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4223 4223
 		{
4224 4224
 			$temp_array['owner_name'] = $row['owner_name'];
4225 4225
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4234,11 +4234,11 @@  discard block
 block discarded – undo
4234 4234
 	* @return Array the pilots list
4235 4235
 	*
4236 4236
 	*/
4237
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4237
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4238 4238
 	{
4239 4239
 		global $globalDBdriver;
4240
-		$filter_query = $this->getFilter($filters,true,true);
4241
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4240
+		$filter_query = $this->getFilter($filters, true, true);
4241
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4242 4242
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4243 4243
                 if ($olderthanmonths > 0) {
4244 4244
             		if ($globalDBdriver == 'mysql') {
@@ -4264,7 +4264,7 @@  discard block
 block discarded – undo
4264 4264
 		$airline_array = array();
4265 4265
 		$temp_array = array();
4266 4266
         
4267
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4267
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4268 4268
 		{
4269 4269
 			$temp_array['owner_name'] = $row['owner_name'];
4270 4270
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4280,11 +4280,11 @@  discard block
 block discarded – undo
4280 4280
 	* @return Array the airline list
4281 4281
 	*
4282 4282
 	*/
4283
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4283
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4284 4284
 	{
4285
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4286
-		$filter_query = $this->getFilter($filters,true,true);
4287
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4285
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4286
+		$filter_query = $this->getFilter($filters, true, true);
4287
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4288 4288
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4289 4289
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4290 4290
 			    ORDER BY airline_count DESC";
@@ -4296,7 +4296,7 @@  discard block
 block discarded – undo
4296 4296
 		$airline_array = array();
4297 4297
 		$temp_array = array();
4298 4298
         
4299
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4299
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4300 4300
 		{
4301 4301
 			$temp_array['airline_name'] = $row['airline_name'];
4302 4302
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4316,11 +4316,11 @@  discard block
 block discarded – undo
4316 4316
 	* @return Array the airline country list
4317 4317
 	*
4318 4318
 	*/
4319
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4319
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4320 4320
 	{
4321
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4322
-		$filter_query = $this->getFilter($filters,true,true);
4323
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4321
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4322
+		$filter_query = $this->getFilter($filters, true, true);
4323
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4324 4324
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4325 4325
                     GROUP BY spotter_output.airline_country
4326 4326
 					ORDER BY airline_country_count DESC
@@ -4333,7 +4333,7 @@  discard block
 block discarded – undo
4333 4333
 		$airline_country_array = array();
4334 4334
 		$temp_array = array();
4335 4335
         
4336
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4336
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4337 4337
 		{
4338 4338
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4339 4339
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4352,11 +4352,11 @@  discard block
 block discarded – undo
4352 4352
 	* @return Array the airline list
4353 4353
 	*
4354 4354
 	*/
4355
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4355
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4356 4356
 	{
4357
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4358
-		$filter_query = $this->getFilter($filters,true,true);
4359
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4357
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4358
+		$filter_query = $this->getFilter($filters, true, true);
4359
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4360 4360
 		    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 ) 
4361 4361
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4362 4362
 		    ORDER BY airline_count DESC";
@@ -4368,7 +4368,7 @@  discard block
 block discarded – undo
4368 4368
 		$airline_array = array();
4369 4369
 		$temp_array = array();
4370 4370
         
4371
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4371
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4372 4372
 		{
4373 4373
 			$temp_array['airline_name'] = $row['airline_name'];
4374 4374
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4387,11 +4387,11 @@  discard block
 block discarded – undo
4387 4387
 	* @return Array the airline country list
4388 4388
 	*
4389 4389
 	*/
4390
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4390
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4391 4391
 	{
4392
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4393
-		$filter_query = $this->getFilter($filters,true,true);
4394
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4392
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4393
+		$filter_query = $this->getFilter($filters, true, true);
4394
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4395 4395
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
4396 4396
 					GROUP BY spotter_output.airline_country
4397 4397
 					ORDER BY airline_country_count DESC
@@ -4404,7 +4404,7 @@  discard block
 block discarded – undo
4404 4404
 		$airline_country_array = array();
4405 4405
 		$temp_array = array();
4406 4406
         
4407
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4407
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4408 4408
 		{
4409 4409
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4410 4410
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4421,11 +4421,11 @@  discard block
 block discarded – undo
4421 4421
 	* @return Array the airline list
4422 4422
 	*
4423 4423
 	*/
4424
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4424
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4425 4425
 	{
4426
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4427
-		$filter_query = $this->getFilter($filters,true,true);
4428
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4426
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4427
+		$filter_query = $this->getFilter($filters, true, true);
4428
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4429 4429
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4430 4430
 					GROUP BY spotter_output.airline_name
4431 4431
 					ORDER BY airline_count DESC";
@@ -4436,7 +4436,7 @@  discard block
 block discarded – undo
4436 4436
 		$airline_array = array();
4437 4437
 		$temp_array = array();
4438 4438
         
4439
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4439
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4440 4440
 		{
4441 4441
 			$temp_array['airline_name'] = $row['airline_name'];
4442 4442
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4456,11 +4456,11 @@  discard block
 block discarded – undo
4456 4456
 	* @return Array the airline country list
4457 4457
 	*
4458 4458
 	*/
4459
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4459
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4460 4460
 	{
4461
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4462
-		$filter_query = $this->getFilter($filters,true,true);
4463
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4461
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4462
+		$filter_query = $this->getFilter($filters, true, true);
4463
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4464 4464
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4465 4465
 					GROUP BY spotter_output.airline_country
4466 4466
 					ORDER BY airline_country_count DESC
@@ -4473,7 +4473,7 @@  discard block
 block discarded – undo
4473 4473
 		$airline_country_array = array();
4474 4474
 		$temp_array = array();
4475 4475
         
4476
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4476
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4477 4477
 		{
4478 4478
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4479 4479
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4489,11 +4489,11 @@  discard block
 block discarded – undo
4489 4489
 	* @return Array the airline list
4490 4490
 	*
4491 4491
 	*/
4492
-	public function countAllAirlinesByDate($date,$filters = array())
4492
+	public function countAllAirlinesByDate($date, $filters = array())
4493 4493
 	{
4494 4494
 		global $globalTimezone, $globalDBdriver;
4495
-		$filter_query = $this->getFilter($filters,true,true);
4496
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4495
+		$filter_query = $this->getFilter($filters, true, true);
4496
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4497 4497
 		if ($globalTimezone != '') {
4498 4498
 			date_default_timezone_set($globalTimezone);
4499 4499
 			$datetime = new DateTime($date);
@@ -4501,12 +4501,12 @@  discard block
 block discarded – undo
4501 4501
 		} else $offset = '+00:00';
4502 4502
 
4503 4503
 		if ($globalDBdriver == 'mysql') {
4504
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4504
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4505 4505
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4506 4506
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4507 4507
 					ORDER BY airline_count DESC";
4508 4508
 		} else {
4509
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4509
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4510 4510
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4511 4511
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4512 4512
 					ORDER BY airline_count DESC";
@@ -4517,7 +4517,7 @@  discard block
 block discarded – undo
4517 4517
 
4518 4518
 		$airline_array = array();
4519 4519
 		$temp_array = array();
4520
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4520
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4521 4521
 		{
4522 4522
 			$temp_array['airline_name'] = $row['airline_name'];
4523 4523
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4537,11 +4537,11 @@  discard block
 block discarded – undo
4537 4537
 	* @return Array the airline country list
4538 4538
 	*
4539 4539
 	*/
4540
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4540
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4541 4541
 	{
4542 4542
 		global $globalTimezone, $globalDBdriver;
4543
-		$filter_query = $this->getFilter($filters,true,true);
4544
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4543
+		$filter_query = $this->getFilter($filters, true, true);
4544
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4545 4545
 		if ($globalTimezone != '') {
4546 4546
 			date_default_timezone_set($globalTimezone);
4547 4547
 			$datetime = new DateTime($date);
@@ -4549,13 +4549,13 @@  discard block
 block discarded – undo
4549 4549
 		} else $offset = '+00:00';
4550 4550
 		
4551 4551
 		if ($globalDBdriver == 'mysql') {
4552
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4552
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4553 4553
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4554 4554
 					GROUP BY spotter_output.airline_country
4555 4555
 					ORDER BY airline_country_count DESC
4556 4556
 					LIMIT 10 OFFSET 0";
4557 4557
 		} else {
4558
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4558
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4559 4559
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4560 4560
 					GROUP BY spotter_output.airline_country
4561 4561
 					ORDER BY airline_country_count DESC
@@ -4567,7 +4567,7 @@  discard block
 block discarded – undo
4567 4567
  
4568 4568
 		$airline_country_array = array();
4569 4569
 		$temp_array = array();
4570
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4570
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4571 4571
 		{
4572 4572
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4573 4573
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4584,11 +4584,11 @@  discard block
 block discarded – undo
4584 4584
 	* @return Array the airline list
4585 4585
 	*
4586 4586
 	*/
4587
-	public function countAllAirlinesByIdent($ident,$filters = array())
4587
+	public function countAllAirlinesByIdent($ident, $filters = array())
4588 4588
 	{
4589
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4590
-		$filter_query = $this->getFilter($filters,true,true);
4591
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4589
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4590
+		$filter_query = $this->getFilter($filters, true, true);
4591
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4592 4592
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4593 4593
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4594 4594
 				ORDER BY airline_count DESC";
@@ -4605,11 +4605,11 @@  discard block
 block discarded – undo
4605 4605
 	* @return Array the airline list
4606 4606
 	*
4607 4607
 	*/
4608
-	public function countAllAirlinesByOwner($owner,$filters = array())
4608
+	public function countAllAirlinesByOwner($owner, $filters = array())
4609 4609
 	{
4610
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4611
-		$filter_query = $this->getFilter($filters,true,true);
4612
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4610
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4611
+		$filter_query = $this->getFilter($filters, true, true);
4612
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4613 4613
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4614 4614
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4615 4615
 				ORDER BY airline_count DESC";
@@ -4626,46 +4626,46 @@  discard block
 block discarded – undo
4626 4626
 	* @return String Duration of all flights
4627 4627
 	*
4628 4628
 	*/
4629
-	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4629
+	public function getFlightDurationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
4630 4630
 	{
4631 4631
 		global $globalDBdriver;
4632
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4633
-		$filter_query = $this->getFilter($filters,true,true);
4634
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4632
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4633
+		$filter_query = $this->getFilter($filters, true, true);
4634
+		$query = "SELECT SUM(last_seen - date) AS duration 
4635 4635
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
4636 4636
 		$query_values = array();
4637 4637
 		if ($year != '') {
4638 4638
 			if ($globalDBdriver == 'mysql') {
4639 4639
 				$query .= " AND YEAR(spotter_output.date) = :year";
4640
-				$query_values = array_merge($query_values,array(':year' => $year));
4640
+				$query_values = array_merge($query_values, array(':year' => $year));
4641 4641
 			} else {
4642 4642
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4643
-				$query_values = array_merge($query_values,array(':year' => $year));
4643
+				$query_values = array_merge($query_values, array(':year' => $year));
4644 4644
 			}
4645 4645
 		}
4646 4646
 		if ($month != '') {
4647 4647
 			if ($globalDBdriver == 'mysql') {
4648 4648
 				$query .= " AND MONTH(spotter_output.date) = :month";
4649
-				$query_values = array_merge($query_values,array(':month' => $month));
4649
+				$query_values = array_merge($query_values, array(':month' => $month));
4650 4650
 			} else {
4651 4651
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4652
-				$query_values = array_merge($query_values,array(':month' => $month));
4652
+				$query_values = array_merge($query_values, array(':month' => $month));
4653 4653
 			}
4654 4654
 		}
4655 4655
 		if ($day != '') {
4656 4656
 			if ($globalDBdriver == 'mysql') {
4657 4657
 				$query .= " AND DAY(spotter_output.date) = :day";
4658
-				$query_values = array_merge($query_values,array(':day' => $day));
4658
+				$query_values = array_merge($query_values, array(':day' => $day));
4659 4659
 			} else {
4660 4660
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4661
-				$query_values = array_merge($query_values,array(':day' => $day));
4661
+				$query_values = array_merge($query_values, array(':day' => $day));
4662 4662
 			}
4663 4663
 		}
4664
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4664
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4665 4665
 		$sth = $this->db->prepare($query);
4666 4666
 		$sth->execute($query_values);
4667 4667
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4668
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4668
+		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4669 4669
 		else return $result[0]['duration'];
4670 4670
 	}
4671 4671
 
@@ -4675,14 +4675,14 @@  discard block
 block discarded – undo
4675 4675
 	* @return String Duration of all flights
4676 4676
 	*
4677 4677
 	*/
4678
-	public function countFlightsByOwner($owner,$filters = array())
4678
+	public function countFlightsByOwner($owner, $filters = array())
4679 4679
 	{
4680
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4681
-		$filter_query = $this->getFilter($filters,true,true);
4682
-		$query  = "SELECT COUNT(*) AS nb 
4680
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4681
+		$filter_query = $this->getFilter($filters, true, true);
4682
+		$query = "SELECT COUNT(*) AS nb 
4683 4683
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
4684 4684
 		$query_values = array();
4685
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4685
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4686 4686
 		$sth = $this->db->prepare($query);
4687 4687
 		$sth->execute($query_values);
4688 4688
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4695,14 +4695,14 @@  discard block
 block discarded – undo
4695 4695
 	* @return String Duration of all flights
4696 4696
 	*
4697 4697
 	*/
4698
-	public function countFlightsByPilot($pilot,$filters = array())
4698
+	public function countFlightsByPilot($pilot, $filters = array())
4699 4699
 	{
4700
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4701
-		$filter_query = $this->getFilter($filters,true,true);
4702
-		$query  = "SELECT COUNT(*) AS nb 
4700
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4701
+		$filter_query = $this->getFilter($filters, true, true);
4702
+		$query = "SELECT COUNT(*) AS nb 
4703 4703
 				FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilod_id = :pilot)";
4704 4704
 		$query_values = array();
4705
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4705
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4706 4706
 		$sth = $this->db->prepare($query);
4707 4707
 		$sth->execute($query_values);
4708 4708
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4715,46 +4715,46 @@  discard block
 block discarded – undo
4715 4715
 	* @return String Duration of all flights
4716 4716
 	*
4717 4717
 	*/
4718
-	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4718
+	public function getFlightDurationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
4719 4719
 	{
4720 4720
 		global $globalDBdriver;
4721
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4722
-		$filter_query = $this->getFilter($filters,true,true);
4723
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4721
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4722
+		$filter_query = $this->getFilter($filters, true, true);
4723
+		$query = "SELECT SUM(last_seen - date) AS duration 
4724 4724
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
4725 4725
 		$query_values = array();
4726 4726
 		if ($year != '') {
4727 4727
 			if ($globalDBdriver == 'mysql') {
4728 4728
 				$query .= " AND YEAR(spotter_output.date) = :year";
4729
-				$query_values = array_merge($query_values,array(':year' => $year));
4729
+				$query_values = array_merge($query_values, array(':year' => $year));
4730 4730
 			} else {
4731 4731
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4732
-				$query_values = array_merge($query_values,array(':year' => $year));
4732
+				$query_values = array_merge($query_values, array(':year' => $year));
4733 4733
 			}
4734 4734
 		}
4735 4735
 		if ($month != '') {
4736 4736
 			if ($globalDBdriver == 'mysql') {
4737 4737
 				$query .= " AND MONTH(spotter_output.date) = :month";
4738
-				$query_values = array_merge($query_values,array(':month' => $month));
4738
+				$query_values = array_merge($query_values, array(':month' => $month));
4739 4739
 			} else {
4740 4740
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4741
-				$query_values = array_merge($query_values,array(':month' => $month));
4741
+				$query_values = array_merge($query_values, array(':month' => $month));
4742 4742
 			}
4743 4743
 		}
4744 4744
 		if ($day != '') {
4745 4745
 			if ($globalDBdriver == 'mysql') {
4746 4746
 				$query .= " AND DAY(spotter_output.date) = :day";
4747
-				$query_values = array_merge($query_values,array(':day' => $day));
4747
+				$query_values = array_merge($query_values, array(':day' => $day));
4748 4748
 			} else {
4749 4749
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4750
-				$query_values = array_merge($query_values,array(':day' => $day));
4750
+				$query_values = array_merge($query_values, array(':day' => $day));
4751 4751
 			}
4752 4752
 		}
4753
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4753
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4754 4754
 		$sth = $this->db->prepare($query);
4755 4755
 		$sth->execute($query_values);
4756 4756
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4757
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4757
+		if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4758 4758
 		else return $result[0]['duration'];
4759 4759
 	}
4760 4760
 
@@ -4764,11 +4764,11 @@  discard block
 block discarded – undo
4764 4764
 	* @return Array the airline list
4765 4765
 	*
4766 4766
 	*/
4767
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4767
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4768 4768
 	{
4769
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4770
-		$filter_query = $this->getFilter($filters,true,true);
4771
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4769
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4770
+		$filter_query = $this->getFilter($filters, true, true);
4771
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4772 4772
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4773 4773
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4774 4774
 				ORDER BY airline_count DESC";
@@ -4785,25 +4785,25 @@  discard block
 block discarded – undo
4785 4785
 	* @return Array the airline list
4786 4786
 	*
4787 4787
 	*/
4788
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4788
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4789 4789
 	{
4790
-		$filter_query = $this->getFilter($filters,true,true);
4791
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4792
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4790
+		$filter_query = $this->getFilter($filters, true, true);
4791
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4792
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4793 4793
 
4794
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4794
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4795 4795
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4796 4796
 					GROUP BY spotter_output.airline_name
4797 4797
 					ORDER BY airline_count DESC";
4798 4798
       
4799 4799
 		
4800 4800
 		$sth = $this->db->prepare($query);
4801
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4801
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4802 4802
       
4803 4803
 		$airline_array = array();
4804 4804
 		$temp_array = array();
4805 4805
         
4806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4807 4807
 		{
4808 4808
 			$temp_array['airline_name'] = $row['airline_name'];
4809 4809
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4821,13 +4821,13 @@  discard block
 block discarded – undo
4821 4821
 	* @return Array the airline country list
4822 4822
 	*
4823 4823
 	*/
4824
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4824
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4825 4825
 	{
4826
-		$filter_query = $this->getFilter($filters,true,true);
4827
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4828
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4826
+		$filter_query = $this->getFilter($filters, true, true);
4827
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4828
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4829 4829
       
4830
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4830
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4831 4831
 		 		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) 
4832 4832
 				GROUP BY spotter_output.airline_country
4833 4833
 				ORDER BY airline_country_count DESC
@@ -4835,11 +4835,11 @@  discard block
 block discarded – undo
4835 4835
       
4836 4836
 		
4837 4837
 		$sth = $this->db->prepare($query);
4838
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4838
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4839 4839
       
4840 4840
 		$airline_country_array = array();
4841 4841
 		$temp_array = array();
4842
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4842
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4843 4843
 		{
4844 4844
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4845 4845
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4857,11 +4857,11 @@  discard block
 block discarded – undo
4857 4857
 	* @return Array the airline list
4858 4858
 	*
4859 4859
 	*/
4860
-	public function countAllAirlinesByCountry($country,$filters = array())
4860
+	public function countAllAirlinesByCountry($country, $filters = array())
4861 4861
 	{
4862
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4863
-		$filter_query = $this->getFilter($filters,true,true);
4864
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4862
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4863
+		$filter_query = $this->getFilter($filters, true, true);
4864
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4865 4865
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4866 4866
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4867 4867
 			    ORDER BY airline_count DESC";
@@ -4872,7 +4872,7 @@  discard block
 block discarded – undo
4872 4872
 
4873 4873
 		$airline_array = array();
4874 4874
 		$temp_array = array();
4875
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4875
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4876 4876
 		{
4877 4877
 			$temp_array['airline_name'] = $row['airline_name'];
4878 4878
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4891,11 +4891,11 @@  discard block
 block discarded – undo
4891 4891
 	* @return Array the airline country list
4892 4892
 	*
4893 4893
 	*/
4894
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4894
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4895 4895
 	{
4896
-		$filter_query = $this->getFilter($filters,true,true);
4897
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4898
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4896
+		$filter_query = $this->getFilter($filters, true, true);
4897
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4898
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4899 4899
 		 		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 
4900 4900
 				GROUP BY spotter_output.airline_country
4901 4901
 				ORDER BY airline_country_count DESC
@@ -4907,7 +4907,7 @@  discard block
 block discarded – undo
4907 4907
 
4908 4908
 		$airline_country_array = array();
4909 4909
 		$temp_array = array();
4910
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4910
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4911 4911
 		{
4912 4912
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4913 4913
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4927,35 +4927,35 @@  discard block
 block discarded – undo
4927 4927
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4928 4928
 	{
4929 4929
 		global $globalDBdriver;
4930
-		$filter_query = $this->getFilter($filters,true,true);
4931
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4930
+		$filter_query = $this->getFilter($filters, true, true);
4931
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4932 4932
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4933 4933
 		$query_values = array();
4934 4934
 		if ($year != '') {
4935 4935
 			if ($globalDBdriver == 'mysql') {
4936 4936
 				$query .= " AND YEAR(spotter_output.date) = :year";
4937
-				$query_values = array_merge($query_values,array(':year' => $year));
4937
+				$query_values = array_merge($query_values, array(':year' => $year));
4938 4938
 			} else {
4939 4939
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4940
-				$query_values = array_merge($query_values,array(':year' => $year));
4940
+				$query_values = array_merge($query_values, array(':year' => $year));
4941 4941
 			}
4942 4942
 		}
4943 4943
 		if ($month != '') {
4944 4944
 			if ($globalDBdriver == 'mysql') {
4945 4945
 				$query .= " AND MONTH(spotter_output.date) = :month";
4946
-				$query_values = array_merge($query_values,array(':month' => $month));
4946
+				$query_values = array_merge($query_values, array(':month' => $month));
4947 4947
 			} else {
4948 4948
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4949
-				$query_values = array_merge($query_values,array(':month' => $month));
4949
+				$query_values = array_merge($query_values, array(':month' => $month));
4950 4950
 			}
4951 4951
 		}
4952 4952
 		if ($day != '') {
4953 4953
 			if ($globalDBdriver == 'mysql') {
4954 4954
 				$query .= " AND DAY(spotter_output.date) = :day";
4955
-				$query_values = array_merge($query_values,array(':day' => $day));
4955
+				$query_values = array_merge($query_values, array(':day' => $day));
4956 4956
 			} else {
4957 4957
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4958
-				$query_values = array_merge($query_values,array(':day' => $day));
4958
+				$query_values = array_merge($query_values, array(':day' => $day));
4959 4959
 			}
4960 4960
 		}
4961 4961
 		$query .= " GROUP BY spotter_output.airline_country
@@ -4967,7 +4967,7 @@  discard block
 block discarded – undo
4967 4967
 
4968 4968
 		$airline_array = array();
4969 4969
 		$temp_array = array();
4970
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4970
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4971 4971
 		{
4972 4972
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4973 4973
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4983,11 +4983,11 @@  discard block
 block discarded – undo
4983 4983
 	* @return Array the airline country list
4984 4984
 	*
4985 4985
 	*/
4986
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4986
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4987 4987
 	{
4988 4988
 		global $globalDBdriver;
4989 4989
 		//$filter_query = $this->getFilter($filters,true,true);
4990
-		$Connection= new Connection($this->db);
4990
+		$Connection = new Connection($this->db);
4991 4991
 		if (!$Connection->tableExists('countries')) return array();
4992 4992
 		/*
4993 4993
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -5002,7 +5002,7 @@  discard block
 block discarded – undo
5002 5002
 */
5003 5003
 		require_once('class.SpotterLive.php');
5004 5004
 		$SpotterLive = new SpotterLive();
5005
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
5005
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
5006 5006
 		$filter_query .= ' over_country IS NOT NULL';
5007 5007
                 if ($olderthanmonths > 0) {
5008 5008
 			if ($globalDBdriver == 'mysql') {
@@ -5029,7 +5029,7 @@  discard block
 block discarded – undo
5029 5029
 		$flight_array = array();
5030 5030
 		$temp_array = array();
5031 5031
         
5032
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5032
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5033 5033
 		{
5034 5034
 			$temp_array['flight_count'] = $row['nb'];
5035 5035
 			$temp_array['flight_country'] = $row['name'];
@@ -5047,11 +5047,11 @@  discard block
 block discarded – undo
5047 5047
 	* @return Array the aircraft list
5048 5048
 	*
5049 5049
 	*/
5050
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5050
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5051 5051
 	{
5052 5052
 		global $globalDBdriver;
5053
-		$filter_query = $this->getFilter($filters,true,true);
5054
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5053
+		$filter_query = $this->getFilter($filters, true, true);
5054
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5055 5055
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
5056 5056
 		if ($olderthanmonths > 0) {
5057 5057
 			if ($globalDBdriver == 'mysql') {
@@ -5071,28 +5071,28 @@  discard block
 block discarded – undo
5071 5071
 		if ($year != '') {
5072 5072
 			if ($globalDBdriver == 'mysql') {
5073 5073
 				$query .= " AND YEAR(spotter_output.date) = :year";
5074
-				$query_values = array_merge($query_values,array(':year' => $year));
5074
+				$query_values = array_merge($query_values, array(':year' => $year));
5075 5075
 			} else {
5076 5076
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5077
-				$query_values = array_merge($query_values,array(':year' => $year));
5077
+				$query_values = array_merge($query_values, array(':year' => $year));
5078 5078
 			}
5079 5079
 		}
5080 5080
 		if ($month != '') {
5081 5081
 			if ($globalDBdriver == 'mysql') {
5082 5082
 				$query .= " AND MONTH(spotter_output.date) = :month";
5083
-				$query_values = array_merge($query_values,array(':month' => $month));
5083
+				$query_values = array_merge($query_values, array(':month' => $month));
5084 5084
 			} else {
5085 5085
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5086
-				$query_values = array_merge($query_values,array(':month' => $month));
5086
+				$query_values = array_merge($query_values, array(':month' => $month));
5087 5087
 			}
5088 5088
 		}
5089 5089
 		if ($day != '') {
5090 5090
 			if ($globalDBdriver == 'mysql') {
5091 5091
 				$query .= " AND DAY(spotter_output.date) = :day";
5092
-				$query_values = array_merge($query_values,array(':day' => $day));
5092
+				$query_values = array_merge($query_values, array(':day' => $day));
5093 5093
 			} else {
5094 5094
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5095
-				$query_values = array_merge($query_values,array(':day' => $day));
5095
+				$query_values = array_merge($query_values, array(':day' => $day));
5096 5096
 			}
5097 5097
 		}
5098 5098
 
@@ -5104,7 +5104,7 @@  discard block
 block discarded – undo
5104 5104
 
5105 5105
 		$aircraft_array = array();
5106 5106
 		$temp_array = array();
5107
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5107
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5108 5108
 		{
5109 5109
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5110 5110
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5121,11 +5121,11 @@  discard block
 block discarded – undo
5121 5121
 	* @return Array the aircraft list
5122 5122
 	*
5123 5123
 	*/
5124
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5124
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5125 5125
 	{
5126 5126
 		global $globalDBdriver;
5127
-		$filter_query = $this->getFilter($filters,true,true);
5128
-		$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 
5127
+		$filter_query = $this->getFilter($filters, true, true);
5128
+		$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 
5129 5129
 		    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'";
5130 5130
 		if ($olderthanmonths > 0) {
5131 5131
 			if ($globalDBdriver == 'mysql') {
@@ -5145,28 +5145,28 @@  discard block
 block discarded – undo
5145 5145
 		if ($year != '') {
5146 5146
 			if ($globalDBdriver == 'mysql') {
5147 5147
 				$query .= " AND YEAR(spotter_output.date) = :year";
5148
-				$query_values = array_merge($query_values,array(':year' => $year));
5148
+				$query_values = array_merge($query_values, array(':year' => $year));
5149 5149
 			} else {
5150 5150
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5151
-				$query_values = array_merge($query_values,array(':year' => $year));
5151
+				$query_values = array_merge($query_values, array(':year' => $year));
5152 5152
 			}
5153 5153
 		}
5154 5154
 		if ($month != '') {
5155 5155
 			if ($globalDBdriver == 'mysql') {
5156 5156
 				$query .= " AND MONTH(spotter_output.date) = :month";
5157
-				$query_values = array_merge($query_values,array(':month' => $month));
5157
+				$query_values = array_merge($query_values, array(':month' => $month));
5158 5158
 			} else {
5159 5159
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5160
-				$query_values = array_merge($query_values,array(':month' => $month));
5160
+				$query_values = array_merge($query_values, array(':month' => $month));
5161 5161
 			}
5162 5162
 		}
5163 5163
 		if ($day != '') {
5164 5164
 			if ($globalDBdriver == 'mysql') {
5165 5165
 				$query .= " AND DAY(spotter_output.date) = :day";
5166
-				$query_values = array_merge($query_values,array(':day' => $day));
5166
+				$query_values = array_merge($query_values, array(':day' => $day));
5167 5167
 			} else {
5168 5168
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5169
-				$query_values = array_merge($query_values,array(':day' => $day));
5169
+				$query_values = array_merge($query_values, array(':day' => $day));
5170 5170
 			}
5171 5171
 		}
5172 5172
 
@@ -5178,7 +5178,7 @@  discard block
 block discarded – undo
5178 5178
 
5179 5179
 		$aircraft_array = array();
5180 5180
 		$temp_array = array();
5181
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5181
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5182 5182
 		{
5183 5183
 			$temp_array['airline_icao'] = $row['airline_icao'];
5184 5184
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5196,11 +5196,11 @@  discard block
 block discarded – undo
5196 5196
 	* @return Array the aircraft list
5197 5197
 	*
5198 5198
 	*/
5199
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5199
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5200 5200
 	{
5201 5201
 		global $globalDBdriver;
5202
-		$filter_query = $this->getFilter($filters,true,true);
5203
-		$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 
5202
+		$filter_query = $this->getFilter($filters, true, true);
5203
+		$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 
5204 5204
 		    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' ";
5205 5205
 		if ($olderthanmonths > 0) {
5206 5206
 			if ($globalDBdriver == 'mysql') {
@@ -5225,7 +5225,7 @@  discard block
 block discarded – undo
5225 5225
 
5226 5226
 		$aircraft_array = array();
5227 5227
 		$temp_array = array();
5228
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5228
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5229 5229
 		{
5230 5230
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5231 5231
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5244,13 +5244,13 @@  discard block
 block discarded – undo
5244 5244
 	* @return Array the aircraft list
5245 5245
 	*
5246 5246
 	*/
5247
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5247
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5248 5248
 	{
5249 5249
 		$Image = new Image($this->db);
5250
-		$filter_query = $this->getFilter($filters,true,true);
5251
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5250
+		$filter_query = $this->getFilter($filters, true, true);
5251
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5252 5252
 
5253
-		$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  
5253
+		$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  
5254 5254
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5255 5255
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5256 5256
 				ORDER BY registration_count DESC";
@@ -5261,14 +5261,14 @@  discard block
 block discarded – undo
5261 5261
 		$aircraft_array = array();
5262 5262
 		$temp_array = array();
5263 5263
         
5264
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5264
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5265 5265
 		{
5266 5266
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5267 5267
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5268 5268
 			$temp_array['registration'] = $row['registration'];
5269 5269
 			$temp_array['airline_name'] = $row['airline_name'];
5270 5270
 			$temp_array['image_thumbnail'] = "";
5271
-			if($row['registration'] != "")
5271
+			if ($row['registration'] != "")
5272 5272
 			{
5273 5273
 				$image_array = $Image->getSpotterImage($row['registration']);
5274 5274
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5287,11 +5287,11 @@  discard block
 block discarded – undo
5287 5287
 	* @return Array the aircraft list
5288 5288
 	*
5289 5289
 	*/
5290
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5290
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5291 5291
 	{
5292
-		$filter_query = $this->getFilter($filters,true,true);
5293
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5294
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5292
+		$filter_query = $this->getFilter($filters, true, true);
5293
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5294
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5295 5295
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5296 5296
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5297 5297
 			    ORDER BY aircraft_icao_count DESC";
@@ -5302,7 +5302,7 @@  discard block
 block discarded – undo
5302 5302
 		$aircraft_array = array();
5303 5303
 		$temp_array = array();
5304 5304
 
5305
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5305
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5306 5306
 		{
5307 5307
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5308 5308
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5320,13 +5320,13 @@  discard block
 block discarded – undo
5320 5320
 	* @return Array the aircraft list
5321 5321
 	*
5322 5322
 	*/
5323
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5323
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5324 5324
 	{
5325
-		$filter_query = $this->getFilter($filters,true,true);
5325
+		$filter_query = $this->getFilter($filters, true, true);
5326 5326
 		$Image = new Image($this->db);
5327
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5327
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5328 5328
 
5329
-		$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 
5329
+		$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 
5330 5330
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5331 5331
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5332 5332
 			    ORDER BY registration_count DESC";
@@ -5336,14 +5336,14 @@  discard block
 block discarded – undo
5336 5336
 
5337 5337
 		$aircraft_array = array();
5338 5338
 		$temp_array = array();
5339
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5339
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5340 5340
 		{
5341 5341
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5342 5342
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5343 5343
 			$temp_array['registration'] = $row['registration'];
5344 5344
 			$temp_array['airline_name'] = $row['airline_name'];
5345 5345
 			$temp_array['image_thumbnail'] = "";
5346
-			if($row['registration'] != "")
5346
+			if ($row['registration'] != "")
5347 5347
 			{
5348 5348
 				$image_array = $Image->getSpotterImage($row['registration']);
5349 5349
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5362,11 +5362,11 @@  discard block
 block discarded – undo
5362 5362
 	* @return Array the aircraft list
5363 5363
 	*
5364 5364
 	*/
5365
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5365
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5366 5366
 	{
5367
-		$filter_query = $this->getFilter($filters,true,true);
5368
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5369
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5367
+		$filter_query = $this->getFilter($filters, true, true);
5368
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5369
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5370 5370
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5371 5371
 				GROUP BY spotter_output.aircraft_manufacturer 
5372 5372
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5377,7 +5377,7 @@  discard block
 block discarded – undo
5377 5377
 		$aircraft_array = array();
5378 5378
 		$temp_array = array();
5379 5379
 
5380
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5380
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5381 5381
 		{
5382 5382
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5383 5383
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5394,12 +5394,12 @@  discard block
 block discarded – undo
5394 5394
 	* @return Array the aircraft list
5395 5395
 	*
5396 5396
 	*/
5397
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5397
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5398 5398
 	{
5399
-		$filter_query = $this->getFilter($filters,true,true);
5400
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5399
+		$filter_query = $this->getFilter($filters, true, true);
5400
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5401 5401
 
5402
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5402
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5403 5403
 				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) 
5404 5404
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5405 5405
 				ORDER BY aircraft_icao_count DESC";
@@ -5409,7 +5409,7 @@  discard block
 block discarded – undo
5409 5409
 
5410 5410
 		$aircraft_array = array();
5411 5411
 		$temp_array = array();
5412
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5412
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5413 5413
 		{
5414 5414
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5415 5415
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5427,13 +5427,13 @@  discard block
 block discarded – undo
5427 5427
 	* @return Array the aircraft list
5428 5428
 	*
5429 5429
 	*/
5430
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5430
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5431 5431
 	{
5432
-		$filter_query = $this->getFilter($filters,true,true);
5432
+		$filter_query = $this->getFilter($filters, true, true);
5433 5433
 		$Image = new Image($this->db);
5434
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5434
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5435 5435
 
5436
-		$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  
5436
+		$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  
5437 5437
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5438 5438
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5439 5439
 		    ORDER BY registration_count DESC";
@@ -5443,14 +5443,14 @@  discard block
 block discarded – undo
5443 5443
 
5444 5444
 		$aircraft_array = array();
5445 5445
 		$temp_array = array();
5446
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5446
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5447 5447
 		{
5448 5448
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5449 5449
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5450 5450
 			$temp_array['registration'] = $row['registration'];
5451 5451
 			$temp_array['airline_name'] = $row['airline_name'];
5452 5452
 			$temp_array['image_thumbnail'] = "";
5453
-			if($row['registration'] != "")
5453
+			if ($row['registration'] != "")
5454 5454
 			{
5455 5455
 				$image_array = $Image->getSpotterImage($row['registration']);
5456 5456
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5468,11 +5468,11 @@  discard block
 block discarded – undo
5468 5468
 	* @return Array the aircraft list
5469 5469
 	*
5470 5470
 	*/
5471
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5471
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5472 5472
 	{
5473
-		$filter_query = $this->getFilter($filters,true,true);
5474
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5475
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5473
+		$filter_query = $this->getFilter($filters, true, true);
5474
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5475
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5476 5476
                     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)  
5477 5477
                     GROUP BY spotter_output.aircraft_manufacturer 
5478 5478
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5483,7 +5483,7 @@  discard block
 block discarded – undo
5483 5483
 
5484 5484
 		$aircraft_array = array();
5485 5485
 		$temp_array = array();
5486
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5486
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5487 5487
 		{
5488 5488
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5489 5489
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5498,12 +5498,12 @@  discard block
 block discarded – undo
5498 5498
 	* @return Array the aircraft list
5499 5499
 	*
5500 5500
 	*/
5501
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5501
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5502 5502
 	{
5503
-		$filter_query = $this->getFilter($filters,true,true);
5504
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5503
+		$filter_query = $this->getFilter($filters, true, true);
5504
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5505 5505
 
5506
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5506
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5507 5507
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5508 5508
                     GROUP BY spotter_output.aircraft_name 
5509 5509
 					ORDER BY aircraft_icao_count DESC";
@@ -5512,7 +5512,7 @@  discard block
 block discarded – undo
5512 5512
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5513 5513
 		$aircraft_array = array();
5514 5514
 		$temp_array = array();
5515
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5515
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5516 5516
 		{
5517 5517
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5518 5518
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5531,11 +5531,11 @@  discard block
 block discarded – undo
5531 5531
 	*/
5532 5532
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5533 5533
 	{
5534
-		$filter_query = $this->getFilter($filters,true,true);
5534
+		$filter_query = $this->getFilter($filters, true, true);
5535 5535
 		$Image = new Image($this->db);
5536
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5536
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5537 5537
 
5538
-		$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   
5538
+		$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   
5539 5539
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5540 5540
                     GROUP BY spotter_output.registration 
5541 5541
 					ORDER BY registration_count DESC";
@@ -5545,14 +5545,14 @@  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'];
5552 5552
 			$temp_array['registration'] = $row['registration'];
5553 5553
 			$temp_array['airline_name'] = $row['airline_name'];
5554 5554
 			$temp_array['image_thumbnail'] = "";
5555
-			if($row['registration'] != "")
5555
+			if ($row['registration'] != "")
5556 5556
 			{
5557 5557
 				$image_array = $Image->getSpotterImage($row['registration']);
5558 5558
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5569,11 +5569,11 @@  discard block
 block discarded – undo
5569 5569
 	* @return Array the aircraft list
5570 5570
 	*
5571 5571
 	*/
5572
-	public function countAllAircraftTypesByDate($date,$filters = array())
5572
+	public function countAllAircraftTypesByDate($date, $filters = array())
5573 5573
 	{
5574 5574
 		global $globalTimezone, $globalDBdriver;
5575
-		$filter_query = $this->getFilter($filters,true,true);
5576
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5575
+		$filter_query = $this->getFilter($filters, true, true);
5576
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5577 5577
 		if ($globalTimezone != '') {
5578 5578
 			date_default_timezone_set($globalTimezone);
5579 5579
 			$datetime = new DateTime($date);
@@ -5581,12 +5581,12 @@  discard block
 block discarded – undo
5581 5581
 		} else $offset = '+00:00';
5582 5582
 
5583 5583
 		if ($globalDBdriver == 'mysql') {
5584
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5584
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5585 5585
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5586 5586
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5587 5587
 					ORDER BY aircraft_icao_count DESC";
5588 5588
 		} else {
5589
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5589
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5590 5590
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5591 5591
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5592 5592
 					ORDER BY aircraft_icao_count DESC";
@@ -5597,7 +5597,7 @@  discard block
 block discarded – undo
5597 5597
 
5598 5598
 		$aircraft_array = array();
5599 5599
 		$temp_array = array();
5600
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5600
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5601 5601
 		{
5602 5602
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5603 5603
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5615,12 +5615,12 @@  discard block
 block discarded – undo
5615 5615
 	* @return Array the aircraft list
5616 5616
 	*
5617 5617
 	*/
5618
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5618
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5619 5619
 	{
5620 5620
 		global $globalTimezone, $globalDBdriver;
5621
-		$filter_query = $this->getFilter($filters,true,true);
5621
+		$filter_query = $this->getFilter($filters, true, true);
5622 5622
 		$Image = new Image($this->db);
5623
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5623
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5624 5624
 		if ($globalTimezone != '') {
5625 5625
 			date_default_timezone_set($globalTimezone);
5626 5626
 			$datetime = new DateTime($date);
@@ -5628,12 +5628,12 @@  discard block
 block discarded – undo
5628 5628
 		} else $offset = '+00:00';
5629 5629
 
5630 5630
 		if ($globalDBdriver == 'mysql') {
5631
-			$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 
5631
+			$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 
5632 5632
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5633 5633
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5634 5634
 					ORDER BY registration_count DESC";
5635 5635
 		} else {
5636
-			$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    
5636
+			$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    
5637 5637
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5638 5638
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5639 5639
 					ORDER BY registration_count DESC";
@@ -5644,14 +5644,14 @@  discard block
 block discarded – undo
5644 5644
 
5645 5645
 		$aircraft_array = array();
5646 5646
 		$temp_array = array();
5647
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5647
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5648 5648
 		{
5649 5649
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5650 5650
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5651 5651
 			$temp_array['registration'] = $row['registration'];
5652 5652
 			$temp_array['airline_name'] = $row['airline_name'];
5653 5653
 			$temp_array['image_thumbnail'] = "";
5654
-			if($row['registration'] != "")
5654
+			if ($row['registration'] != "")
5655 5655
 			{
5656 5656
 				$image_array = $Image->getSpotterImage($row['registration']);
5657 5657
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5670,11 +5670,11 @@  discard block
 block discarded – undo
5670 5670
 	* @return Array the aircraft manufacturer list
5671 5671
 	*
5672 5672
 	*/
5673
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5673
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5674 5674
 	{
5675 5675
 		global $globalTimezone, $globalDBdriver;
5676
-		$filter_query = $this->getFilter($filters,true,true);
5677
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5676
+		$filter_query = $this->getFilter($filters, true, true);
5677
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5678 5678
 		if ($globalTimezone != '') {
5679 5679
 			date_default_timezone_set($globalTimezone);
5680 5680
 			$datetime = new DateTime($date);
@@ -5682,12 +5682,12 @@  discard block
 block discarded – undo
5682 5682
 		} else $offset = '+00:00';
5683 5683
 
5684 5684
 		if ($globalDBdriver == 'mysql') {
5685
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5685
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5686 5686
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5687 5687
 				GROUP BY spotter_output.aircraft_manufacturer 
5688 5688
 				ORDER BY aircraft_manufacturer_count DESC";
5689 5689
 		} else {
5690
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5690
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5691 5691
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5692 5692
 				GROUP BY spotter_output.aircraft_manufacturer 
5693 5693
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5699,7 +5699,7 @@  discard block
 block discarded – undo
5699 5699
 		$aircraft_array = array();
5700 5700
 		$temp_array = array();
5701 5701
 
5702
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5702
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5703 5703
 		{
5704 5704
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5705 5705
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5716,11 +5716,11 @@  discard block
 block discarded – undo
5716 5716
 	* @return Array the aircraft list
5717 5717
 	*
5718 5718
 	*/
5719
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5719
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5720 5720
 	{
5721
-		$filter_query = $this->getFilter($filters,true,true);
5722
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5723
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5721
+		$filter_query = $this->getFilter($filters, true, true);
5722
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5723
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5724 5724
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5725 5725
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5726 5726
 				ORDER BY aircraft_icao_count DESC";
@@ -5731,7 +5731,7 @@  discard block
 block discarded – undo
5731 5731
 		$aircraft_array = array();
5732 5732
 		$temp_array = array();
5733 5733
 
5734
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5734
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5735 5735
 		{
5736 5736
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5737 5737
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5748,45 +5748,45 @@  discard block
 block discarded – undo
5748 5748
 	* @return Array the aircraft list
5749 5749
 	*
5750 5750
 	*/
5751
-	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5751
+	public function countAllAircraftTypesByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5752 5752
 	{
5753 5753
 		global $globalDBdriver;
5754
-		$filter_query = $this->getFilter($filters,true,true);
5755
-		$pilot = filter_var($pilot,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
+		$pilot = filter_var($pilot, 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.pilot_id = :pilot OR spotter_output.pilot_name = :pilot)";
5758 5758
 		$query_values = array();
5759 5759
 		if ($year != '') {
5760 5760
 			if ($globalDBdriver == 'mysql') {
5761 5761
 				$query .= " AND YEAR(spotter_output.date) = :year";
5762
-				$query_values = array_merge($query_values,array(':year' => $year));
5762
+				$query_values = array_merge($query_values, array(':year' => $year));
5763 5763
 			} else {
5764 5764
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5765
-				$query_values = array_merge($query_values,array(':year' => $year));
5765
+				$query_values = array_merge($query_values, array(':year' => $year));
5766 5766
 			}
5767 5767
 		}
5768 5768
 		if ($month != '') {
5769 5769
 			if ($globalDBdriver == 'mysql') {
5770 5770
 				$query .= " AND MONTH(spotter_output.date) = :month";
5771
-				$query_values = array_merge($query_values,array(':month' => $month));
5771
+				$query_values = array_merge($query_values, array(':month' => $month));
5772 5772
 			} else {
5773 5773
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5774
-				$query_values = array_merge($query_values,array(':month' => $month));
5774
+				$query_values = array_merge($query_values, array(':month' => $month));
5775 5775
 			}
5776 5776
 		}
5777 5777
 		if ($day != '') {
5778 5778
 			if ($globalDBdriver == 'mysql') {
5779 5779
 				$query .= " AND DAY(spotter_output.date) = :day";
5780
-				$query_values = array_merge($query_values,array(':day' => $day));
5780
+				$query_values = array_merge($query_values, array(':day' => $day));
5781 5781
 			} else {
5782 5782
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5783
-				$query_values = array_merge($query_values,array(':day' => $day));
5783
+				$query_values = array_merge($query_values, array(':day' => $day));
5784 5784
 			}
5785 5785
 		}
5786 5786
 
5787 5787
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5788 5788
 				ORDER BY aircraft_icao_count DESC";
5789
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
5789
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
5790 5790
 		$sth = $this->db->prepare($query);
5791 5791
 		$sth->execute($query_values);
5792 5792
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5798,44 +5798,44 @@  discard block
 block discarded – undo
5798 5798
 	* @return Array the aircraft list
5799 5799
 	*
5800 5800
 	*/
5801
-	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5801
+	public function countAllAircraftTypesByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5802 5802
 	{
5803 5803
 		global $globalDBdriver;
5804
-		$filter_query = $this->getFilter($filters,true,true);
5805
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5806
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5804
+		$filter_query = $this->getFilter($filters, true, true);
5805
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5806
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5807 5807
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
5808 5808
 		$query_values = array();
5809 5809
 		if ($year != '') {
5810 5810
 			if ($globalDBdriver == 'mysql') {
5811 5811
 				$query .= " AND YEAR(spotter_output.date) = :year";
5812
-				$query_values = array_merge($query_values,array(':year' => $year));
5812
+				$query_values = array_merge($query_values, array(':year' => $year));
5813 5813
 			} else {
5814 5814
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5815
-				$query_values = array_merge($query_values,array(':year' => $year));
5815
+				$query_values = array_merge($query_values, array(':year' => $year));
5816 5816
 			}
5817 5817
 		}
5818 5818
 		if ($month != '') {
5819 5819
 			if ($globalDBdriver == 'mysql') {
5820 5820
 				$query .= " AND MONTH(spotter_output.date) = :month";
5821
-				$query_values = array_merge($query_values,array(':month' => $month));
5821
+				$query_values = array_merge($query_values, array(':month' => $month));
5822 5822
 			} else {
5823 5823
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5824
-				$query_values = array_merge($query_values,array(':month' => $month));
5824
+				$query_values = array_merge($query_values, array(':month' => $month));
5825 5825
 			}
5826 5826
 		}
5827 5827
 		if ($day != '') {
5828 5828
 			if ($globalDBdriver == 'mysql') {
5829 5829
 				$query .= " AND DAY(spotter_output.date) = :day";
5830
-				$query_values = array_merge($query_values,array(':day' => $day));
5830
+				$query_values = array_merge($query_values, array(':day' => $day));
5831 5831
 			} else {
5832 5832
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5833
-				$query_values = array_merge($query_values,array(':day' => $day));
5833
+				$query_values = array_merge($query_values, array(':day' => $day));
5834 5834
 			}
5835 5835
 		}
5836 5836
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5837 5837
 				ORDER BY aircraft_icao_count DESC";
5838
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5838
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5839 5839
 		$sth = $this->db->prepare($query);
5840 5840
 		$sth->execute($query_values);
5841 5841
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5847,13 +5847,13 @@  discard block
 block discarded – undo
5847 5847
 	* @return Array the aircraft list
5848 5848
 	*
5849 5849
 	*/
5850
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5850
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5851 5851
 	{
5852
-		$filter_query = $this->getFilter($filters,true,true);
5852
+		$filter_query = $this->getFilter($filters, true, true);
5853 5853
 		$Image = new Image($this->db);
5854
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5854
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5855 5855
 
5856
-		$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  
5856
+		$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  
5857 5857
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5858 5858
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5859 5859
 		    ORDER BY registration_count DESC";
@@ -5865,14 +5865,14 @@  discard block
 block discarded – undo
5865 5865
 		$aircraft_array = array();
5866 5866
 		$temp_array = array();
5867 5867
         
5868
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5868
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5869 5869
 		{
5870 5870
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5871 5871
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5872 5872
 			$temp_array['registration'] = $row['registration'];
5873 5873
 			$temp_array['airline_name'] = $row['airline_name'];
5874 5874
 			$temp_array['image_thumbnail'] = "";
5875
-			if($row['registration'] != "")
5875
+			if ($row['registration'] != "")
5876 5876
 			{
5877 5877
 				$image_array = $Image->getSpotterImage($row['registration']);
5878 5878
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5890,44 +5890,44 @@  discard block
 block discarded – undo
5890 5890
 	* @return Array the aircraft list
5891 5891
 	*
5892 5892
 	*/
5893
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5893
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5894 5894
 	{
5895 5895
 		global $globalDBdriver;
5896
-		$filter_query = $this->getFilter($filters,true,true);
5896
+		$filter_query = $this->getFilter($filters, true, true);
5897 5897
 		$Image = new Image($this->db);
5898
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5898
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5899 5899
 
5900
-		$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  
5900
+		$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  
5901 5901
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner";
5902 5902
 		$query_values = array();
5903 5903
 		if ($year != '') {
5904 5904
 			if ($globalDBdriver == 'mysql') {
5905 5905
 				$query .= " AND YEAR(spotter_output.date) = :year";
5906
-				$query_values = array_merge($query_values,array(':year' => $year));
5906
+				$query_values = array_merge($query_values, array(':year' => $year));
5907 5907
 			} else {
5908 5908
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5909
-				$query_values = array_merge($query_values,array(':year' => $year));
5909
+				$query_values = array_merge($query_values, array(':year' => $year));
5910 5910
 			}
5911 5911
 		}
5912 5912
 		if ($month != '') {
5913 5913
 			if ($globalDBdriver == 'mysql') {
5914 5914
 				$query .= " AND MONTH(spotter_output.date) = :month";
5915
-				$query_values = array_merge($query_values,array(':month' => $month));
5915
+				$query_values = array_merge($query_values, array(':month' => $month));
5916 5916
 			} else {
5917 5917
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5918
-				$query_values = array_merge($query_values,array(':month' => $month));
5918
+				$query_values = array_merge($query_values, array(':month' => $month));
5919 5919
 			}
5920 5920
 		}
5921 5921
 		if ($day != '') {
5922 5922
 			if ($globalDBdriver == 'mysql') {
5923 5923
 				$query .= " AND DAY(spotter_output.date) = :day";
5924
-				$query_values = array_merge($query_values,array(':day' => $day));
5924
+				$query_values = array_merge($query_values, array(':day' => $day));
5925 5925
 			} else {
5926 5926
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5927
-				$query_values = array_merge($query_values,array(':day' => $day));
5927
+				$query_values = array_merge($query_values, array(':day' => $day));
5928 5928
 			}
5929 5929
 		}
5930
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5930
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5931 5931
 
5932 5932
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5933 5933
 		    ORDER BY registration_count DESC";
@@ -5939,7 +5939,7 @@  discard block
 block discarded – undo
5939 5939
 		$aircraft_array = array();
5940 5940
 		$temp_array = array();
5941 5941
         
5942
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5942
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5943 5943
 		{
5944 5944
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5945 5945
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5947,7 +5947,7 @@  discard block
 block discarded – undo
5947 5947
 			$temp_array['registration'] = $row['registration'];
5948 5948
 			$temp_array['airline_name'] = $row['airline_name'];
5949 5949
 			$temp_array['image_thumbnail'] = "";
5950
-			if($row['registration'] != "")
5950
+			if ($row['registration'] != "")
5951 5951
 			{
5952 5952
 				$image_array = $Image->getSpotterImage($row['registration']);
5953 5953
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5965,44 +5965,44 @@  discard block
 block discarded – undo
5965 5965
 	* @return Array the aircraft list
5966 5966
 	*
5967 5967
 	*/
5968
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5968
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5969 5969
 	{
5970 5970
 		global $globalDBdriver;
5971
-		$filter_query = $this->getFilter($filters,true,true);
5971
+		$filter_query = $this->getFilter($filters, true, true);
5972 5972
 		$Image = new Image($this->db);
5973
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5973
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5974 5974
 
5975
-		$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  
5975
+		$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  
5976 5976
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
5977 5977
 		$query_values = array();
5978 5978
 		if ($year != '') {
5979 5979
 			if ($globalDBdriver == 'mysql') {
5980 5980
 				$query .= " AND YEAR(spotter_output.date) = :year";
5981
-				$query_values = array_merge($query_values,array(':year' => $year));
5981
+				$query_values = array_merge($query_values, array(':year' => $year));
5982 5982
 			} else {
5983 5983
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5984
-				$query_values = array_merge($query_values,array(':year' => $year));
5984
+				$query_values = array_merge($query_values, array(':year' => $year));
5985 5985
 			}
5986 5986
 		}
5987 5987
 		if ($month != '') {
5988 5988
 			if ($globalDBdriver == 'mysql') {
5989 5989
 				$query .= " AND MONTH(spotter_output.date) = :month";
5990
-				$query_values = array_merge($query_values,array(':month' => $month));
5990
+				$query_values = array_merge($query_values, array(':month' => $month));
5991 5991
 			} else {
5992 5992
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5993
-				$query_values = array_merge($query_values,array(':month' => $month));
5993
+				$query_values = array_merge($query_values, array(':month' => $month));
5994 5994
 			}
5995 5995
 		}
5996 5996
 		if ($day != '') {
5997 5997
 			if ($globalDBdriver == 'mysql') {
5998 5998
 				$query .= " AND DAY(spotter_output.date) = :day";
5999
-				$query_values = array_merge($query_values,array(':day' => $day));
5999
+				$query_values = array_merge($query_values, array(':day' => $day));
6000 6000
 			} else {
6001 6001
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6002
-				$query_values = array_merge($query_values,array(':day' => $day));
6002
+				$query_values = array_merge($query_values, array(':day' => $day));
6003 6003
 			}
6004 6004
 		}
6005
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6005
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6006 6006
 
6007 6007
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
6008 6008
 		    ORDER BY registration_count DESC";
@@ -6014,7 +6014,7 @@  discard block
 block discarded – undo
6014 6014
 		$aircraft_array = array();
6015 6015
 		$temp_array = array();
6016 6016
         
6017
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6017
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6018 6018
 		{
6019 6019
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6020 6020
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6022,7 +6022,7 @@  discard block
 block discarded – undo
6022 6022
 			$temp_array['registration'] = $row['registration'];
6023 6023
 			$temp_array['airline_name'] = $row['airline_name'];
6024 6024
 			$temp_array['image_thumbnail'] = "";
6025
-			if($row['registration'] != "")
6025
+			if ($row['registration'] != "")
6026 6026
 			{
6027 6027
 				$image_array = $Image->getSpotterImage($row['registration']);
6028 6028
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6041,11 +6041,11 @@  discard block
 block discarded – undo
6041 6041
 	* @return Array the aircraft manufacturer list
6042 6042
 	*
6043 6043
 	*/
6044
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6044
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
6045 6045
 	{
6046
-		$filter_query = $this->getFilter($filters,true,true);
6047
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6048
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6046
+		$filter_query = $this->getFilter($filters, true, true);
6047
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6048
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6049 6049
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
6050 6050
                     GROUP BY spotter_output.aircraft_manufacturer 
6051 6051
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6055,7 +6055,7 @@  discard block
 block discarded – undo
6055 6055
 		$sth->execute(array(':ident' => $ident));
6056 6056
 		$aircraft_array = array();
6057 6057
 		$temp_array = array();
6058
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6058
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6059 6059
 		{
6060 6060
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6061 6061
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6070,42 +6070,42 @@  discard block
 block discarded – undo
6070 6070
 	* @return Array the aircraft manufacturer list
6071 6071
 	*
6072 6072
 	*/
6073
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6073
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
6074 6074
 	{
6075 6075
 		global $globalDBdriver;
6076
-		$filter_query = $this->getFilter($filters,true,true);
6077
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
6078
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6076
+		$filter_query = $this->getFilter($filters, true, true);
6077
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
6078
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6079 6079
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner";
6080 6080
 		$query_values = array();
6081 6081
 		if ($year != '') {
6082 6082
 			if ($globalDBdriver == 'mysql') {
6083 6083
 				$query .= " AND YEAR(spotter_output.date) = :year";
6084
-				$query_values = array_merge($query_values,array(':year' => $year));
6084
+				$query_values = array_merge($query_values, array(':year' => $year));
6085 6085
 			} else {
6086 6086
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6087
-				$query_values = array_merge($query_values,array(':year' => $year));
6087
+				$query_values = array_merge($query_values, array(':year' => $year));
6088 6088
 			}
6089 6089
 		}
6090 6090
 		if ($month != '') {
6091 6091
 			if ($globalDBdriver == 'mysql') {
6092 6092
 				$query .= " AND MONTH(spotter_output.date) = :month";
6093
-				$query_values = array_merge($query_values,array(':month' => $month));
6093
+				$query_values = array_merge($query_values, array(':month' => $month));
6094 6094
 			} else {
6095 6095
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6096
-				$query_values = array_merge($query_values,array(':month' => $month));
6096
+				$query_values = array_merge($query_values, array(':month' => $month));
6097 6097
 			}
6098 6098
 		}
6099 6099
 		if ($day != '') {
6100 6100
 			if ($globalDBdriver == 'mysql') {
6101 6101
 				$query .= " AND DAY(spotter_output.date) = :day";
6102
-				$query_values = array_merge($query_values,array(':day' => $day));
6102
+				$query_values = array_merge($query_values, array(':day' => $day));
6103 6103
 			} else {
6104 6104
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6105
-				$query_values = array_merge($query_values,array(':day' => $day));
6105
+				$query_values = array_merge($query_values, array(':day' => $day));
6106 6106
 			}
6107 6107
 		}
6108
-		$query_values = array_merge($query_values,array(':owner' => $owner));
6108
+		$query_values = array_merge($query_values, array(':owner' => $owner));
6109 6109
 
6110 6110
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6111 6111
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6122,42 +6122,42 @@  discard block
 block discarded – undo
6122 6122
 	* @return Array the aircraft manufacturer list
6123 6123
 	*
6124 6124
 	*/
6125
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6125
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
6126 6126
 	{
6127 6127
 		global $globalDBdriver;
6128
-		$filter_query = $this->getFilter($filters,true,true);
6129
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
6130
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6128
+		$filter_query = $this->getFilter($filters, true, true);
6129
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
6130
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6131 6131
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
6132 6132
 		$query_values = array();
6133 6133
 		if ($year != '') {
6134 6134
 			if ($globalDBdriver == 'mysql') {
6135 6135
 				$query .= " AND YEAR(spotter_output.date) = :year";
6136
-				$query_values = array_merge($query_values,array(':year' => $year));
6136
+				$query_values = array_merge($query_values, array(':year' => $year));
6137 6137
 			} else {
6138 6138
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6139
-				$query_values = array_merge($query_values,array(':year' => $year));
6139
+				$query_values = array_merge($query_values, array(':year' => $year));
6140 6140
 			}
6141 6141
 		}
6142 6142
 		if ($month != '') {
6143 6143
 			if ($globalDBdriver == 'mysql') {
6144 6144
 				$query .= " AND MONTH(spotter_output.date) = :month";
6145
-				$query_values = array_merge($query_values,array(':month' => $month));
6145
+				$query_values = array_merge($query_values, array(':month' => $month));
6146 6146
 			} else {
6147 6147
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6148
-				$query_values = array_merge($query_values,array(':month' => $month));
6148
+				$query_values = array_merge($query_values, array(':month' => $month));
6149 6149
 			}
6150 6150
 		}
6151 6151
 		if ($day != '') {
6152 6152
 			if ($globalDBdriver == 'mysql') {
6153 6153
 				$query .= " AND DAY(spotter_output.date) = :day";
6154
-				$query_values = array_merge($query_values,array(':day' => $day));
6154
+				$query_values = array_merge($query_values, array(':day' => $day));
6155 6155
 			} else {
6156 6156
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6157
-				$query_values = array_merge($query_values,array(':day' => $day));
6157
+				$query_values = array_merge($query_values, array(':day' => $day));
6158 6158
 			}
6159 6159
 		}
6160
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6160
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6161 6161
 
6162 6162
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6163 6163
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6175,24 +6175,24 @@  discard block
 block discarded – undo
6175 6175
 	* @return Array the aircraft list
6176 6176
 	*
6177 6177
 	*/
6178
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6178
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6179 6179
 	{
6180
-		$filter_query = $this->getFilter($filters,true,true);
6181
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6182
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6180
+		$filter_query = $this->getFilter($filters, true, true);
6181
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6182
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6183 6183
 		
6184 6184
 
6185
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6185
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6186 6186
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
6187 6187
                     GROUP BY spotter_output.aircraft_name 
6188 6188
 					ORDER BY aircraft_icao_count DESC";
6189 6189
  
6190 6190
 		
6191 6191
 		$sth = $this->db->prepare($query);
6192
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6192
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6193 6193
 		$aircraft_array = array();
6194 6194
 		$temp_array = array();
6195
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6195
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6196 6196
 		{
6197 6197
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6198 6198
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6208,33 +6208,33 @@  discard block
 block discarded – undo
6208 6208
 	* @return Array the aircraft list
6209 6209
 	*
6210 6210
 	*/
6211
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6211
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6212 6212
 	{
6213
-		$filter_query = $this->getFilter($filters,true,true);
6213
+		$filter_query = $this->getFilter($filters, true, true);
6214 6214
 		$Image = new Image($this->db);
6215
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6216
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6215
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6216
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6217 6217
 
6218
-		$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   
6218
+		$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   
6219 6219
                     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)   
6220 6220
                     GROUP BY spotter_output.registration 
6221 6221
 					ORDER BY registration_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
       
6227 6227
 		$aircraft_array = array();
6228 6228
 		$temp_array = array();
6229 6229
         
6230
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6230
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6231 6231
 		{
6232 6232
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6233 6233
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6234 6234
 			$temp_array['registration'] = $row['registration'];
6235 6235
 			$temp_array['airline_name'] = $row['airline_name'];
6236 6236
 			$temp_array['image_thumbnail'] = "";
6237
-			if($row['registration'] != "")
6237
+			if ($row['registration'] != "")
6238 6238
 			{
6239 6239
 				$image_array = $Image->getSpotterImage($row['registration']);
6240 6240
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6254,25 +6254,25 @@  discard block
 block discarded – undo
6254 6254
 	* @return Array the aircraft manufacturer list
6255 6255
 	*
6256 6256
 	*/
6257
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6257
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6258 6258
 	{
6259
-		$filter_query = $this->getFilter($filters,true,true);
6260
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6261
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6259
+		$filter_query = $this->getFilter($filters, true, true);
6260
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6261
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6262 6262
 
6263
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6263
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6264 6264
                     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) 
6265 6265
                     GROUP BY spotter_output.aircraft_manufacturer 
6266 6266
 					ORDER BY aircraft_manufacturer_count DESC";
6267 6267
 
6268 6268
 		
6269 6269
 		$sth = $this->db->prepare($query);
6270
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6270
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6271 6271
       
6272 6272
 		$aircraft_array = array();
6273 6273
 		$temp_array = array();
6274 6274
         
6275
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6275
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6276 6276
 		{
6277 6277
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6278 6278
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6292,11 +6292,11 @@  discard block
 block discarded – undo
6292 6292
 	* @return Array the aircraft list
6293 6293
 	*
6294 6294
 	*/
6295
-	public function countAllAircraftTypesByCountry($country,$filters = array())
6295
+	public function countAllAircraftTypesByCountry($country, $filters = array())
6296 6296
 	{
6297
-		$filter_query = $this->getFilter($filters,true,true);
6298
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6299
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6297
+		$filter_query = $this->getFilter($filters, true, true);
6298
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6299
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6300 6300
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6301 6301
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
6302 6302
 			    ORDER BY aircraft_icao_count DESC";
@@ -6308,7 +6308,7 @@  discard block
 block discarded – undo
6308 6308
 		$aircraft_array = array();
6309 6309
 		$temp_array = array();
6310 6310
         
6311
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6311
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6312 6312
 		{
6313 6313
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6314 6314
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6327,12 +6327,12 @@  discard block
 block discarded – undo
6327 6327
 	* @return Array the aircraft list
6328 6328
 	*
6329 6329
 	*/
6330
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6330
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
6331 6331
 	{
6332
-		$filter_query = $this->getFilter($filters,true,true);
6332
+		$filter_query = $this->getFilter($filters, true, true);
6333 6333
 		$Image = new Image($this->db);
6334
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6335
-		$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 
6334
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6335
+		$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 
6336 6336
 			    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)    
6337 6337
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
6338 6338
 			    ORDER BY registration_count DESC";
@@ -6344,14 +6344,14 @@  discard block
 block discarded – undo
6344 6344
 		$aircraft_array = array();
6345 6345
 		$temp_array = array();
6346 6346
         
6347
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6347
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6348 6348
 		{
6349 6349
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6350 6350
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6351 6351
 			$temp_array['registration'] = $row['registration'];
6352 6352
 			$temp_array['airline_name'] = $row['airline_name'];
6353 6353
 			$temp_array['image_thumbnail'] = "";
6354
-			if($row['registration'] != "")
6354
+			if ($row['registration'] != "")
6355 6355
 			{
6356 6356
 				$image_array = $Image->getSpotterImage($row['registration']);
6357 6357
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6371,11 +6371,11 @@  discard block
 block discarded – undo
6371 6371
 	* @return Array the aircraft manufacturer list
6372 6372
 	*
6373 6373
 	*/
6374
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6374
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
6375 6375
 	{
6376
-		$filter_query = $this->getFilter($filters,true,true);
6377
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6378
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6376
+		$filter_query = $this->getFilter($filters, true, true);
6377
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6378
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6379 6379
                     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) 
6380 6380
                     GROUP BY spotter_output.aircraft_manufacturer 
6381 6381
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6387,7 +6387,7 @@  discard block
 block discarded – undo
6387 6387
 		$aircraft_array = array();
6388 6388
 		$temp_array = array();
6389 6389
         
6390
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6390
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6391 6391
 		{
6392 6392
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6393 6393
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6406,38 +6406,38 @@  discard block
 block discarded – undo
6406 6406
 	* @return Array the aircraft list
6407 6407
 	*
6408 6408
 	*/
6409
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6409
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6410 6410
 	{
6411 6411
 		global $globalDBdriver;
6412
-		$filter_query = $this->getFilter($filters,true,true);
6413
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6412
+		$filter_query = $this->getFilter($filters, true, true);
6413
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6414 6414
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6415 6415
                 $query_values = array();
6416 6416
 		if ($year != '') {
6417 6417
 			if ($globalDBdriver == 'mysql') {
6418 6418
 				$query .= " AND YEAR(spotter_output.date) = :year";
6419
-				$query_values = array_merge($query_values,array(':year' => $year));
6419
+				$query_values = array_merge($query_values, array(':year' => $year));
6420 6420
 			} else {
6421 6421
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6422
-				$query_values = array_merge($query_values,array(':year' => $year));
6422
+				$query_values = array_merge($query_values, array(':year' => $year));
6423 6423
 			}
6424 6424
 		}
6425 6425
 		if ($month != '') {
6426 6426
 			if ($globalDBdriver == 'mysql') {
6427 6427
 				$query .= " AND MONTH(spotter_output.date) = :month";
6428
-				$query_values = array_merge($query_values,array(':month' => $month));
6428
+				$query_values = array_merge($query_values, array(':month' => $month));
6429 6429
 			} else {
6430 6430
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6431
-				$query_values = array_merge($query_values,array(':month' => $month));
6431
+				$query_values = array_merge($query_values, array(':month' => $month));
6432 6432
 			}
6433 6433
 		}
6434 6434
 		if ($day != '') {
6435 6435
 			if ($globalDBdriver == 'mysql') {
6436 6436
 				$query .= " AND DAY(spotter_output.date) = :day";
6437
-				$query_values = array_merge($query_values,array(':day' => $day));
6437
+				$query_values = array_merge($query_values, array(':day' => $day));
6438 6438
 			} else {
6439 6439
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6440
-				$query_values = array_merge($query_values,array(':day' => $day));
6440
+				$query_values = array_merge($query_values, array(':day' => $day));
6441 6441
 			}
6442 6442
 		}
6443 6443
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6451,7 +6451,7 @@  discard block
 block discarded – undo
6451 6451
 		$manufacturer_array = array();
6452 6452
 		$temp_array = array();
6453 6453
         
6454
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6454
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6455 6455
 		{
6456 6456
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6457 6457
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6470,12 +6470,12 @@  discard block
 block discarded – undo
6470 6470
 	* @return Array the aircraft list
6471 6471
 	*
6472 6472
 	*/
6473
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6473
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6474 6474
 	{
6475 6475
 		global $globalDBdriver;
6476 6476
 		$Image = new Image($this->db);
6477
-		$filter_query = $this->getFilter($filters,true,true);
6478
-		$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    
6477
+		$filter_query = $this->getFilter($filters, true, true);
6478
+		$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    
6479 6479
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6480 6480
                 if ($olderthanmonths > 0) {
6481 6481
             		if ($globalDBdriver == 'mysql') {
@@ -6495,28 +6495,28 @@  discard block
 block discarded – undo
6495 6495
 		if ($year != '') {
6496 6496
 			if ($globalDBdriver == 'mysql') {
6497 6497
 				$query .= " AND YEAR(spotter_output.date) = :year";
6498
-				$query_values = array_merge($query_values,array(':year' => $year));
6498
+				$query_values = array_merge($query_values, array(':year' => $year));
6499 6499
 			} else {
6500 6500
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6501
-				$query_values = array_merge($query_values,array(':year' => $year));
6501
+				$query_values = array_merge($query_values, array(':year' => $year));
6502 6502
 			}
6503 6503
 		}
6504 6504
 		if ($month != '') {
6505 6505
 			if ($globalDBdriver == 'mysql') {
6506 6506
 				$query .= " AND MONTH(spotter_output.date) = :month";
6507
-				$query_values = array_merge($query_values,array(':month' => $month));
6507
+				$query_values = array_merge($query_values, array(':month' => $month));
6508 6508
 			} else {
6509 6509
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6510
-				$query_values = array_merge($query_values,array(':month' => $month));
6510
+				$query_values = array_merge($query_values, array(':month' => $month));
6511 6511
 			}
6512 6512
 		}
6513 6513
 		if ($day != '') {
6514 6514
 			if ($globalDBdriver == 'mysql') {
6515 6515
 				$query .= " AND DAY(spotter_output.date) = :day";
6516
-				$query_values = array_merge($query_values,array(':day' => $day));
6516
+				$query_values = array_merge($query_values, array(':day' => $day));
6517 6517
 			} else {
6518 6518
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6519
-				$query_values = array_merge($query_values,array(':day' => $day));
6519
+				$query_values = array_merge($query_values, array(':day' => $day));
6520 6520
 			}
6521 6521
 		}
6522 6522
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6528,7 +6528,7 @@  discard block
 block discarded – undo
6528 6528
 		$aircraft_array = array();
6529 6529
 		$temp_array = array();
6530 6530
         
6531
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6531
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6532 6532
 		{
6533 6533
 			$temp_array['registration'] = $row['registration'];
6534 6534
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6536,7 +6536,7 @@  discard block
 block discarded – undo
6536 6536
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6537 6537
 			$temp_array['airline_name'] = $row['airline_name'];
6538 6538
 			$temp_array['image_thumbnail'] = "";
6539
-			if($row['registration'] != "")
6539
+			if ($row['registration'] != "")
6540 6540
 			{
6541 6541
 				$image_array = $Image->getSpotterImage($row['registration']);
6542 6542
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6555,12 +6555,12 @@  discard block
 block discarded – undo
6555 6555
 	* @return Array the aircraft list
6556 6556
 	*
6557 6557
 	*/
6558
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6558
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6559 6559
 	{
6560 6560
 		global $globalDBdriver;
6561
-		$filter_query = $this->getFilter($filters,true,true);
6561
+		$filter_query = $this->getFilter($filters, true, true);
6562 6562
 		$Image = new Image($this->db);
6563
-		$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    
6563
+		$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    
6564 6564
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6565 6565
                 if ($olderthanmonths > 0) {
6566 6566
             		if ($globalDBdriver == 'mysql') {
@@ -6588,7 +6588,7 @@  discard block
 block discarded – undo
6588 6588
 		$aircraft_array = array();
6589 6589
 		$temp_array = array();
6590 6590
         
6591
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6591
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6592 6592
 		{
6593 6593
 			$temp_array['registration'] = $row['registration'];
6594 6594
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6597,7 +6597,7 @@  discard block
 block discarded – undo
6597 6597
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6598 6598
 			$temp_array['airline_name'] = $row['airline_name'];
6599 6599
 			$temp_array['image_thumbnail'] = "";
6600
-			if($row['registration'] != "")
6600
+			if ($row['registration'] != "")
6601 6601
 			{
6602 6602
 				$image_array = $Image->getSpotterImage($row['registration']);
6603 6603
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6616,11 +6616,11 @@  discard block
 block discarded – undo
6616 6616
 	* @return Array the airport list
6617 6617
 	*
6618 6618
 	*/
6619
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6619
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6620 6620
 	{
6621 6621
 		global $globalDBdriver;
6622
-		$filter_query = $this->getFilter($filters,true,true);
6623
-		$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 
6622
+		$filter_query = $this->getFilter($filters, true, true);
6623
+		$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 
6624 6624
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6625 6625
                 if ($olderthanmonths > 0) {
6626 6626
             		if ($globalDBdriver == 'mysql') {
@@ -6640,28 +6640,28 @@  discard block
 block discarded – undo
6640 6640
 		if ($year != '') {
6641 6641
 			if ($globalDBdriver == 'mysql') {
6642 6642
 				$query .= " AND YEAR(spotter_output.date) = :year";
6643
-				$query_values = array_merge($query_values,array(':year' => $year));
6643
+				$query_values = array_merge($query_values, array(':year' => $year));
6644 6644
 			} else {
6645 6645
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6646
-				$query_values = array_merge($query_values,array(':year' => $year));
6646
+				$query_values = array_merge($query_values, array(':year' => $year));
6647 6647
 			}
6648 6648
 		}
6649 6649
 		if ($month != '') {
6650 6650
 			if ($globalDBdriver == 'mysql') {
6651 6651
 				$query .= " AND MONTH(spotter_output.date) = :month";
6652
-				$query_values = array_merge($query_values,array(':month' => $month));
6652
+				$query_values = array_merge($query_values, array(':month' => $month));
6653 6653
 			} else {
6654 6654
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6655
-				$query_values = array_merge($query_values,array(':month' => $month));
6655
+				$query_values = array_merge($query_values, array(':month' => $month));
6656 6656
 			}
6657 6657
 		}
6658 6658
 		if ($day != '') {
6659 6659
 			if ($globalDBdriver == 'mysql') {
6660 6660
 				$query .= " AND DAY(spotter_output.date) = :day";
6661
-				$query_values = array_merge($query_values,array(':day' => $day));
6661
+				$query_values = array_merge($query_values, array(':day' => $day));
6662 6662
 			} else {
6663 6663
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6664
-				$query_values = array_merge($query_values,array(':day' => $day));
6664
+				$query_values = array_merge($query_values, array(':day' => $day));
6665 6665
 			}
6666 6666
 		}
6667 6667
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6673,7 +6673,7 @@  discard block
 block discarded – undo
6673 6673
 
6674 6674
 		$airport_array = array();
6675 6675
 		$temp_array = array();
6676
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6676
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6677 6677
 		{
6678 6678
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6679 6679
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6692,11 +6692,11 @@  discard block
 block discarded – undo
6692 6692
 	* @return Array the airport list
6693 6693
 	*
6694 6694
 	*/
6695
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6695
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6696 6696
 	{
6697 6697
 		global $globalDBdriver;
6698
-		$filter_query = $this->getFilter($filters,true,true);
6699
-		$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 
6698
+		$filter_query = $this->getFilter($filters, true, true);
6699
+		$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 
6700 6700
 			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 <> '' ";
6701 6701
                 if ($olderthanmonths > 0) {
6702 6702
             		if ($globalDBdriver == 'mysql') {
@@ -6725,7 +6725,7 @@  discard block
 block discarded – undo
6725 6725
 		$airport_array = array();
6726 6726
 		$temp_array = array();
6727 6727
         
6728
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6728
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6729 6729
 		{
6730 6730
 			$temp_array['airline_icao'] = $row['airline_icao'];
6731 6731
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6745,11 +6745,11 @@  discard block
 block discarded – undo
6745 6745
 	* @return Array the airport list
6746 6746
 	*
6747 6747
 	*/
6748
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6748
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6749 6749
 	{
6750 6750
 		global $globalDBdriver;
6751
-		$filter_query = $this->getFilter($filters,true,true);
6752
-		$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
6751
+		$filter_query = $this->getFilter($filters, true, true);
6752
+		$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
6753 6753
 				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";
6754 6754
                 if ($olderthanmonths > 0) {
6755 6755
             		if ($globalDBdriver == 'mysql') {
@@ -6769,28 +6769,28 @@  discard block
 block discarded – undo
6769 6769
 		if ($year != '') {
6770 6770
 			if ($globalDBdriver == 'mysql') {
6771 6771
 				$query .= " AND YEAR(spotter_output.date) = :year";
6772
-				$query_values = array_merge($query_values,array(':year' => $year));
6772
+				$query_values = array_merge($query_values, array(':year' => $year));
6773 6773
 			} else {
6774 6774
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6775
-				$query_values = array_merge($query_values,array(':year' => $year));
6775
+				$query_values = array_merge($query_values, array(':year' => $year));
6776 6776
 			}
6777 6777
 		}
6778 6778
 		if ($month != '') {
6779 6779
 			if ($globalDBdriver == 'mysql') {
6780 6780
 				$query .= " AND MONTH(spotter_output.date) = :month";
6781
-				$query_values = array_merge($query_values,array(':month' => $month));
6781
+				$query_values = array_merge($query_values, array(':month' => $month));
6782 6782
 			} else {
6783 6783
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6784
-				$query_values = array_merge($query_values,array(':month' => $month));
6784
+				$query_values = array_merge($query_values, array(':month' => $month));
6785 6785
 			}
6786 6786
 		}
6787 6787
 		if ($day != '') {
6788 6788
 			if ($globalDBdriver == 'mysql') {
6789 6789
 				$query .= " AND DAY(spotter_output.date) = :day";
6790
-				$query_values = array_merge($query_values,array(':day' => $day));
6790
+				$query_values = array_merge($query_values, array(':day' => $day));
6791 6791
 			} else {
6792 6792
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6793
-				$query_values = array_merge($query_values,array(':day' => $day));
6793
+				$query_values = array_merge($query_values, array(':day' => $day));
6794 6794
 			}
6795 6795
 		}
6796 6796
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
@@ -6803,7 +6803,7 @@  discard block
 block discarded – undo
6803 6803
 		$airport_array = array();
6804 6804
 		$temp_array = array();
6805 6805
         
6806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6807 6807
 		{
6808 6808
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6809 6809
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6822,11 +6822,11 @@  discard block
 block discarded – undo
6822 6822
 	* @return Array the airport list
6823 6823
 	*
6824 6824
 	*/
6825
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6825
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6826 6826
 	{
6827 6827
 		global $globalDBdriver;
6828
-		$filter_query = $this->getFilter($filters,true,true);
6829
-		$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
6828
+		$filter_query = $this->getFilter($filters, true, true);
6829
+		$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
6830 6830
 				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 ";
6831 6831
                 if ($olderthanmonths > 0) {
6832 6832
             		if ($globalDBdriver == 'mysql') {
@@ -6855,7 +6855,7 @@  discard block
 block discarded – undo
6855 6855
 		$airport_array = array();
6856 6856
 		$temp_array = array();
6857 6857
         
6858
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6858
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6859 6859
 		{
6860 6860
 			$temp_array['airline_icao'] = $row['airline_icao'];
6861 6861
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6875,11 +6875,11 @@  discard block
 block discarded – undo
6875 6875
 	* @return Array the airport list
6876 6876
 	*
6877 6877
 	*/
6878
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6878
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6879 6879
 	{
6880
-		$filter_query = $this->getFilter($filters,true,true);
6881
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6882
-		$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 
6880
+		$filter_query = $this->getFilter($filters, true, true);
6881
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6882
+		$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 
6883 6883
 			    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 <> '' 
6884 6884
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6885 6885
 			    ORDER BY airport_departure_icao_count DESC";
@@ -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['airport_departure_icao'] = $row['departure_airport_icao'];
6897 6897
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6913,11 +6913,11 @@  discard block
 block discarded – undo
6913 6913
 	* @return Array the airport list
6914 6914
 	*
6915 6915
 	*/
6916
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6916
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6917 6917
 	{
6918
-		$filter_query = $this->getFilter($filters,true,true);
6919
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6920
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6918
+		$filter_query = $this->getFilter($filters, true, true);
6919
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6920
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6921 6921
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6922 6922
                     GROUP BY spotter_output.departure_airport_country
6923 6923
 					ORDER BY airport_departure_country_count DESC";
@@ -6929,7 +6929,7 @@  discard block
 block discarded – undo
6929 6929
 		$airport_array = array();
6930 6930
 		$temp_array = array();
6931 6931
         
6932
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6932
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6933 6933
 		{
6934 6934
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6935 6935
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6948,11 +6948,11 @@  discard block
 block discarded – undo
6948 6948
 	* @return Array the airport list
6949 6949
 	*
6950 6950
 	*/
6951
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6951
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6952 6952
 	{
6953
-		$filter_query = $this->getFilter($filters,true,true);
6954
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6955
-		$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 
6953
+		$filter_query = $this->getFilter($filters, true, true);
6954
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6955
+		$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 
6956 6956
 			    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 <> '' 
6957 6957
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6958 6958
 			    ORDER BY airport_departure_icao_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['airport_departure_icao'] = $row['departure_airport_icao'];
6970 6970
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6985,11 +6985,11 @@  discard block
 block discarded – undo
6985 6985
 	* @return Array the airport list
6986 6986
 	*
6987 6987
 	*/
6988
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6988
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
6989 6989
 	{
6990
-		$filter_query = $this->getFilter($filters,true,true);
6991
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6992
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6990
+		$filter_query = $this->getFilter($filters, true, true);
6991
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6992
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6993 6993
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6994 6994
                     GROUP BY spotter_output.departure_airport_country
6995 6995
 					ORDER BY airport_departure_country_count DESC";
@@ -7001,7 +7001,7 @@  discard block
 block discarded – undo
7001 7001
 		$airport_array = array();
7002 7002
 		$temp_array = array();
7003 7003
         
7004
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7004
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7005 7005
 		{
7006 7006
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7007 7007
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7019,11 +7019,11 @@  discard block
 block discarded – undo
7019 7019
 	* @return Array the airport list
7020 7020
 	*
7021 7021
 	*/
7022
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7022
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
7023 7023
 	{
7024
-		$filter_query = $this->getFilter($filters,true,true);
7025
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7026
-		$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 
7024
+		$filter_query = $this->getFilter($filters, true, true);
7025
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7026
+		$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 
7027 7027
 			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 <> '' 
7028 7028
                     GROUP BY spotter_output.departure_airport_icao
7029 7029
 					ORDER BY airport_departure_icao_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['airport_departure_icao'] = $row['departure_airport_icao'];
7041 7041
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7056,11 +7056,11 @@  discard block
 block discarded – undo
7056 7056
 	* @return Array the airport list
7057 7057
 	*
7058 7058
 	*/
7059
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7059
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
7060 7060
 	{
7061
-		$filter_query = $this->getFilter($filters,true,true);
7062
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7063
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7061
+		$filter_query = $this->getFilter($filters, true, true);
7062
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7063
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7064 7064
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
7065 7065
                     GROUP BY spotter_output.departure_airport_country
7066 7066
 					ORDER BY airport_departure_country_count DESC";
@@ -7072,7 +7072,7 @@  discard block
 block discarded – undo
7072 7072
 		$airport_array = array();
7073 7073
 		$temp_array = array();
7074 7074
         
7075
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7075
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7076 7076
 		{
7077 7077
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7078 7078
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7090,11 +7090,11 @@  discard block
 block discarded – undo
7090 7090
 	* @return Array the airport list
7091 7091
 	*
7092 7092
 	*/
7093
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7093
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
7094 7094
 	{
7095
-		$filter_query = $this->getFilter($filters,true,true);
7096
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7097
-		$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 
7095
+		$filter_query = $this->getFilter($filters, true, true);
7096
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7097
+		$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 
7098 7098
 			    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 <> '' 
7099 7099
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7100 7100
 			    ORDER BY airport_departure_icao_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['airport_departure_icao'] = $row['departure_airport_icao'];
7112 7112
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7127,11 +7127,11 @@  discard block
 block discarded – undo
7127 7127
 	* @return Array the airport list
7128 7128
 	*
7129 7129
 	*/
7130
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7130
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
7131 7131
 	{
7132
-		$filter_query = $this->getFilter($filters,true,true);
7133
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7134
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7132
+		$filter_query = $this->getFilter($filters, true, true);
7133
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7134
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7135 7135
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
7136 7136
                     GROUP BY spotter_output.departure_airport_country
7137 7137
 					ORDER BY airport_departure_country_count DESC";
@@ -7143,7 +7143,7 @@  discard block
 block discarded – undo
7143 7143
 		$airport_array = array();
7144 7144
 		$temp_array = array();
7145 7145
         
7146
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7146
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7147 7147
 		{
7148 7148
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7149 7149
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7162,11 +7162,11 @@  discard block
 block discarded – undo
7162 7162
 	* @return Array the airport list
7163 7163
 	*
7164 7164
 	*/
7165
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7165
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7166 7166
 	{
7167
-		$filter_query = $this->getFilter($filters,true,true);
7168
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7169
-		$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 
7167
+		$filter_query = $this->getFilter($filters, true, true);
7168
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7169
+		$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 
7170 7170
 			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 <> '' 
7171 7171
                     GROUP BY spotter_output.departure_airport_icao
7172 7172
 					ORDER BY airport_departure_icao_count DESC";
@@ -7178,7 +7178,7 @@  discard block
 block discarded – undo
7178 7178
 		$airport_array = array();
7179 7179
 		$temp_array = array();
7180 7180
         
7181
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7181
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7182 7182
 		{
7183 7183
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7184 7184
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7199,11 +7199,11 @@  discard block
 block discarded – undo
7199 7199
 	* @return Array the airport list
7200 7200
 	*
7201 7201
 	*/
7202
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7202
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7203 7203
 	{
7204
-		$filter_query = $this->getFilter($filters,true,true);
7205
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7206
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7204
+		$filter_query = $this->getFilter($filters, true, true);
7205
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7206
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7207 7207
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7208 7208
                     GROUP BY spotter_output.departure_airport_country
7209 7209
 					ORDER BY airport_departure_country_count DESC";
@@ -7215,7 +7215,7 @@  discard block
 block discarded – undo
7215 7215
 		$airport_array = array();
7216 7216
 		$temp_array = array();
7217 7217
         
7218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7219 7219
 		{
7220 7220
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7221 7221
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7233,11 +7233,11 @@  discard block
 block discarded – undo
7233 7233
 	* @return Array the airport list
7234 7234
 	*
7235 7235
 	*/
7236
-	public function countAllDepartureAirportsByDate($date,$filters = array())
7236
+	public function countAllDepartureAirportsByDate($date, $filters = array())
7237 7237
 	{
7238 7238
 		global $globalTimezone, $globalDBdriver;
7239
-		$filter_query = $this->getFilter($filters,true,true);
7240
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7239
+		$filter_query = $this->getFilter($filters, true, true);
7240
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7241 7241
 		if ($globalTimezone != '') {
7242 7242
 			date_default_timezone_set($globalTimezone);
7243 7243
 			$datetime = new DateTime($date);
@@ -7245,12 +7245,12 @@  discard block
 block discarded – undo
7245 7245
 		} else $offset = '+00:00';
7246 7246
 
7247 7247
 		if ($globalDBdriver == 'mysql') {
7248
-			$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 
7248
+			$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 
7249 7249
 					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
7250 7250
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7251 7251
 					ORDER BY airport_departure_icao_count DESC";
7252 7252
 		} else {
7253
-			$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 
7253
+			$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 
7254 7254
 					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
7255 7255
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7256 7256
 					ORDER BY airport_departure_icao_count DESC";
@@ -7262,7 +7262,7 @@  discard block
 block discarded – undo
7262 7262
 		$airport_array = array();
7263 7263
 		$temp_array = array();
7264 7264
         
7265
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7265
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7266 7266
 		{
7267 7267
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7268 7268
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7283,11 +7283,11 @@  discard block
 block discarded – undo
7283 7283
 	* @return Array the airport list
7284 7284
 	*
7285 7285
 	*/
7286
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7286
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
7287 7287
 	{
7288 7288
 		global $globalTimezone, $globalDBdriver;
7289
-		$filter_query = $this->getFilter($filters,true,true);
7290
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7289
+		$filter_query = $this->getFilter($filters, true, true);
7290
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7291 7291
 		if ($globalTimezone != '') {
7292 7292
 			date_default_timezone_set($globalTimezone);
7293 7293
 			$datetime = new DateTime($date);
@@ -7295,12 +7295,12 @@  discard block
 block discarded – undo
7295 7295
 		} else $offset = '+00:00';
7296 7296
 
7297 7297
 		if ($globalDBdriver == 'mysql') {
7298
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7298
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7299 7299
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7300 7300
 					GROUP BY spotter_output.departure_airport_country
7301 7301
 					ORDER BY airport_departure_country_count DESC";
7302 7302
 		} else {
7303
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7303
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7304 7304
 					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 
7305 7305
 					GROUP BY spotter_output.departure_airport_country
7306 7306
 					ORDER BY airport_departure_country_count DESC";
@@ -7312,7 +7312,7 @@  discard block
 block discarded – undo
7312 7312
 		$airport_array = array();
7313 7313
 		$temp_array = array();
7314 7314
         
7315
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7315
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7316 7316
 		{
7317 7317
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7318 7318
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7330,11 +7330,11 @@  discard block
 block discarded – undo
7330 7330
 	* @return Array the airport list
7331 7331
 	*
7332 7332
 	*/
7333
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7333
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
7334 7334
 	{
7335
-		$filter_query = $this->getFilter($filters,true,true);
7336
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7337
-		$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 
7335
+		$filter_query = $this->getFilter($filters, true, true);
7336
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7337
+		$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 
7338 7338
 		    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 
7339 7339
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7340 7340
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7346,7 +7346,7 @@  discard block
 block discarded – undo
7346 7346
 		$airport_array = array();
7347 7347
 		$temp_array = array();
7348 7348
         
7349
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7349
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7350 7350
 		{
7351 7351
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7352 7352
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7366,11 +7366,11 @@  discard block
 block discarded – undo
7366 7366
 	* @return Array the airport list
7367 7367
 	*
7368 7368
 	*/
7369
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7369
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
7370 7370
 	{
7371
-		$filter_query = $this->getFilter($filters,true,true);
7372
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7373
-		$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 
7371
+		$filter_query = $this->getFilter($filters, true, true);
7372
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7373
+		$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 
7374 7374
 		    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 
7375 7375
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7376 7376
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7382,7 +7382,7 @@  discard block
 block discarded – undo
7382 7382
 		$airport_array = array();
7383 7383
 		$temp_array = array();
7384 7384
         
7385
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7385
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7386 7386
 		{
7387 7387
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7388 7388
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7402,11 +7402,11 @@  discard block
 block discarded – undo
7402 7402
 	* @return Array the airport list
7403 7403
 	*
7404 7404
 	*/
7405
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7405
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7406 7406
 	{
7407
-		$filter_query = $this->getFilter($filters,true,true);
7408
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7409
-		$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 
7407
+		$filter_query = $this->getFilter($filters, true, true);
7408
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7409
+		$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 
7410 7410
 		    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) 
7411 7411
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7412 7412
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7417,7 +7417,7 @@  discard block
 block discarded – undo
7417 7417
 		$airport_array = array();
7418 7418
 		$temp_array = array();
7419 7419
         
7420
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7420
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7421 7421
 		{
7422 7422
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7423 7423
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7439,11 +7439,11 @@  discard block
 block discarded – undo
7439 7439
 	* @return Array the airport list
7440 7440
 	*
7441 7441
 	*/
7442
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7442
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7443 7443
 	{
7444
-		$filter_query = $this->getFilter($filters,true,true);
7445
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7446
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7444
+		$filter_query = $this->getFilter($filters, true, true);
7445
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7446
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7447 7447
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7448 7448
                     GROUP BY spotter_output.departure_airport_country
7449 7449
 					ORDER BY airport_departure_country_count DESC";
@@ -7455,7 +7455,7 @@  discard block
 block discarded – undo
7455 7455
 		$airport_array = array();
7456 7456
 		$temp_array = array();
7457 7457
         
7458
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7458
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7459 7459
 		{
7460 7460
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7461 7461
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7472,11 +7472,11 @@  discard block
 block discarded – undo
7472 7472
 	* @return Array the airport list
7473 7473
 	*
7474 7474
 	*/
7475
-	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7475
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7476 7476
 	{
7477
-		$filter_query = $this->getFilter($filters,true,true);
7478
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7479
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7477
+		$filter_query = $this->getFilter($filters, true, true);
7478
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7479
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7480 7480
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7481 7481
 			GROUP BY spotter_output.departure_airport_country
7482 7482
 			ORDER BY airport_departure_country_count DESC";
@@ -7492,11 +7492,11 @@  discard block
 block discarded – undo
7492 7492
 	* @return Array the airport list
7493 7493
 	*
7494 7494
 	*/
7495
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7495
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7496 7496
 	{
7497
-		$filter_query = $this->getFilter($filters,true,true);
7498
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7499
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7497
+		$filter_query = $this->getFilter($filters, true, true);
7498
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7499
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7500 7500
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7501 7501
 			GROUP BY spotter_output.departure_airport_country
7502 7502
 			ORDER BY airport_departure_country_count DESC";
@@ -7514,12 +7514,12 @@  discard block
 block discarded – undo
7514 7514
 	* @return Array the airport list
7515 7515
 	*
7516 7516
 	*/
7517
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7517
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7518 7518
 	{
7519
-		$filter_query = $this->getFilter($filters,true,true);
7520
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7519
+		$filter_query = $this->getFilter($filters, true, true);
7520
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7521 7521
 
7522
-		$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 
7522
+		$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 
7523 7523
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7524 7524
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7525 7525
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7531,7 +7531,7 @@  discard block
 block discarded – undo
7531 7531
 		$airport_array = array();
7532 7532
 		$temp_array = array();
7533 7533
         
7534
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7534
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7535 7535
 		{
7536 7536
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7537 7537
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7552,11 +7552,11 @@  discard block
 block discarded – undo
7552 7552
 	* @return Array the airport list
7553 7553
 	*
7554 7554
 	*/
7555
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7555
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7556 7556
 	{
7557
-		$filter_query = $this->getFilter($filters,true,true);
7558
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7559
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7557
+		$filter_query = $this->getFilter($filters, true, true);
7558
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7559
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7560 7560
 			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 
7561 7561
                     GROUP BY spotter_output.departure_airport_country
7562 7562
 					ORDER BY airport_departure_country_count DESC";
@@ -7568,7 +7568,7 @@  discard block
 block discarded – undo
7568 7568
 		$airport_array = array();
7569 7569
 		$temp_array = array();
7570 7570
         
7571
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7571
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7572 7572
 		{
7573 7573
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7574 7574
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7591,11 +7591,11 @@  discard block
 block discarded – undo
7591 7591
 	* @return Array the airport list
7592 7592
 	*
7593 7593
 	*/
7594
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7594
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7595 7595
 	{
7596 7596
 		global $globalDBdriver;
7597
-		$filter_query = $this->getFilter($filters,true,true);
7598
-		$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 
7597
+		$filter_query = $this->getFilter($filters, true, true);
7598
+		$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 
7599 7599
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7600 7600
                 if ($olderthanmonths > 0) {
7601 7601
             		if ($globalDBdriver == 'mysql') {
@@ -7615,28 +7615,28 @@  discard block
 block discarded – undo
7615 7615
 		if ($year != '') {
7616 7616
 			if ($globalDBdriver == 'mysql') {
7617 7617
 				$query .= " AND YEAR(spotter_output.date) = :year";
7618
-				$query_values = array_merge($query_values,array(':year' => $year));
7618
+				$query_values = array_merge($query_values, array(':year' => $year));
7619 7619
 			} else {
7620 7620
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7621
-				$query_values = array_merge($query_values,array(':year' => $year));
7621
+				$query_values = array_merge($query_values, array(':year' => $year));
7622 7622
 			}
7623 7623
 		}
7624 7624
 		if ($month != '') {
7625 7625
 			if ($globalDBdriver == 'mysql') {
7626 7626
 				$query .= " AND MONTH(spotter_output.date) = :month";
7627
-				$query_values = array_merge($query_values,array(':month' => $month));
7627
+				$query_values = array_merge($query_values, array(':month' => $month));
7628 7628
 			} else {
7629 7629
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7630
-				$query_values = array_merge($query_values,array(':month' => $month));
7630
+				$query_values = array_merge($query_values, array(':month' => $month));
7631 7631
 			}
7632 7632
 		}
7633 7633
 		if ($day != '') {
7634 7634
 			if ($globalDBdriver == 'mysql') {
7635 7635
 				$query .= " AND DAY(spotter_output.date) = :day";
7636
-				$query_values = array_merge($query_values,array(':day' => $day));
7636
+				$query_values = array_merge($query_values, array(':day' => $day));
7637 7637
 			} else {
7638 7638
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7639
-				$query_values = array_merge($query_values,array(':day' => $day));
7639
+				$query_values = array_merge($query_values, array(':day' => $day));
7640 7640
 			}
7641 7641
 		}
7642 7642
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7650,7 +7650,7 @@  discard block
 block discarded – undo
7650 7650
 		$airport_array = array();
7651 7651
 		$temp_array = array();
7652 7652
         
7653
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7653
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7654 7654
 		{
7655 7655
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7656 7656
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7673,11 +7673,11 @@  discard block
 block discarded – undo
7673 7673
 	* @return Array the airport list
7674 7674
 	*
7675 7675
 	*/
7676
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7676
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7677 7677
 	{
7678 7678
 		global $globalDBdriver;
7679
-		$filter_query = $this->getFilter($filters,true,true);
7680
-		$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 
7679
+		$filter_query = $this->getFilter($filters, true, true);
7680
+		$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 
7681 7681
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7682 7682
                 if ($olderthanmonths > 0) {
7683 7683
             		if ($globalDBdriver == 'mysql') {
@@ -7707,7 +7707,7 @@  discard block
 block discarded – undo
7707 7707
 		$airport_array = array();
7708 7708
 		$temp_array = array();
7709 7709
         
7710
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7710
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7711 7711
 		{
7712 7712
 			$temp_array['airline_icao'] = $row['airline_icao'];
7713 7713
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7732,11 +7732,11 @@  discard block
 block discarded – undo
7732 7732
 	* @return Array the airport list
7733 7733
 	*
7734 7734
 	*/
7735
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7735
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7736 7736
 	{
7737 7737
 		global $globalDBdriver;
7738
-		$filter_query = $this->getFilter($filters,true,true);
7739
-		$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 
7738
+		$filter_query = $this->getFilter($filters, true, true);
7739
+		$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 
7740 7740
 			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";
7741 7741
                 if ($olderthanmonths > 0) {
7742 7742
             		if ($globalDBdriver == 'mysql') {
@@ -7756,28 +7756,28 @@  discard block
 block discarded – undo
7756 7756
 		if ($year != '') {
7757 7757
 			if ($globalDBdriver == 'mysql') {
7758 7758
 				$query .= " AND YEAR(spotter_output.date) = :year";
7759
-				$query_values = array_merge($query_values,array(':year' => $year));
7759
+				$query_values = array_merge($query_values, array(':year' => $year));
7760 7760
 			} else {
7761 7761
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7762
-				$query_values = array_merge($query_values,array(':year' => $year));
7762
+				$query_values = array_merge($query_values, array(':year' => $year));
7763 7763
 			}
7764 7764
 		}
7765 7765
 		if ($month != '') {
7766 7766
 			if ($globalDBdriver == 'mysql') {
7767 7767
 				$query .= " AND MONTH(spotter_output.date) = :month";
7768
-				$query_values = array_merge($query_values,array(':month' => $month));
7768
+				$query_values = array_merge($query_values, array(':month' => $month));
7769 7769
 			} else {
7770 7770
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7771
-				$query_values = array_merge($query_values,array(':month' => $month));
7771
+				$query_values = array_merge($query_values, array(':month' => $month));
7772 7772
 			}
7773 7773
 		}
7774 7774
 		if ($day != '') {
7775 7775
 			if ($globalDBdriver == 'mysql') {
7776 7776
 				$query .= " AND DAY(spotter_output.date) = :day";
7777
-				$query_values = array_merge($query_values,array(':day' => $day));
7777
+				$query_values = array_merge($query_values, array(':day' => $day));
7778 7778
 			} else {
7779 7779
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7780
-				$query_values = array_merge($query_values,array(':day' => $day));
7780
+				$query_values = array_merge($query_values, array(':day' => $day));
7781 7781
 			}
7782 7782
 		}
7783 7783
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
@@ -7790,7 +7790,7 @@  discard block
 block discarded – undo
7790 7790
       
7791 7791
 		$airport_array = array();
7792 7792
 		$temp_array = array();
7793
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7793
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7794 7794
 		{
7795 7795
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7796 7796
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7813,11 +7813,11 @@  discard block
 block discarded – undo
7813 7813
 	* @return Array the airport list
7814 7814
 	*
7815 7815
 	*/
7816
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7816
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7817 7817
 	{
7818 7818
 		global $globalDBdriver;
7819
-		$filter_query = $this->getFilter($filters,true,true);
7820
-		$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 
7819
+		$filter_query = $this->getFilter($filters, true, true);
7820
+		$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 
7821 7821
 			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 ";
7822 7822
                 if ($olderthanmonths > 0) {
7823 7823
             		if ($globalDBdriver == 'mysql') {
@@ -7847,7 +7847,7 @@  discard block
 block discarded – undo
7847 7847
 		$airport_array = array();
7848 7848
 		$temp_array = array();
7849 7849
         
7850
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7850
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7851 7851
 		{
7852 7852
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7853 7853
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7873,9 +7873,9 @@  discard block
 block discarded – undo
7873 7873
 	*/
7874 7874
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7875 7875
 	{
7876
-		$filter_query = $this->getFilter($filters,true,true);
7877
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7878
-		$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 
7876
+		$filter_query = $this->getFilter($filters, true, true);
7877
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7878
+		$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 
7879 7879
 			    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 
7880 7880
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7881 7881
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7886,7 +7886,7 @@  discard block
 block discarded – undo
7886 7886
 		$airport_array = array();
7887 7887
 		$temp_array = array();
7888 7888
         
7889
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7889
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7890 7890
 		{
7891 7891
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7892 7892
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7907,12 +7907,12 @@  discard block
 block discarded – undo
7907 7907
 	* @return Array the airport list
7908 7908
 	*
7909 7909
 	*/
7910
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7910
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7911 7911
 	{
7912
-		$filter_query = $this->getFilter($filters,true,true);
7913
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7912
+		$filter_query = $this->getFilter($filters, true, true);
7913
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7914 7914
 					
7915
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7915
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7916 7916
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7917 7917
                     GROUP BY spotter_output.arrival_airport_country
7918 7918
 					ORDER BY airport_arrival_country_count DESC";
@@ -7924,7 +7924,7 @@  discard block
 block discarded – undo
7924 7924
 		$airport_array = array();
7925 7925
 		$temp_array = array();
7926 7926
         
7927
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7927
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7928 7928
 		{
7929 7929
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7930 7930
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7942,11 +7942,11 @@  discard block
 block discarded – undo
7942 7942
 	* @return Array the airport list
7943 7943
 	*
7944 7944
 	*/
7945
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7945
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7946 7946
 	{
7947
-		$filter_query = $this->getFilter($filters,true,true);
7948
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7949
-		$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 
7947
+		$filter_query = $this->getFilter($filters, true, true);
7948
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7949
+		$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 
7950 7950
 			    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 
7951 7951
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7952 7952
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7958,7 +7958,7 @@  discard block
 block discarded – undo
7958 7958
 		$airport_array = array();
7959 7959
 		$temp_array = array();
7960 7960
         
7961
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7961
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7962 7962
 		{
7963 7963
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7964 7964
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7980,11 +7980,11 @@  discard block
 block discarded – undo
7980 7980
 	* @return Array the airport list
7981 7981
 	*
7982 7982
 	*/
7983
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7983
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
7984 7984
 	{
7985
-		$filter_query = $this->getFilter($filters,true,true);
7986
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7987
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7985
+		$filter_query = $this->getFilter($filters, true, true);
7986
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7987
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7988 7988
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7989 7989
                     GROUP BY spotter_output.arrival_airport_country
7990 7990
 					ORDER BY airport_arrival_country_count DESC";
@@ -7996,7 +7996,7 @@  discard block
 block discarded – undo
7996 7996
 		$airport_array = array();
7997 7997
 		$temp_array = array();
7998 7998
         
7999
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7999
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8000 8000
 		{
8001 8001
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8002 8002
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8014,12 +8014,12 @@  discard block
 block discarded – undo
8014 8014
 	* @return Array the airport list
8015 8015
 	*
8016 8016
 	*/
8017
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8017
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
8018 8018
 	{
8019
-		$filter_query = $this->getFilter($filters,true,true);
8020
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8019
+		$filter_query = $this->getFilter($filters, true, true);
8020
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8021 8021
 
8022
-		$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 
8022
+		$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 
8023 8023
 			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 
8024 8024
                     GROUP BY spotter_output.arrival_airport_icao
8025 8025
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8031,7 +8031,7 @@  discard block
 block discarded – undo
8031 8031
 		$airport_array = array();
8032 8032
 		$temp_array = array();
8033 8033
         
8034
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8034
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8035 8035
 		{
8036 8036
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8037 8037
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8052,11 +8052,11 @@  discard block
 block discarded – undo
8052 8052
 	* @return Array the airport list
8053 8053
 	*
8054 8054
 	*/
8055
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8055
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
8056 8056
 	{
8057
-		$filter_query = $this->getFilter($filters,true,true);
8058
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8059
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8057
+		$filter_query = $this->getFilter($filters, true, true);
8058
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8059
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8060 8060
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
8061 8061
                     GROUP BY spotter_output.arrival_airport_country
8062 8062
 					ORDER BY airport_arrival_country_count DESC";
@@ -8068,7 +8068,7 @@  discard block
 block discarded – undo
8068 8068
 		$airport_array = array();
8069 8069
 		$temp_array = array();
8070 8070
         
8071
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8071
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8072 8072
 		{
8073 8073
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8074 8074
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8087,11 +8087,11 @@  discard block
 block discarded – undo
8087 8087
 	* @return Array the airport list
8088 8088
 	*
8089 8089
 	*/
8090
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8090
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
8091 8091
 	{
8092
-		$filter_query = $this->getFilter($filters,true,true);
8093
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8094
-		$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 
8092
+		$filter_query = $this->getFilter($filters, true, true);
8093
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8094
+		$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 
8095 8095
 			    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 
8096 8096
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8097 8097
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8103,7 +8103,7 @@  discard block
 block discarded – undo
8103 8103
 		$airport_array = array();
8104 8104
 		$temp_array = array();
8105 8105
         
8106
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8106
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8107 8107
 		{
8108 8108
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8109 8109
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8124,11 +8124,11 @@  discard block
 block discarded – undo
8124 8124
 	* @return Array the airport list
8125 8125
 	*
8126 8126
 	*/
8127
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8127
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
8128 8128
 	{
8129
-		$filter_query = $this->getFilter($filters,true,true);
8130
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8131
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8129
+		$filter_query = $this->getFilter($filters, true, true);
8130
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8131
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8132 8132
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8133 8133
                     GROUP BY spotter_output.arrival_airport_country
8134 8134
 					ORDER BY airport_arrival_country_count DESC";
@@ -8140,7 +8140,7 @@  discard block
 block discarded – undo
8140 8140
 		$airport_array = array();
8141 8141
 		$temp_array = array();
8142 8142
         
8143
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8143
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8144 8144
 		{
8145 8145
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8146 8146
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8158,11 +8158,11 @@  discard block
 block discarded – undo
8158 8158
 	* @return Array the airport list
8159 8159
 	*
8160 8160
 	*/
8161
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8161
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
8162 8162
 	{
8163
-		$filter_query = $this->getFilter($filters,true,true);
8164
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8165
-		$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 
8163
+		$filter_query = $this->getFilter($filters, true, true);
8164
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8165
+		$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 
8166 8166
 			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 
8167 8167
                     GROUP BY spotter_output.arrival_airport_icao
8168 8168
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8174,7 +8174,7 @@  discard block
 block discarded – undo
8174 8174
 		$airport_array = array();
8175 8175
 		$temp_array = array();
8176 8176
         
8177
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8177
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8178 8178
 		{
8179 8179
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8180 8180
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8196,11 +8196,11 @@  discard block
 block discarded – undo
8196 8196
 	* @return Array the airport list
8197 8197
 	*
8198 8198
 	*/
8199
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8199
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
8200 8200
 	{
8201
-		$filter_query = $this->getFilter($filters,true,true);
8202
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8203
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8201
+		$filter_query = $this->getFilter($filters, true, true);
8202
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8203
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8204 8204
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8205 8205
                     GROUP BY spotter_output.arrival_airport_country
8206 8206
 					ORDER BY airport_arrival_country_count DESC";
@@ -8212,7 +8212,7 @@  discard block
 block discarded – undo
8212 8212
 		$airport_array = array();
8213 8213
 		$temp_array = array();
8214 8214
         
8215
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8215
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8216 8216
 		{
8217 8217
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8218 8218
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8231,11 +8231,11 @@  discard block
 block discarded – undo
8231 8231
 	* @return Array the airport list
8232 8232
 	*
8233 8233
 	*/
8234
-	public function countAllArrivalAirportsByDate($date,$filters = array())
8234
+	public function countAllArrivalAirportsByDate($date, $filters = array())
8235 8235
 	{
8236 8236
 		global $globalTimezone, $globalDBdriver;
8237
-		$filter_query = $this->getFilter($filters,true,true);
8238
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8237
+		$filter_query = $this->getFilter($filters, true, true);
8238
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8239 8239
 		if ($globalTimezone != '') {
8240 8240
 			date_default_timezone_set($globalTimezone);
8241 8241
 			$datetime = new DateTime($date);
@@ -8243,12 +8243,12 @@  discard block
 block discarded – undo
8243 8243
 		} else $offset = '+00:00';
8244 8244
 
8245 8245
 		if ($globalDBdriver == 'mysql') {
8246
-			$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 
8246
+			$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 
8247 8247
 					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  
8248 8248
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8249 8249
 					ORDER BY airport_arrival_icao_count DESC";
8250 8250
 		} else {
8251
-			$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 
8251
+			$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 
8252 8252
 					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  
8253 8253
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8254 8254
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8260,7 +8260,7 @@  discard block
 block discarded – undo
8260 8260
 		$airport_array = array();
8261 8261
 		$temp_array = array();
8262 8262
         
8263
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8263
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8264 8264
 		{
8265 8265
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8266 8266
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8284,8 +8284,8 @@  discard block
 block discarded – undo
8284 8284
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8285 8285
 	{
8286 8286
 		global $globalTimezone, $globalDBdriver;
8287
-		$filter_query = $this->getFilter($filters,true,true);
8288
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8287
+		$filter_query = $this->getFilter($filters, true, true);
8288
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8289 8289
 		if ($globalTimezone != '') {
8290 8290
 			date_default_timezone_set($globalTimezone);
8291 8291
 			$datetime = new DateTime($date);
@@ -8293,12 +8293,12 @@  discard block
 block discarded – undo
8293 8293
 		} else $offset = '+00:00';
8294 8294
 
8295 8295
 		if ($globalDBdriver == 'mysql') {
8296
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8296
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8297 8297
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
8298 8298
 					GROUP BY spotter_output.arrival_airport_country
8299 8299
 					ORDER BY airport_arrival_country_count DESC";
8300 8300
 		} else {
8301
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8301
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8302 8302
 					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 
8303 8303
 					GROUP BY spotter_output.arrival_airport_country
8304 8304
 					ORDER BY airport_arrival_country_count DESC";
@@ -8310,7 +8310,7 @@  discard block
 block discarded – undo
8310 8310
 		$airport_array = array();
8311 8311
 		$temp_array = array();
8312 8312
         
8313
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8313
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8314 8314
 		{
8315 8315
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8316 8316
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8328,11 +8328,11 @@  discard block
 block discarded – undo
8328 8328
 	* @return Array the airport list
8329 8329
 	*
8330 8330
 	*/
8331
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8331
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
8332 8332
 	{
8333
-		$filter_query = $this->getFilter($filters,true,true);
8334
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8335
-		$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 
8333
+		$filter_query = $this->getFilter($filters, true, true);
8334
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8335
+		$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 
8336 8336
 		    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  
8337 8337
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8338 8338
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8344,7 +8344,7 @@  discard block
 block discarded – undo
8344 8344
 		$airport_array = array();
8345 8345
 		$temp_array = array();
8346 8346
         
8347
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8347
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8348 8348
 		{
8349 8349
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8350 8350
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8364,11 +8364,11 @@  discard block
 block discarded – undo
8364 8364
 	* @return Array the airport list
8365 8365
 	*
8366 8366
 	*/
8367
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8367
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
8368 8368
 	{
8369
-		$filter_query = $this->getFilter($filters,true,true);
8370
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8371
-		$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 
8369
+		$filter_query = $this->getFilter($filters, true, true);
8370
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8371
+		$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 
8372 8372
 		    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 
8373 8373
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8374 8374
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8379,7 +8379,7 @@  discard block
 block discarded – undo
8379 8379
 		$airport_array = array();
8380 8380
 		$temp_array = array();
8381 8381
         
8382
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8382
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8383 8383
 		{
8384 8384
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8385 8385
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8399,11 +8399,11 @@  discard block
 block discarded – undo
8399 8399
 	* @return Array the airport list
8400 8400
 	*
8401 8401
 	*/
8402
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8402
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8403 8403
 	{
8404
-		$filter_query = $this->getFilter($filters,true,true);
8405
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8406
-		$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
+		$filter_query = $this->getFilter($filters, true, true);
8405
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8406
+		$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 
8407 8407
 		    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) 
8408 8408
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8409 8409
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8414,7 +8414,7 @@  discard block
 block discarded – undo
8414 8414
 		$airport_array = array();
8415 8415
 		$temp_array = array();
8416 8416
         
8417
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8417
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8418 8418
 		{
8419 8419
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8420 8420
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8436,9 +8436,9 @@  discard block
 block discarded – undo
8436 8436
 	*/
8437 8437
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8438 8438
 	{
8439
-		$filter_query = $this->getFilter($filters,true,true);
8440
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8441
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8439
+		$filter_query = $this->getFilter($filters, true, true);
8440
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8441
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8442 8442
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8443 8443
                     GROUP BY spotter_output.arrival_airport_country
8444 8444
 					ORDER BY airport_arrival_country_count DESC";
@@ -8450,7 +8450,7 @@  discard block
 block discarded – undo
8450 8450
 		$airport_array = array();
8451 8451
 		$temp_array = array();
8452 8452
         
8453
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8453
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8454 8454
 		{
8455 8455
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8456 8456
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8469,9 +8469,9 @@  discard block
 block discarded – undo
8469 8469
 	*/
8470 8470
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8471 8471
 	{
8472
-		$filter_query = $this->getFilter($filters,true,true);
8473
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8474
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8472
+		$filter_query = $this->getFilter($filters, true, true);
8473
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8474
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8475 8475
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8476 8476
                     GROUP BY spotter_output.arrival_airport_country
8477 8477
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8489,9 +8489,9 @@  discard block
 block discarded – undo
8489 8489
 	*/
8490 8490
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8491 8491
 	{
8492
-		$filter_query = $this->getFilter($filters,true,true);
8493
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8494
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8492
+		$filter_query = $this->getFilter($filters, true, true);
8493
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8494
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8495 8495
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8496 8496
                     GROUP BY spotter_output.arrival_airport_country
8497 8497
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8509,11 +8509,11 @@  discard block
 block discarded – undo
8509 8509
 	* @return Array the airport list
8510 8510
 	*
8511 8511
 	*/
8512
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8512
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8513 8513
 	{
8514
-		$filter_query = $this->getFilter($filters,true,true);
8515
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8516
-		$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 
8514
+		$filter_query = $this->getFilter($filters, true, true);
8515
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8516
+		$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 
8517 8517
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8518 8518
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8519 8519
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8525,7 +8525,7 @@  discard block
 block discarded – undo
8525 8525
 		$airport_array = array();
8526 8526
 		$temp_array = array();
8527 8527
         
8528
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8528
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8529 8529
 		{
8530 8530
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8531 8531
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8546,12 +8546,12 @@  discard block
 block discarded – undo
8546 8546
 	* @return Array the airport list
8547 8547
 	*
8548 8548
 	*/
8549
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8549
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8550 8550
 	{
8551 8551
 		global $globalDBdriver;
8552
-		$filter_query = $this->getFilter($filters,true,true);
8553
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8554
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8552
+		$filter_query = $this->getFilter($filters, true, true);
8553
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8554
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8555 8555
 			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 
8556 8556
                     GROUP BY spotter_output.arrival_airport_country
8557 8557
 					ORDER BY airport_arrival_country_count DESC";
@@ -8563,7 +8563,7 @@  discard block
 block discarded – undo
8563 8563
 		$airport_array = array();
8564 8564
 		$temp_array = array();
8565 8565
         
8566
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8566
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8567 8567
 		{
8568 8568
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8569 8569
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8582,38 +8582,38 @@  discard block
 block discarded – undo
8582 8582
 	* @return Array the airport departure list
8583 8583
 	*
8584 8584
 	*/
8585
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8585
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8586 8586
 	{
8587 8587
 		global $globalDBdriver;
8588
-		$filter_query = $this->getFilter($filters,true,true);
8589
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8588
+		$filter_query = $this->getFilter($filters, true, true);
8589
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8590 8590
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8591 8591
 		$query_values = array();
8592 8592
 		if ($year != '') {
8593 8593
 			if ($globalDBdriver == 'mysql') {
8594 8594
 				$query .= " AND YEAR(spotter_output.date) = :year";
8595
-				$query_values = array_merge($query_values,array(':year' => $year));
8595
+				$query_values = array_merge($query_values, array(':year' => $year));
8596 8596
 			} else {
8597 8597
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8598
-				$query_values = array_merge($query_values,array(':year' => $year));
8598
+				$query_values = array_merge($query_values, array(':year' => $year));
8599 8599
 			}
8600 8600
 		}
8601 8601
 		if ($month != '') {
8602 8602
 			if ($globalDBdriver == 'mysql') {
8603 8603
 				$query .= " AND MONTH(spotter_output.date) = :month";
8604
-				$query_values = array_merge($query_values,array(':month' => $month));
8604
+				$query_values = array_merge($query_values, array(':month' => $month));
8605 8605
 			} else {
8606 8606
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8607
-				$query_values = array_merge($query_values,array(':month' => $month));
8607
+				$query_values = array_merge($query_values, array(':month' => $month));
8608 8608
 			}
8609 8609
 		}
8610 8610
 		if ($day != '') {
8611 8611
 			if ($globalDBdriver == 'mysql') {
8612 8612
 				$query .= " AND DAY(spotter_output.date) = :day";
8613
-				$query_values = array_merge($query_values,array(':day' => $day));
8613
+				$query_values = array_merge($query_values, array(':day' => $day));
8614 8614
 			} else {
8615 8615
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8616
-				$query_values = array_merge($query_values,array(':day' => $day));
8616
+				$query_values = array_merge($query_values, array(':day' => $day));
8617 8617
 			}
8618 8618
 		}
8619 8619
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -8627,7 +8627,7 @@  discard block
 block discarded – undo
8627 8627
 		$airport_array = array();
8628 8628
 		$temp_array = array();
8629 8629
         
8630
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8630
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8631 8631
 		{
8632 8632
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8633 8633
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8645,38 +8645,38 @@  discard block
 block discarded – undo
8645 8645
 	* @return Array the airport arrival list
8646 8646
 	*
8647 8647
 	*/
8648
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8648
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8649 8649
 	{
8650 8650
 		global $globalDBdriver;
8651
-		$filter_query = $this->getFilter($filters,true,true);
8652
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8651
+		$filter_query = $this->getFilter($filters, true, true);
8652
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8653 8653
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8654 8654
 		$query_values = array();
8655 8655
 		if ($year != '') {
8656 8656
 			if ($globalDBdriver == 'mysql') {
8657 8657
 				$query .= " AND YEAR(spotter_output.date) = :year";
8658
-				$query_values = array_merge($query_values,array(':year' => $year));
8658
+				$query_values = array_merge($query_values, array(':year' => $year));
8659 8659
 			} else {
8660 8660
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8661
-				$query_values = array_merge($query_values,array(':year' => $year));
8661
+				$query_values = array_merge($query_values, array(':year' => $year));
8662 8662
 			}
8663 8663
 		}
8664 8664
 		if ($month != '') {
8665 8665
 			if ($globalDBdriver == 'mysql') {
8666 8666
 				$query .= " AND MONTH(spotter_output.date) = :month";
8667
-				$query_values = array_merge($query_values,array(':month' => $month));
8667
+				$query_values = array_merge($query_values, array(':month' => $month));
8668 8668
 			} else {
8669 8669
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8670
-				$query_values = array_merge($query_values,array(':month' => $month));
8670
+				$query_values = array_merge($query_values, array(':month' => $month));
8671 8671
 			}
8672 8672
 		}
8673 8673
 		if ($day != '') {
8674 8674
 			if ($globalDBdriver == 'mysql') {
8675 8675
 				$query .= " AND DAY(spotter_output.date) = :day";
8676
-				$query_values = array_merge($query_values,array(':day' => $day));
8676
+				$query_values = array_merge($query_values, array(':day' => $day));
8677 8677
 			} else {
8678 8678
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8679
-				$query_values = array_merge($query_values,array(':day' => $day));
8679
+				$query_values = array_merge($query_values, array(':day' => $day));
8680 8680
 			}
8681 8681
 		}
8682 8682
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -8690,7 +8690,7 @@  discard block
 block discarded – undo
8690 8690
 		$airport_array = array();
8691 8691
 		$temp_array = array();
8692 8692
         
8693
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8693
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8694 8694
 		{
8695 8695
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8696 8696
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8713,8 +8713,8 @@  discard block
 block discarded – undo
8713 8713
 	*/
8714 8714
 	public function countAllRoutes($filters = array())
8715 8715
 	{
8716
-		$filter_query = $this->getFilter($filters,true,true);
8717
-		$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
8716
+		$filter_query = $this->getFilter($filters, true, true);
8717
+		$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
8718 8718
 		    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 <> ''
8719 8719
                     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
8720 8720
                     ORDER BY route_count DESC
@@ -8727,7 +8727,7 @@  discard block
 block discarded – undo
8727 8727
 		$routes_array = array();
8728 8728
 		$temp_array = array();
8729 8729
         
8730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8731 8731
 		{
8732 8732
 			$temp_array['route_count'] = $row['route_count'];
8733 8733
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8754,11 +8754,11 @@  discard block
 block discarded – undo
8754 8754
 	* @return Array the route list
8755 8755
 	*
8756 8756
 	*/
8757
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8757
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8758 8758
 	{
8759
-		$filter_query = $this->getFilter($filters,true,true);
8760
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8761
-		$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
8759
+		$filter_query = $this->getFilter($filters, true, true);
8760
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8761
+		$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
8762 8762
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8763 8763
 			    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 
8764 8764
 			    ORDER BY route_count DESC";
@@ -8769,7 +8769,7 @@  discard block
 block discarded – undo
8769 8769
 		$routes_array = array();
8770 8770
 		$temp_array = array();
8771 8771
         
8772
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8772
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8773 8773
 		{
8774 8774
 			$temp_array['route_count'] = $row['route_count'];
8775 8775
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8796,9 +8796,9 @@  discard block
 block discarded – undo
8796 8796
 	*/
8797 8797
 	public function countAllRoutesByRegistration($registration, $filters = array())
8798 8798
 	{
8799
-		$filter_query = $this->getFilter($filters,true,true);
8799
+		$filter_query = $this->getFilter($filters, true, true);
8800 8800
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8801
-		$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
8801
+		$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
8802 8802
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8803 8803
                     GROUP BY route
8804 8804
                     ORDER BY route_count DESC";
@@ -8810,7 +8810,7 @@  discard block
 block discarded – undo
8810 8810
 		$routes_array = array();
8811 8811
 		$temp_array = array();
8812 8812
         
8813
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8813
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8814 8814
 		{
8815 8815
 			$temp_array['route_count'] = $row['route_count'];
8816 8816
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8838,9 +8838,9 @@  discard block
 block discarded – undo
8838 8838
 	*/
8839 8839
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8840 8840
 	{
8841
-		$filter_query = $this->getFilter($filters,true,true);
8842
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8843
-		$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
8841
+		$filter_query = $this->getFilter($filters, true, true);
8842
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8843
+		$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
8844 8844
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8845 8845
 			    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 
8846 8846
 			    ORDER BY route_count DESC";
@@ -8852,7 +8852,7 @@  discard block
 block discarded – undo
8852 8852
 		$routes_array = array();
8853 8853
 		$temp_array = array();
8854 8854
         
8855
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8855
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8856 8856
 		{
8857 8857
 			$temp_array['route_count'] = $row['route_count'];
8858 8858
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8880,9 +8880,9 @@  discard block
 block discarded – undo
8880 8880
 	*/
8881 8881
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8882 8882
 	{
8883
-		$filter_query = $this->getFilter($filters,true,true);
8884
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8885
-		$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
8883
+		$filter_query = $this->getFilter($filters, true, true);
8884
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8885
+		$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
8886 8886
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8887 8887
 			    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 
8888 8888
 			    ORDER BY route_count DESC";
@@ -8893,7 +8893,7 @@  discard block
 block discarded – undo
8893 8893
 		$routes_array = array();
8894 8894
 		$temp_array = array();
8895 8895
         
8896
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8896
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8897 8897
 		{
8898 8898
 			$temp_array['route_count'] = $row['route_count'];
8899 8899
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8921,9 +8921,9 @@  discard block
 block discarded – undo
8921 8921
 	*/
8922 8922
 	public function countAllRoutesByCountry($country, $filters = array())
8923 8923
 	{
8924
-		$filter_query = $this->getFilter($filters,true,true);
8925
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8926
-		$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
8924
+		$filter_query = $this->getFilter($filters, true, true);
8925
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8926
+		$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
8927 8927
 			    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 
8928 8928
 			    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 
8929 8929
 			    ORDER BY route_count DESC";
@@ -8934,7 +8934,7 @@  discard block
 block discarded – undo
8934 8934
 		$routes_array = array();
8935 8935
 		$temp_array = array();
8936 8936
         
8937
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8937
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8938 8938
 		{
8939 8939
 			$temp_array['route_count'] = $row['route_count'];
8940 8940
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8962,8 +8962,8 @@  discard block
 block discarded – undo
8962 8962
 	public function countAllRoutesByDate($date, $filters = array())
8963 8963
 	{
8964 8964
 		global $globalTimezone, $globalDBdriver;
8965
-		$filter_query = $this->getFilter($filters,true,true);
8966
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8965
+		$filter_query = $this->getFilter($filters, true, true);
8966
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8967 8967
 		if ($globalTimezone != '') {
8968 8968
 			date_default_timezone_set($globalTimezone);
8969 8969
 			$datetime = new DateTime($date);
@@ -8971,12 +8971,12 @@  discard block
 block discarded – undo
8971 8971
 		} else $offset = '+00:00';
8972 8972
 		
8973 8973
 		if ($globalDBdriver == 'mysql') {
8974
-			$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
8974
+			$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
8975 8975
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8976 8976
 				    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
8977 8977
 				    ORDER BY route_count DESC";
8978 8978
 		} else {
8979
-			$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
8979
+			$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
8980 8980
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8981 8981
 				    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
8982 8982
 				    ORDER BY route_count DESC";
@@ -8988,7 +8988,7 @@  discard block
 block discarded – undo
8988 8988
 		$routes_array = array();
8989 8989
 		$temp_array = array();
8990 8990
         
8991
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8991
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8992 8992
 		{
8993 8993
 			$temp_array['route_count'] = $row['route_count'];
8994 8994
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9015,9 +9015,9 @@  discard block
 block discarded – undo
9015 9015
 	*/
9016 9016
 	public function countAllRoutesByIdent($ident, $filters = array())
9017 9017
 	{
9018
-		$filter_query = $this->getFilter($filters,true,true);
9019
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9020
-		$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
9018
+		$filter_query = $this->getFilter($filters, true, true);
9019
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9020
+		$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
9021 9021
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
9022 9022
                     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
9023 9023
                     ORDER BY route_count DESC";
@@ -9029,7 +9029,7 @@  discard block
 block discarded – undo
9029 9029
 		$routes_array = array();
9030 9030
 		$temp_array = array();
9031 9031
         
9032
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9032
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9033 9033
 		{
9034 9034
 			$temp_array['route_count'] = $row['route_count'];
9035 9035
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9053,11 +9053,11 @@  discard block
 block discarded – undo
9053 9053
 	* @return Array the route list
9054 9054
 	*
9055 9055
 	*/
9056
-	public function countAllRoutesByOwner($owner,$filters = array())
9056
+	public function countAllRoutesByOwner($owner, $filters = array())
9057 9057
 	{
9058
-		$filter_query = $this->getFilter($filters,true,true);
9059
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
9060
-		$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
9058
+		$filter_query = $this->getFilter($filters, true, true);
9059
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
9060
+		$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
9061 9061
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
9062 9062
                     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
9063 9063
                     ORDER BY route_count DESC";
@@ -9069,7 +9069,7 @@  discard block
 block discarded – undo
9069 9069
 		$routes_array = array();
9070 9070
 		$temp_array = array();
9071 9071
         
9072
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9072
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9073 9073
 		{
9074 9074
 			$temp_array['route_count'] = $row['route_count'];
9075 9075
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9093,11 +9093,11 @@  discard block
 block discarded – undo
9093 9093
 	* @return Array the route list
9094 9094
 	*
9095 9095
 	*/
9096
-	public function countAllRoutesByPilot($pilot,$filters = array())
9096
+	public function countAllRoutesByPilot($pilot, $filters = array())
9097 9097
 	{
9098
-		$filter_query = $this->getFilter($filters,true,true);
9099
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
9100
-		$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
9098
+		$filter_query = $this->getFilter($filters, true, true);
9099
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
9100
+		$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
9101 9101
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
9102 9102
                     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
9103 9103
                     ORDER BY route_count DESC";
@@ -9109,7 +9109,7 @@  discard block
 block discarded – undo
9109 9109
 		$routes_array = array();
9110 9110
 		$temp_array = array();
9111 9111
         
9112
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9112
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9113 9113
 		{
9114 9114
 			$temp_array['route_count'] = $row['route_count'];
9115 9115
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9136,9 +9136,9 @@  discard block
 block discarded – undo
9136 9136
 	*/
9137 9137
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9138 9138
 	{
9139
-		$filter_query = $this->getFilter($filters,true,true);
9140
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9141
-		$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
9139
+		$filter_query = $this->getFilter($filters, true, true);
9140
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9141
+		$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
9142 9142
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
9143 9143
                     GROUP BY route
9144 9144
                     ORDER BY route_count DESC";
@@ -9150,7 +9150,7 @@  discard block
 block discarded – undo
9150 9150
 		$routes_array = array();
9151 9151
 		$temp_array = array();
9152 9152
         
9153
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9153
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9154 9154
 		{
9155 9155
 			$temp_array['route_count'] = $row['route_count'];
9156 9156
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9178,8 +9178,8 @@  discard block
 block discarded – undo
9178 9178
 	*/
9179 9179
 	public function countAllRoutesWithWaypoints($filters = array())
9180 9180
 	{
9181
-		$filter_query = $this->getFilter($filters,true,true);
9182
-		$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
9181
+		$filter_query = $this->getFilter($filters, true, true);
9182
+		$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
9183 9183
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
9184 9184
                     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
9185 9185
                     ORDER BY route_count DESC
@@ -9192,7 +9192,7 @@  discard block
 block discarded – undo
9192 9192
 		$routes_array = array();
9193 9193
 		$temp_array = array();
9194 9194
         
9195
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9195
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9196 9196
 		{
9197 9197
 			$temp_array['spotter_id'] = $row['spotter_id'];
9198 9198
 			$temp_array['route_count'] = $row['route_count'];
@@ -9217,11 +9217,11 @@  discard block
 block discarded – undo
9217 9217
 	* @return Array the callsign list
9218 9218
 	*
9219 9219
 	*/
9220
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9220
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
9221 9221
 	{
9222 9222
 		global $globalDBdriver;
9223
-		$filter_query = $this->getFilter($filters,true,true);
9224
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9223
+		$filter_query = $this->getFilter($filters, true, true);
9224
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9225 9225
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9226 9226
 		 if ($olderthanmonths > 0) {
9227 9227
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -9235,28 +9235,28 @@  discard block
 block discarded – undo
9235 9235
 		if ($year != '') {
9236 9236
 			if ($globalDBdriver == 'mysql') {
9237 9237
 				$query .= " AND YEAR(spotter_output.date) = :year";
9238
-				$query_values = array_merge($query_values,array(':year' => $year));
9238
+				$query_values = array_merge($query_values, array(':year' => $year));
9239 9239
 			} else {
9240 9240
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9241
-				$query_values = array_merge($query_values,array(':year' => $year));
9241
+				$query_values = array_merge($query_values, array(':year' => $year));
9242 9242
 			}
9243 9243
 		}
9244 9244
 		if ($month != '') {
9245 9245
 			if ($globalDBdriver == 'mysql') {
9246 9246
 				$query .= " AND MONTH(spotter_output.date) = :month";
9247
-				$query_values = array_merge($query_values,array(':month' => $month));
9247
+				$query_values = array_merge($query_values, array(':month' => $month));
9248 9248
 			} else {
9249 9249
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
9250
-				$query_values = array_merge($query_values,array(':month' => $month));
9250
+				$query_values = array_merge($query_values, array(':month' => $month));
9251 9251
 			}
9252 9252
 		}
9253 9253
 		if ($day != '') {
9254 9254
 			if ($globalDBdriver == 'mysql') {
9255 9255
 				$query .= " AND DAY(spotter_output.date) = :day";
9256
-				$query_values = array_merge($query_values,array(':day' => $day));
9256
+				$query_values = array_merge($query_values, array(':day' => $day));
9257 9257
 			} else {
9258 9258
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
9259
-				$query_values = array_merge($query_values,array(':day' => $day));
9259
+				$query_values = array_merge($query_values, array(':day' => $day));
9260 9260
 			}
9261 9261
 		}
9262 9262
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -9268,7 +9268,7 @@  discard block
 block discarded – undo
9268 9268
 		$callsign_array = array();
9269 9269
 		$temp_array = array();
9270 9270
         
9271
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9271
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9272 9272
 		{
9273 9273
 			$temp_array['callsign_icao'] = $row['ident'];
9274 9274
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9290,8 +9290,8 @@  discard block
 block discarded – undo
9290 9290
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9291 9291
 	{
9292 9292
 		global $globalDBdriver;
9293
-		$filter_query = $this->getFilter($filters,true,true);
9294
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9293
+		$filter_query = $this->getFilter($filters, true, true);
9294
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9295 9295
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9296 9296
 		 if ($olderthanmonths > 0) {
9297 9297
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -9310,7 +9310,7 @@  discard block
 block discarded – undo
9310 9310
 		$callsign_array = array();
9311 9311
 		$temp_array = array();
9312 9312
         
9313
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9313
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9314 9314
 		{
9315 9315
 			$temp_array['callsign_icao'] = $row['ident'];
9316 9316
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9364,7 +9364,7 @@  discard block
 block discarded – undo
9364 9364
 		$date_array = array();
9365 9365
 		$temp_array = array();
9366 9366
         
9367
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9367
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9368 9368
 		{
9369 9369
 			$temp_array['date_name'] = $row['date_name'];
9370 9370
 			$temp_array['date_count'] = $row['date_count'];
@@ -9389,15 +9389,15 @@  discard block
 block discarded – undo
9389 9389
 			$datetime = new DateTime();
9390 9390
 			$offset = $datetime->format('P');
9391 9391
 		} else $offset = '+00:00';
9392
-		$filter_query = $this->getFilter($filters,true,true);
9392
+		$filter_query = $this->getFilter($filters, true, true);
9393 9393
 		if ($globalDBdriver == 'mysql') {
9394
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9394
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9395 9395
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9396 9396
 								GROUP BY spotter_output.airline_icao, date_name 
9397 9397
 								ORDER BY date_count DESC
9398 9398
 								LIMIT 10 OFFSET 0";
9399 9399
 		} else {
9400
-			$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
9400
+			$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
9401 9401
 								FROM spotter_output 
9402 9402
 								WHERE spotter_output.airline_icao <> '' 
9403 9403
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9412,7 +9412,7 @@  discard block
 block discarded – undo
9412 9412
 		$date_array = array();
9413 9413
 		$temp_array = array();
9414 9414
         
9415
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9415
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9416 9416
 		{
9417 9417
 			$temp_array['date_name'] = $row['date_name'];
9418 9418
 			$temp_array['date_count'] = $row['date_count'];
@@ -9438,7 +9438,7 @@  discard block
 block discarded – undo
9438 9438
 			$datetime = new DateTime();
9439 9439
 			$offset = $datetime->format('P');
9440 9440
 		} else $offset = '+00:00';
9441
-		$filter_query = $this->getFilter($filters,true,true);
9441
+		$filter_query = $this->getFilter($filters, true, true);
9442 9442
 		if ($globalDBdriver == 'mysql') {
9443 9443
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9444 9444
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9459,7 +9459,7 @@  discard block
 block discarded – undo
9459 9459
 		$date_array = array();
9460 9460
 		$temp_array = array();
9461 9461
         
9462
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9462
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9463 9463
 		{
9464 9464
 			$temp_array['date_name'] = $row['date_name'];
9465 9465
 			$temp_array['date_count'] = $row['date_count'];
@@ -9484,7 +9484,7 @@  discard block
 block discarded – undo
9484 9484
 			$datetime = new DateTime();
9485 9485
 			$offset = $datetime->format('P');
9486 9486
 		} else $offset = '+00:00';
9487
-		$filter_query = $this->getFilter($filters,true,true);
9487
+		$filter_query = $this->getFilter($filters, true, true);
9488 9488
 		if ($globalDBdriver == 'mysql') {
9489 9489
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9490 9490
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9505,7 +9505,7 @@  discard block
 block discarded – undo
9505 9505
 		$date_array = array();
9506 9506
 		$temp_array = array();
9507 9507
         
9508
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9508
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9509 9509
 		{
9510 9510
 			$temp_array['date_name'] = $row['date_name'];
9511 9511
 			$temp_array['date_count'] = $row['date_count'];
@@ -9526,7 +9526,7 @@  discard block
 block discarded – undo
9526 9526
 	public function countAllDatesLastMonthByAirlines($filters = array())
9527 9527
 	{
9528 9528
 		global $globalTimezone, $globalDBdriver;
9529
-		$filter_query = $this->getFilter($filters,true,true);
9529
+		$filter_query = $this->getFilter($filters, true, true);
9530 9530
 		if ($globalTimezone != '') {
9531 9531
 			date_default_timezone_set($globalTimezone);
9532 9532
 			$datetime = new DateTime();
@@ -9534,13 +9534,13 @@  discard block
 block discarded – undo
9534 9534
 		} else $offset = '+00:00';
9535 9535
 		
9536 9536
 		if ($globalDBdriver == 'mysql') {
9537
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9537
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9538 9538
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9539 9539
 								GROUP BY spotter_output.airline_icao, date_name 
9540 9540
 								ORDER BY spotter_output.date ASC";
9541 9541
 			$query_data = array(':offset' => $offset);
9542 9542
 		} else {
9543
-			$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
9543
+			$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
9544 9544
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9545 9545
 								GROUP BY spotter_output.airline_icao, date_name 
9546 9546
 								ORDER BY date_name ASC";
@@ -9553,7 +9553,7 @@  discard block
 block discarded – undo
9553 9553
 		$date_array = array();
9554 9554
 		$temp_array = array();
9555 9555
         
9556
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9556
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9557 9557
 		{
9558 9558
 			$temp_array['date_name'] = $row['date_name'];
9559 9559
 			$temp_array['date_count'] = $row['date_count'];
@@ -9600,7 +9600,7 @@  discard block
 block discarded – undo
9600 9600
 		$date_array = array();
9601 9601
 		$temp_array = array();
9602 9602
         
9603
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9603
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9604 9604
 		{
9605 9605
 			$temp_array['month_name'] = $row['month_name'];
9606 9606
 			$temp_array['year_name'] = $row['year_name'];
@@ -9621,7 +9621,7 @@  discard block
 block discarded – undo
9621 9621
 	public function countAllMonthsByAirlines($filters = array())
9622 9622
 	{
9623 9623
 		global $globalTimezone, $globalDBdriver;
9624
-		$filter_query = $this->getFilter($filters,true,true);
9624
+		$filter_query = $this->getFilter($filters, true, true);
9625 9625
 		if ($globalTimezone != '') {
9626 9626
 			date_default_timezone_set($globalTimezone);
9627 9627
 			$datetime = new DateTime();
@@ -9629,12 +9629,12 @@  discard block
 block discarded – undo
9629 9629
 		} else $offset = '+00:00';
9630 9630
 
9631 9631
 		if ($globalDBdriver == 'mysql') {
9632
-			$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
9632
+			$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
9633 9633
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9634 9634
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9635 9635
 								ORDER BY date_count DESC";
9636 9636
 		} else {
9637
-			$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
9637
+			$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
9638 9638
 								FROM spotter_output 
9639 9639
 								WHERE spotter_output.airline_icao <> '' 
9640 9640
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9648,7 +9648,7 @@  discard block
 block discarded – undo
9648 9648
 		$date_array = array();
9649 9649
 		$temp_array = array();
9650 9650
         
9651
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9651
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9652 9652
 		{
9653 9653
 			$temp_array['month_name'] = $row['month_name'];
9654 9654
 			$temp_array['year_name'] = $row['year_name'];
@@ -9675,14 +9675,14 @@  discard block
 block discarded – undo
9675 9675
 			$datetime = new DateTime();
9676 9676
 			$offset = $datetime->format('P');
9677 9677
 		} else $offset = '+00:00';
9678
-		$filter_query = $this->getFilter($filters,true,true);
9678
+		$filter_query = $this->getFilter($filters, true, true);
9679 9679
 		if ($globalDBdriver == 'mysql') {
9680
-			$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
9680
+			$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
9681 9681
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9682 9682
 								GROUP BY year_name, month_name 
9683 9683
 								ORDER BY date_count DESC";
9684 9684
 		} else {
9685
-			$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
9685
+			$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
9686 9686
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9687 9687
 								GROUP BY year_name, month_name 
9688 9688
 								ORDER BY date_count DESC";
@@ -9694,7 +9694,7 @@  discard block
 block discarded – undo
9694 9694
 		$date_array = array();
9695 9695
 		$temp_array = array();
9696 9696
         
9697
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9697
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9698 9698
 		{
9699 9699
 			$temp_array['month_name'] = $row['month_name'];
9700 9700
 			$temp_array['year_name'] = $row['year_name'];
@@ -9720,15 +9720,15 @@  discard block
 block discarded – undo
9720 9720
 			$datetime = new DateTime();
9721 9721
 			$offset = $datetime->format('P');
9722 9722
 		} else $offset = '+00:00';
9723
-		$filter_query = $this->getFilter($filters,true,true);
9723
+		$filter_query = $this->getFilter($filters, true, true);
9724 9724
 
9725 9725
 		if ($globalDBdriver == 'mysql') {
9726
-			$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
9726
+			$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
9727 9727
 								FROM spotter_output".$filter_query." owner_name <> ''
9728 9728
 								GROUP BY year_name, month_name
9729 9729
 								ORDER BY date_count DESC";
9730 9730
 		} else {
9731
-			$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
9731
+			$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
9732 9732
 								FROM spotter_output".$filter_query." owner_name <> ''
9733 9733
 								GROUP BY year_name, month_name
9734 9734
 								ORDER BY date_count DESC";
@@ -9740,7 +9740,7 @@  discard block
 block discarded – undo
9740 9740
 		$date_array = array();
9741 9741
 		$temp_array = array();
9742 9742
         
9743
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9743
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9744 9744
 		{
9745 9745
 			$temp_array['month_name'] = $row['month_name'];
9746 9746
 			$temp_array['year_name'] = $row['year_name'];
@@ -9761,7 +9761,7 @@  discard block
 block discarded – undo
9761 9761
 	public function countAllMonthsOwnersByAirlines($filters = array())
9762 9762
 	{
9763 9763
 		global $globalTimezone, $globalDBdriver;
9764
-		$filter_query = $this->getFilter($filters,true,true);
9764
+		$filter_query = $this->getFilter($filters, true, true);
9765 9765
 		if ($globalTimezone != '') {
9766 9766
 			date_default_timezone_set($globalTimezone);
9767 9767
 			$datetime = new DateTime();
@@ -9769,12 +9769,12 @@  discard block
 block discarded – undo
9769 9769
 		} else $offset = '+00:00';
9770 9770
 
9771 9771
 		if ($globalDBdriver == 'mysql') {
9772
-			$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
9772
+			$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
9773 9773
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9774 9774
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9775 9775
 								ORDER BY date_count DESC";
9776 9776
 		} else {
9777
-			$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
9777
+			$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
9778 9778
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9779 9779
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9780 9780
 								ORDER BY date_count DESC";
@@ -9786,7 +9786,7 @@  discard block
 block discarded – undo
9786 9786
 		$date_array = array();
9787 9787
 		$temp_array = array();
9788 9788
         
9789
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9789
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9790 9790
 		{
9791 9791
 			$temp_array['month_name'] = $row['month_name'];
9792 9792
 			$temp_array['year_name'] = $row['year_name'];
@@ -9813,15 +9813,15 @@  discard block
 block discarded – undo
9813 9813
 			$datetime = new DateTime();
9814 9814
 			$offset = $datetime->format('P');
9815 9815
 		} else $offset = '+00:00';
9816
-		$filter_query = $this->getFilter($filters,true,true);
9816
+		$filter_query = $this->getFilter($filters, true, true);
9817 9817
 
9818 9818
 		if ($globalDBdriver == 'mysql') {
9819
-			$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
9819
+			$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
9820 9820
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9821 9821
 								GROUP BY year_name, month_name
9822 9822
 								ORDER BY date_count DESC";
9823 9823
 		} else {
9824
-			$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
9824
+			$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
9825 9825
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9826 9826
 								GROUP BY year_name, month_name
9827 9827
 								ORDER BY date_count DESC";
@@ -9833,7 +9833,7 @@  discard block
 block discarded – undo
9833 9833
 		$date_array = array();
9834 9834
 		$temp_array = array();
9835 9835
         
9836
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9836
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9837 9837
 		{
9838 9838
 			$temp_array['month_name'] = $row['month_name'];
9839 9839
 			$temp_array['year_name'] = $row['year_name'];
@@ -9854,7 +9854,7 @@  discard block
 block discarded – undo
9854 9854
 	public function countAllMonthsPilotsByAirlines($filters = array())
9855 9855
 	{
9856 9856
 		global $globalTimezone, $globalDBdriver;
9857
-		$filter_query = $this->getFilter($filters,true,true);
9857
+		$filter_query = $this->getFilter($filters, true, true);
9858 9858
 		if ($globalTimezone != '') {
9859 9859
 			date_default_timezone_set($globalTimezone);
9860 9860
 			$datetime = new DateTime();
@@ -9862,12 +9862,12 @@  discard block
 block discarded – undo
9862 9862
 		} else $offset = '+00:00';
9863 9863
 
9864 9864
 		if ($globalDBdriver == 'mysql') {
9865
-			$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
9865
+			$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
9866 9866
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9867 9867
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9868 9868
 								ORDER BY date_count DESC";
9869 9869
 		} else {
9870
-			$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
9870
+			$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
9871 9871
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9872 9872
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9873 9873
 								ORDER BY date_count DESC";
@@ -9879,7 +9879,7 @@  discard block
 block discarded – undo
9879 9879
 		$date_array = array();
9880 9880
 		$temp_array = array();
9881 9881
         
9882
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9882
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9883 9883
 		{
9884 9884
 			$temp_array['month_name'] = $row['month_name'];
9885 9885
 			$temp_array['year_name'] = $row['year_name'];
@@ -9901,7 +9901,7 @@  discard block
 block discarded – undo
9901 9901
 	public function countAllMonthsAirlines($filters = array())
9902 9902
 	{
9903 9903
 		global $globalTimezone, $globalDBdriver;
9904
-		$filter_query = $this->getFilter($filters,true,true);
9904
+		$filter_query = $this->getFilter($filters, true, true);
9905 9905
 		if ($globalTimezone != '') {
9906 9906
 			date_default_timezone_set($globalTimezone);
9907 9907
 			$datetime = new DateTime();
@@ -9909,12 +9909,12 @@  discard block
 block discarded – undo
9909 9909
 		} else $offset = '+00:00';
9910 9910
 
9911 9911
 		if ($globalDBdriver == 'mysql') {
9912
-			$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
9912
+			$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
9913 9913
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9914 9914
 								GROUP BY year_name, month_name
9915 9915
 								ORDER BY date_count DESC";
9916 9916
 		} else {
9917
-			$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
9917
+			$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
9918 9918
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9919 9919
 								GROUP BY year_name, month_name
9920 9920
 								ORDER BY date_count DESC";
@@ -9926,7 +9926,7 @@  discard block
 block discarded – undo
9926 9926
 		$date_array = array();
9927 9927
 		$temp_array = array();
9928 9928
         
9929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9930 9930
 		{
9931 9931
 			$temp_array['month_name'] = $row['month_name'];
9932 9932
 			$temp_array['year_name'] = $row['year_name'];
@@ -9952,15 +9952,15 @@  discard block
 block discarded – undo
9952 9952
 			$datetime = new DateTime();
9953 9953
 			$offset = $datetime->format('P');
9954 9954
 		} else $offset = '+00:00';
9955
-		$filter_query = $this->getFilter($filters,true,true);
9955
+		$filter_query = $this->getFilter($filters, true, true);
9956 9956
 
9957 9957
 		if ($globalDBdriver == 'mysql') {
9958
-			$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
9958
+			$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
9959 9959
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9960 9960
 								GROUP BY year_name, month_name
9961 9961
 								ORDER BY date_count DESC";
9962 9962
 		} else {
9963
-			$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
9963
+			$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
9964 9964
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9965 9965
 								GROUP BY year_name, month_name
9966 9966
 								ORDER BY date_count DESC";
@@ -9972,7 +9972,7 @@  discard block
 block discarded – undo
9972 9972
 		$date_array = array();
9973 9973
 		$temp_array = array();
9974 9974
         
9975
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9975
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9976 9976
 		{
9977 9977
 			$temp_array['month_name'] = $row['month_name'];
9978 9978
 			$temp_array['year_name'] = $row['year_name'];
@@ -9994,7 +9994,7 @@  discard block
 block discarded – undo
9994 9994
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9995 9995
 	{
9996 9996
 		global $globalTimezone, $globalDBdriver;
9997
-		$filter_query = $this->getFilter($filters,true,true);
9997
+		$filter_query = $this->getFilter($filters, true, true);
9998 9998
 		if ($globalTimezone != '') {
9999 9999
 			date_default_timezone_set($globalTimezone);
10000 10000
 			$datetime = new DateTime();
@@ -10002,12 +10002,12 @@  discard block
 block discarded – undo
10002 10002
 		} else $offset = '+00:00';
10003 10003
 
10004 10004
 		if ($globalDBdriver == 'mysql') {
10005
-			$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
10005
+			$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
10006 10006
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
10007 10007
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10008 10008
 								ORDER BY date_count DESC";
10009 10009
 		} else {
10010
-			$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
10010
+			$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
10011 10011
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
10012 10012
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10013 10013
 								ORDER BY date_count DESC";
@@ -10019,7 +10019,7 @@  discard block
 block discarded – undo
10019 10019
 		$date_array = array();
10020 10020
 		$temp_array = array();
10021 10021
         
10022
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10022
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10023 10023
 		{
10024 10024
 			$temp_array['month_name'] = $row['month_name'];
10025 10025
 			$temp_array['year_name'] = $row['year_name'];
@@ -10046,15 +10046,15 @@  discard block
 block discarded – undo
10046 10046
 			$datetime = new DateTime();
10047 10047
 			$offset = $datetime->format('P');
10048 10048
 		} else $offset = '+00:00';
10049
-		$filter_query = $this->getFilter($filters,true,true);
10049
+		$filter_query = $this->getFilter($filters, true, true);
10050 10050
 
10051 10051
 		if ($globalDBdriver == 'mysql') {
10052
-			$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
10052
+			$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
10053 10053
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10054 10054
 								GROUP BY year_name, month_name
10055 10055
 								ORDER BY date_count DESC";
10056 10056
 		} else {
10057
-			$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
10057
+			$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
10058 10058
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10059 10059
 								GROUP BY year_name, month_name
10060 10060
 								ORDER BY date_count DESC";
@@ -10066,7 +10066,7 @@  discard block
 block discarded – undo
10066 10066
 		$date_array = array();
10067 10067
 		$temp_array = array();
10068 10068
         
10069
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10069
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10070 10070
 		{
10071 10071
 			$temp_array['month_name'] = $row['month_name'];
10072 10072
 			$temp_array['year_name'] = $row['year_name'];
@@ -10088,7 +10088,7 @@  discard block
 block discarded – undo
10088 10088
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10089 10089
 	{
10090 10090
 		global $globalTimezone, $globalDBdriver;
10091
-		$filter_query = $this->getFilter($filters,true,true);
10091
+		$filter_query = $this->getFilter($filters, true, true);
10092 10092
 		if ($globalTimezone != '') {
10093 10093
 			date_default_timezone_set($globalTimezone);
10094 10094
 			$datetime = new DateTime();
@@ -10096,12 +10096,12 @@  discard block
 block discarded – undo
10096 10096
 		} else $offset = '+00:00';
10097 10097
 
10098 10098
 		if ($globalDBdriver == 'mysql') {
10099
-			$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
10099
+			$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
10100 10100
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10101 10101
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10102 10102
 								ORDER BY date_count DESC";
10103 10103
 		} else {
10104
-			$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
10104
+			$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
10105 10105
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10106 10106
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10107 10107
 								ORDER BY date_count DESC";
@@ -10113,7 +10113,7 @@  discard block
 block discarded – undo
10113 10113
 		$date_array = array();
10114 10114
 		$temp_array = array();
10115 10115
         
10116
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10116
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10117 10117
 		{
10118 10118
 			$temp_array['month_name'] = $row['month_name'];
10119 10119
 			$temp_array['year_name'] = $row['year_name'];
@@ -10141,7 +10141,7 @@  discard block
 block discarded – undo
10141 10141
 			$datetime = new DateTime();
10142 10142
 			$offset = $datetime->format('P');
10143 10143
 		} else $offset = '+00:00';
10144
-		$filter_query = $this->getFilter($filters,true,true);
10144
+		$filter_query = $this->getFilter($filters, true, true);
10145 10145
 		if ($globalDBdriver == 'mysql') {
10146 10146
 			$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
10147 10147
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -10162,7 +10162,7 @@  discard block
 block discarded – undo
10162 10162
 		$date_array = array();
10163 10163
 		$temp_array = array();
10164 10164
         
10165
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10165
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10166 10166
 		{
10167 10167
 			$temp_array['year_name'] = $row['year_name'];
10168 10168
 			$temp_array['month_name'] = $row['month_name'];
@@ -10182,7 +10182,7 @@  discard block
 block discarded – undo
10182 10182
 	* @return Array the hour list
10183 10183
 	*
10184 10184
 	*/
10185
-	public function countAllHours($orderby,$filters = array())
10185
+	public function countAllHours($orderby, $filters = array())
10186 10186
 	{
10187 10187
 		global $globalTimezone, $globalDBdriver;
10188 10188
 		if ($globalTimezone != '') {
@@ -10230,7 +10230,7 @@  discard block
 block discarded – undo
10230 10230
 		$hour_array = array();
10231 10231
 		$temp_array = array();
10232 10232
         
10233
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10233
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10234 10234
 		{
10235 10235
 			$temp_array['hour_name'] = $row['hour_name'];
10236 10236
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10250,7 +10250,7 @@  discard block
 block discarded – undo
10250 10250
 	public function countAllHoursByAirlines($orderby, $filters = array())
10251 10251
 	{
10252 10252
 		global $globalTimezone, $globalDBdriver;
10253
-		$filter_query = $this->getFilter($filters,true,true);
10253
+		$filter_query = $this->getFilter($filters, true, true);
10254 10254
 		if ($globalTimezone != '') {
10255 10255
 			date_default_timezone_set($globalTimezone);
10256 10256
 			$datetime = new DateTime();
@@ -10268,7 +10268,7 @@  discard block
 block discarded – undo
10268 10268
 		}
10269 10269
 		
10270 10270
 		if ($globalDBdriver == 'mysql') {
10271
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10271
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10272 10272
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10273 10273
 								GROUP BY spotter_output.airline_icao, hour_name 
10274 10274
 								".$orderby_sql;
@@ -10281,7 +10281,7 @@  discard block
 block discarded – undo
10281 10281
   */    
10282 10282
 		$query_data = array(':offset' => $offset);
10283 10283
 		} else {
10284
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10284
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10285 10285
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10286 10286
 								GROUP BY spotter_output.airline_icao, hour_name 
10287 10287
 								".$orderby_sql;
@@ -10294,7 +10294,7 @@  discard block
 block discarded – undo
10294 10294
 		$hour_array = array();
10295 10295
 		$temp_array = array();
10296 10296
         
10297
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10297
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10298 10298
 		{
10299 10299
 			$temp_array['hour_name'] = $row['hour_name'];
10300 10300
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10317,34 +10317,34 @@  discard block
 block discarded – undo
10317 10317
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10318 10318
 	{
10319 10319
 		global $globalTimezone, $globalDBdriver;
10320
-		$filter_query = $this->getFilter($filters,true,true);
10320
+		$filter_query = $this->getFilter($filters, true, true);
10321 10321
 		if ($globalTimezone != '') {
10322 10322
 			date_default_timezone_set($globalTimezone);
10323 10323
 			$datetime = new DateTime();
10324 10324
 			$offset = $datetime->format('P');
10325 10325
 		} else $offset = '+00:00';
10326 10326
 
10327
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10327
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
10328 10328
 
10329 10329
 		if ($globalDBdriver == 'mysql') {
10330
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10330
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10331 10331
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10332 10332
 								GROUP BY hour_name 
10333 10333
 								ORDER BY hour_name ASC";
10334 10334
 		} else {
10335
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10335
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10336 10336
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10337 10337
 								GROUP BY hour_name 
10338 10338
 								ORDER BY hour_name ASC";
10339 10339
 		}
10340 10340
 		
10341 10341
 		$sth = $this->db->prepare($query);
10342
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
10342
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
10343 10343
       
10344 10344
 		$hour_array = array();
10345 10345
 		$temp_array = array();
10346 10346
         
10347
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10347
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10348 10348
 		{
10349 10349
 			$temp_array['hour_name'] = $row['hour_name'];
10350 10350
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10367,8 +10367,8 @@  discard block
 block discarded – undo
10367 10367
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10368 10368
 	{
10369 10369
 		global $globalTimezone, $globalDBdriver;
10370
-		$filter_query = $this->getFilter($filters,true,true);
10371
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
10370
+		$filter_query = $this->getFilter($filters, true, true);
10371
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
10372 10372
 		if ($globalTimezone != '') {
10373 10373
 			date_default_timezone_set($globalTimezone);
10374 10374
 			$datetime = new DateTime();
@@ -10376,24 +10376,24 @@  discard block
 block discarded – undo
10376 10376
 		} else $offset = '+00:00';
10377 10377
 
10378 10378
 		if ($globalDBdriver == 'mysql') {
10379
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10379
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10380 10380
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10381 10381
 								GROUP BY hour_name 
10382 10382
 								ORDER BY hour_name ASC";
10383 10383
 		} else {
10384
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10384
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10385 10385
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10386 10386
 								GROUP BY hour_name 
10387 10387
 								ORDER BY hour_name ASC";
10388 10388
 		}
10389 10389
 		
10390 10390
 		$sth = $this->db->prepare($query);
10391
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
10391
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
10392 10392
       
10393 10393
 		$hour_array = array();
10394 10394
 		$temp_array = array();
10395 10395
         
10396
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10396
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10397 10397
 		{
10398 10398
 			$temp_array['hour_name'] = $row['hour_name'];
10399 10399
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10414,8 +10414,8 @@  discard block
 block discarded – undo
10414 10414
 	public function countAllHoursByRegistration($registration, $filters = array())
10415 10415
 	{
10416 10416
 		global $globalTimezone, $globalDBdriver;
10417
-		$filter_query = $this->getFilter($filters,true,true);
10418
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10417
+		$filter_query = $this->getFilter($filters, true, true);
10418
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10419 10419
 		if ($globalTimezone != '') {
10420 10420
 			date_default_timezone_set($globalTimezone);
10421 10421
 			$datetime = new DateTime();
@@ -10423,24 +10423,24 @@  discard block
 block discarded – undo
10423 10423
 		} else $offset = '+00:00';
10424 10424
 
10425 10425
 		if ($globalDBdriver == 'mysql') {
10426
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10426
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10427 10427
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10428 10428
 								GROUP BY hour_name 
10429 10429
 								ORDER BY hour_name ASC";
10430 10430
 		} else {
10431
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10431
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10432 10432
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10433 10433
 								GROUP BY hour_name 
10434 10434
 								ORDER BY hour_name ASC";
10435 10435
 		}
10436 10436
 		
10437 10437
 		$sth = $this->db->prepare($query);
10438
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10438
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10439 10439
       
10440 10440
 		$hour_array = array();
10441 10441
 		$temp_array = array();
10442 10442
         
10443
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10443
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10444 10444
 		{
10445 10445
 			$temp_array['hour_name'] = $row['hour_name'];
10446 10446
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10461,8 +10461,8 @@  discard block
 block discarded – undo
10461 10461
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10462 10462
 	{
10463 10463
 		global $globalTimezone, $globalDBdriver;
10464
-		$filter_query = $this->getFilter($filters,true,true);
10465
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10464
+		$filter_query = $this->getFilter($filters, true, true);
10465
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10466 10466
 		if ($globalTimezone != '') {
10467 10467
 			date_default_timezone_set($globalTimezone);
10468 10468
 			$datetime = new DateTime();
@@ -10470,24 +10470,24 @@  discard block
 block discarded – undo
10470 10470
 		} else $offset = '+00:00';
10471 10471
 
10472 10472
 		if ($globalDBdriver == 'mysql') {
10473
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10473
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10474 10474
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10475 10475
 								GROUP BY hour_name 
10476 10476
 								ORDER BY hour_name ASC";
10477 10477
 		} else {
10478
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10478
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10479 10479
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10480 10480
 								GROUP BY hour_name 
10481 10481
 								ORDER BY hour_name ASC";
10482 10482
 		}
10483 10483
 		
10484 10484
 		$sth = $this->db->prepare($query);
10485
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10485
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10486 10486
       
10487 10487
 		$hour_array = array();
10488 10488
 		$temp_array = array();
10489 10489
         
10490
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10490
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10491 10491
 		{
10492 10492
 			$temp_array['hour_name'] = $row['hour_name'];
10493 10493
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10506,11 +10506,11 @@  discard block
 block discarded – undo
10506 10506
 	* @return Array the hour list
10507 10507
 	*
10508 10508
 	*/
10509
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10509
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10510 10510
 	{
10511 10511
 		global $globalTimezone, $globalDBdriver;
10512
-		$filter_query = $this->getFilter($filters,true,true);
10513
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10512
+		$filter_query = $this->getFilter($filters, true, true);
10513
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10514 10514
 		if ($globalTimezone != '') {
10515 10515
 			date_default_timezone_set($globalTimezone);
10516 10516
 			$datetime = new DateTime();
@@ -10518,24 +10518,24 @@  discard block
 block discarded – undo
10518 10518
 		} else $offset = '+00:00';
10519 10519
 
10520 10520
 		if ($globalDBdriver == 'mysql') {
10521
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10521
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10522 10522
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10523 10523
 								GROUP BY hour_name 
10524 10524
 								ORDER BY hour_name ASC";
10525 10525
 		} else {
10526
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10526
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10527 10527
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10528 10528
 								GROUP BY hour_name 
10529 10529
 								ORDER BY hour_name ASC";
10530 10530
 		}
10531 10531
 		
10532 10532
 		$sth = $this->db->prepare($query);
10533
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10533
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10534 10534
       
10535 10535
 		$hour_array = array();
10536 10536
 		$temp_array = array();
10537 10537
         
10538
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10538
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10539 10539
 		{
10540 10540
 			$temp_array['hour_name'] = $row['hour_name'];
10541 10541
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10557,8 +10557,8 @@  discard block
 block discarded – undo
10557 10557
 	public function countAllHoursByDate($date, $filters = array())
10558 10558
 	{
10559 10559
 		global $globalTimezone, $globalDBdriver;
10560
-		$filter_query = $this->getFilter($filters,true,true);
10561
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10560
+		$filter_query = $this->getFilter($filters, true, true);
10561
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10562 10562
 		if ($globalTimezone != '') {
10563 10563
 			date_default_timezone_set($globalTimezone);
10564 10564
 			$datetime = new DateTime($date);
@@ -10566,12 +10566,12 @@  discard block
 block discarded – undo
10566 10566
 		} else $offset = '+00:00';
10567 10567
 
10568 10568
 		if ($globalDBdriver == 'mysql') {
10569
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10569
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10570 10570
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10571 10571
 								GROUP BY hour_name 
10572 10572
 								ORDER BY hour_name ASC";
10573 10573
 		} else {
10574
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10574
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10575 10575
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10576 10576
 								GROUP BY hour_name 
10577 10577
 								ORDER BY hour_name ASC";
@@ -10583,7 +10583,7 @@  discard block
 block discarded – undo
10583 10583
 		$hour_array = array();
10584 10584
 		$temp_array = array();
10585 10585
         
10586
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10586
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10587 10587
 		{
10588 10588
 			$temp_array['hour_name'] = $row['hour_name'];
10589 10589
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10605,8 +10605,8 @@  discard block
 block discarded – undo
10605 10605
 	public function countAllHoursByIdent($ident, $filters = array())
10606 10606
 	{
10607 10607
 		global $globalTimezone, $globalDBdriver;
10608
-		$filter_query = $this->getFilter($filters,true,true);
10609
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10608
+		$filter_query = $this->getFilter($filters, true, true);
10609
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10610 10610
 		if ($globalTimezone != '') {
10611 10611
 			date_default_timezone_set($globalTimezone);
10612 10612
 			$datetime = new DateTime();
@@ -10614,12 +10614,12 @@  discard block
 block discarded – undo
10614 10614
 		} else $offset = '+00:00';
10615 10615
 
10616 10616
 		if ($globalDBdriver == 'mysql') {
10617
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10617
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10618 10618
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10619 10619
 								GROUP BY hour_name 
10620 10620
 								ORDER BY hour_name ASC";
10621 10621
 		} else {
10622
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10622
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10623 10623
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10624 10624
 								GROUP BY hour_name 
10625 10625
 								ORDER BY hour_name ASC";
@@ -10627,12 +10627,12 @@  discard block
 block discarded – undo
10627 10627
       
10628 10628
 		
10629 10629
 		$sth = $this->db->prepare($query);
10630
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10630
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10631 10631
       
10632 10632
 		$hour_array = array();
10633 10633
 		$temp_array = array();
10634 10634
         
10635
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10635
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10636 10636
 		{
10637 10637
 			$temp_array['hour_name'] = $row['hour_name'];
10638 10638
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10652,8 +10652,8 @@  discard block
 block discarded – undo
10652 10652
 	public function countAllHoursByOwner($owner, $filters = array())
10653 10653
 	{
10654 10654
 		global $globalTimezone, $globalDBdriver;
10655
-		$filter_query = $this->getFilter($filters,true,true);
10656
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10655
+		$filter_query = $this->getFilter($filters, true, true);
10656
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10657 10657
 		if ($globalTimezone != '') {
10658 10658
 			date_default_timezone_set($globalTimezone);
10659 10659
 			$datetime = new DateTime();
@@ -10661,12 +10661,12 @@  discard block
 block discarded – undo
10661 10661
 		} else $offset = '+00:00';
10662 10662
 
10663 10663
 		if ($globalDBdriver == 'mysql') {
10664
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10664
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10665 10665
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10666 10666
 								GROUP BY hour_name 
10667 10667
 								ORDER BY hour_name ASC";
10668 10668
 		} else {
10669
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10669
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10670 10670
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10671 10671
 								GROUP BY hour_name 
10672 10672
 								ORDER BY hour_name ASC";
@@ -10674,12 +10674,12 @@  discard block
 block discarded – undo
10674 10674
       
10675 10675
 		
10676 10676
 		$sth = $this->db->prepare($query);
10677
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10677
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10678 10678
       
10679 10679
 		$hour_array = array();
10680 10680
 		$temp_array = array();
10681 10681
         
10682
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10682
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10683 10683
 		{
10684 10684
 			$temp_array['hour_name'] = $row['hour_name'];
10685 10685
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10699,8 +10699,8 @@  discard block
 block discarded – undo
10699 10699
 	public function countAllHoursByPilot($pilot, $filters = array())
10700 10700
 	{
10701 10701
 		global $globalTimezone, $globalDBdriver;
10702
-		$filter_query = $this->getFilter($filters,true,true);
10703
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10702
+		$filter_query = $this->getFilter($filters, true, true);
10703
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10704 10704
 		if ($globalTimezone != '') {
10705 10705
 			date_default_timezone_set($globalTimezone);
10706 10706
 			$datetime = new DateTime();
@@ -10708,12 +10708,12 @@  discard block
 block discarded – undo
10708 10708
 		} else $offset = '+00:00';
10709 10709
 
10710 10710
 		if ($globalDBdriver == 'mysql') {
10711
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10711
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10712 10712
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10713 10713
 								GROUP BY hour_name 
10714 10714
 								ORDER BY hour_name ASC";
10715 10715
 		} else {
10716
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10716
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10717 10717
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10718 10718
 								GROUP BY hour_name 
10719 10719
 								ORDER BY hour_name ASC";
@@ -10721,12 +10721,12 @@  discard block
 block discarded – undo
10721 10721
       
10722 10722
 		
10723 10723
 		$sth = $this->db->prepare($query);
10724
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10724
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10725 10725
       
10726 10726
 		$hour_array = array();
10727 10727
 		$temp_array = array();
10728 10728
         
10729
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10729
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10730 10730
 		{
10731 10731
 			$temp_array['hour_name'] = $row['hour_name'];
10732 10732
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10745,12 +10745,12 @@  discard block
 block discarded – undo
10745 10745
 	* @return Array the hour list
10746 10746
 	*
10747 10747
 	*/
10748
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10748
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10749 10749
 	{
10750 10750
 		global $globalTimezone, $globalDBdriver;
10751
-		$filter_query = $this->getFilter($filters,true,true);
10752
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10753
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10751
+		$filter_query = $this->getFilter($filters, true, true);
10752
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10753
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10754 10754
 		if ($globalTimezone != '') {
10755 10755
 			date_default_timezone_set($globalTimezone);
10756 10756
 			$datetime = new DateTime();
@@ -10758,24 +10758,24 @@  discard block
 block discarded – undo
10758 10758
 		} else $offset = '+00:00';
10759 10759
 
10760 10760
 		if ($globalDBdriver == 'mysql') {
10761
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10761
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10762 10762
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10763 10763
 								GROUP BY hour_name 
10764 10764
 								ORDER BY hour_name ASC";
10765 10765
 		} else {
10766
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10766
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10767 10767
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10768 10768
 								GROUP BY hour_name 
10769 10769
 								ORDER BY hour_name ASC";
10770 10770
 		}
10771 10771
 		
10772 10772
 		$sth = $this->db->prepare($query);
10773
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10773
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10774 10774
       
10775 10775
 		$hour_array = array();
10776 10776
 		$temp_array = array();
10777 10777
         
10778
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10778
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10779 10779
 		{
10780 10780
 			$temp_array['hour_name'] = $row['hour_name'];
10781 10781
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10796,8 +10796,8 @@  discard block
 block discarded – undo
10796 10796
 	public function countAllHoursByCountry($country, $filters = array())
10797 10797
 	{
10798 10798
 		global $globalTimezone, $globalDBdriver;
10799
-		$filter_query = $this->getFilter($filters,true,true);
10800
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10799
+		$filter_query = $this->getFilter($filters, true, true);
10800
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10801 10801
 		if ($globalTimezone != '') {
10802 10802
 			date_default_timezone_set($globalTimezone);
10803 10803
 			$datetime = new DateTime();
@@ -10805,24 +10805,24 @@  discard block
 block discarded – undo
10805 10805
 		} else $offset = '+00:00';
10806 10806
 
10807 10807
 		if ($globalDBdriver == 'mysql') {
10808
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10808
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10809 10809
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10810 10810
 								GROUP BY hour_name 
10811 10811
 								ORDER BY hour_name ASC";
10812 10812
 		} else {
10813
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10813
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10814 10814
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10815 10815
 								GROUP BY hour_name 
10816 10816
 								ORDER BY hour_name ASC";
10817 10817
 		}
10818 10818
 		
10819 10819
 		$sth = $this->db->prepare($query);
10820
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10820
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10821 10821
       
10822 10822
 		$hour_array = array();
10823 10823
 		$temp_array = array();
10824 10824
         
10825
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10825
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10826 10826
 		{
10827 10827
 			$temp_array['hour_name'] = $row['hour_name'];
10828 10828
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10842,29 +10842,29 @@  discard block
 block discarded – undo
10842 10842
 	* @return Integer the number of aircrafts
10843 10843
 	*
10844 10844
 	*/
10845
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10845
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10846 10846
 	{
10847 10847
 		global $globalDBdriver;
10848
-		$filter_query = $this->getFilter($filters,true,true);
10849
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10848
+		$filter_query = $this->getFilter($filters, true, true);
10849
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10850 10850
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10851 10851
 		$query_values = array();
10852 10852
 		if ($year != '') {
10853 10853
 			if ($globalDBdriver == 'mysql') {
10854 10854
 				$query .= " AND YEAR(spotter_output.date) = :year";
10855
-				$query_values = array_merge($query_values,array(':year' => $year));
10855
+				$query_values = array_merge($query_values, array(':year' => $year));
10856 10856
 			} else {
10857 10857
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10858
-				$query_values = array_merge($query_values,array(':year' => $year));
10858
+				$query_values = array_merge($query_values, array(':year' => $year));
10859 10859
 			}
10860 10860
 		}
10861 10861
 		if ($month != '') {
10862 10862
 			if ($globalDBdriver == 'mysql') {
10863 10863
 				$query .= " AND MONTH(spotter_output.date) = :month";
10864
-				$query_values = array_merge($query_values,array(':month' => $month));
10864
+				$query_values = array_merge($query_values, array(':month' => $month));
10865 10865
 			} else {
10866 10866
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10867
-				$query_values = array_merge($query_values,array(':month' => $month));
10867
+				$query_values = array_merge($query_values, array(':month' => $month));
10868 10868
 			}
10869 10869
 		}
10870 10870
 
@@ -10879,29 +10879,29 @@  discard block
 block discarded – undo
10879 10879
 	* @return Integer the number of aircrafts
10880 10880
 	*
10881 10881
 	*/
10882
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10882
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10883 10883
 	{
10884 10884
 		global $globalDBdriver;
10885
-		$filter_query = $this->getFilter($filters,true,true);
10886
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10885
+		$filter_query = $this->getFilter($filters, true, true);
10886
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10887 10887
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10888 10888
 		$query_values = array();
10889 10889
 		if ($year != '') {
10890 10890
 			if ($globalDBdriver == 'mysql') {
10891 10891
 				$query .= " AND YEAR(spotter_output.date) = :year";
10892
-				$query_values = array_merge($query_values,array(':year' => $year));
10892
+				$query_values = array_merge($query_values, array(':year' => $year));
10893 10893
 			} else {
10894 10894
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10895
-				$query_values = array_merge($query_values,array(':year' => $year));
10895
+				$query_values = array_merge($query_values, array(':year' => $year));
10896 10896
 			}
10897 10897
 		}
10898 10898
 		if ($month != '') {
10899 10899
 			if ($globalDBdriver == 'mysql') {
10900 10900
 				$query .= " AND MONTH(spotter_output.date) = :month";
10901
-				$query_values = array_merge($query_values,array(':month' => $month));
10901
+				$query_values = array_merge($query_values, array(':month' => $month));
10902 10902
 			} else {
10903 10903
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10904
-				$query_values = array_merge($query_values,array(':month' => $month));
10904
+				$query_values = array_merge($query_values, array(':month' => $month));
10905 10905
 			}
10906 10906
 		}
10907 10907
 		
@@ -10916,29 +10916,29 @@  discard block
 block discarded – undo
10916 10916
 	* @return Integer the number of pilots
10917 10917
 	*
10918 10918
 	*/
10919
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10919
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10920 10920
 	{
10921 10921
 		global $globalDBdriver;
10922
-		$filter_query = $this->getFilter($filters,true,true);
10923
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10922
+		$filter_query = $this->getFilter($filters, true, true);
10923
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10924 10924
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10925 10925
 		$query_values = array();
10926 10926
 		if ($year != '') {
10927 10927
 			if ($globalDBdriver == 'mysql') {
10928 10928
 				$query .= " AND YEAR(spotter_output.date) = :year";
10929
-				$query_values = array_merge($query_values,array(':year' => $year));
10929
+				$query_values = array_merge($query_values, array(':year' => $year));
10930 10930
 			} else {
10931 10931
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10932
-				$query_values = array_merge($query_values,array(':year' => $year));
10932
+				$query_values = array_merge($query_values, array(':year' => $year));
10933 10933
 			}
10934 10934
 		}
10935 10935
 		if ($month != '') {
10936 10936
 			if ($globalDBdriver == 'mysql') {
10937 10937
 				$query .= " AND MONTH(spotter_output.date) = :month";
10938
-				$query_values = array_merge($query_values,array(':month' => $month));
10938
+				$query_values = array_merge($query_values, array(':month' => $month));
10939 10939
 			} else {
10940 10940
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10941
-				$query_values = array_merge($query_values,array(':month' => $month));
10941
+				$query_values = array_merge($query_values, array(':month' => $month));
10942 10942
 			}
10943 10943
 		}
10944 10944
 		$sth = $this->db->prepare($query);
@@ -10952,29 +10952,29 @@  discard block
 block discarded – undo
10952 10952
 	* @return Integer the number of owners
10953 10953
 	*
10954 10954
 	*/
10955
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10955
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10956 10956
 	{
10957 10957
 		global $globalDBdriver;
10958
-		$filter_query = $this->getFilter($filters,true,true);
10959
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10958
+		$filter_query = $this->getFilter($filters, true, true);
10959
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10960 10960
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10961 10961
 		$query_values = array();
10962 10962
 		if ($year != '') {
10963 10963
 			if ($globalDBdriver == 'mysql') {
10964 10964
 				$query .= " AND YEAR(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
 			} else {
10967 10967
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10968
-				$query_values = array_merge($query_values,array(':year' => $year));
10968
+				$query_values = array_merge($query_values, array(':year' => $year));
10969 10969
 			}
10970 10970
 		}
10971 10971
 		if ($month != '') {
10972 10972
 			if ($globalDBdriver == 'mysql') {
10973 10973
 				$query .= " AND MONTH(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
 			} else {
10976 10976
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10977
-				$query_values = array_merge($query_values,array(':month' => $month));
10977
+				$query_values = array_merge($query_values, array(':month' => $month));
10978 10978
 			}
10979 10979
 		}
10980 10980
 		$sth = $this->db->prepare($query);
@@ -10989,32 +10989,32 @@  discard block
 block discarded – undo
10989 10989
 	* @return Integer the number of flights
10990 10990
 	*
10991 10991
 	*/
10992
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
10992
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
10993 10993
 	{
10994 10994
 		global $globalDBdriver;
10995
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10995
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10996 10996
 		$query_values = array();
10997 10997
 		$query = '';
10998 10998
 		if ($year != '') {
10999 10999
 			if ($globalDBdriver == 'mysql') {
11000 11000
 				$query .= " AND YEAR(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
 			} else {
11003 11003
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11004
-				$query_values = array_merge($query_values,array(':year' => $year));
11004
+				$query_values = array_merge($query_values, array(':year' => $year));
11005 11005
 			}
11006 11006
 		}
11007 11007
 		if ($month != '') {
11008 11008
 			if ($globalDBdriver == 'mysql') {
11009 11009
 				$query .= " AND MONTH(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
 			} else {
11012 11012
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11013
-				$query_values = array_merge($query_values,array(':month' => $month));
11013
+				$query_values = array_merge($query_values, array(':month' => $month));
11014 11014
 			}
11015 11015
 		}
11016 11016
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11017
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11017
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11018 11018
 		
11019 11019
 		$sth = $this->db->prepare($queryi);
11020 11020
 		$sth->execute($query_values);
@@ -11027,29 +11027,29 @@  discard block
 block discarded – undo
11027 11027
 	* @return Integer the number of flights
11028 11028
 	*
11029 11029
 	*/
11030
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11030
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
11031 11031
 	{
11032 11032
 		global $globalDBdriver;
11033
-		$filter_query = $this->getFilter($filters,true,true);
11034
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11033
+		$filter_query = $this->getFilter($filters, true, true);
11034
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11035 11035
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
11036 11036
 		$query_values = array();
11037 11037
 		if ($year != '') {
11038 11038
 			if ($globalDBdriver == 'mysql') {
11039 11039
 				$query .= " AND YEAR(spotter_output.date) = :year";
11040
-				$query_values = array_merge($query_values,array(':year' => $year));
11040
+				$query_values = array_merge($query_values, array(':year' => $year));
11041 11041
 			} else {
11042 11042
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11043
-				$query_values = array_merge($query_values,array(':year' => $year));
11043
+				$query_values = array_merge($query_values, array(':year' => $year));
11044 11044
 			}
11045 11045
 		}
11046 11046
 		if ($month != '') {
11047 11047
 			if ($globalDBdriver == 'mysql') {
11048 11048
 				$query .= " AND MONTH(spotter_output.date) = :month";
11049
-				$query_values = array_merge($query_values,array(':month' => $month));
11049
+				$query_values = array_merge($query_values, array(':month' => $month));
11050 11050
 			} else {
11051 11051
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11052
-				$query_values = array_merge($query_values,array(':month' => $month));
11052
+				$query_values = array_merge($query_values, array(':month' => $month));
11053 11053
 			}
11054 11054
 		}
11055 11055
       
@@ -11066,10 +11066,10 @@  discard block
 block discarded – undo
11066 11066
 	* @return Integer the number of airlines
11067 11067
 	*
11068 11068
 	*/
11069
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11069
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
11070 11070
 	{
11071 11071
 		global $globalDBdriver;
11072
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11072
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11073 11073
 							FROM spotter_output";
11074 11074
       
11075 11075
 		$query_values = array();
@@ -11077,23 +11077,23 @@  discard block
 block discarded – undo
11077 11077
 		if ($year != '') {
11078 11078
 			if ($globalDBdriver == 'mysql') {
11079 11079
 				$query .= " AND YEAR(spotter_output.date) = :year";
11080
-				$query_values = array_merge($query_values,array(':year' => $year));
11080
+				$query_values = array_merge($query_values, array(':year' => $year));
11081 11081
 			} else {
11082 11082
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11083
-				$query_values = array_merge($query_values,array(':year' => $year));
11083
+				$query_values = array_merge($query_values, array(':year' => $year));
11084 11084
 			}
11085 11085
 		}
11086 11086
 		if ($month != '') {
11087 11087
 			if ($globalDBdriver == 'mysql') {
11088 11088
 				$query .= " AND MONTH(spotter_output.date) = :month";
11089
-				$query_values = array_merge($query_values,array(':month' => $month));
11089
+				$query_values = array_merge($query_values, array(':month' => $month));
11090 11090
 			} else {
11091 11091
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11092
-				$query_values = array_merge($query_values,array(':month' => $month));
11092
+				$query_values = array_merge($query_values, array(':month' => $month));
11093 11093
 			}
11094 11094
 		}
11095 11095
                 if ($query == '') $queryi .= $this->getFilter($filters);
11096
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11096
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11097 11097
 
11098 11098
 
11099 11099
 		$sth = $this->db->prepare($queryi);
@@ -11111,7 +11111,7 @@  discard block
 block discarded – undo
11111 11111
 	public function countAllHoursFromToday($filters = array())
11112 11112
 	{
11113 11113
 		global $globalTimezone, $globalDBdriver;
11114
-		$filter_query = $this->getFilter($filters,true,true);
11114
+		$filter_query = $this->getFilter($filters, true, true);
11115 11115
 		if ($globalTimezone != '') {
11116 11116
 			date_default_timezone_set($globalTimezone);
11117 11117
 			$datetime = new DateTime();
@@ -11119,12 +11119,12 @@  discard block
 block discarded – undo
11119 11119
 		} else $offset = '+00:00';
11120 11120
 
11121 11121
 		if ($globalDBdriver == 'mysql') {
11122
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11122
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11123 11123
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
11124 11124
 								GROUP BY hour_name 
11125 11125
 								ORDER BY hour_name ASC";
11126 11126
 		} else {
11127
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11127
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11128 11128
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
11129 11129
 								GROUP BY hour_name 
11130 11130
 								ORDER BY hour_name ASC";
@@ -11136,7 +11136,7 @@  discard block
 block discarded – undo
11136 11136
 		$hour_array = array();
11137 11137
 		$temp_array = array();
11138 11138
         
11139
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11139
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11140 11140
 		{
11141 11141
 			$temp_array['hour_name'] = $row['hour_name'];
11142 11142
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -11155,14 +11155,14 @@  discard block
 block discarded – undo
11155 11155
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11156 11156
 	{
11157 11157
 		global $global_query, $globalDBdriver, $globalTimezone;
11158
-		$filter_query = $this->getFilter($filters,true,true);
11158
+		$filter_query = $this->getFilter($filters, true, true);
11159 11159
 		date_default_timezone_set('UTC');
11160 11160
 		$limit_query = '';
11161 11161
 		if ($limit != "")
11162 11162
 		{
11163 11163
 			$limit_array = explode(",", $limit);
11164
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
11165
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
11164
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
11165
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
11166 11166
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
11167 11167
 			{
11168 11168
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -11215,7 +11215,7 @@  discard block
 block discarded – undo
11215 11215
 			    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')
11216 11216
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
11217 11217
 			//echo $query;
11218
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
11218
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
11219 11219
 			/*
11220 11220
 			$sth = $this->db->prepare($query);
11221 11221
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -11234,9 +11234,9 @@  discard block
 block discarded – undo
11234 11234
 	*/
11235 11235
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11236 11236
 	{
11237
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
11237
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
11238 11238
 
11239
-		$query  = "SELECT spotter_output.spotter_id
11239
+		$query = "SELECT spotter_output.spotter_id
11240 11240
 								FROM spotter_output 
11241 11241
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
11242 11242
         
@@ -11244,7 +11244,7 @@  discard block
 block discarded – undo
11244 11244
 		$sth = $this->db->prepare($query);
11245 11245
 		$sth->execute();
11246 11246
 
11247
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11247
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11248 11248
 		{
11249 11249
 			return $row['spotter_id'];
11250 11250
 		}
@@ -11269,23 +11269,23 @@  discard block
 block discarded – undo
11269 11269
 		}
11270 11270
 		
11271 11271
 		$current_date = date("Y-m-d H:i:s");
11272
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
11272
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
11273 11273
 		
11274 11274
 		$diff = abs(strtotime($current_date) - strtotime($date));
11275 11275
 
11276
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
11276
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
11277 11277
 		$years = $time_array['years'];
11278 11278
 		
11279
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
11279
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
11280 11280
 		$months = $time_array['months'];
11281 11281
 		
11282
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
11282
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
11283 11283
 		$days = $time_array['days'];
11284
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
11284
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
11285 11285
 		$hours = $time_array['hours'];
11286
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
11286
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
11287 11287
 		$minutes = $time_array['minutes'];
11288
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11288
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11289 11289
 		
11290 11290
 		return $time_array;	
11291 11291
 	}	
@@ -11311,63 +11311,63 @@  discard block
 block discarded – undo
11311 11311
 			$temp_array['direction_degree'] = $direction;
11312 11312
 			$temp_array['direction_shortname'] = "N";
11313 11313
 			$temp_array['direction_fullname'] = "North";
11314
-		} elseif ($direction >= 22.5 && $direction < 45){
11314
+		} elseif ($direction >= 22.5 && $direction < 45) {
11315 11315
 			$temp_array['direction_degree'] = $direction;
11316 11316
 			$temp_array['direction_shortname'] = "NNE";
11317 11317
 			$temp_array['direction_fullname'] = "North-Northeast";
11318
-		} elseif ($direction >= 45 && $direction < 67.5){
11318
+		} elseif ($direction >= 45 && $direction < 67.5) {
11319 11319
 			$temp_array['direction_degree'] = $direction;
11320 11320
 			$temp_array['direction_shortname'] = "NE";
11321 11321
 			$temp_array['direction_fullname'] = "Northeast";
11322
-		} elseif ($direction >= 67.5 && $direction < 90){
11322
+		} elseif ($direction >= 67.5 && $direction < 90) {
11323 11323
 			$temp_array['direction_degree'] = $direction;
11324 11324
 			$temp_array['direction_shortname'] = "ENE";
11325 11325
 			$temp_array['direction_fullname'] = "East-Northeast";
11326
-		} elseif ($direction >= 90 && $direction < 112.5){
11326
+		} elseif ($direction >= 90 && $direction < 112.5) {
11327 11327
 			$temp_array['direction_degree'] = $direction;
11328 11328
 			$temp_array['direction_shortname'] = "E";
11329 11329
 			$temp_array['direction_fullname'] = "East";
11330
-		} elseif ($direction >= 112.5 && $direction < 135){
11330
+		} elseif ($direction >= 112.5 && $direction < 135) {
11331 11331
 			$temp_array['direction_degree'] = $direction;
11332 11332
 			$temp_array['direction_shortname'] = "ESE";
11333 11333
 			$temp_array['direction_fullname'] = "East-Southeast";
11334
-		} elseif ($direction >= 135 && $direction < 157.5){
11334
+		} elseif ($direction >= 135 && $direction < 157.5) {
11335 11335
 			$temp_array['direction_degree'] = $direction;
11336 11336
 			$temp_array['direction_shortname'] = "SE";
11337 11337
 			$temp_array['direction_fullname'] = "Southeast";
11338
-		} elseif ($direction >= 157.5 && $direction < 180){
11338
+		} elseif ($direction >= 157.5 && $direction < 180) {
11339 11339
 			$temp_array['direction_degree'] = $direction;
11340 11340
 			$temp_array['direction_shortname'] = "SSE";
11341 11341
 			$temp_array['direction_fullname'] = "South-Southeast";
11342
-		} elseif ($direction >= 180 && $direction < 202.5){
11342
+		} elseif ($direction >= 180 && $direction < 202.5) {
11343 11343
 			$temp_array['direction_degree'] = $direction;
11344 11344
 			$temp_array['direction_shortname'] = "S";
11345 11345
 			$temp_array['direction_fullname'] = "South";
11346
-		} elseif ($direction >= 202.5 && $direction < 225){
11346
+		} elseif ($direction >= 202.5 && $direction < 225) {
11347 11347
 			$temp_array['direction_degree'] = $direction;
11348 11348
 			$temp_array['direction_shortname'] = "SSW";
11349 11349
 			$temp_array['direction_fullname'] = "South-Southwest";
11350
-		} elseif ($direction >= 225 && $direction < 247.5){
11350
+		} elseif ($direction >= 225 && $direction < 247.5) {
11351 11351
 			$temp_array['direction_degree'] = $direction;
11352 11352
 			$temp_array['direction_shortname'] = "SW";
11353 11353
 			$temp_array['direction_fullname'] = "Southwest";
11354
-		} elseif ($direction >= 247.5 && $direction < 270){
11354
+		} elseif ($direction >= 247.5 && $direction < 270) {
11355 11355
 			$temp_array['direction_degree'] = $direction;
11356 11356
 			$temp_array['direction_shortname'] = "WSW";
11357 11357
 			$temp_array['direction_fullname'] = "West-Southwest";
11358
-		} elseif ($direction >= 270 && $direction < 292.5){
11358
+		} elseif ($direction >= 270 && $direction < 292.5) {
11359 11359
 			$temp_array['direction_degree'] = $direction;
11360 11360
 			$temp_array['direction_shortname'] = "W";
11361 11361
 			$temp_array['direction_fullname'] = "West";
11362
-		} elseif ($direction >= 292.5 && $direction < 315){
11362
+		} elseif ($direction >= 292.5 && $direction < 315) {
11363 11363
 			$temp_array['direction_degree'] = $direction;
11364 11364
 			$temp_array['direction_shortname'] = "WNW";
11365 11365
 			$temp_array['direction_fullname'] = "West-Northwest";
11366
-		} elseif ($direction >= 315 && $direction < 337.5){
11366
+		} elseif ($direction >= 315 && $direction < 337.5) {
11367 11367
 			$temp_array['direction_degree'] = $direction;
11368 11368
 			$temp_array['direction_shortname'] = "NW";
11369 11369
 			$temp_array['direction_fullname'] = "Northwest";
11370
-		} elseif ($direction >= 337.5 && $direction < 360){
11370
+		} elseif ($direction >= 337.5 && $direction < 360) {
11371 11371
 			$temp_array['direction_degree'] = $direction;
11372 11372
 			$temp_array['direction_shortname'] = "NNW";
11373 11373
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11420,9 +11420,9 @@  discard block
 block discarded – undo
11420 11420
 	*/
11421 11421
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11422 11422
 	{
11423
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11423
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11424 11424
 	
11425
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11425
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11426 11426
 		
11427 11427
 		$sth = $this->db->prepare($query);
11428 11428
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11445,9 +11445,9 @@  discard block
 block discarded – undo
11445 11445
 	*/
11446 11446
 	public function getAircraftTypeBymodeS($aircraft_modes)
11447 11447
 	{
11448
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11448
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11449 11449
 	
11450
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11450
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11451 11451
 		
11452 11452
 		$sth = $this->db->prepare($query);
11453 11453
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11468,11 +11468,11 @@  discard block
 block discarded – undo
11468 11468
 	* @param Float $longitude longitute of the flight
11469 11469
 	* @return String the countrie
11470 11470
 	*/
11471
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11471
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11472 11472
 	{
11473 11473
 		global $globalDBdriver, $globalDebug;
11474
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11475
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11474
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11475
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11476 11476
 	
11477 11477
 		$Connection = new Connection($this->db);
11478 11478
 		if (!$Connection->tableExists('countries')) return '';
@@ -11512,7 +11512,7 @@  discard block
 block discarded – undo
11512 11512
 	public function getCountryFromISO2($iso2)
11513 11513
 	{
11514 11514
 		global $globalDBdriver, $globalDebug;
11515
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11515
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11516 11516
 	
11517 11517
 		$Connection = new Connection($this->db);
11518 11518
 		if (!$Connection->tableExists('countries')) return '';
@@ -11544,19 +11544,19 @@  discard block
 block discarded – undo
11544 11544
 	*/
11545 11545
 	public function convertAircraftRegistration($registration)
11546 11546
 	{
11547
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11547
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11548 11548
 		$registration_prefix = '';
11549 11549
 		$registration_1 = substr($registration, 0, 1);
11550 11550
 		$registration_2 = substr($registration, 0, 2);
11551 11551
 
11552 11552
 		//first get the prefix based on two characters
11553
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11553
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11554 11554
       
11555 11555
 		
11556 11556
 		$sth = $this->db->prepare($query);
11557 11557
 		$sth->execute(array(':registration_2' => $registration_2));
11558 11558
         
11559
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11559
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11560 11560
 		{
11561 11561
 			$registration_prefix = $row['registration_prefix'];
11562 11562
 		}
@@ -11564,11 +11564,11 @@  discard block
 block discarded – undo
11564 11564
 		//if we didn't find a two chracter prefix lets just search the one with one character
11565 11565
 		if ($registration_prefix == '')
11566 11566
 		{
11567
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11567
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11568 11568
 			$sth = $this->db->prepare($query);
11569 11569
 			$sth->execute(array(':registration_1' => $registration_1));
11570 11570
 	        
11571
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11571
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11572 11572
 			{
11573 11573
 				$registration_prefix = $row['registration_prefix'];
11574 11574
 			}
@@ -11582,7 +11582,7 @@  discard block
 block discarded – undo
11582 11582
 			} else {
11583 11583
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11584 11584
 			}
11585
-		} else if(strlen($registration_prefix) == 2){
11585
+		} else if (strlen($registration_prefix) == 2) {
11586 11586
 			if (0 === strpos($registration, 'N')) {
11587 11587
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11588 11588
 			} else {
@@ -11601,17 +11601,17 @@  discard block
 block discarded – undo
11601 11601
 	*/
11602 11602
 	public function countryFromAircraftRegistration($registration)
11603 11603
 	{
11604
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11604
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11605 11605
 		
11606 11606
 		$registration_prefix = '';
11607
-		$registration_test = explode('-',$registration);
11607
+		$registration_test = explode('-', $registration);
11608 11608
 		$country = '';
11609 11609
 		if ($registration_test[0] != $registration) {
11610 11610
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11611 11611
 	      
11612 11612
 			$sth = $this->db->prepare($query);
11613 11613
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11614
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11614
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11615 11615
 			{
11616 11616
 				//$registration_prefix = $row['registration_prefix'];
11617 11617
 				$country = $row['country'];
@@ -11622,13 +11622,13 @@  discard block
 block discarded – undo
11622 11622
 
11623 11623
 			$country = '';
11624 11624
 			//first get the prefix based on two characters
11625
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11625
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11626 11626
       
11627 11627
 			
11628 11628
 			$sth = $this->db->prepare($query);
11629 11629
 			$sth->execute(array(':registration_2' => $registration_2));
11630 11630
         
11631
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11631
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11632 11632
 			{
11633 11633
 				$registration_prefix = $row['registration_prefix'];
11634 11634
 				$country = $row['country'];
@@ -11637,12 +11637,12 @@  discard block
 block discarded – undo
11637 11637
 			//if we didn't find a two chracter prefix lets just search the one with one character
11638 11638
 			if ($registration_prefix == "")
11639 11639
 			{
11640
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11640
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11641 11641
 	      
11642 11642
 				$sth = $this->db->prepare($query);
11643 11643
 				$sth->execute(array(':registration_1' => $registration_1));
11644 11644
 	        
11645
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11645
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11646 11646
 				{
11647 11647
 					//$registration_prefix = $row['registration_prefix'];
11648 11648
 					$country = $row['country'];
@@ -11662,17 +11662,17 @@  discard block
 block discarded – undo
11662 11662
 	*/
11663 11663
 	public function registrationPrefixFromAircraftRegistration($registration)
11664 11664
 	{
11665
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11665
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11666 11666
 		
11667 11667
 		$registration_prefix = '';
11668
-		$registration_test = explode('-',$registration);
11668
+		$registration_test = explode('-', $registration);
11669 11669
 		//$country = '';
11670 11670
 		if ($registration_test[0] != $registration) {
11671
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11671
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11672 11672
 	      
11673 11673
 			$sth = $this->db->prepare($query);
11674 11674
 			$sth->execute(array(':registration_1' => $registration_test[0]));
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'];
@@ -11682,13 +11682,13 @@  discard block
 block discarded – undo
11682 11682
 		        $registration_2 = substr($registration, 0, 2);
11683 11683
 
11684 11684
 			//first get the prefix based on two characters
11685
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11685
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11686 11686
       
11687 11687
 			
11688 11688
 			$sth = $this->db->prepare($query);
11689 11689
 			$sth->execute(array(':registration_2' => $registration_2));
11690 11690
         
11691
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11691
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11692 11692
 			{
11693 11693
 				$registration_prefix = $row['registration_prefix'];
11694 11694
 				//$country = $row['country'];
@@ -11697,12 +11697,12 @@  discard block
 block discarded – undo
11697 11697
 			//if we didn't find a two chracter prefix lets just search the one with one character
11698 11698
 			if ($registration_prefix == "")
11699 11699
 			{
11700
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11700
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11701 11701
 	      
11702 11702
 				$sth = $this->db->prepare($query);
11703 11703
 				$sth->execute(array(':registration_1' => $registration_1));
11704 11704
 	        
11705
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11705
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11706 11706
 				{
11707 11707
 					$registration_prefix = $row['registration_prefix'];
11708 11708
 					//$country = $row['country'];
@@ -11723,13 +11723,13 @@  discard block
 block discarded – undo
11723 11723
 	*/
11724 11724
 	public function countryFromAircraftRegistrationCode($registration)
11725 11725
 	{
11726
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11726
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11727 11727
 		
11728 11728
 		$country = '';
11729
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11729
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11730 11730
 		$sth = $this->db->prepare($query);
11731 11731
 		$sth->execute(array(':registration' => $registration));
11732
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11732
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11733 11733
 		{
11734 11734
 			$country = $row['country'];
11735 11735
 		}
@@ -11742,9 +11742,9 @@  discard block
 block discarded – undo
11742 11742
 	* @param String $flightaware_id flightaware_id from spotter_output table
11743 11743
 	* @param String $highlight New highlight value
11744 11744
 	*/
11745
-	public function setHighlightFlight($flightaware_id,$highlight) {
11745
+	public function setHighlightFlight($flightaware_id, $highlight) {
11746 11746
 		
11747
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11747
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11748 11748
 		$sth = $this->db->prepare($query);
11749 11749
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11750 11750
 	}
@@ -11756,13 +11756,13 @@  discard block
 block discarded – undo
11756 11756
 	* @param String $date Date of spotted aircraft
11757 11757
 	* @param String $highlight New highlight value
11758 11758
 	*/
11759
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11759
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11760 11760
 		if ($date == '') {
11761 11761
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11762 11762
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11763 11763
 		} else {
11764 11764
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11765
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11765
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11766 11766
 		}
11767 11767
 		$sth = $this->db->prepare($query);
11768 11768
 		$sth->execute($query_values);
@@ -11792,7 +11792,7 @@  discard block
 block discarded – undo
11792 11792
 		
11793 11793
 		$bitly_data = json_decode($bitly_data);
11794 11794
 		$bitly_url = '';
11795
-		if ($bitly_data->status_txt = "OK"){
11795
+		if ($bitly_data->status_txt = "OK") {
11796 11796
 			$bitly_url = $bitly_data->data->url;
11797 11797
 		}
11798 11798
 
@@ -11802,7 +11802,7 @@  discard block
 block discarded – undo
11802 11802
 
11803 11803
 	public function getOrderBy()
11804 11804
 	{
11805
-		$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"));
11805
+		$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"));
11806 11806
 		
11807 11807
 		return $orderby;
11808 11808
 		
@@ -11936,14 +11936,14 @@  discard block
 block discarded – undo
11936 11936
 		}
11937 11937
 		$sth = $this->db->prepare($query);
11938 11938
 		$sth->execute();
11939
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11939
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11940 11940
 		{
11941 11941
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11942 11942
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11943 11943
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11944
-				$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";
11944
+				$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";
11945 11945
 				$sthu = $this->db->prepare($update_query);
11946
-				$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']));
11946
+				$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']));
11947 11947
 			}
11948 11948
 		}
11949 11949
 		
@@ -11956,7 +11956,7 @@  discard block
 block discarded – undo
11956 11956
 		}
11957 11957
 		$sth = $this->db->prepare($query);
11958 11958
 		$sth->execute();
11959
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11959
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11960 11960
 		{
11961 11961
 			if (is_numeric(substr($row['ident'], -1, 1)))
11962 11962
 			{
@@ -11965,11 +11965,11 @@  discard block
 block discarded – undo
11965 11965
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11966 11966
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11967 11967
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
11968
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11968
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
11969 11969
 				if (isset($airline_array[0]['name'])) {
11970
-					$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";
11970
+					$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";
11971 11971
 					$sthu = $this->db->prepare($update_query);
11972
-					$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']));
11972
+					$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']));
11973 11973
 				}
11974 11974
 			}
11975 11975
 		}
@@ -11989,18 +11989,18 @@  discard block
 block discarded – undo
11989 11989
 		}
11990 11990
 		$sth = $this->db->prepare($query);
11991 11991
 		$sth->execute();
11992
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11992
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11993 11993
 		{
11994 11994
 			if ($row['aircraft_icao'] != '') {
11995 11995
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
11996
-				if ($row['registration'] != ""){
11996
+				if ($row['registration'] != "") {
11997 11997
 					$image_array = $Image->getSpotterImage($row['registration']);
11998 11998
 					if (!isset($image_array[0]['registration'])) {
11999 11999
 						$Image->addSpotterImage($row['registration']);
12000 12000
 					}
12001 12001
 				}
12002 12002
 				if (count($aircraft_name) > 0) {
12003
-					$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";
12003
+					$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";
12004 12004
 					$sthu = $this->db->prepare($update_query);
12005 12005
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
12006 12006
 				}
@@ -12015,10 +12015,10 @@  discard block
 block discarded – undo
12015 12015
 		$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";
12016 12016
 		$sth = $this->db->prepare($query);
12017 12017
 		$sth->execute();
12018
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12018
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12019 12019
 		{
12020 12020
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
12021
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
12021
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
12022 12022
 				$airport_icao = '';
12023 12023
 				 if (isset($closestAirports[0])) {
12024 12024
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -12032,7 +12032,7 @@  discard block
 block discarded – undo
12032 12032
 								break;
12033 12033
 							}
12034 12034
 						}
12035
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12035
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
12036 12036
 						$airport_icao = $closestAirports[0]['icao'];
12037 12037
 						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";
12038 12038
 					} else {
@@ -12043,28 +12043,28 @@  discard block
 block discarded – undo
12043 12043
 				}
12044 12044
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12045 12045
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12046
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12046
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12047 12047
 					$sthu = $this->db->prepare($update_query);
12048
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
12048
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
12049 12049
 				}
12050 12050
 			}
12051 12051
 		}
12052 12052
 	}
12053 12053
 	
12054
-	public function closestAirports($origLat,$origLon,$dist = 10) {
12054
+	public function closestAirports($origLat, $origLon, $dist = 10) {
12055 12055
 		global $globalDBdriver;
12056
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
12056
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
12057 12057
 /*
12058 12058
 		$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 
12059 12059
                       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)) 
12060 12060
                       having distance < $dist ORDER BY distance limit 100;";
12061 12061
 */
12062 12062
 		if ($globalDBdriver == 'mysql') {
12063
-			$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 
12063
+			$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 
12064 12064
 	                      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)) 
12065 12065
 	                      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;";
12066 12066
                 } else {
12067
-			$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 
12067
+			$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 
12068 12068
 	                      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)) 
12069 12069
 	                      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;";
12070 12070
     		}
Please login to merge, or discard this patch.