Completed
Push — master ( 27c107...d1f57a )
by Yannick
07:44
created
require/class.Spotter.php 2 patches
Indentation   +1266 added lines, -1266 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Executes the SQL statements to get the spotter information
59
-	*
60
-	* @param String $query the SQL query
61
-	* @param Array $params parameter of the query
62
-	* @param String $limitQuery the limit query
63
-	* @return Array the spotter information
64
-	*
65
-	*/
58
+	 * Executes the SQL statements to get the spotter information
59
+	 *
60
+	 * @param String $query the SQL query
61
+	 * @param Array $params parameter of the query
62
+	 * @param String $limitQuery the limit query
63
+	 * @return Array the spotter information
64
+	 *
65
+	 */
66 66
 	public function getDataFromDB($query, $params = array(), $limitQuery = '')
67 67
 	{
68 68
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
227 227
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
228 228
 					} else $temp_array['aircraft_shadow'] = 'default.png';
229
-                                } else {
230
-                            		$temp_array['aircraft_shadow'] = 'default.png';
229
+								} else {
230
+									$temp_array['aircraft_shadow'] = 'default.png';
231 231
 					$temp_array['aircraft_name'] = 'N/A';
232 232
 					$temp_array['aircraft_manufacturer'] = 'N/A';
233
-                            	}
233
+								}
234 234
 			}
235 235
 			$fromsource = NULL;
236 236
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	
414 414
 	
415 415
 	/**
416
-	* Gets all the spotter information
417
-	*
418
-	* @return Array the spotter information
419
-	*
420
-	*/
416
+	 * Gets all the spotter information
417
+	 *
418
+	 * @return Array the spotter information
419
+	 *
420
+	 */
421 421
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filter = array())
422 422
 	{
423 423
 		global $globalTimezone, $globalDBdriver;
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
 	
765 765
 	
766 766
 	/**
767
-	* Gets all the spotter information based on the latest data entry
768
-	*
769
-	* @return Array the spotter information
770
-	*
771
-	*/
767
+	 * Gets all the spotter information based on the latest data entry
768
+	 *
769
+	 * @return Array the spotter information
770
+	 *
771
+	 */
772 772
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
773 773
 	{
774 774
 		global $global_query;
@@ -807,12 +807,12 @@  discard block
 block discarded – undo
807 807
 	}
808 808
     
809 809
     
810
-    /**
811
-	* Gets all the spotter information based on a user's latitude and longitude
812
-	*
813
-	* @return Array the spotter information
814
-	*
815
-	*/
810
+	/**
811
+	 * Gets all the spotter information based on a user's latitude and longitude
812
+	 *
813
+	 * @return Array the spotter information
814
+	 *
815
+	 */
816 816
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
817 817
 	{
818 818
 		date_default_timezone_set('UTC');
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 				return false;
841 841
 			}
842 842
 		}
843
-    		$additional_query = '';
843
+			$additional_query = '';
844 844
 		if ($interval != "")
845 845
 		{
846 846
 			if (!is_string($interval))
@@ -880,12 +880,12 @@  discard block
 block discarded – undo
880 880
 	}
881 881
     
882 882
     
883
-    /**
884
-	* Gets all the spotter information sorted by the newest aircraft type
885
-	*
886
-	* @return Array the spotter information
887
-	*
888
-	*/
883
+	/**
884
+	 * Gets all the spotter information sorted by the newest aircraft type
885
+	 *
886
+	 * @return Array the spotter information
887
+	 *
888
+	 */
889 889
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
890 890
 	{
891 891
 		global $global_query;
@@ -926,11 +926,11 @@  discard block
 block discarded – undo
926 926
     
927 927
     
928 928
 	/**
929
-	* Gets all the spotter information sorted by the newest aircraft registration
930
-	*
931
-	* @return Array the spotter information
932
-	*
933
-	*/
929
+	 * Gets all the spotter information sorted by the newest aircraft registration
930
+	 *
931
+	 * @return Array the spotter information
932
+	 *
933
+	 */
934 934
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
935 935
 	{
936 936
 		global $global_query;
@@ -970,11 +970,11 @@  discard block
 block discarded – undo
970 970
 
971 971
 
972 972
 	/**
973
-	* Gets all the spotter information sorted by the newest airline
974
-	*
975
-	* @return Array the spotter information
976
-	*
977
-	*/
973
+	 * Gets all the spotter information sorted by the newest airline
974
+	 *
975
+	 * @return Array the spotter information
976
+	 *
977
+	 */
978 978
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
979 979
 	{
980 980
 		global $global_query;
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
 	}
1014 1014
     
1015 1015
     
1016
-    /**
1017
-	* Gets all the spotter information sorted by the newest departure airport
1018
-	*
1019
-	* @return Array the spotter information
1020
-	*
1021
-	*/
1016
+	/**
1017
+	 * Gets all the spotter information sorted by the newest departure airport
1018
+	 *
1019
+	 * @return Array the spotter information
1020
+	 *
1021
+	 */
1022 1022
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1023 1023
 	{
1024 1024
 		global $global_query;
@@ -1060,11 +1060,11 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
 
1062 1062
 	/**
1063
-	* Gets all the spotter information sorted by the newest arrival airport
1064
-	*
1065
-	* @return Array the spotter information
1066
-	*
1067
-	*/
1063
+	 * Gets all the spotter information sorted by the newest arrival airport
1064
+	 *
1065
+	 * @return Array the spotter information
1066
+	 *
1067
+	 */
1068 1068
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1069 1069
 	{
1070 1070
 		global $global_query;
@@ -1103,11 +1103,11 @@  discard block
 block discarded – undo
1103 1103
 	
1104 1104
 
1105 1105
 	/**
1106
-	* Gets all the spotter information based on the spotter id
1107
-	*
1108
-	* @return Array the spotter information
1109
-	*
1110
-	*/
1106
+	 * Gets all the spotter information based on the spotter id
1107
+	 *
1108
+	 * @return Array the spotter information
1109
+	 *
1110
+	 */
1111 1111
 	public function getSpotterDataByID($id = '')
1112 1112
 	{
1113 1113
 		global $global_query;
@@ -1129,11 +1129,11 @@  discard block
 block discarded – undo
1129 1129
 	
1130 1130
 	
1131 1131
 	/**
1132
-	* Gets all the spotter information based on the callsign
1133
-	*
1134
-	* @return Array the spotter information
1135
-	*
1136
-	*/
1132
+	 * Gets all the spotter information based on the callsign
1133
+	 *
1134
+	 * @return Array the spotter information
1135
+	 *
1136
+	 */
1137 1137
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1138 1138
 	{
1139 1139
 		global $global_query;
@@ -1186,11 +1186,11 @@  discard block
 block discarded – undo
1186 1186
 	
1187 1187
 	
1188 1188
 	/**
1189
-	* Gets all the spotter information based on the aircraft type
1190
-	*
1191
-	* @return Array the spotter information
1192
-	*
1193
-	*/
1189
+	 * Gets all the spotter information based on the aircraft type
1190
+	 *
1191
+	 * @return Array the spotter information
1192
+	 *
1193
+	 */
1194 1194
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1195 1195
 	{
1196 1196
 		global $global_query;
@@ -1244,11 +1244,11 @@  discard block
 block discarded – undo
1244 1244
 	
1245 1245
 	
1246 1246
 	/**
1247
-	* Gets all the spotter information based on the aircraft registration
1248
-	*
1249
-	* @return Array the spotter information
1250
-	*
1251
-	*/
1247
+	 * Gets all the spotter information based on the aircraft registration
1248
+	 *
1249
+	 * @return Array the spotter information
1250
+	 *
1251
+	 */
1252 1252
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1253 1253
 	{
1254 1254
 		global $global_query;
@@ -1304,11 +1304,11 @@  discard block
 block discarded – undo
1304 1304
 	
1305 1305
 	
1306 1306
 	/**
1307
-	* Gets all the spotter information based on the airline
1308
-	*
1309
-	* @return Array the spotter information
1310
-	*
1311
-	*/
1307
+	 * Gets all the spotter information based on the airline
1308
+	 *
1309
+	 * @return Array the spotter information
1310
+	 *
1311
+	 */
1312 1312
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '')
1313 1313
 	{
1314 1314
 		global $global_query;
@@ -1360,11 +1360,11 @@  discard block
 block discarded – undo
1360 1360
 	
1361 1361
 	
1362 1362
 	/**
1363
-	* Gets all the spotter information based on the airport
1364
-	*
1365
-	* @return Array the spotter information
1366
-	*
1367
-	*/
1363
+	 * Gets all the spotter information based on the airport
1364
+	 *
1365
+	 * @return Array the spotter information
1366
+	 *
1367
+	 */
1368 1368
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '')
1369 1369
 	{
1370 1370
 		global $global_query;
@@ -1417,11 +1417,11 @@  discard block
 block discarded – undo
1417 1417
 
1418 1418
 
1419 1419
 	/**
1420
-	* Gets all the spotter information based on the date
1421
-	*
1422
-	* @return Array the spotter information
1423
-	*
1424
-	*/
1420
+	 * Gets all the spotter information based on the date
1421
+	 *
1422
+	 * @return Array the spotter information
1423
+	 *
1424
+	 */
1425 1425
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1426 1426
 	{
1427 1427
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1498,11 +1498,11 @@  discard block
 block discarded – undo
1498 1498
 
1499 1499
 
1500 1500
 	/**
1501
-	* Gets all the spotter information based on the country name
1502
-	*
1503
-	* @return Array the spotter information
1504
-	*
1505
-	*/
1501
+	 * Gets all the spotter information based on the country name
1502
+	 *
1503
+	 * @return Array the spotter information
1504
+	 *
1505
+	 */
1506 1506
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '')
1507 1507
 	{
1508 1508
 		global $global_query;
@@ -1555,11 +1555,11 @@  discard block
 block discarded – undo
1555 1555
 	
1556 1556
 	
1557 1557
 	/**
1558
-	* Gets all the spotter information based on the manufacturer name
1559
-	*
1560
-	* @return Array the spotter information
1561
-	*
1562
-	*/
1558
+	 * Gets all the spotter information based on the manufacturer name
1559
+	 *
1560
+	 * @return Array the spotter information
1561
+	 *
1562
+	 */
1563 1563
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '')
1564 1564
 	{
1565 1565
 		global $global_query;
@@ -1614,13 +1614,13 @@  discard block
 block discarded – undo
1614 1614
   
1615 1615
   
1616 1616
 	/**
1617
-	* Gets a list of all aircraft that take a route
1618
-	*
1619
-	* @param String $departure_airport_icao ICAO code of departure airport
1620
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1621
-	* @return Array the spotter information
1622
-	*
1623
-	*/
1617
+	 * Gets a list of all aircraft that take a route
1618
+	 *
1619
+	 * @param String $departure_airport_icao ICAO code of departure airport
1620
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1621
+	 * @return Array the spotter information
1622
+	 *
1623
+	 */
1624 1624
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '')
1625 1625
 	{
1626 1626
 		global $global_query;
@@ -1686,11 +1686,11 @@  discard block
 block discarded – undo
1686 1686
 	
1687 1687
 	
1688 1688
 	/**
1689
-	* Gets all the spotter information based on the special column in the table
1690
-	*
1691
-	* @return Array the spotter information
1692
-	*
1693
-	*/
1689
+	 * Gets all the spotter information based on the special column in the table
1690
+	 *
1691
+	 * @return Array the spotter information
1692
+	 *
1693
+	 */
1694 1694
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1695 1695
 	{
1696 1696
 		global $global_query;
@@ -1729,11 +1729,11 @@  discard block
 block discarded – undo
1729 1729
 	}
1730 1730
 
1731 1731
 	/**
1732
-	* Gets all the highlight based on a aircraft registration
1733
-	*
1734
-	* @return String the highlight text
1735
-	*
1736
-	*/
1732
+	 * Gets all the highlight based on a aircraft registration
1733
+	 *
1734
+	 * @return String the highlight text
1735
+	 *
1736
+	 */
1737 1737
 	public function getHighlightByRegistration($registration,$filter = array())
1738 1738
 	{
1739 1739
 		global $global_query;
@@ -1755,13 +1755,13 @@  discard block
 block discarded – undo
1755 1755
 
1756 1756
 	
1757 1757
 	/**
1758
-	* Gets the squawk usage from squawk code
1759
-	*
1760
-	* @param String $squawk squawk code
1761
-	* @param String $country country
1762
-	* @return String usage
1763
-	*
1764
-	*/
1758
+	 * Gets the squawk usage from squawk code
1759
+	 *
1760
+	 * @param String $squawk squawk code
1761
+	 * @param String $country country
1762
+	 * @return String usage
1763
+	 *
1764
+	 */
1765 1765
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1766 1766
 	{
1767 1767
 		
@@ -1782,12 +1782,12 @@  discard block
 block discarded – undo
1782 1782
 	}
1783 1783
 
1784 1784
 	/**
1785
-	* Gets the airport icao from the iata
1786
-	*
1787
-	* @param String $airport_iata the iata code of the airport
1788
-	* @return String airport iata
1789
-	*
1790
-	*/
1785
+	 * Gets the airport icao from the iata
1786
+	 *
1787
+	 * @param String $airport_iata the iata code of the airport
1788
+	 * @return String airport iata
1789
+	 *
1790
+	 */
1791 1791
 	public function getAirportIcao($airport_iata = '')
1792 1792
 	{
1793 1793
 		
@@ -1807,14 +1807,14 @@  discard block
 block discarded – undo
1807 1807
 	}
1808 1808
 
1809 1809
 	/**
1810
-	* Gets the airport distance
1811
-	*
1812
-	* @param String $airport_icao the icao code of the airport
1813
-	* @param Float $latitude the latitude
1814
-	* @param Float $longitude the longitude
1815
-	* @return Float distance to the airport
1816
-	*
1817
-	*/
1810
+	 * Gets the airport distance
1811
+	 *
1812
+	 * @param String $airport_icao the icao code of the airport
1813
+	 * @param Float $latitude the latitude
1814
+	 * @param Float $longitude the longitude
1815
+	 * @return Float distance to the airport
1816
+	 *
1817
+	 */
1818 1818
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1819 1819
 	{
1820 1820
 		
@@ -1835,12 +1835,12 @@  discard block
 block discarded – undo
1835 1835
 	}
1836 1836
 	
1837 1837
 	/**
1838
-	* Gets the airport info based on the icao
1839
-	*
1840
-	* @param String $airport the icao code of the airport
1841
-	* @return Array airport information
1842
-	*
1843
-	*/
1838
+	 * Gets the airport info based on the icao
1839
+	 *
1840
+	 * @param String $airport the icao code of the airport
1841
+	 * @return Array airport information
1842
+	 *
1843
+	 */
1844 1844
 	public function getAllAirportInfo($airport = '')
1845 1845
 	{
1846 1846
 		
@@ -1886,12 +1886,12 @@  discard block
 block discarded – undo
1886 1886
 	}
1887 1887
 	
1888 1888
 	/**
1889
-	* Gets the airport info based on the country
1890
-	*
1891
-	* @param Array $countries Airports countries
1892
-	* @return Array airport information
1893
-	*
1894
-	*/
1889
+	 * Gets the airport info based on the country
1890
+	 *
1891
+	 * @param Array $countries Airports countries
1892
+	 * @return Array airport information
1893
+	 *
1894
+	 */
1895 1895
 	public function getAllAirportInfobyCountry($countries)
1896 1896
 	{
1897 1897
 		$lst_countries = '';
@@ -1929,12 +1929,12 @@  discard block
 block discarded – undo
1929 1929
 	}
1930 1930
 	
1931 1931
 	/**
1932
-	* Gets airports info based on the coord
1933
-	*
1934
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1935
-	* @return Array airport information
1936
-	*
1937
-	*/
1932
+	 * Gets airports info based on the coord
1933
+	 *
1934
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1935
+	 * @return Array airport information
1936
+	 *
1937
+	 */
1938 1938
 	public function getAllAirportInfobyCoord($coord)
1939 1939
 	{
1940 1940
 		global $globalDBdriver;
@@ -1965,12 +1965,12 @@  discard block
 block discarded – undo
1965 1965
 	}
1966 1966
 
1967 1967
 	/**
1968
-	* Gets waypoints info based on the coord
1969
-	*
1970
-	* @param Array $coord waypoints coord
1971
-	* @return Array airport information
1972
-	*
1973
-	*/
1968
+	 * Gets waypoints info based on the coord
1969
+	 *
1970
+	 * @param Array $coord waypoints coord
1971
+	 * @return Array airport information
1972
+	 *
1973
+	 */
1974 1974
 	public function getAllWaypointsInfobyCoord($coord)
1975 1975
 	{
1976 1976
 		if (is_array($coord)) {
@@ -2004,12 +2004,12 @@  discard block
 block discarded – undo
2004 2004
 	
2005 2005
 	
2006 2006
 	/**
2007
-	* Gets the airline info based on the icao code or iata code
2008
-	*
2009
-	* @param String $airline_icao the iata code of the airport
2010
-	* @return Array airport information
2011
-	*
2012
-	*/
2007
+	 * Gets the airline info based on the icao code or iata code
2008
+	 *
2009
+	 * @param String $airline_icao the iata code of the airport
2010
+	 * @return Array airport information
2011
+	 *
2012
+	 */
2013 2013
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2014 2014
 	{
2015 2015
 		global $globalUseRealAirlines;
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 			} else {
2041 2041
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2042 2042
 			}
2043
-                        /*
2043
+						/*
2044 2044
 			$airline_array = array();
2045 2045
 			$temp_array = array();
2046 2046
 		
@@ -2072,12 +2072,12 @@  discard block
 block discarded – undo
2072 2072
 	
2073 2073
 	
2074 2074
 	/**
2075
-	* Gets the aircraft info based on the aircraft type
2076
-	*
2077
-	* @param String $aircraft_type the aircraft type
2078
-	* @return Array aircraft information
2079
-	*
2080
-	*/
2075
+	 * Gets the aircraft info based on the aircraft type
2076
+	 *
2077
+	 * @param String $aircraft_type the aircraft type
2078
+	 * @return Array aircraft information
2079
+	 *
2080
+	 */
2081 2081
 	public function getAllAircraftInfo($aircraft_type)
2082 2082
 	{
2083 2083
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2109,12 +2109,12 @@  discard block
 block discarded – undo
2109 2109
 	}
2110 2110
 
2111 2111
 	/**
2112
-	* Gets the aircraft icao based on the aircraft name/type
2113
-	*
2114
-	* @param String $aircraft_type the aircraft type
2115
-	* @return String aircraft information
2116
-	*
2117
-	*/
2112
+	 * Gets the aircraft icao based on the aircraft name/type
2113
+	 *
2114
+	 * @param String $aircraft_type the aircraft type
2115
+	 * @return String aircraft information
2116
+	 *
2117
+	 */
2118 2118
 	public function getAircraftIcao($aircraft_type)
2119 2119
 	{
2120 2120
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2139,12 +2139,12 @@  discard block
 block discarded – undo
2139 2139
 	}
2140 2140
 	
2141 2141
 	/**
2142
-	* Gets the aircraft info based on the aircraft ident
2143
-	*
2144
-	* @param String $aircraft_modes the aircraft ident (hex)
2145
-	* @return String aircraft type
2146
-	*
2147
-	*/
2142
+	 * Gets the aircraft info based on the aircraft ident
2143
+	 *
2144
+	 * @param String $aircraft_modes the aircraft ident (hex)
2145
+	 * @return String aircraft type
2146
+	 *
2147
+	 */
2148 2148
 	public function getAllAircraftType($aircraft_modes)
2149 2149
 	{
2150 2150
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2162,12 +2162,12 @@  discard block
 block discarded – undo
2162 2162
 	}
2163 2163
 
2164 2164
 	/**
2165
-	* Gets correct aircraft operator corde
2166
-	*
2167
-	* @param String $operator the aircraft operator code (callsign)
2168
-	* @return String aircraft operator code
2169
-	*
2170
-	*/
2165
+	 * Gets correct aircraft operator corde
2166
+	 *
2167
+	 * @param String $operator the aircraft operator code (callsign)
2168
+	 * @return String aircraft operator code
2169
+	 *
2170
+	 */
2171 2171
 	public function getOperator($operator)
2172 2172
 	{
2173 2173
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2184,16 +2184,16 @@  discard block
 block discarded – undo
2184 2184
 	}
2185 2185
 
2186 2186
 	/**
2187
-	* Gets the aircraft route based on the aircraft callsign
2188
-	*
2189
-	* @param String $callsign the aircraft callsign
2190
-	* @return Array aircraft type
2191
-	*
2192
-	*/
2187
+	 * Gets the aircraft route based on the aircraft callsign
2188
+	 *
2189
+	 * @param String $callsign the aircraft callsign
2190
+	 * @return Array aircraft type
2191
+	 *
2192
+	 */
2193 2193
 	public function getRouteInfo($callsign)
2194 2194
 	{
2195 2195
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2196
-                if ($callsign == '') return array();
2196
+				if ($callsign == '') return array();
2197 2197
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2198 2198
 		
2199 2199
 		$sth = $this->db->prepare($query);
@@ -2207,12 +2207,12 @@  discard block
 block discarded – undo
2207 2207
 	}
2208 2208
 	
2209 2209
 	/**
2210
-	* Gets the aircraft info based on the aircraft registration
2211
-	*
2212
-	* @param String $registration the aircraft registration
2213
-	* @return Array aircraft information
2214
-	*
2215
-	*/
2210
+	 * Gets the aircraft info based on the aircraft registration
2211
+	 *
2212
+	 * @param String $registration the aircraft registration
2213
+	 * @return Array aircraft information
2214
+	 *
2215
+	 */
2216 2216
 	public function getAircraftInfoByRegistration($registration)
2217 2217
 	{
2218 2218
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2239,12 +2239,12 @@  discard block
 block discarded – undo
2239 2239
 	}
2240 2240
 	
2241 2241
 	/**
2242
-	* Gets the aircraft owner & base based on the aircraft registration
2243
-	*
2244
-	* @param String $registration the aircraft registration
2245
-	* @return Array aircraft information
2246
-	*
2247
-	*/
2242
+	 * Gets the aircraft owner & base based on the aircraft registration
2243
+	 *
2244
+	 * @param String $registration the aircraft registration
2245
+	 * @return Array aircraft information
2246
+	 *
2247
+	 */
2248 2248
 	public function getAircraftOwnerByRegistration($registration)
2249 2249
 	{
2250 2250
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2261,11 +2261,11 @@  discard block
 block discarded – undo
2261 2261
 	
2262 2262
   
2263 2263
   /**
2264
-	* Gets all flights (but with only little info)
2265
-	*
2266
-	* @return Array basic flight information
2267
-	*
2268
-	*/
2264
+   * Gets all flights (but with only little info)
2265
+   *
2266
+   * @return Array basic flight information
2267
+   *
2268
+   */
2269 2269
 	public function getAllFlightsforSitemap()
2270 2270
 	{
2271 2271
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
 		
2274 2274
 		$sth = $this->db->prepare($query);
2275 2275
 		$sth->execute();
2276
-                  /*
2276
+				  /*
2277 2277
 		$flight_array = array();
2278 2278
 		$temp_array = array();
2279 2279
 		
@@ -2295,11 +2295,11 @@  discard block
 block discarded – undo
2295 2295
 	}
2296 2296
   
2297 2297
 	/**
2298
-	* Gets a list of all aircraft manufacturers
2299
-	*
2300
-	* @return Array list of aircraft types
2301
-	*
2302
-	*/
2298
+	 * Gets a list of all aircraft manufacturers
2299
+	 *
2300
+	 * @return Array list of aircraft types
2301
+	 *
2302
+	 */
2303 2303
 	public function getAllManufacturers()
2304 2304
 	{
2305 2305
 		/*
@@ -2328,11 +2328,11 @@  discard block
 block discarded – undo
2328 2328
   
2329 2329
   
2330 2330
   /**
2331
-	* Gets a list of all aircraft types
2332
-	*
2333
-	* @return Array list of aircraft types
2334
-	*
2335
-	*/
2331
+   * Gets a list of all aircraft types
2332
+   *
2333
+   * @return Array list of aircraft types
2334
+   *
2335
+   */
2336 2336
 	public function getAllAircraftTypes($filters = array())
2337 2337
 	{
2338 2338
 		/*
@@ -2365,11 +2365,11 @@  discard block
 block discarded – undo
2365 2365
 	
2366 2366
 	
2367 2367
 	/**
2368
-	* Gets a list of all aircraft registrations
2369
-	*
2370
-	* @return Array list of aircraft registrations
2371
-	*
2372
-	*/
2368
+	 * Gets a list of all aircraft registrations
2369
+	 *
2370
+	 * @return Array list of aircraft registrations
2371
+	 *
2372
+	 */
2373 2373
 	public function getAllAircraftRegistrations($filters = array())
2374 2374
 	{
2375 2375
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2394,12 +2394,12 @@  discard block
 block discarded – undo
2394 2394
 	}
2395 2395
 
2396 2396
 	/**
2397
-	* Gets all source name
2398
-	*
2399
-	* @param String type format of source
2400
-	* @return Array list of source name
2401
-	*
2402
-	*/
2397
+	 * Gets all source name
2398
+	 *
2399
+	 * @param String type format of source
2400
+	 * @return Array list of source name
2401
+	 *
2402
+	 */
2403 2403
 	public function getAllSourceName($type = '',$filters = array())
2404 2404
 	{
2405 2405
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2430,11 +2430,11 @@  discard block
 block discarded – undo
2430 2430
 
2431 2431
 
2432 2432
 	/**
2433
-	* Gets a list of all airline names
2434
-	*
2435
-	* @return Array list of airline names
2436
-	*
2437
-	*/
2433
+	 * Gets a list of all airline names
2434
+	 *
2435
+	 * @return Array list of airline names
2436
+	 *
2437
+	 */
2438 2438
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2439 2439
 	{
2440 2440
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2484,11 +2484,11 @@  discard block
 block discarded – undo
2484 2484
 	
2485 2485
 	
2486 2486
 	/**
2487
-	* Gets a list of all airline countries
2488
-	*
2489
-	* @return Array list of airline countries
2490
-	*
2491
-	*/
2487
+	 * Gets a list of all airline countries
2488
+	 *
2489
+	 * @return Array list of airline countries
2490
+	 *
2491
+	 */
2492 2492
 	public function getAllAirlineCountries($filters = array())
2493 2493
 	{
2494 2494
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2516,11 +2516,11 @@  discard block
 block discarded – undo
2516 2516
 	
2517 2517
 	
2518 2518
 	/**
2519
-	* Gets a list of all departure & arrival names
2520
-	*
2521
-	* @return Array list of airport names
2522
-	*
2523
-	*/
2519
+	 * Gets a list of all departure & arrival names
2520
+	 *
2521
+	 * @return Array list of airport names
2522
+	 *
2523
+	 */
2524 2524
 	public function getAllAirportNames($filters = array())
2525 2525
 	{
2526 2526
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2569,11 +2569,11 @@  discard block
 block discarded – undo
2569 2569
 	
2570 2570
 	
2571 2571
 	/**
2572
-	* Gets a list of all departure & arrival airport countries
2573
-	*
2574
-	* @return Array list of airport countries
2575
-	*
2576
-	*/
2572
+	 * Gets a list of all departure & arrival airport countries
2573
+	 *
2574
+	 * @return Array list of airport countries
2575
+	 *
2576
+	 */
2577 2577
 	public function getAllAirportCountries($filters = array())
2578 2578
 	{
2579 2579
 		$airport_array = array();
@@ -2621,11 +2621,11 @@  discard block
 block discarded – undo
2621 2621
 	
2622 2622
 	
2623 2623
 	/**
2624
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2625
-	*
2626
-	* @return Array list of countries
2627
-	*
2628
-	*/
2624
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2625
+	 *
2626
+	 * @return Array list of countries
2627
+	 *
2628
+	 */
2629 2629
 	public function getAllCountries($filters = array())
2630 2630
 	{
2631 2631
 		$Connection= new Connection($this->db);
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 	
2703 2703
 	
2704 2704
 	/**
2705
-	* Gets a list of all idents/callsigns
2706
-	*
2707
-	* @return Array list of ident/callsign names
2708
-	*
2709
-	*/
2705
+	 * Gets a list of all idents/callsigns
2706
+	 *
2707
+	 * @return Array list of ident/callsign names
2708
+	 *
2709
+	 */
2710 2710
 	public function getAllIdents($filters = array())
2711 2711
 	{
2712 2712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2730,9 +2730,9 @@  discard block
 block discarded – undo
2730 2730
 	}
2731 2731
 
2732 2732
 	/**
2733
-	* Get a list of flights from airport since 7 days
2734
-	* @return Array number, icao, name and city of airports
2735
-	*/
2733
+	 * Get a list of flights from airport since 7 days
2734
+	 * @return Array number, icao, name and city of airports
2735
+	 */
2736 2736
 
2737 2737
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2738 2738
 		global $globalTimezone, $globalDBdriver;
@@ -2763,9 +2763,9 @@  discard block
 block discarded – undo
2763 2763
 	}
2764 2764
 
2765 2765
 	/**
2766
-	* Get a list of flights from airport since 7 days
2767
-	* @return Array number, icao, name and city of airports
2768
-	*/
2766
+	 * Get a list of flights from airport since 7 days
2767
+	 * @return Array number, icao, name and city of airports
2768
+	 */
2769 2769
 
2770 2770
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2771 2771
 		global $globalTimezone, $globalDBdriver;
@@ -2795,9 +2795,9 @@  discard block
 block discarded – undo
2795 2795
 	}
2796 2796
 
2797 2797
 	/**
2798
-	* Get a list of flights from detected airport since 7 days
2799
-	* @return Array number, icao, name and city of airports
2800
-	*/
2798
+	 * Get a list of flights from detected airport since 7 days
2799
+	 * @return Array number, icao, name and city of airports
2800
+	 */
2801 2801
 
2802 2802
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '') {
2803 2803
 		global $globalTimezone, $globalDBdriver;
@@ -2838,9 +2838,9 @@  discard block
 block discarded – undo
2838 2838
 	}
2839 2839
 
2840 2840
 	/**
2841
-	* Get a list of flights from detected airport since 7 days
2842
-	* @return Array number, icao, name and city of airports
2843
-	*/
2841
+	 * Get a list of flights from detected airport since 7 days
2842
+	 * @return Array number, icao, name and city of airports
2843
+	 */
2844 2844
 
2845 2845
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2846 2846
 		global $globalTimezone, $globalDBdriver;
@@ -2882,9 +2882,9 @@  discard block
 block discarded – undo
2882 2882
 
2883 2883
 
2884 2884
 	/**
2885
-	* Get a list of flights to airport since 7 days
2886
-	* @return Array number, icao, name and city of airports
2887
-	*/
2885
+	 * Get a list of flights to airport since 7 days
2886
+	 * @return Array number, icao, name and city of airports
2887
+	 */
2888 2888
 
2889 2889
 	public function getLast7DaysAirportsArrival($airport_icao = '') {
2890 2890
 		global $globalTimezone, $globalDBdriver;
@@ -2916,9 +2916,9 @@  discard block
 block discarded – undo
2916 2916
 
2917 2917
 
2918 2918
 	/**
2919
-	* Get a list of flights detected to airport since 7 days
2920
-	* @return Array number, icao, name and city of airports
2921
-	*/
2919
+	 * Get a list of flights detected to airport since 7 days
2920
+	 * @return Array number, icao, name and city of airports
2921
+	 */
2922 2922
 
2923 2923
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '') {
2924 2924
 		global $globalTimezone, $globalDBdriver;
@@ -2962,9 +2962,9 @@  discard block
 block discarded – undo
2962 2962
 
2963 2963
 
2964 2964
 	/**
2965
-	* Get a list of flights to airport since 7 days
2966
-	* @return Array number, icao, name and city of airports
2967
-	*/
2965
+	 * Get a list of flights to airport since 7 days
2966
+	 * @return Array number, icao, name and city of airports
2967
+	 */
2968 2968
 
2969 2969
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2970 2970
 		global $globalTimezone, $globalDBdriver;
@@ -2996,9 +2996,9 @@  discard block
 block discarded – undo
2996 2996
 
2997 2997
 
2998 2998
 	/**
2999
-	* Get a list of flights detected to airport since 7 days
3000
-	* @return Array number, icao, name and city of airports
3001
-	*/
2999
+	 * Get a list of flights detected to airport since 7 days
3000
+	 * @return Array number, icao, name and city of airports
3001
+	 */
3002 3002
 
3003 3003
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3004 3004
 		global $globalTimezone, $globalDBdriver;
@@ -3042,11 +3042,11 @@  discard block
 block discarded – undo
3042 3042
 
3043 3043
 
3044 3044
 	/**
3045
-	* Gets a list of all dates
3046
-	*
3047
-	* @return Array list of date names
3048
-	*
3049
-	*/
3045
+	 * Gets a list of all dates
3046
+	 *
3047
+	 * @return Array list of date names
3048
+	 *
3049
+	 */
3050 3050
 	public function getAllDates()
3051 3051
 	{
3052 3052
 		global $globalTimezone, $globalDBdriver;
@@ -3087,11 +3087,11 @@  discard block
 block discarded – undo
3087 3087
 	
3088 3088
 	
3089 3089
 	/**
3090
-	* Gets all route combinations
3091
-	*
3092
-	* @return Array the route list
3093
-	*
3094
-	*/
3090
+	 * Gets all route combinations
3091
+	 *
3092
+	 * @return Array the route list
3093
+	 *
3094
+	 */
3095 3095
 	public function getAllRoutes()
3096 3096
 	{
3097 3097
 		$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 
@@ -3117,13 +3117,13 @@  discard block
 block discarded – undo
3117 3117
 	}
3118 3118
 
3119 3119
 	/**
3120
-	* Update ident spotter data
3121
-	*
3122
-	* @param String $flightaware_id the ID from flightaware
3123
-	* @param String $ident the flight ident
3124
-	* @return String success or false
3125
-	*
3126
-	*/	
3120
+	 * Update ident spotter data
3121
+	 *
3122
+	 * @param String $flightaware_id the ID from flightaware
3123
+	 * @param String $ident the flight ident
3124
+	 * @return String success or false
3125
+	 *
3126
+	 */	
3127 3127
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3128 3128
 	{
3129 3129
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3144,14 +3144,14 @@  discard block
 block discarded – undo
3144 3144
 		} else {
3145 3145
 			$airline_array = $this->getAllAirlineInfo("NA");
3146 3146
 		}
3147
-                $airline_name = $airline_array[0]['name'];
3148
-                $airline_icao = $airline_array[0]['icao'];
3149
-                $airline_country = $airline_array[0]['country'];
3150
-                $airline_type = $airline_array[0]['type'];
3147
+				$airline_name = $airline_array[0]['name'];
3148
+				$airline_icao = $airline_array[0]['icao'];
3149
+				$airline_country = $airline_array[0]['country'];
3150
+				$airline_type = $airline_array[0]['type'];
3151 3151
 
3152 3152
 
3153 3153
 		$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';
3154
-                $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);
3154
+				$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);
3155 3155
 
3156 3156
 		try {
3157 3157
 			$sth = $this->db->prepare($query);
@@ -3164,19 +3164,19 @@  discard block
 block discarded – undo
3164 3164
 
3165 3165
 	}
3166 3166
 	/**
3167
-	* Update latest spotter data
3168
-	*
3169
-	* @param String $flightaware_id the ID from flightaware
3170
-	* @param String $ident the flight ident
3171
-	* @param String $arrival_airport_icao the arrival airport
3172
-	* @return String success or false
3173
-	*
3174
-	*/	
3167
+	 * Update latest spotter data
3168
+	 *
3169
+	 * @param String $flightaware_id the ID from flightaware
3170
+	 * @param String $ident the flight ident
3171
+	 * @param String $arrival_airport_icao the arrival airport
3172
+	 * @return String success or false
3173
+	 *
3174
+	 */	
3175 3175
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3176 3176
 	{
3177 3177
 		if ($groundspeed == '') $groundspeed = NULL;
3178 3178
 		$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';
3179
-                $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);
3179
+				$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);
3180 3180
 
3181 3181
 		try {
3182 3182
 			$sth = $this->db->prepare($query);
@@ -3190,32 +3190,32 @@  discard block
 block discarded – undo
3190 3190
 	}
3191 3191
 
3192 3192
 	/**
3193
-	* Adds a new spotter data
3194
-	*
3195
-	* @param String $flightaware_id the ID from flightaware
3196
-	* @param String $ident the flight ident
3197
-	* @param String $aircraft_icao the aircraft type
3198
-	* @param String $departure_airport_icao the departure airport
3199
-	* @param String $arrival_airport_icao the arrival airport
3200
-	* @param String $latitude latitude of flight
3201
-	* @param String $longitude latitude of flight
3202
-	* @param String $waypoints waypoints of flight
3203
-	* @param String $altitude altitude of flight
3204
-	* @param String $heading heading of flight
3205
-	* @param String $groundspeed speed of flight
3206
-	* @param String $date date of flight
3207
-	* @param String $departure_airport_time departure time of flight
3208
-	* @param String $arrival_airport_time arrival time of flight
3209
-	* @param String $squawk squawk code of flight
3210
-	* @param String $route_stop route stop of flight
3211
-	* @param String $highlight highlight or not
3212
-	* @param String $ModeS ModesS code of flight
3213
-	* @param String $registration registration code of flight
3214
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3215
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3216
-	* @param String $verticalrate vertival rate of flight
3217
-	* @return String success or false
3218
-	*/
3193
+	 * Adds a new spotter data
3194
+	 *
3195
+	 * @param String $flightaware_id the ID from flightaware
3196
+	 * @param String $ident the flight ident
3197
+	 * @param String $aircraft_icao the aircraft type
3198
+	 * @param String $departure_airport_icao the departure airport
3199
+	 * @param String $arrival_airport_icao the arrival airport
3200
+	 * @param String $latitude latitude of flight
3201
+	 * @param String $longitude latitude of flight
3202
+	 * @param String $waypoints waypoints of flight
3203
+	 * @param String $altitude altitude of flight
3204
+	 * @param String $heading heading of flight
3205
+	 * @param String $groundspeed speed of flight
3206
+	 * @param String $date date of flight
3207
+	 * @param String $departure_airport_time departure time of flight
3208
+	 * @param String $arrival_airport_time arrival time of flight
3209
+	 * @param String $squawk squawk code of flight
3210
+	 * @param String $route_stop route stop of flight
3211
+	 * @param String $highlight highlight or not
3212
+	 * @param String $ModeS ModesS code of flight
3213
+	 * @param String $registration registration code of flight
3214
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3215
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3216
+	 * @param String $verticalrate vertival rate of flight
3217
+	 * @return String success or false
3218
+	 */
3219 3219
 	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 = '')
3220 3220
 	{
3221 3221
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3429,8 +3429,8 @@  discard block
 block discarded – undo
3429 3429
     
3430 3430
 		if ($globalIVAO && $aircraft_icao != '')
3431 3431
 		{
3432
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3433
-            		else $airline_icao = '';
3432
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3433
+					else $airline_icao = '';
3434 3434
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3435 3435
 			if (!isset($image_array[0]['registration']))
3436 3436
 			{
@@ -3461,48 +3461,48 @@  discard block
 block discarded – undo
3461 3461
 	
3462 3462
 		if (count($airline_array) == 0) 
3463 3463
 		{
3464
-                        $airline_array = $this->getAllAirlineInfo('NA');
3465
-                }
3466
-                if (count($aircraft_array) == 0) 
3467
-                {
3468
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3469
-                }
3470
-                if (count($departure_airport_array) == 0) 
3471
-                {
3472
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3473
-                }
3474
-                if (count($arrival_airport_array) == 0) 
3475
-                {
3476
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3477
-                }
3478
-                if ($registration == '') $registration = 'NA';
3479
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3480
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3481
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3482
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3483
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3484
-                $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) 
3464
+						$airline_array = $this->getAllAirlineInfo('NA');
3465
+				}
3466
+				if (count($aircraft_array) == 0) 
3467
+				{
3468
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3469
+				}
3470
+				if (count($departure_airport_array) == 0) 
3471
+				{
3472
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3473
+				}
3474
+				if (count($arrival_airport_array) == 0) 
3475
+				{
3476
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3477
+				}
3478
+				if ($registration == '') $registration = 'NA';
3479
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3480
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3481
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3482
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3483
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3484
+				$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) 
3485 3485
                 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)";
3486 3486
 
3487
-                $airline_name = $airline_array[0]['name'];
3488
-                $airline_icao = $airline_array[0]['icao'];
3489
-                $airline_country = $airline_array[0]['country'];
3490
-                $airline_type = $airline_array[0]['type'];
3487
+				$airline_name = $airline_array[0]['name'];
3488
+				$airline_icao = $airline_array[0]['icao'];
3489
+				$airline_country = $airline_array[0]['country'];
3490
+				$airline_type = $airline_array[0]['type'];
3491 3491
 		if ($airline_type == '') {
3492 3492
 			$timeelapsed = microtime(true);
3493 3493
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3494 3494
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3495 3495
 		}
3496 3496
 		if ($airline_type == null) $airline_type = '';
3497
-                $aircraft_type = $aircraft_array[0]['type'];
3498
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3499
-                $departure_airport_name = $departure_airport_array[0]['name'];
3500
-                $departure_airport_city = $departure_airport_array[0]['city'];
3501
-                $departure_airport_country = $departure_airport_array[0]['country'];
3502
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3503
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3504
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3505
-                $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);
3497
+				$aircraft_type = $aircraft_array[0]['type'];
3498
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3499
+				$departure_airport_name = $departure_airport_array[0]['name'];
3500
+				$departure_airport_city = $departure_airport_array[0]['city'];
3501
+				$departure_airport_country = $departure_airport_array[0]['country'];
3502
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3503
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3504
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3505
+				$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);
3506 3506
 
3507 3507
 		try {
3508 3508
 		        
@@ -3510,7 +3510,7 @@  discard block
 block discarded – undo
3510 3510
 			$sth->execute($query_values);
3511 3511
 			$this->db = null;
3512 3512
 		} catch (PDOException $e) {
3513
-		    return "error : ".$e->getMessage();
3513
+			return "error : ".$e->getMessage();
3514 3514
 		}
3515 3515
 		
3516 3516
 		return "success";
@@ -3519,11 +3519,11 @@  discard block
 block discarded – undo
3519 3519
 	
3520 3520
   
3521 3521
 	/**
3522
-	* Gets the aircraft ident within the last hour
3523
-	*
3524
-	* @return String the ident
3525
-	*
3526
-	*/
3522
+	 * Gets the aircraft ident within the last hour
3523
+	 *
3524
+	 * @return String the ident
3525
+	 *
3526
+	 */
3527 3527
 	public function getIdentFromLastHour($ident)
3528 3528
 	{
3529 3529
 		global $globalDBdriver, $globalTimezone;
@@ -3539,11 +3539,11 @@  discard block
 block discarded – undo
3539 3539
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3540 3540
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3541 3541
 			$query_data = array(':ident' => $ident);
3542
-    		}
3542
+			}
3543 3543
 		
3544 3544
 		$sth = $this->db->prepare($query);
3545 3545
 		$sth->execute($query_data);
3546
-    		$ident_result='';
3546
+			$ident_result='';
3547 3547
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3548 3548
 		{
3549 3549
 			$ident_result = $row['ident'];
@@ -3554,11 +3554,11 @@  discard block
 block discarded – undo
3554 3554
 	
3555 3555
 	
3556 3556
 	/**
3557
-	* Gets the aircraft data from the last 20 seconds
3558
-	*
3559
-	* @return Array the spotter data
3560
-	*
3561
-	*/
3557
+	 * Gets the aircraft data from the last 20 seconds
3558
+	 *
3559
+	 * @return Array the spotter data
3560
+	 *
3561
+	 */
3562 3562
 	public function getRealTimeData($q = '')
3563 3563
 	{
3564 3564
 		global $globalDBdriver;
@@ -3602,11 +3602,11 @@  discard block
 block discarded – undo
3602 3602
 	
3603 3603
 	
3604 3604
 	 /**
3605
-	* Gets all airlines that have flown over
3606
-	*
3607
-	* @return Array the airline list
3608
-	*
3609
-	*/
3605
+	  * Gets all airlines that have flown over
3606
+	  *
3607
+	  * @return Array the airline list
3608
+	  *
3609
+	  */
3610 3610
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3611 3611
 	{
3612 3612
 		global $globalDBdriver;
@@ -3620,7 +3620,7 @@  discard block
 block discarded – undo
3620 3620
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3621 3621
 			}
3622 3622
 		}
3623
-                if ($sincedate != '') {
3623
+				if ($sincedate != '') {
3624 3624
 			if ($globalDBdriver == 'mysql') {
3625 3625
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3626 3626
 			} else {
@@ -3647,26 +3647,26 @@  discard block
 block discarded – undo
3647 3647
 	}
3648 3648
 
3649 3649
 	 /**
3650
-	* Gets all pilots that have flown over
3651
-	*
3652
-	* @return Array the pilots list
3653
-	*
3654
-	*/
3650
+	  * Gets all pilots that have flown over
3651
+	  *
3652
+	  * @return Array the pilots list
3653
+	  *
3654
+	  */
3655 3655
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3656 3656
 	{
3657 3657
 		global $globalDBdriver;
3658 3658
 		$filter_query = $this->getFilter($filters,true,true);
3659 3659
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3660 3660
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3661
-                if ($olderthanmonths > 0) {
3662
-            		if ($globalDBdriver == 'mysql') {
3661
+				if ($olderthanmonths > 0) {
3662
+					if ($globalDBdriver == 'mysql') {
3663 3663
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3664 3664
 			} else {
3665 3665
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3666 3666
 			}
3667 3667
 		}
3668
-                if ($sincedate != '') {
3669
-            		if ($globalDBdriver == 'mysql') {
3668
+				if ($sincedate != '') {
3669
+					if ($globalDBdriver == 'mysql') {
3670 3670
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3671 3671
 			} else {
3672 3672
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3693,25 +3693,25 @@  discard block
 block discarded – undo
3693 3693
 	}
3694 3694
 	
3695 3695
 		 /**
3696
-	* Gets all pilots that have flown over
3697
-	*
3698
-	* @return Array the pilots list
3699
-	*
3700
-	*/
3696
+		  * Gets all pilots that have flown over
3697
+		  *
3698
+		  * @return Array the pilots list
3699
+		  *
3700
+		  */
3701 3701
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3702 3702
 	{
3703 3703
 		global $globalDBdriver;
3704 3704
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3705 3705
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3706
-                if ($olderthanmonths > 0) {
3707
-            		if ($globalDBdriver == 'mysql') {
3706
+				if ($olderthanmonths > 0) {
3707
+					if ($globalDBdriver == 'mysql') {
3708 3708
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3709 3709
 			} else {
3710 3710
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3711 3711
 			}
3712 3712
 		}
3713
-                if ($sincedate != '') {
3714
-            		if ($globalDBdriver == 'mysql') {
3713
+				if ($sincedate != '') {
3714
+					if ($globalDBdriver == 'mysql') {
3715 3715
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3716 3716
 			} else {
3717 3717
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3739,26 +3739,26 @@  discard block
 block discarded – undo
3739 3739
 	}
3740 3740
 	
3741 3741
 	 /**
3742
-	* Gets all owner that have flown over
3743
-	*
3744
-	* @return Array the pilots list
3745
-	*
3746
-	*/
3742
+	  * Gets all owner that have flown over
3743
+	  *
3744
+	  * @return Array the pilots list
3745
+	  *
3746
+	  */
3747 3747
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3748 3748
 	{
3749 3749
 		global $globalDBdriver;
3750 3750
 		$filter_query = $this->getFilter($filters,true,true);
3751 3751
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3752 3752
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3753
-                if ($olderthanmonths > 0) {
3754
-            		if ($globalDBdriver == 'mysql') {
3753
+				if ($olderthanmonths > 0) {
3754
+					if ($globalDBdriver == 'mysql') {
3755 3755
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3756 3756
 			} else {
3757 3757
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3758 3758
 			}
3759 3759
 		}
3760
-                if ($sincedate != '') {
3761
-            		if ($globalDBdriver == 'mysql') {
3760
+				if ($sincedate != '') {
3761
+					if ($globalDBdriver == 'mysql') {
3762 3762
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3763 3763
 			} else {
3764 3764
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3784,26 +3784,26 @@  discard block
 block discarded – undo
3784 3784
 	}
3785 3785
 	
3786 3786
 	 /**
3787
-	* Gets all owner that have flown over
3788
-	*
3789
-	* @return Array the pilots list
3790
-	*
3791
-	*/
3787
+	  * Gets all owner that have flown over
3788
+	  *
3789
+	  * @return Array the pilots list
3790
+	  *
3791
+	  */
3792 3792
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3793 3793
 	{
3794 3794
 		global $globalDBdriver;
3795 3795
 		$filter_query = $this->getFilter($filters,true,true);
3796 3796
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3797 3797
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3798
-                if ($olderthanmonths > 0) {
3799
-            		if ($globalDBdriver == 'mysql') {
3798
+				if ($olderthanmonths > 0) {
3799
+					if ($globalDBdriver == 'mysql') {
3800 3800
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3801 3801
 			} else {
3802 3802
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3803 3803
 			}
3804 3804
 		}
3805
-                if ($sincedate != '') {
3806
-            		if ($globalDBdriver == 'mysql') {
3805
+				if ($sincedate != '') {
3806
+					if ($globalDBdriver == 'mysql') {
3807 3807
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3808 3808
 			} else {
3809 3809
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3830,11 +3830,11 @@  discard block
 block discarded – undo
3830 3830
 	}
3831 3831
 
3832 3832
 	/**
3833
-	* Gets all airlines that have flown over by aircraft
3834
-	*
3835
-	* @return Array the airline list
3836
-	*
3837
-	*/
3833
+	 * Gets all airlines that have flown over by aircraft
3834
+	 *
3835
+	 * @return Array the airline list
3836
+	 *
3837
+	 */
3838 3838
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3839 3839
 	{
3840 3840
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3866,11 +3866,11 @@  discard block
 block discarded – undo
3866 3866
 
3867 3867
 
3868 3868
 	/**
3869
-	* Gets all airline countries that have flown over by aircraft
3870
-	*
3871
-	* @return Array the airline country list
3872
-	*
3873
-	*/
3869
+	 * Gets all airline countries that have flown over by aircraft
3870
+	 *
3871
+	 * @return Array the airline country list
3872
+	 *
3873
+	 */
3874 3874
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3875 3875
 	{
3876 3876
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3902,11 +3902,11 @@  discard block
 block discarded – undo
3902 3902
 	
3903 3903
 	
3904 3904
 	/**
3905
-	* Gets all airlines that have flown over by airport
3906
-	*
3907
-	* @return Array the airline list
3908
-	*
3909
-	*/
3905
+	 * Gets all airlines that have flown over by airport
3906
+	 *
3907
+	 * @return Array the airline list
3908
+	 *
3909
+	 */
3910 3910
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3911 3911
 	{
3912 3912
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3937,11 +3937,11 @@  discard block
 block discarded – undo
3937 3937
 
3938 3938
 
3939 3939
 	/**
3940
-	* Gets all airline countries that have flown over by airport icao
3941
-	*
3942
-	* @return Array the airline country list
3943
-	*
3944
-	*/
3940
+	 * Gets all airline countries that have flown over by airport icao
3941
+	 *
3942
+	 * @return Array the airline country list
3943
+	 *
3944
+	 */
3945 3945
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3946 3946
 	{
3947 3947
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3971,11 +3971,11 @@  discard block
 block discarded – undo
3971 3971
 
3972 3972
 
3973 3973
 	/**
3974
-	* Gets all airlines that have flown over by aircraft manufacturer
3975
-	*
3976
-	* @return Array the airline list
3977
-	*
3978
-	*/
3974
+	 * Gets all airlines that have flown over by aircraft manufacturer
3975
+	 *
3976
+	 * @return Array the airline list
3977
+	 *
3978
+	 */
3979 3979
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3980 3980
 	{
3981 3981
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4006,11 +4006,11 @@  discard block
 block discarded – undo
4006 4006
 
4007 4007
 
4008 4008
 	/**
4009
-	* Gets all airline countries that have flown over by aircraft manufacturer
4010
-	*
4011
-	* @return Array the airline country list
4012
-	*
4013
-	*/
4009
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4010
+	 *
4011
+	 * @return Array the airline country list
4012
+	 *
4013
+	 */
4014 4014
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4015 4015
 	{
4016 4016
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4039,11 +4039,11 @@  discard block
 block discarded – undo
4039 4039
 
4040 4040
 
4041 4041
 	/**
4042
-	* Gets all airlines that have flown over by date
4043
-	*
4044
-	* @return Array the airline list
4045
-	*
4046
-	*/
4042
+	 * Gets all airlines that have flown over by date
4043
+	 *
4044
+	 * @return Array the airline list
4045
+	 *
4046
+	 */
4047 4047
 	public function countAllAirlinesByDate($date,$filters = array())
4048 4048
 	{
4049 4049
 		global $globalTimezone, $globalDBdriver;
@@ -4087,11 +4087,11 @@  discard block
 block discarded – undo
4087 4087
 	
4088 4088
 	
4089 4089
 	/**
4090
-	* Gets all airline countries that have flown over by date
4091
-	*
4092
-	* @return Array the airline country list
4093
-	*
4094
-	*/
4090
+	 * Gets all airline countries that have flown over by date
4091
+	 *
4092
+	 * @return Array the airline country list
4093
+	 *
4094
+	 */
4095 4095
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4096 4096
 	{
4097 4097
 		global $globalTimezone, $globalDBdriver;
@@ -4134,11 +4134,11 @@  discard block
 block discarded – undo
4134 4134
 
4135 4135
 
4136 4136
 	/**
4137
-	* Gets all airlines that have flown over by ident/callsign
4138
-	*
4139
-	* @return Array the airline list
4140
-	*
4141
-	*/
4137
+	 * Gets all airlines that have flown over by ident/callsign
4138
+	 *
4139
+	 * @return Array the airline list
4140
+	 *
4141
+	 */
4142 4142
 	public function countAllAirlinesByIdent($ident,$filters = array())
4143 4143
 	{
4144 4144
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4168,11 +4168,11 @@  discard block
 block discarded – undo
4168 4168
 	}
4169 4169
 
4170 4170
 	/**
4171
-	* Gets all airlines that have flown over by route
4172
-	*
4173
-	* @return Array the airline list
4174
-	*
4175
-	*/
4171
+	 * Gets all airlines that have flown over by route
4172
+	 *
4173
+	 * @return Array the airline list
4174
+	 *
4175
+	 */
4176 4176
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4177 4177
 	{
4178 4178
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4204,11 +4204,11 @@  discard block
 block discarded – undo
4204 4204
 	}
4205 4205
 
4206 4206
 	/**
4207
-	* Gets all airline countries that have flown over by route
4208
-	*
4209
-	* @return Array the airline country list
4210
-	*
4211
-	*/
4207
+	 * Gets all airline countries that have flown over by route
4208
+	 *
4209
+	 * @return Array the airline country list
4210
+	 *
4211
+	 */
4212 4212
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4213 4213
 	{
4214 4214
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4240,11 +4240,11 @@  discard block
 block discarded – undo
4240 4240
 
4241 4241
 
4242 4242
 	/**
4243
-	* Gets all airlines that have flown over by country
4244
-	*
4245
-	* @return Array the airline list
4246
-	*
4247
-	*/
4243
+	 * Gets all airlines that have flown over by country
4244
+	 *
4245
+	 * @return Array the airline list
4246
+	 *
4247
+	 */
4248 4248
 	public function countAllAirlinesByCountry($country,$filters = array())
4249 4249
 	{
4250 4250
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4274,11 +4274,11 @@  discard block
 block discarded – undo
4274 4274
 
4275 4275
 
4276 4276
 	/**
4277
-	* Gets all airline countries that have flown over by country
4278
-	*
4279
-	* @return Array the airline country list
4280
-	*
4281
-	*/
4277
+	 * Gets all airline countries that have flown over by country
4278
+	 *
4279
+	 * @return Array the airline country list
4280
+	 *
4281
+	 */
4282 4282
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4283 4283
 	{
4284 4284
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4307,11 +4307,11 @@  discard block
 block discarded – undo
4307 4307
 
4308 4308
 
4309 4309
 	/**
4310
-	* Gets all airlines countries
4311
-	*
4312
-	* @return Array the airline country list
4313
-	*
4314
-	*/
4310
+	 * Gets all airlines countries
4311
+	 *
4312
+	 * @return Array the airline country list
4313
+	 *
4314
+	 */
4315 4315
 	public function countAllAirlineCountries($limit = true, $filters = array())
4316 4316
 	{
4317 4317
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4337,11 +4337,11 @@  discard block
 block discarded – undo
4337 4337
 	}
4338 4338
 
4339 4339
 	/**
4340
-	* Gets all number of flight over countries
4341
-	*
4342
-	* @return Array the airline country list
4343
-	*
4344
-	*/
4340
+	 * Gets all number of flight over countries
4341
+	 *
4342
+	 * @return Array the airline country list
4343
+	 *
4344
+	 */
4345 4345
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4346 4346
 	{
4347 4347
 		global $globalDBdriver;
@@ -4356,15 +4356,15 @@  discard block
 block discarded – undo
4356 4356
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4357 4357
 					FROM countries c, spotter_live s
4358 4358
 					WHERE c.iso2 = s.over_country ";
4359
-                if ($olderthanmonths > 0) {
4359
+				if ($olderthanmonths > 0) {
4360 4360
 			if ($globalDBdriver == 'mysql') {
4361 4361
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4362 4362
 			} else {
4363 4363
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4364 4364
 			}
4365 4365
 		}
4366
-                if ($sincedate != '') {
4367
-            		if ($globalDBdriver == 'mysql') {
4366
+				if ($sincedate != '') {
4367
+					if ($globalDBdriver == 'mysql') {
4368 4368
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4369 4369
 			} else {
4370 4370
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4394,11 +4394,11 @@  discard block
 block discarded – undo
4394 4394
 	
4395 4395
 	
4396 4396
 	/**
4397
-	* Gets all aircraft types that have flown over
4398
-	*
4399
-	* @return Array the aircraft list
4400
-	*
4401
-	*/
4397
+	 * Gets all aircraft types that have flown over
4398
+	 *
4399
+	 * @return Array the aircraft list
4400
+	 *
4401
+	 */
4402 4402
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4403 4403
 	{
4404 4404
 		global $globalDBdriver;
@@ -4441,11 +4441,11 @@  discard block
 block discarded – undo
4441 4441
 	}
4442 4442
 
4443 4443
 	/**
4444
-	* Gets all aircraft types that have flown over by airline
4445
-	*
4446
-	* @return Array the aircraft list
4447
-	*
4448
-	*/
4444
+	 * Gets all aircraft types that have flown over by airline
4445
+	 *
4446
+	 * @return Array the aircraft list
4447
+	 *
4448
+	 */
4449 4449
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4450 4450
 	{
4451 4451
 		global $globalDBdriver;
@@ -4489,11 +4489,11 @@  discard block
 block discarded – undo
4489 4489
 
4490 4490
 
4491 4491
 	/**
4492
-	* Gets all aircraft registration that have flown over by aircaft icao
4493
-	*
4494
-	* @return Array the aircraft list
4495
-	*
4496
-	*/
4492
+	 * Gets all aircraft registration that have flown over by aircaft icao
4493
+	 *
4494
+	 * @return Array the aircraft list
4495
+	 *
4496
+	 */
4497 4497
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4498 4498
 	{
4499 4499
 		$Image = new Image($this->db);
@@ -4532,11 +4532,11 @@  discard block
 block discarded – undo
4532 4532
 
4533 4533
 
4534 4534
 	/**
4535
-	* Gets all aircraft types that have flown over by airline icao
4536
-	*
4537
-	* @return Array the aircraft list
4538
-	*
4539
-	*/
4535
+	 * Gets all aircraft types that have flown over by airline icao
4536
+	 *
4537
+	 * @return Array the aircraft list
4538
+	 *
4539
+	 */
4540 4540
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4541 4541
 	{
4542 4542
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4565,11 +4565,11 @@  discard block
 block discarded – undo
4565 4565
 
4566 4566
 
4567 4567
 	/**
4568
-	* Gets all aircraft registration that have flown over by airline icao
4569
-	*
4570
-	* @return Array the aircraft list
4571
-	*
4572
-	*/
4568
+	 * Gets all aircraft registration that have flown over by airline icao
4569
+	 *
4570
+	 * @return Array the aircraft list
4571
+	 *
4572
+	 */
4573 4573
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4574 4574
 	{
4575 4575
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4607,11 +4607,11 @@  discard block
 block discarded – undo
4607 4607
 
4608 4608
 
4609 4609
 	/**
4610
-	* Gets all aircraft manufacturer that have flown over by airline icao
4611
-	*
4612
-	* @return Array the aircraft list
4613
-	*
4614
-	*/
4610
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4611
+	 *
4612
+	 * @return Array the aircraft list
4613
+	 *
4614
+	 */
4615 4615
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4616 4616
 	{
4617 4617
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4639,11 +4639,11 @@  discard block
 block discarded – undo
4639 4639
 
4640 4640
 
4641 4641
 	/**
4642
-	* Gets all aircraft types that have flown over by airline icao
4643
-	*
4644
-	* @return Array the aircraft list
4645
-	*
4646
-	*/
4642
+	 * Gets all aircraft types that have flown over by airline icao
4643
+	 *
4644
+	 * @return Array the aircraft list
4645
+	 *
4646
+	 */
4647 4647
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4648 4648
 	{
4649 4649
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4672,11 +4672,11 @@  discard block
 block discarded – undo
4672 4672
 
4673 4673
 
4674 4674
 	/**
4675
-	* Gets all aircraft registration that have flown over by airport icao
4676
-	*
4677
-	* @return Array the aircraft list
4678
-	*
4679
-	*/
4675
+	 * Gets all aircraft registration that have flown over by airport icao
4676
+	 *
4677
+	 * @return Array the aircraft list
4678
+	 *
4679
+	 */
4680 4680
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4681 4681
 	{
4682 4682
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4714,11 +4714,11 @@  discard block
 block discarded – undo
4714 4714
 	
4715 4715
 	
4716 4716
 	/**
4717
-	* Gets all aircraft manufacturer that have flown over by airport icao
4718
-	*
4719
-	* @return Array the aircraft list
4720
-	*
4721
-	*/
4717
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4718
+	 *
4719
+	 * @return Array the aircraft list
4720
+	 *
4721
+	 */
4722 4722
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4723 4723
 	{
4724 4724
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4744,11 +4744,11 @@  discard block
 block discarded – undo
4744 4744
 	}
4745 4745
 
4746 4746
 	/**
4747
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4748
-	*
4749
-	* @return Array the aircraft list
4750
-	*
4751
-	*/
4747
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4748
+	 *
4749
+	 * @return Array the aircraft list
4750
+	 *
4751
+	 */
4752 4752
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4753 4753
 	{
4754 4754
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4775,11 +4775,11 @@  discard block
 block discarded – undo
4775 4775
 
4776 4776
 
4777 4777
 	/**
4778
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4779
-	*
4780
-	* @return Array the aircraft list
4781
-	*
4782
-	*/
4778
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4779
+	 *
4780
+	 * @return Array the aircraft list
4781
+	 *
4782
+	 */
4783 4783
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4784 4784
 	{
4785 4785
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4815,11 +4815,11 @@  discard block
 block discarded – undo
4815 4815
 	}
4816 4816
 
4817 4817
 	/**
4818
-	* Gets all aircraft types that have flown over by date
4819
-	*
4820
-	* @return Array the aircraft list
4821
-	*
4822
-	*/
4818
+	 * Gets all aircraft types that have flown over by date
4819
+	 *
4820
+	 * @return Array the aircraft list
4821
+	 *
4822
+	 */
4823 4823
 	public function countAllAircraftTypesByDate($date,$filters = array())
4824 4824
 	{
4825 4825
 		global $globalTimezone, $globalDBdriver;
@@ -4861,11 +4861,11 @@  discard block
 block discarded – undo
4861 4861
 
4862 4862
 
4863 4863
 	/**
4864
-	* Gets all aircraft registration that have flown over by date
4865
-	*
4866
-	* @return Array the aircraft list
4867
-	*
4868
-	*/
4864
+	 * Gets all aircraft registration that have flown over by date
4865
+	 *
4866
+	 * @return Array the aircraft list
4867
+	 *
4868
+	 */
4869 4869
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4870 4870
 	{
4871 4871
 		global $globalTimezone, $globalDBdriver;
@@ -4916,11 +4916,11 @@  discard block
 block discarded – undo
4916 4916
 
4917 4917
 
4918 4918
 	/**
4919
-	* Gets all aircraft manufacturer that have flown over by date
4920
-	*
4921
-	* @return Array the aircraft manufacturer list
4922
-	*
4923
-	*/
4919
+	 * Gets all aircraft manufacturer that have flown over by date
4920
+	 *
4921
+	 * @return Array the aircraft manufacturer list
4922
+	 *
4923
+	 */
4924 4924
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
4925 4925
 	{
4926 4926
 		global $globalTimezone, $globalDBdriver;
@@ -4962,11 +4962,11 @@  discard block
 block discarded – undo
4962 4962
 
4963 4963
 
4964 4964
 	/**
4965
-	* Gets all aircraft types that have flown over by ident/callsign
4966
-	*
4967
-	* @return Array the aircraft list
4968
-	*
4969
-	*/
4965
+	 * Gets all aircraft types that have flown over by ident/callsign
4966
+	 *
4967
+	 * @return Array the aircraft list
4968
+	 *
4969
+	 */
4970 4970
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
4971 4971
 	{
4972 4972
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4995,11 +4995,11 @@  discard block
 block discarded – undo
4995 4995
 
4996 4996
 
4997 4997
 	/**
4998
-	* Gets all aircraft registration that have flown over by ident/callsign
4999
-	*
5000
-	* @return Array the aircraft list
5001
-	*
5002
-	*/
4998
+	 * Gets all aircraft registration that have flown over by ident/callsign
4999
+	 *
5000
+	 * @return Array the aircraft list
5001
+	 *
5002
+	 */
5003 5003
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5004 5004
 	{
5005 5005
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5039,11 +5039,11 @@  discard block
 block discarded – undo
5039 5039
 
5040 5040
 
5041 5041
 	/**
5042
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5043
-	*
5044
-	* @return Array the aircraft manufacturer list
5045
-	*
5046
-	*/
5042
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5043
+	 *
5044
+	 * @return Array the aircraft manufacturer list
5045
+	 *
5046
+	 */
5047 5047
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5048 5048
 	{
5049 5049
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5069,11 +5069,11 @@  discard block
 block discarded – undo
5069 5069
 
5070 5070
 
5071 5071
 	/**
5072
-	* Gets all aircraft types that have flown over by route
5073
-	*
5074
-	* @return Array the aircraft list
5075
-	*
5076
-	*/
5072
+	 * Gets all aircraft types that have flown over by route
5073
+	 *
5074
+	 * @return Array the aircraft list
5075
+	 *
5076
+	 */
5077 5077
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5078 5078
 	{
5079 5079
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5102,11 +5102,11 @@  discard block
 block discarded – undo
5102 5102
 	}
5103 5103
 
5104 5104
 	/**
5105
-	* Gets all aircraft registration that have flown over by route
5106
-	*
5107
-	* @return Array the aircraft list
5108
-	*
5109
-	*/
5105
+	 * Gets all aircraft registration that have flown over by route
5106
+	 *
5107
+	 * @return Array the aircraft list
5108
+	 *
5109
+	 */
5110 5110
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5111 5111
 	{
5112 5112
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5148,11 +5148,11 @@  discard block
 block discarded – undo
5148 5148
 	
5149 5149
 	
5150 5150
 	/**
5151
-	* Gets all aircraft manufacturer that have flown over by route
5152
-	*
5153
-	* @return Array the aircraft manufacturer list
5154
-	*
5155
-	*/
5151
+	 * Gets all aircraft manufacturer that have flown over by route
5152
+	 *
5153
+	 * @return Array the aircraft manufacturer list
5154
+	 *
5155
+	 */
5156 5156
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5157 5157
 	{
5158 5158
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5186,11 +5186,11 @@  discard block
 block discarded – undo
5186 5186
 	
5187 5187
 	
5188 5188
 	/**
5189
-	* Gets all aircraft types that have flown over by country
5190
-	*
5191
-	* @return Array the aircraft list
5192
-	*
5193
-	*/
5189
+	 * Gets all aircraft types that have flown over by country
5190
+	 *
5191
+	 * @return Array the aircraft list
5192
+	 *
5193
+	 */
5194 5194
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5195 5195
 	{
5196 5196
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5221,11 +5221,11 @@  discard block
 block discarded – undo
5221 5221
 
5222 5222
 
5223 5223
 	/**
5224
-	* Gets all aircraft registration that have flown over by country
5225
-	*
5226
-	* @return Array the aircraft list
5227
-	*
5228
-	*/
5224
+	 * Gets all aircraft registration that have flown over by country
5225
+	 *
5226
+	 * @return Array the aircraft list
5227
+	 *
5228
+	 */
5229 5229
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5230 5230
 	{
5231 5231
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5265,11 +5265,11 @@  discard block
 block discarded – undo
5265 5265
 	
5266 5266
 	
5267 5267
 	/**
5268
-	* Gets all aircraft manufacturer that have flown over by country
5269
-	*
5270
-	* @return Array the aircraft manufacturer list
5271
-	*
5272
-	*/
5268
+	 * Gets all aircraft manufacturer that have flown over by country
5269
+	 *
5270
+	 * @return Array the aircraft manufacturer list
5271
+	 *
5272
+	 */
5273 5273
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5274 5274
 	{
5275 5275
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5300,17 +5300,17 @@  discard block
 block discarded – undo
5300 5300
 	
5301 5301
 	
5302 5302
 	/**
5303
-	* Gets all aircraft manufacturers that have flown over
5304
-	*
5305
-	* @return Array the aircraft list
5306
-	*
5307
-	*/
5303
+	 * Gets all aircraft manufacturers that have flown over
5304
+	 *
5305
+	 * @return Array the aircraft list
5306
+	 *
5307
+	 */
5308 5308
 	public function countAllAircraftManufacturers($filters = array())
5309 5309
 	{
5310 5310
 		$filter_query = $this->getFilter($filters,true,true);
5311 5311
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5312 5312
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5313
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5313
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5314 5314
 					ORDER BY aircraft_manufacturer_count DESC
5315 5315
 					LIMIT 10";
5316 5316
       
@@ -5335,11 +5335,11 @@  discard block
 block discarded – undo
5335 5335
 	
5336 5336
 	
5337 5337
 	/**
5338
-	* Gets all aircraft registrations that have flown over
5339
-	*
5340
-	* @return Array the aircraft list
5341
-	*
5342
-	*/
5338
+	 * Gets all aircraft registrations that have flown over
5339
+	 *
5340
+	 * @return Array the aircraft list
5341
+	 *
5342
+	 */
5343 5343
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5344 5344
 	{
5345 5345
 		global $globalDBdriver;
@@ -5347,15 +5347,15 @@  discard block
 block discarded – undo
5347 5347
 		$filter_query = $this->getFilter($filters,true,true);
5348 5348
 		$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    
5349 5349
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5350
-                if ($olderthanmonths > 0) {
5351
-            		if ($globalDBdriver == 'mysql') {
5350
+				if ($olderthanmonths > 0) {
5351
+					if ($globalDBdriver == 'mysql') {
5352 5352
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5353 5353
 			} else {
5354 5354
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5355 5355
 			}
5356 5356
 		}
5357
-                if ($sincedate != '') {
5358
-            		if ($globalDBdriver == 'mysql') {
5357
+				if ($sincedate != '') {
5358
+					if ($globalDBdriver == 'mysql') {
5359 5359
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5360 5360
 			} else {
5361 5361
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5364,7 +5364,7 @@  discard block
 block discarded – undo
5364 5364
 
5365 5365
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5366 5366
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5367
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5367
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5368 5368
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5369 5369
 		
5370 5370
 		$sth = $this->db->prepare($query);
@@ -5395,11 +5395,11 @@  discard block
 block discarded – undo
5395 5395
 
5396 5396
 
5397 5397
 	/**
5398
-	* Gets all aircraft registrations that have flown over
5399
-	*
5400
-	* @return Array the aircraft list
5401
-	*
5402
-	*/
5398
+	 * Gets all aircraft registrations that have flown over
5399
+	 *
5400
+	 * @return Array the aircraft list
5401
+	 *
5402
+	 */
5403 5403
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5404 5404
 	{
5405 5405
 		global $globalDBdriver;
@@ -5407,15 +5407,15 @@  discard block
 block discarded – undo
5407 5407
 		$Image = new Image($this->db);
5408 5408
 		$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    
5409 5409
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5410
-                if ($olderthanmonths > 0) {
5411
-            		if ($globalDBdriver == 'mysql') {
5410
+				if ($olderthanmonths > 0) {
5411
+					if ($globalDBdriver == 'mysql') {
5412 5412
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5413 5413
 			} else {
5414 5414
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5415 5415
 			}
5416 5416
 		}
5417
-                if ($sincedate != '') {
5418
-            		if ($globalDBdriver == 'mysql') {
5417
+				if ($sincedate != '') {
5418
+					if ($globalDBdriver == 'mysql') {
5419 5419
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5420 5420
 			} else {
5421 5421
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5424,7 +5424,7 @@  discard block
 block discarded – undo
5424 5424
 
5425 5425
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5426 5426
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5427
-                $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";
5427
+				$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";
5428 5428
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5429 5429
 		
5430 5430
 		$sth = $this->db->prepare($query);
@@ -5456,35 +5456,35 @@  discard block
 block discarded – undo
5456 5456
 	
5457 5457
 	
5458 5458
 	/**
5459
-	* Gets all departure airports of the airplanes that have flown over
5460
-	*
5461
-	* @return Array the airport list
5462
-	*
5463
-	*/
5459
+	 * Gets all departure airports of the airplanes that have flown over
5460
+	 *
5461
+	 * @return Array the airport list
5462
+	 *
5463
+	 */
5464 5464
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5465 5465
 	{
5466 5466
 		global $globalDBdriver;
5467 5467
 		$filter_query = $this->getFilter($filters,true,true);
5468 5468
 		$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 
5469 5469
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5470
-                if ($olderthanmonths > 0) {
5471
-            		if ($globalDBdriver == 'mysql') {
5470
+				if ($olderthanmonths > 0) {
5471
+					if ($globalDBdriver == 'mysql') {
5472 5472
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5473 5473
 			} else {
5474 5474
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5475 5475
 			}
5476
-                }
5477
-                if ($sincedate != '') {
5478
-            		if ($globalDBdriver == 'mysql') {
5476
+				}
5477
+				if ($sincedate != '') {
5478
+					if ($globalDBdriver == 'mysql') {
5479 5479
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5480 5480
 			} else {
5481 5481
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5482 5482
 			}
5483 5483
 		}
5484 5484
 
5485
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5486
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5487
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5485
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5486
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5487
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5488 5488
 				ORDER BY airport_departure_icao_count DESC";
5489 5489
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5490 5490
       
@@ -5508,35 +5508,35 @@  discard block
 block discarded – undo
5508 5508
 	}
5509 5509
 
5510 5510
 	/**
5511
-	* Gets all departure airports of the airplanes that have flown over
5512
-	*
5513
-	* @return Array the airport list
5514
-	*
5515
-	*/
5511
+	 * Gets all departure airports of the airplanes that have flown over
5512
+	 *
5513
+	 * @return Array the airport list
5514
+	 *
5515
+	 */
5516 5516
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5517 5517
 	{
5518 5518
 		global $globalDBdriver;
5519 5519
 		$filter_query = $this->getFilter($filters,true,true);
5520 5520
 		$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 
5521 5521
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5522
-                if ($olderthanmonths > 0) {
5523
-            		if ($globalDBdriver == 'mysql') {
5522
+				if ($olderthanmonths > 0) {
5523
+					if ($globalDBdriver == 'mysql') {
5524 5524
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5525 5525
 			} else {
5526 5526
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5527 5527
 			}
5528
-                }
5529
-                if ($sincedate != '') {
5530
-            		if ($globalDBdriver == 'mysql') {
5528
+				}
5529
+				if ($sincedate != '') {
5530
+					if ($globalDBdriver == 'mysql') {
5531 5531
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5532 5532
 			} else {
5533 5533
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5534 5534
 			}
5535 5535
 		}
5536 5536
 
5537
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5538
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5539
-                $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
5537
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5538
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5539
+				$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
5540 5540
 				ORDER BY airport_departure_icao_count DESC";
5541 5541
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5542 5542
       
@@ -5561,37 +5561,37 @@  discard block
 block discarded – undo
5561 5561
 	}
5562 5562
 
5563 5563
 	/**
5564
-	* Gets all detected departure airports of the airplanes that have flown over
5565
-	*
5566
-	* @return Array the airport list
5567
-	*
5568
-	*/
5564
+	 * Gets all detected departure airports of the airplanes that have flown over
5565
+	 *
5566
+	 * @return Array the airport list
5567
+	 *
5568
+	 */
5569 5569
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5570 5570
 	{
5571 5571
 		global $globalDBdriver;
5572 5572
 		$filter_query = $this->getFilter($filters,true,true);
5573 5573
 		$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
5574 5574
 				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";
5575
-                if ($olderthanmonths > 0) {
5576
-            		if ($globalDBdriver == 'mysql') {
5575
+				if ($olderthanmonths > 0) {
5576
+					if ($globalDBdriver == 'mysql') {
5577 5577
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5578 5578
 			} else {
5579 5579
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5580 5580
 			}
5581
-                }
5582
-                if ($sincedate != '') {
5583
-            		if ($globalDBdriver == 'mysql') {
5581
+				}
5582
+				if ($sincedate != '') {
5583
+					if ($globalDBdriver == 'mysql') {
5584 5584
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5585 5585
 			} else {
5586 5586
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5587 5587
 			}
5588 5588
 		}
5589
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5590
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5591
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5589
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5590
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5591
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5592 5592
 				ORDER BY airport_departure_icao_count DESC";
5593 5593
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5594
-    		echo $query;
5594
+			echo $query;
5595 5595
 		$sth = $this->db->prepare($query);
5596 5596
 		$sth->execute();
5597 5597
       
@@ -5612,35 +5612,35 @@  discard block
 block discarded – undo
5612 5612
 	}
5613 5613
 	
5614 5614
 	/**
5615
-	* Gets all detected departure airports of the airplanes that have flown over
5616
-	*
5617
-	* @return Array the airport list
5618
-	*
5619
-	*/
5615
+	 * Gets all detected departure airports of the airplanes that have flown over
5616
+	 *
5617
+	 * @return Array the airport list
5618
+	 *
5619
+	 */
5620 5620
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5621 5621
 	{
5622 5622
 		global $globalDBdriver;
5623 5623
 		$filter_query = $this->getFilter($filters,true,true);
5624 5624
 		$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
5625 5625
 				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 ";
5626
-                if ($olderthanmonths > 0) {
5627
-            		if ($globalDBdriver == 'mysql') {
5626
+				if ($olderthanmonths > 0) {
5627
+					if ($globalDBdriver == 'mysql') {
5628 5628
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5629 5629
 			} else {
5630 5630
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5631 5631
 			}
5632
-                }
5633
-                if ($sincedate != '') {
5634
-            		if ($globalDBdriver == 'mysql') {
5632
+				}
5633
+				if ($sincedate != '') {
5634
+					if ($globalDBdriver == 'mysql') {
5635 5635
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5636 5636
 			} else {
5637 5637
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5638 5638
 			}
5639 5639
 		}
5640 5640
 
5641
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5642
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5643
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5641
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5642
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5643
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5644 5644
 				ORDER BY airport_departure_icao_count DESC";
5645 5645
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5646 5646
       
@@ -5665,11 +5665,11 @@  discard block
 block discarded – undo
5665 5665
 	}	
5666 5666
 	
5667 5667
 	/**
5668
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5669
-	*
5670
-	* @return Array the airport list
5671
-	*
5672
-	*/
5668
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5669
+	 *
5670
+	 * @return Array the airport list
5671
+	 *
5672
+	 */
5673 5673
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5674 5674
 	{
5675 5675
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5703,11 +5703,11 @@  discard block
 block discarded – undo
5703 5703
 	
5704 5704
 	
5705 5705
 	/**
5706
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5707
-	*
5708
-	* @return Array the airport list
5709
-	*
5710
-	*/
5706
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5707
+	 *
5708
+	 * @return Array the airport list
5709
+	 *
5710
+	 */
5711 5711
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5712 5712
 	{
5713 5713
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5738,11 +5738,11 @@  discard block
 block discarded – undo
5738 5738
 	
5739 5739
 	
5740 5740
 	/**
5741
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5742
-	*
5743
-	* @return Array the airport list
5744
-	*
5745
-	*/
5741
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5742
+	 *
5743
+	 * @return Array the airport list
5744
+	 *
5745
+	 */
5746 5746
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5747 5747
 	{
5748 5748
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5775,11 +5775,11 @@  discard block
 block discarded – undo
5775 5775
 	
5776 5776
 	
5777 5777
 	/**
5778
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5779
-	*
5780
-	* @return Array the airport list
5781
-	*
5782
-	*/
5778
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5779
+	 *
5780
+	 * @return Array the airport list
5781
+	 *
5782
+	 */
5783 5783
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5784 5784
 	{
5785 5785
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5809,11 +5809,11 @@  discard block
 block discarded – undo
5809 5809
 	
5810 5810
 	
5811 5811
 	/**
5812
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5813
-	*
5814
-	* @return Array the airport list
5815
-	*
5816
-	*/
5812
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5813
+	 *
5814
+	 * @return Array the airport list
5815
+	 *
5816
+	 */
5817 5817
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5818 5818
 	{
5819 5819
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5846,11 +5846,11 @@  discard block
 block discarded – undo
5846 5846
 	
5847 5847
 	
5848 5848
 	/**
5849
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5850
-	*
5851
-	* @return Array the airport list
5852
-	*
5853
-	*/
5849
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5850
+	 *
5851
+	 * @return Array the airport list
5852
+	 *
5853
+	 */
5854 5854
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5855 5855
 	{
5856 5856
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5880,11 +5880,11 @@  discard block
 block discarded – undo
5880 5880
 	
5881 5881
 	
5882 5882
 	/**
5883
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5884
-	*
5885
-	* @return Array the airport list
5886
-	*
5887
-	*/
5883
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5884
+	 *
5885
+	 * @return Array the airport list
5886
+	 *
5887
+	 */
5888 5888
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5889 5889
 	{
5890 5890
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5917,11 +5917,11 @@  discard block
 block discarded – undo
5917 5917
 	
5918 5918
 	
5919 5919
 	/**
5920
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5921
-	*
5922
-	* @return Array the airport list
5923
-	*
5924
-	*/
5920
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5921
+	 *
5922
+	 * @return Array the airport list
5923
+	 *
5924
+	 */
5925 5925
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5926 5926
 	{
5927 5927
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5952,11 +5952,11 @@  discard block
 block discarded – undo
5952 5952
 	
5953 5953
 	
5954 5954
 	/**
5955
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5956
-	*
5957
-	* @return Array the airport list
5958
-	*
5959
-	*/
5955
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5956
+	 *
5957
+	 * @return Array the airport list
5958
+	 *
5959
+	 */
5960 5960
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5961 5961
 	{
5962 5962
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5989,11 +5989,11 @@  discard block
 block discarded – undo
5989 5989
 	
5990 5990
 	
5991 5991
 	/**
5992
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5993
-	*
5994
-	* @return Array the airport list
5995
-	*
5996
-	*/
5992
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5993
+	 *
5994
+	 * @return Array the airport list
5995
+	 *
5996
+	 */
5997 5997
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5998 5998
 	{
5999 5999
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6023,11 +6023,11 @@  discard block
 block discarded – undo
6023 6023
 	
6024 6024
 	
6025 6025
 	/**
6026
-	* Gets all departure airports of the airplanes that have flown over based on a date
6027
-	*
6028
-	* @return Array the airport list
6029
-	*
6030
-	*/
6026
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6027
+	 *
6028
+	 * @return Array the airport list
6029
+	 *
6030
+	 */
6031 6031
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6032 6032
 	{
6033 6033
 		global $globalTimezone, $globalDBdriver;
@@ -6073,11 +6073,11 @@  discard block
 block discarded – undo
6073 6073
 	
6074 6074
 	
6075 6075
 	/**
6076
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6077
-	*
6078
-	* @return Array the airport list
6079
-	*
6080
-	*/
6076
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6077
+	 *
6078
+	 * @return Array the airport list
6079
+	 *
6080
+	 */
6081 6081
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6082 6082
 	{
6083 6083
 		global $globalTimezone, $globalDBdriver;
@@ -6120,11 +6120,11 @@  discard block
 block discarded – undo
6120 6120
 	
6121 6121
 	
6122 6122
 	/**
6123
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6124
-	*
6125
-	* @return Array the airport list
6126
-	*
6127
-	*/
6123
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6124
+	 *
6125
+	 * @return Array the airport list
6126
+	 *
6127
+	 */
6128 6128
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6129 6129
 	{
6130 6130
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6158,11 +6158,11 @@  discard block
 block discarded – undo
6158 6158
 	
6159 6159
 	
6160 6160
 	/**
6161
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6162
-	*
6163
-	* @return Array the airport list
6164
-	*
6165
-	*/
6161
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6162
+	 *
6163
+	 * @return Array the airport list
6164
+	 *
6165
+	 */
6166 6166
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6167 6167
 	{
6168 6168
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6193,11 +6193,11 @@  discard block
 block discarded – undo
6193 6193
 	
6194 6194
 	
6195 6195
 	/**
6196
-	* Gets all departure airports of the airplanes that have flown over based on a country
6197
-	*
6198
-	* @return Array the airport list
6199
-	*
6200
-	*/
6196
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6197
+	 *
6198
+	 * @return Array the airport list
6199
+	 *
6200
+	 */
6201 6201
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6202 6202
 	{
6203 6203
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6231,11 +6231,11 @@  discard block
 block discarded – undo
6231 6231
 
6232 6232
 
6233 6233
 	/**
6234
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6235
-	*
6236
-	* @return Array the airport list
6237
-	*
6238
-	*/
6234
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6235
+	 *
6236
+	 * @return Array the airport list
6237
+	 *
6238
+	 */
6239 6239
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6240 6240
 	{
6241 6241
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6265,40 +6265,40 @@  discard block
 block discarded – undo
6265 6265
 	
6266 6266
 
6267 6267
 	/**
6268
-	* Gets all arrival airports of the airplanes that have flown over
6269
-	*
6270
-	* @return Array the airport list
6271
-	*
6272
-	*/
6268
+	 * Gets all arrival airports of the airplanes that have flown over
6269
+	 *
6270
+	 * @return Array the airport list
6271
+	 *
6272
+	 */
6273 6273
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6274 6274
 	{
6275 6275
 		global $globalDBdriver;
6276 6276
 		$filter_query = $this->getFilter($filters,true,true);
6277 6277
 		$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 
6278 6278
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6279
-                if ($olderthanmonths > 0) {
6280
-            		if ($globalDBdriver == 'mysql') {
6279
+				if ($olderthanmonths > 0) {
6280
+					if ($globalDBdriver == 'mysql') {
6281 6281
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6282 6282
 			} else {
6283 6283
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6284 6284
 			}
6285
-                if ($sincedate != '') {
6286
-            		if ($globalDBdriver == 'mysql') {
6285
+				if ($sincedate != '') {
6286
+					if ($globalDBdriver == 'mysql') {
6287 6287
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6288 6288
 			} else {
6289 6289
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6290 6290
 			}
6291 6291
 		}
6292
-            		if ($globalDBdriver == 'mysql') {
6292
+					if ($globalDBdriver == 'mysql') {
6293 6293
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6294 6294
 			} else {
6295 6295
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6296 6296
 			}
6297 6297
 		}
6298 6298
 
6299
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6300
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6301
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6299
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6300
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6301
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6302 6302
 					ORDER BY airport_arrival_icao_count DESC";
6303 6303
 		if ($limit) $query .= " LIMIT 10";
6304 6304
       
@@ -6327,40 +6327,40 @@  discard block
 block discarded – undo
6327 6327
 	}
6328 6328
 
6329 6329
 	/**
6330
-	* Gets all arrival airports of the airplanes that have flown over
6331
-	*
6332
-	* @return Array the airport list
6333
-	*
6334
-	*/
6330
+	 * Gets all arrival airports of the airplanes that have flown over
6331
+	 *
6332
+	 * @return Array the airport list
6333
+	 *
6334
+	 */
6335 6335
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6336 6336
 	{
6337 6337
 		global $globalDBdriver;
6338 6338
 		$filter_query = $this->getFilter($filters,true,true);
6339 6339
 		$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 
6340 6340
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6341
-                if ($olderthanmonths > 0) {
6342
-            		if ($globalDBdriver == 'mysql') {
6341
+				if ($olderthanmonths > 0) {
6342
+					if ($globalDBdriver == 'mysql') {
6343 6343
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6344 6344
 			} else {
6345 6345
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6346 6346
 			}
6347
-                if ($sincedate != '') {
6348
-            		if ($globalDBdriver == 'mysql') {
6347
+				if ($sincedate != '') {
6348
+					if ($globalDBdriver == 'mysql') {
6349 6349
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6350 6350
 			} else {
6351 6351
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6352 6352
 			}
6353 6353
 		}
6354
-            		if ($globalDBdriver == 'mysql') {
6354
+					if ($globalDBdriver == 'mysql') {
6355 6355
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6356 6356
 			} else {
6357 6357
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6358 6358
 			}
6359 6359
 		}
6360 6360
 
6361
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6362
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6363
-                $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
6361
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6362
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6363
+				$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
6364 6364
 					ORDER BY airport_arrival_icao_count DESC";
6365 6365
 		if ($limit) $query .= " LIMIT 10";
6366 6366
       
@@ -6391,39 +6391,39 @@  discard block
 block discarded – undo
6391 6391
 
6392 6392
 
6393 6393
 	/**
6394
-	* Gets all detected arrival airports of the airplanes that have flown over
6395
-	*
6396
-	* @return Array the airport list
6397
-	*
6398
-	*/
6394
+	 * Gets all detected arrival airports of the airplanes that have flown over
6395
+	 *
6396
+	 * @return Array the airport list
6397
+	 *
6398
+	 */
6399 6399
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6400 6400
 	{
6401 6401
 		global $globalDBdriver;
6402 6402
 		$filter_query = $this->getFilter($filters,true,true);
6403 6403
 		$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 
6404 6404
 			FROM spotter_output, airport".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6405
-                if ($olderthanmonths > 0) {
6406
-            		if ($globalDBdriver == 'mysql') {
6405
+				if ($olderthanmonths > 0) {
6406
+					if ($globalDBdriver == 'mysql') {
6407 6407
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6408 6408
 			} else {
6409 6409
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6410 6410
 			}
6411
-                if ($sincedate != '') {
6412
-            		if ($globalDBdriver == 'mysql') {
6411
+				if ($sincedate != '') {
6412
+					if ($globalDBdriver == 'mysql') {
6413 6413
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6414 6414
 			} else {
6415 6415
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6416 6416
 			}
6417 6417
 		}
6418
-            		if ($globalDBdriver == 'mysql') {
6418
+					if ($globalDBdriver == 'mysql') {
6419 6419
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6420 6420
 			} else {
6421 6421
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6422 6422
 			}
6423 6423
 		}
6424
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6425
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6426
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6424
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6425
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6426
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6427 6427
 					ORDER BY airport_arrival_icao_count DESC";
6428 6428
 		if ($limit) $query .= " LIMIT 10";
6429 6429
       
@@ -6452,40 +6452,40 @@  discard block
 block discarded – undo
6452 6452
 	}
6453 6453
 	
6454 6454
 	/**
6455
-	* Gets all detected arrival airports of the airplanes that have flown over
6456
-	*
6457
-	* @return Array the airport list
6458
-	*
6459
-	*/
6455
+	 * Gets all detected arrival airports of the airplanes that have flown over
6456
+	 *
6457
+	 * @return Array the airport list
6458
+	 *
6459
+	 */
6460 6460
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6461 6461
 	{
6462 6462
 		global $globalDBdriver;
6463 6463
 		$filter_query = $this->getFilter($filters,true,true);
6464 6464
 		$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 
6465 6465
 			FROM spotter_output, airport".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6466
-                if ($olderthanmonths > 0) {
6467
-            		if ($globalDBdriver == 'mysql') {
6466
+				if ($olderthanmonths > 0) {
6467
+					if ($globalDBdriver == 'mysql') {
6468 6468
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6469 6469
 			} else {
6470 6470
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6471 6471
 			}
6472
-                if ($sincedate != '') {
6473
-            		if ($globalDBdriver == 'mysql') {
6472
+				if ($sincedate != '') {
6473
+					if ($globalDBdriver == 'mysql') {
6474 6474
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6475 6475
 			} else {
6476 6476
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6477 6477
 			}
6478 6478
 		}
6479
-            		if ($globalDBdriver == 'mysql') {
6479
+					if ($globalDBdriver == 'mysql') {
6480 6480
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6481 6481
 			} else {
6482 6482
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6483 6483
 			}
6484 6484
 		}
6485 6485
 
6486
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6487
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6488
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6486
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6487
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6488
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6489 6489
 					ORDER BY airport_arrival_icao_count DESC";
6490 6490
 		if ($limit) $query .= " LIMIT 10";
6491 6491
       
@@ -6515,11 +6515,11 @@  discard block
 block discarded – undo
6515 6515
 	}	
6516 6516
 	
6517 6517
 	/**
6518
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6519
-	*
6520
-	* @return Array the airport list
6521
-	*
6522
-	*/
6518
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6519
+	 *
6520
+	 * @return Array the airport list
6521
+	 *
6522
+	 */
6523 6523
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6524 6524
 	{
6525 6525
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6551,11 +6551,11 @@  discard block
 block discarded – undo
6551 6551
 	
6552 6552
 	
6553 6553
 	/**
6554
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6555
-	*
6556
-	* @return Array the airport list
6557
-	*
6558
-	*/
6554
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6555
+	 *
6556
+	 * @return Array the airport list
6557
+	 *
6558
+	 */
6559 6559
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6560 6560
 	{
6561 6561
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6586,11 +6586,11 @@  discard block
 block discarded – undo
6586 6586
 	
6587 6587
 	
6588 6588
 	/**
6589
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6590
-	*
6591
-	* @return Array the airport list
6592
-	*
6593
-	*/
6589
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6590
+	 *
6591
+	 * @return Array the airport list
6592
+	 *
6593
+	 */
6594 6594
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6595 6595
 	{
6596 6596
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6624,11 +6624,11 @@  discard block
 block discarded – undo
6624 6624
 	
6625 6625
 	
6626 6626
 	/**
6627
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6628
-	*
6629
-	* @return Array the airport list
6630
-	*
6631
-	*/
6627
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6628
+	 *
6629
+	 * @return Array the airport list
6630
+	 *
6631
+	 */
6632 6632
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6633 6633
 	{
6634 6634
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6658,11 +6658,11 @@  discard block
 block discarded – undo
6658 6658
 	
6659 6659
 	
6660 6660
 	/**
6661
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6662
-	*
6663
-	* @return Array the airport list
6664
-	*
6665
-	*/
6661
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6662
+	 *
6663
+	 * @return Array the airport list
6664
+	 *
6665
+	 */
6666 6666
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6667 6667
 	{
6668 6668
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6696,11 +6696,11 @@  discard block
 block discarded – undo
6696 6696
 	
6697 6697
 	
6698 6698
 	/**
6699
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6700
-	*
6701
-	* @return Array the airport list
6702
-	*
6703
-	*/
6699
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6700
+	 *
6701
+	 * @return Array the airport list
6702
+	 *
6703
+	 */
6704 6704
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6705 6705
 	{
6706 6706
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6731,11 +6731,11 @@  discard block
 block discarded – undo
6731 6731
 	
6732 6732
 	
6733 6733
 	/**
6734
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6735
-	*
6736
-	* @return Array the airport list
6737
-	*
6738
-	*/
6734
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6735
+	 *
6736
+	 * @return Array the airport list
6737
+	 *
6738
+	 */
6739 6739
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6740 6740
 	{
6741 6741
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6768,11 +6768,11 @@  discard block
 block discarded – undo
6768 6768
 	
6769 6769
 	
6770 6770
 	/**
6771
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6772
-	*
6773
-	* @return Array the airport list
6774
-	*
6775
-	*/
6771
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6772
+	 *
6773
+	 * @return Array the airport list
6774
+	 *
6775
+	 */
6776 6776
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6777 6777
 	{
6778 6778
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6802,11 +6802,11 @@  discard block
 block discarded – undo
6802 6802
 	
6803 6803
 	
6804 6804
 	/**
6805
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6806
-	*
6807
-	* @return Array the airport list
6808
-	*
6809
-	*/
6805
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6806
+	 *
6807
+	 * @return Array the airport list
6808
+	 *
6809
+	 */
6810 6810
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6811 6811
 	{
6812 6812
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6840,11 +6840,11 @@  discard block
 block discarded – undo
6840 6840
 	
6841 6841
 	
6842 6842
 	/**
6843
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6844
-	*
6845
-	* @return Array the airport list
6846
-	*
6847
-	*/
6843
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6844
+	 *
6845
+	 * @return Array the airport list
6846
+	 *
6847
+	 */
6848 6848
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6849 6849
 	{
6850 6850
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6875,11 +6875,11 @@  discard block
 block discarded – undo
6875 6875
 	
6876 6876
 	
6877 6877
 	/**
6878
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6879
-	*
6880
-	* @return Array the airport list
6881
-	*
6882
-	*/
6878
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6879
+	 *
6880
+	 * @return Array the airport list
6881
+	 *
6882
+	 */
6883 6883
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6884 6884
 	{
6885 6885
 		global $globalTimezone, $globalDBdriver;
@@ -6925,11 +6925,11 @@  discard block
 block discarded – undo
6925 6925
 	
6926 6926
 	
6927 6927
 	/**
6928
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
6929
-	*
6930
-	* @return Array the airport list
6931
-	*
6932
-	*/
6928
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
6929
+	 *
6930
+	 * @return Array the airport list
6931
+	 *
6932
+	 */
6933 6933
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6934 6934
 	{
6935 6935
 		global $globalTimezone, $globalDBdriver;
@@ -6972,11 +6972,11 @@  discard block
 block discarded – undo
6972 6972
 	
6973 6973
 	
6974 6974
 	/**
6975
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6976
-	*
6977
-	* @return Array the airport list
6978
-	*
6979
-	*/
6975
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6976
+	 *
6977
+	 * @return Array the airport list
6978
+	 *
6979
+	 */
6980 6980
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6981 6981
 	{
6982 6982
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7009,11 +7009,11 @@  discard block
 block discarded – undo
7009 7009
 	
7010 7010
 	
7011 7011
 	/**
7012
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7013
-	*
7014
-	* @return Array the airport list
7015
-	*
7016
-	*/
7012
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7013
+	 *
7014
+	 * @return Array the airport list
7015
+	 *
7016
+	 */
7017 7017
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7018 7018
 	{
7019 7019
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7044,11 +7044,11 @@  discard block
 block discarded – undo
7044 7044
 	
7045 7045
 	
7046 7046
 	/**
7047
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7048
-	*
7049
-	* @return Array the airport list
7050
-	*
7051
-	*/
7047
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7048
+	 *
7049
+	 * @return Array the airport list
7050
+	 *
7051
+	 */
7052 7052
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7053 7053
 	{
7054 7054
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7081,11 +7081,11 @@  discard block
 block discarded – undo
7081 7081
 	
7082 7082
 	
7083 7083
 	/**
7084
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7085
-	*
7086
-	* @return Array the airport list
7087
-	*
7088
-	*/
7084
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7085
+	 *
7086
+	 * @return Array the airport list
7087
+	 *
7088
+	 */
7089 7089
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7090 7090
 	{
7091 7091
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7116,11 +7116,11 @@  discard block
 block discarded – undo
7116 7116
 
7117 7117
 
7118 7118
 	/**
7119
-	* Counts all airport departure countries
7120
-	*
7121
-	* @return Array the airport departure list
7122
-	*
7123
-	*/
7119
+	 * Counts all airport departure countries
7120
+	 *
7121
+	 * @return Array the airport departure list
7122
+	 *
7123
+	 */
7124 7124
 	public function countAllDepartureCountries($filters = array())
7125 7125
 	{
7126 7126
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7150,11 +7150,11 @@  discard block
 block discarded – undo
7150 7150
 	
7151 7151
 	
7152 7152
 	/**
7153
-	* Counts all airport arrival countries
7154
-	*
7155
-	* @return Array the airport arrival list
7156
-	*
7157
-	*/
7153
+	 * Counts all airport arrival countries
7154
+	 *
7155
+	 * @return Array the airport arrival list
7156
+	 *
7157
+	 */
7158 7158
 	public function countAllArrivalCountries($limit = true,$filters = array())
7159 7159
 	{
7160 7160
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7187,11 +7187,11 @@  discard block
 block discarded – undo
7187 7187
 
7188 7188
 
7189 7189
 	/**
7190
-	* Gets all route combinations
7191
-	*
7192
-	* @return Array the route list
7193
-	*
7194
-	*/
7190
+	 * Gets all route combinations
7191
+	 *
7192
+	 * @return Array the route list
7193
+	 *
7194
+	 */
7195 7195
 	public function countAllRoutes($filters = array())
7196 7196
 	{
7197 7197
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7230,11 +7230,11 @@  discard block
 block discarded – undo
7230 7230
 	
7231 7231
 	
7232 7232
 	/**
7233
-	* Gets all route combinations based on an aircraft
7234
-	*
7235
-	* @return Array the route list
7236
-	*
7237
-	*/
7233
+	 * Gets all route combinations based on an aircraft
7234
+	 *
7235
+	 * @return Array the route list
7236
+	 *
7237
+	 */
7238 7238
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7239 7239
 	{
7240 7240
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7270,11 +7270,11 @@  discard block
 block discarded – undo
7270 7270
 	
7271 7271
 	
7272 7272
 	/**
7273
-	* Gets all route combinations based on an aircraft registration
7274
-	*
7275
-	* @return Array the route list
7276
-	*
7277
-	*/
7273
+	 * Gets all route combinations based on an aircraft registration
7274
+	 *
7275
+	 * @return Array the route list
7276
+	 *
7277
+	 */
7278 7278
 	public function countAllRoutesByRegistration($registration, $filters = array())
7279 7279
 	{
7280 7280
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7312,11 +7312,11 @@  discard block
 block discarded – undo
7312 7312
 	
7313 7313
 	
7314 7314
 	/**
7315
-	* Gets all route combinations based on an airline
7316
-	*
7317
-	* @return Array the route list
7318
-	*
7319
-	*/
7315
+	 * Gets all route combinations based on an airline
7316
+	 *
7317
+	 * @return Array the route list
7318
+	 *
7319
+	 */
7320 7320
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7321 7321
 	{
7322 7322
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7354,11 +7354,11 @@  discard block
 block discarded – undo
7354 7354
 	
7355 7355
 	
7356 7356
 	/**
7357
-	* Gets all route combinations based on an airport
7358
-	*
7359
-	* @return Array the route list
7360
-	*
7361
-	*/
7357
+	 * Gets all route combinations based on an airport
7358
+	 *
7359
+	 * @return Array the route list
7360
+	 *
7361
+	 */
7362 7362
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7363 7363
 	{
7364 7364
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7395,11 +7395,11 @@  discard block
 block discarded – undo
7395 7395
 	
7396 7396
 	
7397 7397
 	/**
7398
-	* Gets all route combinations based on an country
7399
-	*
7400
-	* @return Array the route list
7401
-	*
7402
-	*/
7398
+	 * Gets all route combinations based on an country
7399
+	 *
7400
+	 * @return Array the route list
7401
+	 *
7402
+	 */
7403 7403
 	public function countAllRoutesByCountry($country, $filters = array())
7404 7404
 	{
7405 7405
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7435,11 +7435,11 @@  discard block
 block discarded – undo
7435 7435
 
7436 7436
 
7437 7437
 	/**
7438
-	* Gets all route combinations based on an date
7439
-	*
7440
-	* @return Array the route list
7441
-	*
7442
-	*/
7438
+	 * Gets all route combinations based on an date
7439
+	 *
7440
+	 * @return Array the route list
7441
+	 *
7442
+	 */
7443 7443
 	public function countAllRoutesByDate($date, $filters = array())
7444 7444
 	{
7445 7445
 		global $globalTimezone, $globalDBdriver;
@@ -7489,11 +7489,11 @@  discard block
 block discarded – undo
7489 7489
 	
7490 7490
 	
7491 7491
 	/**
7492
-	* Gets all route combinations based on an ident/callsign
7493
-	*
7494
-	* @return Array the route list
7495
-	*
7496
-	*/
7492
+	 * Gets all route combinations based on an ident/callsign
7493
+	 *
7494
+	 * @return Array the route list
7495
+	 *
7496
+	 */
7497 7497
 	public function countAllRoutesByIdent($ident, $filters = array())
7498 7498
 	{
7499 7499
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7530,11 +7530,11 @@  discard block
 block discarded – undo
7530 7530
 	
7531 7531
 	
7532 7532
 	/**
7533
-	* Gets all route combinations based on an manufacturer
7534
-	*
7535
-	* @return Array the route list
7536
-	*
7537
-	*/
7533
+	 * Gets all route combinations based on an manufacturer
7534
+	 *
7535
+	 * @return Array the route list
7536
+	 *
7537
+	 */
7538 7538
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7539 7539
 	{
7540 7540
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7572,11 +7572,11 @@  discard block
 block discarded – undo
7572 7572
 	
7573 7573
 	
7574 7574
 	/**
7575
-	* Gets all route combinations with waypoints
7576
-	*
7577
-	* @return Array the route list
7578
-	*
7579
-	*/
7575
+	 * Gets all route combinations with waypoints
7576
+	 *
7577
+	 * @return Array the route list
7578
+	 *
7579
+	 */
7580 7580
 	public function countAllRoutesWithWaypoints($filters = array())
7581 7581
 	{
7582 7582
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7613,11 +7613,11 @@  discard block
 block discarded – undo
7613 7613
 	}
7614 7614
 	
7615 7615
 	/**
7616
-	* Gets all callsigns that have flown over
7617
-	*
7618
-	* @return Array the callsign list
7619
-	*
7620
-	*/
7616
+	 * Gets all callsigns that have flown over
7617
+	 *
7618
+	 * @return Array the callsign list
7619
+	 *
7620
+	 */
7621 7621
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7622 7622
 	{
7623 7623
 		global $globalDBdriver;
@@ -7655,11 +7655,11 @@  discard block
 block discarded – undo
7655 7655
 	}
7656 7656
 
7657 7657
 	/**
7658
-	* Gets all callsigns that have flown over
7659
-	*
7660
-	* @return Array the callsign list
7661
-	*
7662
-	*/
7658
+	 * Gets all callsigns that have flown over
7659
+	 *
7660
+	 * @return Array the callsign list
7661
+	 *
7662
+	 */
7663 7663
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7664 7664
 	{
7665 7665
 		global $globalDBdriver;
@@ -7700,11 +7700,11 @@  discard block
 block discarded – undo
7700 7700
 
7701 7701
 
7702 7702
 	/**
7703
-	* Counts all dates
7704
-	*
7705
-	* @return Array the date list
7706
-	*
7707
-	*/
7703
+	 * Counts all dates
7704
+	 *
7705
+	 * @return Array the date list
7706
+	 *
7707
+	 */
7708 7708
 	public function countAllDates($filters = array())
7709 7709
 	{
7710 7710
 		global $globalTimezone, $globalDBdriver;
@@ -7749,11 +7749,11 @@  discard block
 block discarded – undo
7749 7749
 	}
7750 7750
 	
7751 7751
 	/**
7752
-	* Counts all dates
7753
-	*
7754
-	* @return Array the date list
7755
-	*
7756
-	*/
7752
+	 * Counts all dates
7753
+	 *
7754
+	 * @return Array the date list
7755
+	 *
7756
+	 */
7757 7757
 	public function countAllDatesByAirlines($filters = array())
7758 7758
 	{
7759 7759
 		global $globalTimezone, $globalDBdriver;
@@ -7798,11 +7798,11 @@  discard block
 block discarded – undo
7798 7798
 	}	
7799 7799
 	
7800 7800
 	/**
7801
-	* Counts all dates during the last 7 days
7802
-	*
7803
-	* @return Array the date list
7804
-	*
7805
-	*/
7801
+	 * Counts all dates during the last 7 days
7802
+	 *
7803
+	 * @return Array the date list
7804
+	 *
7805
+	 */
7806 7806
 	public function countAllDatesLast7Days($filters = array())
7807 7807
 	{
7808 7808
 		global $globalTimezone, $globalDBdriver;
@@ -7824,7 +7824,7 @@  discard block
 block discarded – undo
7824 7824
 			$query .= " GROUP BY date_name 
7825 7825
 								ORDER BY date_name ASC";
7826 7826
 			$query_data = array(':offset' => $offset);
7827
-    		}
7827
+			}
7828 7828
 		
7829 7829
 		$sth = $this->db->prepare($query);
7830 7830
 		$sth->execute($query_data);
@@ -7844,11 +7844,11 @@  discard block
 block discarded – undo
7844 7844
 	}
7845 7845
 
7846 7846
 	/**
7847
-	* Counts all dates during the last month
7848
-	*
7849
-	* @return Array the date list
7850
-	*
7851
-	*/
7847
+	 * Counts all dates during the last month
7848
+	 *
7849
+	 * @return Array the date list
7850
+	 *
7851
+	 */
7852 7852
 	public function countAllDatesLastMonth($filters = array())
7853 7853
 	{
7854 7854
 		global $globalTimezone, $globalDBdriver;
@@ -7870,7 +7870,7 @@  discard block
 block discarded – undo
7870 7870
 			$query .= " GROUP BY date_name 
7871 7871
 								ORDER BY date_name ASC";
7872 7872
 			$query_data = array(':offset' => $offset);
7873
-    		}
7873
+			}
7874 7874
 		
7875 7875
 		$sth = $this->db->prepare($query);
7876 7876
 		$sth->execute($query_data);
@@ -7891,11 +7891,11 @@  discard block
 block discarded – undo
7891 7891
 
7892 7892
 
7893 7893
 	/**
7894
-	* Counts all dates during the last month
7895
-	*
7896
-	* @return Array the date list
7897
-	*
7898
-	*/
7894
+	 * Counts all dates during the last month
7895
+	 *
7896
+	 * @return Array the date list
7897
+	 *
7898
+	 */
7899 7899
 	public function countAllDatesLastMonthByAirlines($filters = array())
7900 7900
 	{
7901 7901
 		global $globalTimezone, $globalDBdriver;
@@ -7918,7 +7918,7 @@  discard block
 block discarded – undo
7918 7918
 								GROUP BY spotter_output.airline_icao, date_name 
7919 7919
 								ORDER BY date_name ASC";
7920 7920
 			$query_data = array(':offset' => $offset);
7921
-    		}
7921
+			}
7922 7922
 		
7923 7923
 		$sth = $this->db->prepare($query);
7924 7924
 		$sth->execute($query_data);
@@ -7940,11 +7940,11 @@  discard block
 block discarded – undo
7940 7940
 	
7941 7941
 
7942 7942
 	/**
7943
-	* Counts all month
7944
-	*
7945
-	* @return Array the month list
7946
-	*
7947
-	*/
7943
+	 * Counts all month
7944
+	 *
7945
+	 * @return Array the month list
7946
+	 *
7947
+	 */
7948 7948
 	public function countAllMonths($filters = array())
7949 7949
 	{
7950 7950
 		global $globalTimezone, $globalDBdriver;
@@ -7986,11 +7986,11 @@  discard block
 block discarded – undo
7986 7986
 	}
7987 7987
 
7988 7988
 	/**
7989
-	* Counts all month
7990
-	*
7991
-	* @return Array the month list
7992
-	*
7993
-	*/
7989
+	 * Counts all month
7990
+	 *
7991
+	 * @return Array the month list
7992
+	 *
7993
+	 */
7994 7994
 	public function countAllMonthsByAirlines($filters = array())
7995 7995
 	{
7996 7996
 		global $globalTimezone, $globalDBdriver;
@@ -8035,11 +8035,11 @@  discard block
 block discarded – undo
8035 8035
 	}
8036 8036
 
8037 8037
 	/**
8038
-	* Counts all military month
8039
-	*
8040
-	* @return Array the month list
8041
-	*
8042
-	*/
8038
+	 * Counts all military month
8039
+	 *
8040
+	 * @return Array the month list
8041
+	 *
8042
+	 */
8043 8043
 	public function countAllMilitaryMonths($filters = array())
8044 8044
 	{
8045 8045
 		global $globalTimezone, $globalDBdriver;
@@ -8080,11 +8080,11 @@  discard block
 block discarded – undo
8080 8080
 	}
8081 8081
 	
8082 8082
 	/**
8083
-	* Counts all month owners
8084
-	*
8085
-	* @return Array the month list
8086
-	*
8087
-	*/
8083
+	 * Counts all month owners
8084
+	 *
8085
+	 * @return Array the month list
8086
+	 *
8087
+	 */
8088 8088
 	public function countAllMonthsOwners($filters = array())
8089 8089
 	{
8090 8090
 		global $globalTimezone, $globalDBdriver;
@@ -8126,11 +8126,11 @@  discard block
 block discarded – undo
8126 8126
 	}
8127 8127
 	
8128 8128
 	/**
8129
-	* Counts all month owners
8130
-	*
8131
-	* @return Array the month list
8132
-	*
8133
-	*/
8129
+	 * Counts all month owners
8130
+	 *
8131
+	 * @return Array the month list
8132
+	 *
8133
+	 */
8134 8134
 	public function countAllMonthsOwnersByAirlines($filters = array())
8135 8135
 	{
8136 8136
 		global $globalTimezone, $globalDBdriver;
@@ -8173,11 +8173,11 @@  discard block
 block discarded – undo
8173 8173
 	}
8174 8174
 
8175 8175
 	/**
8176
-	* Counts all month pilot
8177
-	*
8178
-	* @return Array the month list
8179
-	*
8180
-	*/
8176
+	 * Counts all month pilot
8177
+	 *
8178
+	 * @return Array the month list
8179
+	 *
8180
+	 */
8181 8181
 	public function countAllMonthsPilots($filters = array())
8182 8182
 	{
8183 8183
 		global $globalTimezone, $globalDBdriver;
@@ -8219,11 +8219,11 @@  discard block
 block discarded – undo
8219 8219
 	}
8220 8220
 	
8221 8221
 	/**
8222
-	* Counts all month pilot
8223
-	*
8224
-	* @return Array the month list
8225
-	*
8226
-	*/
8222
+	 * Counts all month pilot
8223
+	 *
8224
+	 * @return Array the month list
8225
+	 *
8226
+	 */
8227 8227
 	public function countAllMonthsPilotsByAirlines($filters = array())
8228 8228
 	{
8229 8229
 		global $globalTimezone, $globalDBdriver;
@@ -8266,11 +8266,11 @@  discard block
 block discarded – undo
8266 8266
 	}
8267 8267
 
8268 8268
 	/**
8269
-	* Counts all month airline
8270
-	*
8271
-	* @return Array the month list
8272
-	*
8273
-	*/
8269
+	 * Counts all month airline
8270
+	 *
8271
+	 * @return Array the month list
8272
+	 *
8273
+	 */
8274 8274
 	public function countAllMonthsAirlines($filters = array())
8275 8275
 	{
8276 8276
 		global $globalTimezone, $globalDBdriver;
@@ -8312,11 +8312,11 @@  discard block
 block discarded – undo
8312 8312
 	}
8313 8313
 	
8314 8314
 	/**
8315
-	* Counts all month aircraft
8316
-	*
8317
-	* @return Array the month list
8318
-	*
8319
-	*/
8315
+	 * Counts all month aircraft
8316
+	 *
8317
+	 * @return Array the month list
8318
+	 *
8319
+	 */
8320 8320
 	public function countAllMonthsAircrafts($filters = array())
8321 8321
 	{
8322 8322
 		global $globalTimezone, $globalDBdriver;
@@ -8359,11 +8359,11 @@  discard block
 block discarded – undo
8359 8359
 	
8360 8360
 
8361 8361
 	/**
8362
-	* Counts all month aircraft
8363
-	*
8364
-	* @return Array the month list
8365
-	*
8366
-	*/
8362
+	 * Counts all month aircraft
8363
+	 *
8364
+	 * @return Array the month list
8365
+	 *
8366
+	 */
8367 8367
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8368 8368
 	{
8369 8369
 		global $globalTimezone, $globalDBdriver;
@@ -8406,11 +8406,11 @@  discard block
 block discarded – undo
8406 8406
 	}
8407 8407
 
8408 8408
 	/**
8409
-	* Counts all month real arrival
8410
-	*
8411
-	* @return Array the month list
8412
-	*
8413
-	*/
8409
+	 * Counts all month real arrival
8410
+	 *
8411
+	 * @return Array the month list
8412
+	 *
8413
+	 */
8414 8414
 	public function countAllMonthsRealArrivals($filters = array())
8415 8415
 	{
8416 8416
 		global $globalTimezone, $globalDBdriver;
@@ -8453,11 +8453,11 @@  discard block
 block discarded – undo
8453 8453
 	
8454 8454
 
8455 8455
 	/**
8456
-	* Counts all month real arrival
8457
-	*
8458
-	* @return Array the month list
8459
-	*
8460
-	*/
8456
+	 * Counts all month real arrival
8457
+	 *
8458
+	 * @return Array the month list
8459
+	 *
8460
+	 */
8461 8461
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8462 8462
 	{
8463 8463
 		global $globalTimezone, $globalDBdriver;
@@ -8501,11 +8501,11 @@  discard block
 block discarded – undo
8501 8501
 	
8502 8502
 
8503 8503
 	/**
8504
-	* Counts all dates during the last year
8505
-	*
8506
-	* @return Array the date list
8507
-	*
8508
-	*/
8504
+	 * Counts all dates during the last year
8505
+	 *
8506
+	 * @return Array the date list
8507
+	 *
8508
+	 */
8509 8509
 	public function countAllMonthsLastYear($filters)
8510 8510
 	{
8511 8511
 		global $globalTimezone, $globalDBdriver;
@@ -8527,7 +8527,7 @@  discard block
 block discarded – undo
8527 8527
 			$query .= " GROUP BY year_name, month_name
8528 8528
 								ORDER BY year_name, month_name ASC";
8529 8529
 			$query_data = array(':offset' => $offset);
8530
-    		}
8530
+			}
8531 8531
 		
8532 8532
 		$sth = $this->db->prepare($query);
8533 8533
 		$sth->execute($query_data);
@@ -8550,11 +8550,11 @@  discard block
 block discarded – undo
8550 8550
 	
8551 8551
 	
8552 8552
 	/**
8553
-	* Counts all hours
8554
-	*
8555
-	* @return Array the hour list
8556
-	*
8557
-	*/
8553
+	 * Counts all hours
8554
+	 *
8555
+	 * @return Array the hour list
8556
+	 *
8557
+	 */
8558 8558
 	public function countAllHours($orderby,$filters = array())
8559 8559
 	{
8560 8560
 		global $globalTimezone, $globalDBdriver;
@@ -8615,11 +8615,11 @@  discard block
 block discarded – undo
8615 8615
 	}
8616 8616
 	
8617 8617
 	/**
8618
-	* Counts all hours
8619
-	*
8620
-	* @return Array the hour list
8621
-	*
8622
-	*/
8618
+	 * Counts all hours
8619
+	 *
8620
+	 * @return Array the hour list
8621
+	 *
8622
+	 */
8623 8623
 	public function countAllHoursByAirlines($orderby, $filters = array())
8624 8624
 	{
8625 8625
 		global $globalTimezone, $globalDBdriver;
@@ -8682,11 +8682,11 @@  discard block
 block discarded – undo
8682 8682
 
8683 8683
 
8684 8684
 	/**
8685
-	* Counts all hours by airline
8686
-	*
8687
-	* @return Array the hour list
8688
-	*
8689
-	*/
8685
+	 * Counts all hours by airline
8686
+	 *
8687
+	 * @return Array the hour list
8688
+	 *
8689
+	 */
8690 8690
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8691 8691
 	{
8692 8692
 		global $globalTimezone, $globalDBdriver;
@@ -8732,11 +8732,11 @@  discard block
 block discarded – undo
8732 8732
 	
8733 8733
 	
8734 8734
 	/**
8735
-	* Counts all hours by aircraft
8736
-	*
8737
-	* @return Array the hour list
8738
-	*
8739
-	*/
8735
+	 * Counts all hours by aircraft
8736
+	 *
8737
+	 * @return Array the hour list
8738
+	 *
8739
+	 */
8740 8740
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8741 8741
 	{
8742 8742
 		global $globalTimezone, $globalDBdriver;
@@ -8779,11 +8779,11 @@  discard block
 block discarded – undo
8779 8779
 	
8780 8780
 	
8781 8781
 	/**
8782
-	* Counts all hours by aircraft registration
8783
-	*
8784
-	* @return Array the hour list
8785
-	*
8786
-	*/
8782
+	 * Counts all hours by aircraft registration
8783
+	 *
8784
+	 * @return Array the hour list
8785
+	 *
8786
+	 */
8787 8787
 	public function countAllHoursByRegistration($registration, $filters = array())
8788 8788
 	{
8789 8789
 		global $globalTimezone, $globalDBdriver;
@@ -8826,11 +8826,11 @@  discard block
 block discarded – undo
8826 8826
 	
8827 8827
 	
8828 8828
 	/**
8829
-	* Counts all hours by airport
8830
-	*
8831
-	* @return Array the hour list
8832
-	*
8833
-	*/
8829
+	 * Counts all hours by airport
8830
+	 *
8831
+	 * @return Array the hour list
8832
+	 *
8833
+	 */
8834 8834
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8835 8835
 	{
8836 8836
 		global $globalTimezone, $globalDBdriver;
@@ -8874,11 +8874,11 @@  discard block
 block discarded – undo
8874 8874
 	
8875 8875
 	
8876 8876
 	/**
8877
-	* Counts all hours by manufacturer
8878
-	*
8879
-	* @return Array the hour list
8880
-	*
8881
-	*/
8877
+	 * Counts all hours by manufacturer
8878
+	 *
8879
+	 * @return Array the hour list
8880
+	 *
8881
+	 */
8882 8882
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8883 8883
 	{
8884 8884
 		global $globalTimezone, $globalDBdriver;
@@ -8922,11 +8922,11 @@  discard block
 block discarded – undo
8922 8922
 	
8923 8923
 	
8924 8924
 	/**
8925
-	* Counts all hours by date
8926
-	*
8927
-	* @return Array the hour list
8928
-	*
8929
-	*/
8925
+	 * Counts all hours by date
8926
+	 *
8927
+	 * @return Array the hour list
8928
+	 *
8929
+	 */
8930 8930
 	public function countAllHoursByDate($date, $filters = array())
8931 8931
 	{
8932 8932
 		global $globalTimezone, $globalDBdriver;
@@ -8970,11 +8970,11 @@  discard block
 block discarded – undo
8970 8970
 	
8971 8971
 	
8972 8972
 	/**
8973
-	* Counts all hours by a ident/callsign
8974
-	*
8975
-	* @return Array the hour list
8976
-	*
8977
-	*/
8973
+	 * Counts all hours by a ident/callsign
8974
+	 *
8975
+	 * @return Array the hour list
8976
+	 *
8977
+	 */
8978 8978
 	public function countAllHoursByIdent($ident, $filters = array())
8979 8979
 	{
8980 8980
 		global $globalTimezone, $globalDBdriver;
@@ -9019,11 +9019,11 @@  discard block
 block discarded – undo
9019 9019
 	
9020 9020
 	
9021 9021
 	/**
9022
-	* Counts all hours by route
9023
-	*
9024
-	* @return Array the hour list
9025
-	*
9026
-	*/
9022
+	 * Counts all hours by route
9023
+	 *
9024
+	 * @return Array the hour list
9025
+	 *
9026
+	 */
9027 9027
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9028 9028
 	{
9029 9029
 		global $globalTimezone, $globalDBdriver;
@@ -9067,11 +9067,11 @@  discard block
 block discarded – undo
9067 9067
 	
9068 9068
 	
9069 9069
 	/**
9070
-	* Counts all hours by country
9071
-	*
9072
-	* @return Array the hour list
9073
-	*
9074
-	*/
9070
+	 * Counts all hours by country
9071
+	 *
9072
+	 * @return Array the hour list
9073
+	 *
9074
+	 */
9075 9075
 	public function countAllHoursByCountry($country, $filters = array())
9076 9076
 	{
9077 9077
 		global $globalTimezone, $globalDBdriver;
@@ -9116,11 +9116,11 @@  discard block
 block discarded – undo
9116 9116
 
9117 9117
 
9118 9118
 	/**
9119
-	* Counts all aircraft that have flown over
9120
-	*
9121
-	* @return Integer the number of aircrafts
9122
-	*
9123
-	*/
9119
+	 * Counts all aircraft that have flown over
9120
+	 *
9121
+	 * @return Integer the number of aircrafts
9122
+	 *
9123
+	 */
9124 9124
 	public function countOverallAircrafts($filters = array())
9125 9125
 	{
9126 9126
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9132,11 +9132,11 @@  discard block
 block discarded – undo
9132 9132
 	}
9133 9133
 
9134 9134
 	/**
9135
-	* Counts all flight that really arrival
9136
-	*
9137
-	* @return Integer the number of aircrafts
9138
-	*
9139
-	*/
9135
+	 * Counts all flight that really arrival
9136
+	 *
9137
+	 * @return Integer the number of aircrafts
9138
+	 *
9139
+	 */
9140 9140
 	public function countOverallArrival($filters = array())
9141 9141
 	{
9142 9142
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9149,11 +9149,11 @@  discard block
 block discarded – undo
9149 9149
 	}
9150 9150
 
9151 9151
 	/**
9152
-	* Counts all pilots that have flown over
9153
-	*
9154
-	* @return Integer the number of pilots
9155
-	*
9156
-	*/
9152
+	 * Counts all pilots that have flown over
9153
+	 *
9154
+	 * @return Integer the number of pilots
9155
+	 *
9156
+	 */
9157 9157
 	public function countOverallPilots($filters = array())
9158 9158
 	{
9159 9159
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9165,11 +9165,11 @@  discard block
 block discarded – undo
9165 9165
 	}
9166 9166
 
9167 9167
 	/**
9168
-	* Counts all owners that have flown over
9169
-	*
9170
-	* @return Integer the number of owners
9171
-	*
9172
-	*/
9168
+	 * Counts all owners that have flown over
9169
+	 *
9170
+	 * @return Integer the number of owners
9171
+	 *
9172
+	 */
9173 9173
 	public function countOverallOwners($filters = array())
9174 9174
 	{
9175 9175
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9182,11 +9182,11 @@  discard block
 block discarded – undo
9182 9182
 	
9183 9183
 	
9184 9184
 	/**
9185
-	* Counts all flights that have flown over
9186
-	*
9187
-	* @return Integer the number of flights
9188
-	*
9189
-	*/
9185
+	 * Counts all flights that have flown over
9186
+	 *
9187
+	 * @return Integer the number of flights
9188
+	 *
9189
+	 */
9190 9190
 	public function countOverallFlights($filters = array())
9191 9191
 	{
9192 9192
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9199,11 +9199,11 @@  discard block
 block discarded – undo
9199 9199
 	}
9200 9200
 	
9201 9201
 	/**
9202
-	* Counts all military flights that have flown over
9203
-	*
9204
-	* @return Integer the number of flights
9205
-	*
9206
-	*/
9202
+	 * Counts all military flights that have flown over
9203
+	 *
9204
+	 * @return Integer the number of flights
9205
+	 *
9206
+	 */
9207 9207
 	public function countOverallMilitaryFlights($filters = array())
9208 9208
 	{
9209 9209
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9218,11 +9218,11 @@  discard block
 block discarded – undo
9218 9218
 	
9219 9219
 	
9220 9220
 	/**
9221
-	* Counts all airlines that have flown over
9222
-	*
9223
-	* @return Integer the number of airlines
9224
-	*
9225
-	*/
9221
+	 * Counts all airlines that have flown over
9222
+	 *
9223
+	 * @return Integer the number of airlines
9224
+	 *
9225
+	 */
9226 9226
 	public function countOverallAirlines($filters = array())
9227 9227
 	{
9228 9228
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9236,11 +9236,11 @@  discard block
 block discarded – undo
9236 9236
 
9237 9237
   
9238 9238
 	/**
9239
-	* Counts all hours of today
9240
-	*
9241
-	* @return Array the hour list
9242
-	*
9243
-	*/
9239
+	 * Counts all hours of today
9240
+	 *
9241
+	 * @return Array the hour list
9242
+	 *
9243
+	 */
9244 9244
 	public function countAllHoursFromToday($filters = array())
9245 9245
 	{
9246 9246
 		global $globalTimezone, $globalDBdriver;
@@ -9280,11 +9280,11 @@  discard block
 block discarded – undo
9280 9280
 	}
9281 9281
     
9282 9282
 	/**
9283
-	* Gets all the spotter information based on calculated upcoming flights
9284
-	*
9285
-	* @return Array the spotter information
9286
-	*
9287
-	*/
9283
+	 * Gets all the spotter information based on calculated upcoming flights
9284
+	 *
9285
+	 * @return Array the spotter information
9286
+	 *
9287
+	 */
9288 9288
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9289 9289
 	{
9290 9290
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9359,12 +9359,12 @@  discard block
 block discarded – undo
9359 9359
 	}
9360 9360
     
9361 9361
     
9362
-     /**
9363
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9364
-	*
9365
-	* @return Integer the Barrie Spotter ID
9362
+	 /**
9363
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9364
+	  *
9365
+	  * @return Integer the Barrie Spotter ID
9366 9366
 q	*
9367
-	*/
9367
+	  */
9368 9368
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9369 9369
 	{
9370 9370
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9385,13 +9385,13 @@  discard block
 block discarded – undo
9385 9385
   
9386 9386
  
9387 9387
 	/**
9388
-	* Parses a date string
9389
-	*
9390
-	* @param String $dateString the date string
9391
-	* @param String $timezone the timezone of a user
9392
-	* @return Array the time information
9393
-	*
9394
-	*/
9388
+	 * Parses a date string
9389
+	 *
9390
+	 * @param String $dateString the date string
9391
+	 * @param String $timezone the timezone of a user
9392
+	 * @return Array the time information
9393
+	 *
9394
+	 */
9395 9395
 	public function parseDateString($dateString, $timezone = '')
9396 9396
 	{
9397 9397
 		$time_array = array();
@@ -9427,12 +9427,12 @@  discard block
 block discarded – undo
9427 9427
 	
9428 9428
 	
9429 9429
 	/**
9430
-	* Parses the direction degrees to working
9431
-	*
9432
-	* @param Float $direction the direction in degrees
9433
-	* @return Array the direction information
9434
-	*
9435
-	*/
9430
+	 * Parses the direction degrees to working
9431
+	 *
9432
+	 * @param Float $direction the direction in degrees
9433
+	 * @return Array the direction information
9434
+	 *
9435
+	 */
9436 9436
 	public function parseDirection($direction = 0)
9437 9437
 	{
9438 9438
 		if ($direction == '') $direction = 0;
@@ -9511,12 +9511,12 @@  discard block
 block discarded – undo
9511 9511
 	
9512 9512
 	
9513 9513
 	/**
9514
-	* Gets the aircraft registration
9515
-	*
9516
-	* @param String $flightaware_id the flight aware id
9517
-	* @return String the aircraft registration
9518
-	*
9519
-	*/
9514
+	 * Gets the aircraft registration
9515
+	 *
9516
+	 * @param String $flightaware_id the flight aware id
9517
+	 * @return String the aircraft registration
9518
+	 *
9519
+	 */
9520 9520
 	
9521 9521
 	public function getAircraftRegistration($flightaware_id)
9522 9522
 	{
@@ -9545,12 +9545,12 @@  discard block
 block discarded – undo
9545 9545
 
9546 9546
 
9547 9547
 	/**
9548
-	* Gets the aircraft registration from ModeS
9549
-	*
9550
-	* @param String $aircraft_modes the flight ModeS in hex
9551
-	* @return String the aircraft registration
9552
-	*
9553
-	*/
9548
+	 * Gets the aircraft registration from ModeS
9549
+	 *
9550
+	 * @param String $aircraft_modes the flight ModeS in hex
9551
+	 * @return String the aircraft registration
9552
+	 *
9553
+	 */
9554 9554
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9555 9555
 	{
9556 9556
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9563,19 +9563,19 @@  discard block
 block discarded – undo
9563 9563
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9564 9564
 		$sth->closeCursor();
9565 9565
 		if (count($row) > 0) {
9566
-		    //return $row['Registration'];
9567
-		    return $row['registration'];
9566
+			//return $row['Registration'];
9567
+			return $row['registration'];
9568 9568
 		} else return '';
9569 9569
 	
9570 9570
 	}
9571 9571
 
9572 9572
 	/**
9573
-	* Gets the aircraft type from ModeS
9574
-	*
9575
-	* @param String $aircraft_modes the flight ModeS in hex
9576
-	* @return String the aircraft type
9577
-	*
9578
-	*/
9573
+	 * Gets the aircraft type from ModeS
9574
+	 *
9575
+	 * @param String $aircraft_modes the flight ModeS in hex
9576
+	 * @return String the aircraft type
9577
+	 *
9578
+	 */
9579 9579
 	public function getAircraftTypeBymodeS($aircraft_modes)
9580 9580
 	{
9581 9581
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9588,19 +9588,19 @@  discard block
 block discarded – undo
9588 9588
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9589 9589
 		$sth->closeCursor();
9590 9590
 		if (count($row) > 0) {
9591
-		    if ($row['type_flight'] == null) return '';
9592
-		    else return $row['type_flight'];
9591
+			if ($row['type_flight'] == null) return '';
9592
+			else return $row['type_flight'];
9593 9593
 		} else return '';
9594 9594
 	
9595 9595
 	}
9596 9596
 
9597 9597
 	/**
9598
-	* Gets Countrie from latitude/longitude
9599
-	*
9600
-	* @param Float $latitude latitute of the flight
9601
-	* @param Float $longitude longitute of the flight
9602
-	* @return String the countrie
9603
-	*/
9598
+	 * Gets Countrie from latitude/longitude
9599
+	 *
9600
+	 * @param Float $latitude latitute of the flight
9601
+	 * @param Float $longitude longitute of the flight
9602
+	 * @return String the countrie
9603
+	 */
9604 9604
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9605 9605
 	{
9606 9606
 		global $globalDBdriver, $globalDebug;
@@ -9637,12 +9637,12 @@  discard block
 block discarded – undo
9637 9637
 	}
9638 9638
 
9639 9639
 	/**
9640
-	* converts the registration code using the country prefix
9641
-	*
9642
-	* @param String $registration the aircraft registration
9643
-	* @return String the aircraft registration
9644
-	*
9645
-	*/
9640
+	 * converts the registration code using the country prefix
9641
+	 *
9642
+	 * @param String $registration the aircraft registration
9643
+	 * @return String the aircraft registration
9644
+	 *
9645
+	 */
9646 9646
 	public function convertAircraftRegistration($registration)
9647 9647
 	{
9648 9648
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9694,12 +9694,12 @@  discard block
 block discarded – undo
9694 9694
 	}
9695 9695
 
9696 9696
 	/**
9697
-	* Country from the registration code
9698
-	*
9699
-	* @param String $registration the aircraft registration
9700
-	* @return String the country
9701
-	*
9702
-	*/
9697
+	 * Country from the registration code
9698
+	 *
9699
+	 * @param String $registration the aircraft registration
9700
+	 * @return String the country
9701
+	 *
9702
+	 */
9703 9703
 	public function countryFromAircraftRegistration($registration)
9704 9704
 	{
9705 9705
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9718,8 +9718,8 @@  discard block
 block discarded – undo
9718 9718
 				$country = $row['country'];
9719 9719
 			}
9720 9720
 		} else {
9721
-    			$registration_1 = substr($registration, 0, 1);
9722
-		        $registration_2 = substr($registration, 0, 2);
9721
+				$registration_1 = substr($registration, 0, 1);
9722
+				$registration_2 = substr($registration, 0, 2);
9723 9723
 
9724 9724
 			$country = '';
9725 9725
 			//first get the prefix based on two characters
@@ -9755,11 +9755,11 @@  discard block
 block discarded – undo
9755 9755
 	}
9756 9756
 	
9757 9757
 	/**
9758
-	* Set a new highlight value for a flight
9759
-	*
9760
-	* @param String $flightaware_id flightaware_id from spotter_output table
9761
-	* @param String $highlight New highlight value
9762
-	*/
9758
+	 * Set a new highlight value for a flight
9759
+	 *
9760
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9761
+	 * @param String $highlight New highlight value
9762
+	 */
9763 9763
 	public function setHighlightFlight($flightaware_id,$highlight) {
9764 9764
 		
9765 9765
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9768,12 +9768,12 @@  discard block
 block discarded – undo
9768 9768
 	}
9769 9769
 	
9770 9770
 	/**
9771
-	* Gets the short url from bit.ly
9772
-	*
9773
-	* @param String $url the full url
9774
-	* @return String the bit.ly url
9775
-	*
9776
-	*/
9771
+	 * Gets the short url from bit.ly
9772
+	 *
9773
+	 * @param String $url the full url
9774
+	 * @return String the bit.ly url
9775
+	 *
9776
+	 */
9777 9777
 	public function getBitlyURL($url)
9778 9778
 	{
9779 9779
 		global $globalBitlyAccessToken;
@@ -10062,11 +10062,11 @@  discard block
 block discarded – undo
10062 10062
 			$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 
10063 10063
 	                      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)) 
10064 10064
 	                      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;";
10065
-                } else {
10065
+				} else {
10066 10066
 			$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 
10067 10067
 	                      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)) 
10068 10068
 	                      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;";
10069
-    		}
10069
+			}
10070 10070
 		$sth = $this->db->prepare($query);
10071 10071
 		$sth->execute();
10072 10072
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +984 added lines, -984 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22
-		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
23
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter);
23
+		if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter);
24 24
 		$filter_query_join = '';
25 25
 		$filter_query_where = '';
26 26
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
27 27
 			if ($filter['airlines'][0] != '') {
28
-				$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";
28
+				$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";
29 29
 			}
30 30
 		}
31 31
 		
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id ";
34 34
 		}
35 35
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
36
-			$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";
36
+			$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";
37 37
 		}
38 38
 		if (isset($filter['source']) && !empty($filter['source'])) {
39
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
39
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
40 40
 		}
41 41
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
42 42
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
43 43
 		}
44 44
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
45 45
 			if ($filter_query_where == '') {
46
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
46
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
47 47
 			} else {
48
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
48
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
49 49
 			}
50 50
 		}
51 51
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			$sth = $this->db->prepare($query.$limitQuery);
94 94
 			$sth->execute($params);
95 95
 		} catch (PDOException $e) {
96
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
96
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
97 97
 			exit();
98 98
 		}
99 99
 		
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$spotter_array = array();
104 104
 		
105 105
 
106
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
106
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
107 107
 		{
108 108
 			$num_rows++;
109 109
 			$temp_array = array();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			if (isset($row['route_stop'])) {
149 149
 				$temp_array['route_stop'] = $row['route_stop'];
150 150
 				if ($row['route_stop'] != '') {
151
-					$allroute = explode(' ',$row['route_stop']);
151
+					$allroute = explode(' ', $row['route_stop']);
152 152
 			
153 153
 					foreach ($allroute as $route) {
154 154
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 				{
204 204
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
205 205
 				} else {
206
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
206
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
207 207
 				}
208 208
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
209
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
210
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
209
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
210
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
211 211
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
212 212
 			}
213 213
 			
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
242 242
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
243 243
 					if (is_numeric(substr($row['ident'], 2, 1))) {
244
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
244
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
245 245
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
246
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
246
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
247 247
 					} else {
248 248
 						$airline_array = $this->getAllAirlineInfo('NA');
249 249
 					}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 				$temp_array['airline_type'] = $row['airline_type'];
270 270
 			}
271 271
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
272
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
272
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
273 273
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
274 274
 				if (count($acars_array) > 0) {
275 275
 					$temp_array['acars'] = $acars_array;
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
287 287
 			}
288 288
 
289
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
289
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
290 290
 			{
291 291
 				if ($globalIVAO) {
292
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
293
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
292
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
293
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
294 294
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
295 295
 				if (count($image_array) > 0) {
296 296
 					$temp_array['image'] = $image_array[0]['image'];
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 			if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') {
314 314
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
315 315
 			}
316
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
316
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
317 317
 				$schedule_array = $Schedule->getSchedule($temp_array['ident']);
318 318
 				//print_r($schedule_array);
319 319
 				if (count($schedule_array) > 0) {
@@ -394,12 +394,12 @@  discard block
 block discarded – undo
394 394
 			if (isset($row['squawk'])) {
395 395
 				$temp_array['squawk'] = $row['squawk'];
396 396
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
397
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
398
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
397
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
398
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
399 399
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
400
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
401
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
402
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
400
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
401
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
402
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
403 403
 			}
404 404
     			
405 405
 			$temp_array['query_number_rows'] = $num_rows;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	* @return Array the spotter information
419 419
 	*
420 420
 	*/
421
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filter = array())
421
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filter = array())
422 422
 	{
423 423
 		global $globalTimezone, $globalDBdriver;
424 424
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 
429 429
 		$query_values = array();
430 430
 		$additional_query = '';
431
-		$filter_query = $this->getFilter($filter,true,true);
431
+		$filter_query = $this->getFilter($filter, true, true);
432 432
 		if ($q != "")
433 433
 		{
434 434
 			if (!is_string($q))
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 				return false;
437 437
 			} else {
438 438
 				$q_array = explode(" ", $q);
439
-				foreach ($q_array as $q_item){
440
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
439
+				foreach ($q_array as $q_item) {
440
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
441 441
 					$additional_query .= " AND (";
442 442
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
443 443
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -469,37 +469,37 @@  discard block
 block discarded – undo
469 469
 
470 470
 		if ($registration != "")
471 471
 		{
472
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
472
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
473 473
 			if (!is_string($registration))
474 474
 			{
475 475
 				return false;
476 476
 			} else {
477 477
 				$additional_query .= " AND spotter_output.registration = :registration";
478
-				$query_values = array_merge($query_values,array(':registration' => $registration));
478
+				$query_values = array_merge($query_values, array(':registration' => $registration));
479 479
 			}
480 480
 		}
481 481
 
482 482
 		if ($aircraft_icao != "")
483 483
 		{
484
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
484
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
485 485
 			if (!is_string($aircraft_icao))
486 486
 			{
487 487
 				return false;
488 488
 			} else {
489 489
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
490
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
490
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
491 491
 			}
492 492
 		}
493 493
 
494 494
 		if ($aircraft_manufacturer != "")
495 495
 		{
496
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
496
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
497 497
 			if (!is_string($aircraft_manufacturer))
498 498
 			{
499 499
 				return false;
500 500
 			} else {
501 501
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
502
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
502
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
503 503
 			}
504 504
 		}
505 505
 
@@ -515,25 +515,25 @@  discard block
 block discarded – undo
515 515
 
516 516
 		if ($airline_icao != "")
517 517
 		{
518
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
518
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
519 519
 			if (!is_string($airline_icao))
520 520
 			{
521 521
 				return false;
522 522
 			} else {
523 523
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
524
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
524
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
525 525
 			}
526 526
 		}
527 527
 
528 528
 		if ($airline_country != "")
529 529
 		{
530
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
530
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
531 531
 			if (!is_string($airline_country))
532 532
 			{
533 533
 				return false;
534 534
 			} else {
535 535
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
536
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
536
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
537 537
 			}
538 538
 		}
539 539
 
@@ -560,31 +560,31 @@  discard block
 block discarded – undo
560 560
 
561 561
 		if ($airport != "")
562 562
 		{
563
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
563
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
564 564
 			if (!is_string($airport))
565 565
 			{
566 566
 				return false;
567 567
 			} else {
568 568
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
569
-				$query_values = array_merge($query_values,array(':airport' => $airport));
569
+				$query_values = array_merge($query_values, array(':airport' => $airport));
570 570
 			}
571 571
 		}
572 572
 
573 573
 		if ($airport_country != "")
574 574
 		{
575
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
575
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
576 576
 			if (!is_string($airport_country))
577 577
 			{
578 578
 				return false;
579 579
 			} else {
580 580
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
581
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
581
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
582 582
 			}
583 583
 		}
584 584
     
585 585
 		if ($callsign != "")
586 586
 		{
587
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
587
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
588 588
 			if (!is_string($callsign))
589 589
 			{
590 590
 				return false;
@@ -592,79 +592,79 @@  discard block
 block discarded – undo
592 592
 				$translate = $Translation->ident2icao($callsign);
593 593
 				if ($translate != $callsign) {
594 594
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
595
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
595
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
596 596
 				} else {
597 597
 					$additional_query .= " AND spotter_output.ident = :callsign";
598
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
598
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
599 599
 				}
600 600
 			}
601 601
 		}
602 602
 
603 603
 		if ($owner != "")
604 604
 		{
605
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
605
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
606 606
 			if (!is_string($owner))
607 607
 			{
608 608
 				return false;
609 609
 			} else {
610 610
 				$additional_query .= " AND spotter_output.owner_name = :owner";
611
-				$query_values = array_merge($query_values,array(':owner' => $owner));
611
+				$query_values = array_merge($query_values, array(':owner' => $owner));
612 612
 			}
613 613
 		}
614 614
 
615 615
 		if ($pilot_name != "")
616 616
 		{
617
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
617
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
618 618
 			if (!is_string($pilot_name))
619 619
 			{
620 620
 				return false;
621 621
 			} else {
622 622
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
623
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
623
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
624 624
 			}
625 625
 		}
626 626
 
627 627
 		if ($pilot_id != "")
628 628
 		{
629
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
629
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
630 630
 			if (!is_string($pilot_id))
631 631
 			{
632 632
 				return false;
633 633
 			} else {
634 634
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
635
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
635
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
636 636
 			}
637 637
 		}
638 638
 
639 639
 		if ($departure_airport_route != "")
640 640
 		{
641
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
641
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
642 642
 			if (!is_string($departure_airport_route))
643 643
 			{
644 644
 				return false;
645 645
 			} else {
646 646
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
647
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
647
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
648 648
 			}
649 649
 		}
650 650
 
651 651
 		if ($arrival_airport_route != "")
652 652
 		{
653
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
653
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
654 654
 			if (!is_string($arrival_airport_route))
655 655
 			{
656 656
 				return false;
657 657
 			} else {
658 658
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
659
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
659
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
660 660
 			}
661 661
 		}
662 662
 
663 663
 		if ($altitude != "")
664 664
 		{
665 665
 			$altitude_array = explode(",", $altitude);
666
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
667
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
666
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
667
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
668 668
 
669 669
 			if ($altitude_array[1] != "")
670 670
 			{                
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 		if ($date_posted != "")
681 681
 		{
682 682
 			$date_array = explode(",", $date_posted);
683
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
684
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
683
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
684
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
685 685
 
686 686
 			if ($globalTimezone != '') {
687 687
 				date_default_timezone_set($globalTimezone);
@@ -712,8 +712,8 @@  discard block
 block discarded – undo
712 712
 		{
713 713
 			$limit_array = explode(",", $limit);
714 714
 			
715
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
716
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
715
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
716
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
717 717
 			
718 718
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
719 719
 			{
@@ -742,23 +742,23 @@  discard block
 block discarded – undo
742 742
 
743 743
 
744 744
 		if ($origLat != "" && $origLon != "" && $dist != "") {
745
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
745
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
746 746
 
747 747
 			if ($globalDBdriver == 'mysql') {
748
-				$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 
748
+				$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 
749 749
 						FROM spotter_output, spotter_archive".$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)) 
750 750
 						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;
751 751
 			} else {
752
-				$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 
752
+				$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 
753 753
 						FROM spotter_output, spotter_archive".$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)) 
754 754
 						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;
755 755
 			}
756 756
 		} else {		
757
-			$query  = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' 
757
+			$query = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' 
758 758
 					".$additional_query."
759 759
 					".$orderby_query;
760 760
 		}
761
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
761
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
762 762
 		return $spotter_array;
763 763
 	}
764 764
 	
@@ -781,8 +781,8 @@  discard block
 block discarded – undo
781 781
 		{
782 782
 			$limit_array = explode(",", $limit);
783 783
 			
784
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
785
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
784
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
785
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
786 786
 			
787 787
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
788 788
 			{
@@ -799,9 +799,9 @@  discard block
 block discarded – undo
799 799
 			$orderby_query = " ORDER BY spotter_output.date DESC";
800 800
 		}
801 801
 
802
-		$query  = $global_query.$filter_query." ".$orderby_query;
802
+		$query = $global_query.$filter_query." ".$orderby_query;
803 803
 
804
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query);
804
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
805 805
 
806 806
 		return $spotter_array;
807 807
 	}
@@ -847,34 +847,34 @@  discard block
 block discarded – undo
847 847
 			{
848 848
 				return false;
849 849
 			} else {
850
-				if ($interval == "30m"){
850
+				if ($interval == "30m") {
851 851
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
852
-				} else if ($interval == "1h"){
852
+				} else if ($interval == "1h") {
853 853
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
854
-				} else if ($interval == "3h"){
854
+				} else if ($interval == "3h") {
855 855
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
856
-				} else if ($interval == "6h"){
856
+				} else if ($interval == "6h") {
857 857
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
858
-				} else if ($interval == "12h"){
858
+				} else if ($interval == "12h") {
859 859
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
860
-				} else if ($interval == "24h"){
860
+				} else if ($interval == "24h") {
861 861
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
862
-				} else if ($interval == "7d"){
862
+				} else if ($interval == "7d") {
863 863
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
864
-				} else if ($interval == "30d"){
864
+				} else if ($interval == "30d") {
865 865
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
866 866
 				} 
867 867
 			}
868 868
 		}
869 869
 
870
-		$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 
870
+		$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 
871 871
                    WHERE spotter_output.latitude <> '' 
872 872
 				   AND spotter_output.longitude <> '' 
873 873
                    ".$additional_query."
874 874
                    HAVING distance < :radius  
875 875
 				   ORDER BY distance";
876 876
 
877
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
877
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
878 878
 
879 879
 		return $spotter_array;
880 880
 	}
@@ -886,21 +886,21 @@  discard block
 block discarded – undo
886 886
 	* @return Array the spotter information
887 887
 	*
888 888
 	*/
889
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
889
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
890 890
 	{
891 891
 		global $global_query;
892 892
 		
893 893
 		date_default_timezone_set('UTC');
894 894
 
895
-		$filter_query = $this->getFilter($filter,true,true);
895
+		$filter_query = $this->getFilter($filter, true, true);
896 896
 
897 897
 		$limit_query = '';
898 898
 		if ($limit != "")
899 899
 		{
900 900
 			$limit_array = explode(",", $limit);
901 901
 			
902
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
903
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
902
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
903
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
904 904
 			
905 905
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
906 906
 			{
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
918 918
 		}
919 919
 
920
-		$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;
920
+		$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;
921 921
 
922 922
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
923 923
 
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 		global $global_query;
937 937
 		
938 938
 		date_default_timezone_set('UTC');
939
-		$filter_query = $this->getFilter($filter,true,true);
939
+		$filter_query = $this->getFilter($filter, true, true);
940 940
 
941 941
 		$limit_query = '';
942 942
 		if ($limit != "")
943 943
 		{
944 944
 			$limit_array = explode(",", $limit);
945 945
 			
946
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
947
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
946
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
947
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
948 948
 			
949 949
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
950 950
 			{
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
962 962
 		}
963 963
 
964
-		$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;
964
+		$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;
965 965
 
966 966
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
967 967
 
@@ -975,20 +975,20 @@  discard block
 block discarded – undo
975 975
 	* @return Array the spotter information
976 976
 	*
977 977
 	*/
978
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
978
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
979 979
 	{
980 980
 		global $global_query;
981 981
 		
982 982
 		date_default_timezone_set('UTC');
983
-		$filter_query = $this->getFilter($filter,true,true);
983
+		$filter_query = $this->getFilter($filter, true, true);
984 984
 		
985 985
 		$limit_query = '';
986 986
 		if ($limit != "")
987 987
 		{
988 988
 			$limit_array = explode(",", $limit);
989 989
 			
990
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
991
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
990
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
991
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
992 992
 			
993 993
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
994 994
 			{
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1006 1006
 		}
1007 1007
 
1008
-		$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;
1008
+		$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;
1009 1009
 
1010 1010
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1011 1011
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 		
1026 1026
 		date_default_timezone_set('UTC');
1027 1027
 		
1028
-		$filter_query = $this->getFilter($filter,true,true);
1028
+		$filter_query = $this->getFilter($filter, true, true);
1029 1029
 		
1030 1030
 		$limit_query = '';
1031 1031
 		
@@ -1033,8 +1033,8 @@  discard block
 block discarded – undo
1033 1033
 		{
1034 1034
 			$limit_array = explode(",", $limit);
1035 1035
 			
1036
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1037
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1036
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1037
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1038 1038
 			
1039 1039
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1040 1040
 			{
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1052 1052
 		}
1053 1053
 
1054
-		$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;
1054
+		$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;
1055 1055
 
1056 1056
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1057 1057
 
@@ -1070,14 +1070,14 @@  discard block
 block discarded – undo
1070 1070
 		global $global_query;
1071 1071
 		
1072 1072
 		date_default_timezone_set('UTC');
1073
-		$filter_query = $this->getFilter($filter,true,true);
1073
+		$filter_query = $this->getFilter($filter, true, true);
1074 1074
 		$limit_query = '';
1075 1075
 		if ($limit != "")
1076 1076
 		{
1077 1077
 			$limit_array = explode(",", $limit);
1078 1078
 			
1079
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1080
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1079
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1080
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1081 1081
 			
1082 1082
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1083 1083
 			{
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1095 1095
 		}
1096 1096
 
1097
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1097
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1098 1098
 
1099 1099
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1100 1100
 
@@ -1118,9 +1118,9 @@  discard block
 block discarded – undo
1118 1118
 		$query_values = array(':id' => $id);
1119 1119
 
1120 1120
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1121
-		$query  = $global_query." WHERE ".$additional_query." ";
1121
+		$query = $global_query." WHERE ".$additional_query." ";
1122 1122
 
1123
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1123
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1124 1124
 
1125 1125
 		return $spotter_array;
1126 1126
 	}
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
 		{
1159 1159
 			$limit_array = explode(",", $limit);
1160 1160
 			
1161
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1162
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1161
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1162
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1163 1163
 			
1164 1164
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1165 1165
 			{
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 		$query_values = array();
1201 1201
 		$limit_query = '';
1202 1202
 		$additional_query = '';
1203
-		$filter_query = $this->getFilter($filter,true,true);
1203
+		$filter_query = $this->getFilter($filter, true, true);
1204 1204
 		
1205 1205
 		if ($aircraft_type != "")
1206 1206
 		{
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 		{
1218 1218
 			$limit_array = explode(",", $limit);
1219 1219
 			
1220
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1221
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1220
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1221
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1222 1222
 			
1223 1223
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1224 1224
 			{
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
 		$query_values = array();
1259 1259
 		$limit_query = '';
1260 1260
 		$additional_query = '';
1261
-		$filter_query = $this->getFilter($filter,true,true);
1261
+		$filter_query = $this->getFilter($filter, true, true);
1262 1262
 		
1263 1263
 		if ($registration != "")
1264 1264
 		{
@@ -1275,8 +1275,8 @@  discard block
 block discarded – undo
1275 1275
 		{
1276 1276
 			$limit_array = explode(",", $limit);
1277 1277
 			
1278
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1279
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1278
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1279
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1280 1280
 			
1281 1281
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1282 1282
 			{
@@ -1334,8 +1334,8 @@  discard block
 block discarded – undo
1334 1334
 		{
1335 1335
 			$limit_array = explode(",", $limit);
1336 1336
 			
1337
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1338
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1337
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1338
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1339 1339
 			
1340 1340
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1341 1341
 			{
@@ -1389,8 +1389,8 @@  discard block
 block discarded – undo
1389 1389
 		{
1390 1390
 			$limit_array = explode(",", $limit);
1391 1391
 			
1392
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1393
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1392
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1393
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1394 1394
 			
1395 1395
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1396 1396
 			{
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 	* @return Array the spotter information
1423 1423
 	*
1424 1424
 	*/
1425
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1425
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1426 1426
 	{
1427 1427
 		global $global_query, $globalTimezone, $globalDBdriver;
1428 1428
 		
@@ -1432,19 +1432,19 @@  discard block
 block discarded – undo
1432 1432
 
1433 1433
 		$filter_query = '';
1434 1434
 		if (isset($filter['source']) && !empty($filter['source'])) {
1435
-			$filter_query = " AND format_source IN ('".implode("','",$filter['source'])."')";
1435
+			$filter_query = " AND format_source IN ('".implode("','", $filter['source'])."')";
1436 1436
 		}
1437 1437
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
1438
-			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1438
+			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1439 1439
 		}
1440 1440
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
1441 1441
 			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
1442 1442
 		}
1443 1443
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
1444
-			$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
1444
+			$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
1445 1445
 		}
1446 1446
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
1447
-			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1447
+			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1448 1448
 		}
1449 1449
 	
1450 1450
 		
@@ -1472,8 +1472,8 @@  discard block
 block discarded – undo
1472 1472
 		{
1473 1473
 			$limit_array = explode(",", $limit);
1474 1474
 			
1475
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1476
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1475
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1476
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1477 1477
 			
1478 1478
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1479 1479
 			{
@@ -1528,8 +1528,8 @@  discard block
 block discarded – undo
1528 1528
 		{
1529 1529
 			$limit_array = explode(",", $limit);
1530 1530
 			
1531
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1532
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1531
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1532
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1533 1533
 			
1534 1534
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1535 1535
 			{
@@ -1585,8 +1585,8 @@  discard block
 block discarded – undo
1585 1585
 		{
1586 1586
 			$limit_array = explode(",", $limit);
1587 1587
 			
1588
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1589
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1588
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1589
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1590 1590
 			
1591 1591
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1592 1592
 			{
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
 			{
1635 1635
 				return false;
1636 1636
 			} else {
1637
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1637
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1638 1638
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1639 1639
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
1640 1640
 			}
@@ -1646,9 +1646,9 @@  discard block
 block discarded – undo
1646 1646
 			{
1647 1647
 				return false;
1648 1648
 			} else {
1649
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1649
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1650 1650
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1651
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1651
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1652 1652
 			}
1653 1653
 		}
1654 1654
 		
@@ -1656,8 +1656,8 @@  discard block
 block discarded – undo
1656 1656
 		{
1657 1657
 			$limit_array = explode(",", $limit);
1658 1658
 			
1659
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1660
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1659
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1660
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1661 1661
 			
1662 1662
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1663 1663
 			{
@@ -1696,15 +1696,15 @@  discard block
 block discarded – undo
1696 1696
 		global $global_query;
1697 1697
 		
1698 1698
 		date_default_timezone_set('UTC');
1699
-		$filter_query = $this->getFilter($filter,true,true);
1699
+		$filter_query = $this->getFilter($filter, true, true);
1700 1700
 		$limit_query = '';
1701 1701
 		
1702 1702
 		if ($limit != "")
1703 1703
 		{
1704 1704
 			$limit_array = explode(",", $limit);
1705 1705
 			
1706
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1707
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1706
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1707
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1708 1708
 			
1709 1709
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1710 1710
 			{
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1722 1722
 		}
1723 1723
 
1724
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1724
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1725 1725
 
1726 1726
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1727 1727
 
@@ -1734,19 +1734,19 @@  discard block
 block discarded – undo
1734 1734
 	* @return String the highlight text
1735 1735
 	*
1736 1736
 	*/
1737
-	public function getHighlightByRegistration($registration,$filter = array())
1737
+	public function getHighlightByRegistration($registration, $filter = array())
1738 1738
 	{
1739 1739
 		global $global_query;
1740 1740
 		
1741 1741
 		date_default_timezone_set('UTC');
1742
-		$filter_query = $this->getFilter($filter,true,true);
1743
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1742
+		$filter_query = $this->getFilter($filter, true, true);
1743
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1744 1744
 		
1745
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1745
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1746 1746
 		$sth = $this->db->prepare($query);
1747 1747
 		$sth->execute(array(':registration' => $registration));
1748 1748
 
1749
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1749
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1750 1750
 		{
1751 1751
 			$highlight = $row['highlight'];
1752 1752
 		}
@@ -1762,14 +1762,14 @@  discard block
 block discarded – undo
1762 1762
 	* @return String usage
1763 1763
 	*
1764 1764
 	*/
1765
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1765
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1766 1766
 	{
1767 1767
 		
1768
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1769
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1768
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1769
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1770 1770
 
1771 1771
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1772
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1772
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1773 1773
 		
1774 1774
 		$sth = $this->db->prepare($query);
1775 1775
 		$sth->execute($query_values);
@@ -1791,9 +1791,9 @@  discard block
 block discarded – undo
1791 1791
 	public function getAirportIcao($airport_iata = '')
1792 1792
 	{
1793 1793
 		
1794
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1794
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1795 1795
 
1796
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1796
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1797 1797
 		$query_values = array(':airport' => $airport_iata);
1798 1798
 		
1799 1799
 		$sth = $this->db->prepare($query);
@@ -1815,12 +1815,12 @@  discard block
 block discarded – undo
1815 1815
 	* @return Float distance to the airport
1816 1816
 	*
1817 1817
 	*/
1818
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1818
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1819 1819
 	{
1820 1820
 		
1821
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1821
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1822 1822
 
1823
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1823
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1824 1824
 		$query_values = array(':airport' => $airport_icao);
1825 1825
 		$sth = $this->db->prepare($query);
1826 1826
 		$sth->execute($query_values);
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
 			$airport_latitude = $row['latitude'];
1831 1831
 			$airport_longitude = $row['longitude'];
1832 1832
 			$Common = new Common();
1833
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1833
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1834 1834
 		} else return '';
1835 1835
 	}
1836 1836
 	
@@ -1844,11 +1844,11 @@  discard block
 block discarded – undo
1844 1844
 	public function getAllAirportInfo($airport = '')
1845 1845
 	{
1846 1846
 		
1847
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1847
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1848 1848
 
1849 1849
 		$query_values = array();
1850 1850
 		if ($airport == 'NA') {
1851
-			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' => ''));
1851
+			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' => ''));
1852 1852
 		} elseif ($airport == '') {
1853 1853
 			$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";
1854 1854
 		} else {
@@ -1896,14 +1896,14 @@  discard block
 block discarded – undo
1896 1896
 	{
1897 1897
 		$lst_countries = '';
1898 1898
 		foreach ($countries as $country) {
1899
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1899
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1900 1900
 			if ($lst_countries == '') {
1901 1901
 				$lst_countries = "'".$country."'";
1902 1902
 			} else {
1903 1903
 				$lst_countries .= ",'".$country."'";
1904 1904
 			}
1905 1905
 		}
1906
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1906
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1907 1907
 		
1908 1908
 		$sth = $this->db->prepare($query);
1909 1909
 		$sth->execute();
@@ -1911,7 +1911,7 @@  discard block
 block discarded – undo
1911 1911
 		$airport_array = array();
1912 1912
 		$temp_array = array();
1913 1913
 		
1914
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1914
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1915 1915
 		{
1916 1916
 			$temp_array['name'] = $row['name'];
1917 1917
 			$temp_array['city'] = $row['city'];
@@ -1939,10 +1939,10 @@  discard block
 block discarded – undo
1939 1939
 	{
1940 1940
 		global $globalDBdriver;
1941 1941
 		if (is_array($coord)) {
1942
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1943
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1944
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1945
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1942
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1943
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1944
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1945
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1946 1946
 		} else return array();
1947 1947
 		if ($globalDBdriver == 'mysql') {
1948 1948
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
     
1955 1955
 		$airport_array = array();
1956 1956
 		
1957
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1957
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1958 1958
 		{
1959 1959
 			$temp_array = $row;
1960 1960
 
@@ -1974,13 +1974,13 @@  discard block
 block discarded – undo
1974 1974
 	public function getAllWaypointsInfobyCoord($coord)
1975 1975
 	{
1976 1976
 		if (is_array($coord)) {
1977
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1978
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1979
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1980
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1977
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1978
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1979
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1980
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1981 1981
 		} else return array();
1982 1982
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1983
-		$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.")";
1983
+		$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.")";
1984 1984
 		//$query  = "SELECT waypoints.* FROM waypoints";
1985 1985
 		//$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";
1986 1986
 		//$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;
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
     
1993 1993
 		$waypoints_array = array();
1994 1994
 		
1995
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1995
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1996 1996
 		{
1997 1997
 			$temp_array = $row;
1998 1998
 
@@ -2014,10 +2014,10 @@  discard block
 block discarded – undo
2014 2014
 	{
2015 2015
 		global $globalUseRealAirlines;
2016 2016
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2017
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2017
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2018 2018
 		if ($airline_icao == 'NA') {
2019 2019
 			$airline_array = array();
2020
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2020
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2021 2021
 			return $airline_array;
2022 2022
 		} else {
2023 2023
 			if (strlen($airline_icao) == 2) {
@@ -2038,7 +2038,7 @@  discard block
 block discarded – undo
2038 2038
 			if ($fromsource === NULL) {
2039 2039
 				$sth->execute(array(':airline_icao' => $airline_icao));
2040 2040
 			} else {
2041
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2041
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2042 2042
 			}
2043 2043
                         /*
2044 2044
 			$airline_array = array();
@@ -2080,12 +2080,12 @@  discard block
 block discarded – undo
2080 2080
 	*/
2081 2081
 	public function getAllAircraftInfo($aircraft_type)
2082 2082
 	{
2083
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2083
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2084 2084
 
2085 2085
 		if ($aircraft_type == 'NA') {
2086
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2086
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2087 2087
 		}
2088
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2088
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2089 2089
 		
2090 2090
 		$sth = $this->db->prepare($query);
2091 2091
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
 	*/
2118 2118
 	public function getAircraftIcao($aircraft_type)
2119 2119
 	{
2120
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2120
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2121 2121
 		$all_aircraft = array('737-300' => 'B733',
2122 2122
 				'777-200' => 'B772',
2123 2123
 				'777-200ER' => 'B772',
@@ -2129,10 +2129,10 @@  discard block
 block discarded – undo
2129 2129
 				'A380' => 'A388');
2130 2130
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2131 2131
 
2132
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2132
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2133 2133
 		$aircraft_type = strtoupper($aircraft_type);
2134 2134
 		$sth = $this->db->prepare($query);
2135
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2135
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2136 2136
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2137 2137
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2138 2138
 		else return '';
@@ -2147,9 +2147,9 @@  discard block
 block discarded – undo
2147 2147
 	*/
2148 2148
 	public function getAllAircraftType($aircraft_modes)
2149 2149
 	{
2150
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2150
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2151 2151
 
2152
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2152
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2153 2153
 		
2154 2154
 		$sth = $this->db->prepare($query);
2155 2155
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2170,8 +2170,8 @@  discard block
 block discarded – undo
2170 2170
 	*/
2171 2171
 	public function getOperator($operator)
2172 2172
 	{
2173
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2174
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2173
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2174
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2175 2175
 		
2176 2176
 		$sth = $this->db->prepare($query);
2177 2177
 		$sth->execute(array(':operator' => $operator));
@@ -2192,9 +2192,9 @@  discard block
 block discarded – undo
2192 2192
 	*/
2193 2193
 	public function getRouteInfo($callsign)
2194 2194
 	{
2195
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2195
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2196 2196
                 if ($callsign == '') return array();
2197
-		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2197
+		$query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2198 2198
 		
2199 2199
 		$sth = $this->db->prepare($query);
2200 2200
 		$sth->execute(array(':callsign' => $callsign));
@@ -2215,9 +2215,9 @@  discard block
 block discarded – undo
2215 2215
 	*/
2216 2216
 	public function getAircraftInfoByRegistration($registration)
2217 2217
 	{
2218
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2218
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2219 2219
 
2220
-		$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";
2220
+		$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";
2221 2221
 		
2222 2222
 		$sth = $this->db->prepare($query);
2223 2223
 		$sth->execute(array(':registration' => $registration));
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
 		$aircraft_array = array();
2226 2226
 		$temp_array = array();
2227 2227
 		
2228
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2228
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2229 2229
 		{
2230 2230
 			$temp_array['airline_icao'] = $row['airline_icao'];
2231 2231
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2247,7 +2247,7 @@  discard block
 block discarded – undo
2247 2247
 	*/
2248 2248
 	public function getAircraftOwnerByRegistration($registration)
2249 2249
 	{
2250
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2250
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2251 2251
 		$Connection = new Connection($this->db);
2252 2252
 		if ($Connection->tableExists('aircraft_owner')) {
2253 2253
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
 	public function getAllFlightsforSitemap()
2270 2270
 	{
2271 2271
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
2272
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2272
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2273 2273
 		
2274 2274
 		$sth = $this->db->prepare($query);
2275 2275
 		$sth->execute();
@@ -2316,7 +2316,7 @@  discard block
 block discarded – undo
2316 2316
 		$manufacturer_array = array();
2317 2317
 		$temp_array = array();
2318 2318
 		
2319
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2319
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2320 2320
 		{
2321 2321
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2322 2322
 
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 								ORDER BY spotter_output.aircraft_name ASC";
2343 2343
 								
2344 2344
 		*/
2345
-		$filter_query = $this->getFilter($filters,true,true);
2345
+		$filter_query = $this->getFilter($filters, true, true);
2346 2346
 		$query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC";
2347 2347
 		
2348 2348
 		$sth = $this->db->prepare($query);
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
 		$aircraft_array = array();
2352 2352
 		$temp_array = array();
2353 2353
 		
2354
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2354
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2355 2355
 		{
2356 2356
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2357 2357
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2372,8 +2372,8 @@  discard block
 block discarded – undo
2372 2372
 	*/
2373 2373
 	public function getAllAircraftRegistrations($filters = array())
2374 2374
 	{
2375
-		$filter_query = $this->getFilter($filters,true,true);
2376
-		$query  = "SELECT DISTINCT spotter_output.registration 
2375
+		$filter_query = $this->getFilter($filters, true, true);
2376
+		$query = "SELECT DISTINCT spotter_output.registration 
2377 2377
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2378 2378
 				ORDER BY spotter_output.registration ASC";
2379 2379
 
@@ -2383,7 +2383,7 @@  discard block
 block discarded – undo
2383 2383
 		$aircraft_array = array();
2384 2384
 		$temp_array = array();
2385 2385
 		
2386
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2386
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2387 2387
 		{
2388 2388
 			$temp_array['registration'] = $row['registration'];
2389 2389
 
@@ -2400,11 +2400,11 @@  discard block
 block discarded – undo
2400 2400
 	* @return Array list of source name
2401 2401
 	*
2402 2402
 	*/
2403
-	public function getAllSourceName($type = '',$filters = array())
2403
+	public function getAllSourceName($type = '', $filters = array())
2404 2404
 	{
2405
-		$filter_query = $this->getFilter($filters,true,true);
2405
+		$filter_query = $this->getFilter($filters, true, true);
2406 2406
 		$query_values = array();
2407
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2407
+		$query = "SELECT DISTINCT spotter_output.source_name 
2408 2408
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2409 2409
 		if ($type != '') {
2410 2410
 			$query_values = array(':type' => $type);
@@ -2419,7 +2419,7 @@  discard block
 block discarded – undo
2419 2419
 		$source_array = array();
2420 2420
 		$temp_array = array();
2421 2421
 		
2422
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2422
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2423 2423
 		{
2424 2424
 			$temp_array['source_name'] = $row['source_name'];
2425 2425
 			$source_array[] = $temp_array;
@@ -2435,11 +2435,11 @@  discard block
 block discarded – undo
2435 2435
 	* @return Array list of airline names
2436 2436
 	*
2437 2437
 	*/
2438
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2438
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2439 2439
 	{
2440
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2441
-		$filter_query = $this->getFilter($filters,true,true);
2442
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2440
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2441
+		$filter_query = $this->getFilter($filters, true, true);
2442
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2443 2443
 		if ($airline_type == '' || $airline_type == 'all') {
2444 2444
 			/*
2445 2445
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2458,7 +2458,7 @@  discard block
 block discarded – undo
2458 2458
 				$query_data = array(':forsource' => $forsource);
2459 2459
 			}
2460 2460
 		} else {
2461
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2461
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2462 2462
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2463 2463
 					AND spotter_output.airline_type = :airline_type 
2464 2464
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 		$airline_array = array();
2472 2472
 		$temp_array = array();
2473 2473
 		
2474
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2474
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2475 2475
 		{
2476 2476
 			$temp_array['airline_icao'] = $row['airline_icao'];
2477 2477
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2491,8 +2491,8 @@  discard block
 block discarded – undo
2491 2491
 	*/
2492 2492
 	public function getAllAirlineCountries($filters = array())
2493 2493
 	{
2494
-		$filter_query = $this->getFilter($filters,true,true);
2495
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2494
+		$filter_query = $this->getFilter($filters, true, true);
2495
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2496 2496
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2497 2497
 				ORDER BY spotter_output.airline_country ASC";
2498 2498
 		
@@ -2503,7 +2503,7 @@  discard block
 block discarded – undo
2503 2503
 		$airline_array = array();
2504 2504
 		$temp_array = array();
2505 2505
 		
2506
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2506
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2507 2507
 		{
2508 2508
 			$temp_array['airline_country'] = $row['airline_country'];
2509 2509
 
@@ -2523,9 +2523,9 @@  discard block
 block discarded – undo
2523 2523
 	*/
2524 2524
 	public function getAllAirportNames($filters = array())
2525 2525
 	{
2526
-		$filter_query = $this->getFilter($filters,true,true);
2526
+		$filter_query = $this->getFilter($filters, true, true);
2527 2527
 		$airport_array = array();
2528
-		$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
2528
+		$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
2529 2529
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2530 2530
 				ORDER BY spotter_output.departure_airport_city ASC";
2531 2531
 		
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 		$sth->execute();
2535 2535
 
2536 2536
 		$temp_array = array();
2537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2538 2538
 		{
2539 2539
 			$temp_array['airport_icao'] = $row['airport_icao'];
2540 2540
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2544,14 +2544,14 @@  discard block
 block discarded – undo
2544 2544
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2545 2545
 		}
2546 2546
 
2547
-		$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
2547
+		$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
2548 2548
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2549 2549
 								ORDER BY spotter_output.arrival_airport_city ASC";
2550 2550
 					
2551 2551
 		$sth = $this->db->prepare($query);
2552 2552
 		$sth->execute();
2553 2553
 
2554
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2554
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2555 2555
 			{
2556 2556
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2557 2557
 		//	{
@@ -2591,21 +2591,21 @@  discard block
 block discarded – undo
2591 2591
    
2592 2592
 		$temp_array = array();
2593 2593
 		
2594
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2594
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2595 2595
 		{
2596 2596
 			$temp_array['airport_country'] = $row['airport_country'];
2597 2597
 
2598 2598
 			$airport_array[$row['airport_country']] = $temp_array;
2599 2599
 		}
2600
-		$filter_query = $this->getFilter($filters,true,true);
2601
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2600
+		$filter_query = $this->getFilter($filters, true, true);
2601
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2602 2602
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2603 2603
 								ORDER BY spotter_output.arrival_airport_country ASC";
2604 2604
 					
2605 2605
 		$sth = $this->db->prepare($query);
2606 2606
 		$sth->execute();
2607 2607
 		
2608
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2608
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2609 2609
 		{
2610 2610
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2611 2611
 			{
@@ -2628,9 +2628,9 @@  discard block
 block discarded – undo
2628 2628
 	*/
2629 2629
 	public function getAllCountries($filters = array())
2630 2630
 	{
2631
-		$Connection= new Connection($this->db);
2631
+		$Connection = new Connection($this->db);
2632 2632
 		if ($Connection->tableExists('countries')) {
2633
-			$query  = "SELECT countries.name AS airport_country
2633
+			$query = "SELECT countries.name AS airport_country
2634 2634
 				FROM countries
2635 2635
 				ORDER BY countries.name ASC";
2636 2636
 			$sth = $this->db->prepare($query);
@@ -2639,14 +2639,14 @@  discard block
 block discarded – undo
2639 2639
 			$temp_array = array();
2640 2640
 			$country_array = array();
2641 2641
 		
2642
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2642
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2643 2643
 			{
2644 2644
 				$temp_array['country'] = $row['airport_country'];
2645 2645
 				$country_array[$row['airport_country']] = $temp_array;
2646 2646
 			}
2647 2647
 		} else {
2648
-			$filter_query = $this->getFilter($filters,true,true);
2649
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2648
+			$filter_query = $this->getFilter($filters, true, true);
2649
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2650 2650
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2651 2651
 								ORDER BY spotter_output.departure_airport_country ASC";
2652 2652
 
@@ -2655,20 +2655,20 @@  discard block
 block discarded – undo
2655 2655
    
2656 2656
 			$temp_array = array();
2657 2657
 			$country_array = array();
2658
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2658
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2659 2659
 			{
2660 2660
 				$temp_array['country'] = $row['airport_country'];
2661 2661
 				$country_array[$row['airport_country']] = $temp_array;
2662 2662
 			}
2663 2663
 
2664
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2664
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2665 2665
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2666 2666
 								ORDER BY spotter_output.arrival_airport_country ASC";
2667 2667
 					
2668 2668
 		$sth = $this->db->prepare($query);
2669 2669
 		$sth->execute();
2670 2670
 		
2671
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2671
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2672 2672
 		{
2673 2673
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2674 2674
 			{
@@ -2678,14 +2678,14 @@  discard block
 block discarded – undo
2678 2678
 			}
2679 2679
 		}
2680 2680
 		
2681
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2681
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2682 2682
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2683 2683
 								ORDER BY spotter_output.airline_country ASC";
2684 2684
 					
2685 2685
 		$sth = $this->db->prepare($query);
2686 2686
 		$sth->execute();
2687 2687
 		
2688
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2688
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2689 2689
 		{
2690 2690
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2691 2691
 			{
@@ -2709,8 +2709,8 @@  discard block
 block discarded – undo
2709 2709
 	*/
2710 2710
 	public function getAllIdents($filters = array())
2711 2711
 	{
2712
-		$filter_query = $this->getFilter($filters,true,true);
2713
-		$query  = "SELECT DISTINCT spotter_output.ident
2712
+		$filter_query = $this->getFilter($filters, true, true);
2713
+		$query = "SELECT DISTINCT spotter_output.ident
2714 2714
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2715 2715
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2716 2716
 
@@ -2720,7 +2720,7 @@  discard block
 block discarded – undo
2720 2720
 		$ident_array = array();
2721 2721
 		$temp_array = array();
2722 2722
 		
2723
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2723
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2724 2724
 		{
2725 2725
 			$temp_array['ident'] = $row['ident'];
2726 2726
 			$ident_array[] = $temp_array;
@@ -2734,9 +2734,9 @@  discard block
 block discarded – undo
2734 2734
 	* @return Array number, icao, name and city of airports
2735 2735
 	*/
2736 2736
 
2737
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2737
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2738 2738
 		global $globalTimezone, $globalDBdriver;
2739
-		$filter_query = $this->getFilter($filters,true,true);
2739
+		$filter_query = $this->getFilter($filters, true, true);
2740 2740
 		if ($globalTimezone != '') {
2741 2741
 			date_default_timezone_set($globalTimezone);
2742 2742
 			$datetime = new DateTime();
@@ -3057,12 +3057,12 @@  discard block
 block discarded – undo
3057 3057
 		} else $offset = '+00:00';
3058 3058
 
3059 3059
 		if ($globalDBdriver == 'mysql') {
3060
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3060
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3061 3061
 								FROM spotter_output
3062 3062
 								WHERE spotter_output.date <> '' 
3063 3063
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3064 3064
 		} else {
3065
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3065
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3066 3066
 								FROM spotter_output
3067 3067
 								WHERE spotter_output.date <> '' 
3068 3068
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3074,7 +3074,7 @@  discard block
 block discarded – undo
3074 3074
 		$date_array = array();
3075 3075
 		$temp_array = array();
3076 3076
 		
3077
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3077
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3078 3078
 		{
3079 3079
 			$temp_array['date'] = $row['date'];
3080 3080
 
@@ -3094,7 +3094,7 @@  discard block
 block discarded – undo
3094 3094
 	*/
3095 3095
 	public function getAllRoutes()
3096 3096
 	{
3097
-		$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 
3097
+		$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 
3098 3098
 				FROM spotter_output
3099 3099
 				WHERE spotter_output.ident <> '' 
3100 3100
 				GROUP BY route
@@ -3105,7 +3105,7 @@  discard block
 block discarded – undo
3105 3105
 
3106 3106
 		$routes_array = array();
3107 3107
 		$temp_array = array();
3108
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3108
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3109 3109
 		{
3110 3110
 			$temp_array['route'] = $row['route'];
3111 3111
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3124,21 +3124,21 @@  discard block
 block discarded – undo
3124 3124
 	* @return String success or false
3125 3125
 	*
3126 3126
 	*/	
3127
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3127
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3128 3128
 	{
3129 3129
 		if (!is_numeric(substr($ident, 0, 3)))
3130 3130
 		{
3131 3131
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3132
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3132
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3133 3133
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3134
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3134
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3135 3135
 			} else {
3136 3136
 				$airline_array = $this->getAllAirlineInfo("NA");
3137 3137
 			}
3138 3138
 			if (count($airline_array) == 0) {
3139 3139
 				$airline_array = $this->getAllAirlineInfo("NA");
3140 3140
 			}
3141
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3141
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3142 3142
 				$airline_array = $this->getAllAirlineInfo("NA");
3143 3143
 			}
3144 3144
 		} else {
@@ -3151,7 +3151,7 @@  discard block
 block discarded – undo
3151 3151
 
3152 3152
 
3153 3153
 		$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';
3154
-                $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);
3154
+                $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);
3155 3155
 
3156 3156
 		try {
3157 3157
 			$sth = $this->db->prepare($query);
@@ -3172,11 +3172,11 @@  discard block
 block discarded – undo
3172 3172
 	* @return String success or false
3173 3173
 	*
3174 3174
 	*/	
3175
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3175
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3176 3176
 	{
3177 3177
 		if ($groundspeed == '') $groundspeed = NULL;
3178 3178
 		$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';
3179
-                $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);
3179
+                $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);
3180 3180
 
3181 3181
 		try {
3182 3182
 			$sth = $this->db->prepare($query);
@@ -3216,7 +3216,7 @@  discard block
 block discarded – undo
3216 3216
 	* @param String $verticalrate vertival rate of flight
3217 3217
 	* @return String success or false
3218 3218
 	*/
3219
-	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 = '')
3219
+	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 = '')
3220 3220
 	{
3221 3221
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3222 3222
 		
@@ -3240,13 +3240,13 @@  discard block
 block discarded – undo
3240 3240
 				if ($ModeS != '') {
3241 3241
 					$timeelapsed = microtime(true);
3242 3242
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3243
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3243
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3244 3244
 				} else {
3245
-					$myhex = explode('-',$flightaware_id);
3245
+					$myhex = explode('-', $flightaware_id);
3246 3246
 					if (count($myhex) > 0) {
3247 3247
 						$timeelapsed = microtime(true);
3248 3248
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3249
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3249
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3250 3250
 					}
3251 3251
 				}
3252 3252
 			}
@@ -3268,24 +3268,24 @@  discard block
 block discarded – undo
3268 3268
 				{
3269 3269
 					$timeelapsed = microtime(true);
3270 3270
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3271
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3271
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3272 3272
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3273
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3273
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3274 3274
 					} else {
3275 3275
 						$airline_array = $this->getAllAirlineInfo("NA");
3276 3276
 					}
3277 3277
 					if (count($airline_array) == 0) {
3278 3278
 						$airline_array = $this->getAllAirlineInfo("NA");
3279 3279
 					}
3280
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3280
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3281 3281
 						$airline_array = $this->getAllAirlineInfo("NA");
3282 3282
 					}
3283
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3283
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3284 3284
 
3285 3285
 				} else {
3286 3286
 					$timeelapsed = microtime(true);
3287 3287
 					$airline_array = $this->getAllAirlineInfo("NA");
3288
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3288
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3289 3289
 				}
3290 3290
 			}
3291 3291
 		} else $airline_array = array();
@@ -3302,27 +3302,27 @@  discard block
 block discarded – undo
3302 3302
 				{
3303 3303
 					$timeelapsed = microtime(true);
3304 3304
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3305
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3305
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3306 3306
 				} else {
3307 3307
 					$timeelapsed = microtime(true);
3308 3308
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3309
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3309
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3310 3310
 				}
3311 3311
 			}
3312 3312
 		} else {
3313 3313
 			if ($ModeS != '') {
3314 3314
 				$timeelapsed = microtime(true);
3315 3315
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3316
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3316
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3317 3317
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3318 3318
 				{
3319 3319
 					$timeelapsed = microtime(true);
3320 3320
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3321
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3321
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3322 3322
 				} else {
3323 3323
 					$timeelapsed = microtime(true);
3324 3324
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3325
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3325
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3326 3326
 				}
3327 3327
 			}
3328 3328
 		}
@@ -3337,7 +3337,7 @@  discard block
 block discarded – undo
3337 3337
 			} else {
3338 3338
 				$timeelapsed = microtime(true);
3339 3339
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3340
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3340
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3341 3341
 			}
3342 3342
 		}
3343 3343
 		
@@ -3351,7 +3351,7 @@  discard block
 block discarded – undo
3351 3351
 			} else {
3352 3352
 				$timeelapsed = microtime(true);
3353 3353
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3354
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3354
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3355 3355
 			}
3356 3356
 		}
3357 3357
 
@@ -3415,7 +3415,7 @@  discard block
 block discarded – undo
3415 3415
 		{
3416 3416
 			$timeelapsed = microtime(true);
3417 3417
 			$image_array = $Image->getSpotterImage($registration);
3418
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3418
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3419 3419
 			if (!isset($image_array[0]['registration']))
3420 3420
 			{
3421 3421
 				//echo "Add image !!!! \n";
@@ -3423,7 +3423,7 @@  discard block
 block discarded – undo
3423 3423
 			}
3424 3424
 			$timeelapsed = microtime(true);
3425 3425
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3426
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3426
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3427 3427
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3428 3428
 		}
3429 3429
     
@@ -3431,33 +3431,33 @@  discard block
 block discarded – undo
3431 3431
 		{
3432 3432
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3433 3433
             		else $airline_icao = '';
3434
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3434
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3435 3435
 			if (!isset($image_array[0]['registration']))
3436 3436
 			{
3437 3437
 				//echo "Add image !!!! \n";
3438
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3438
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3439 3439
 			}
3440 3440
 		}
3441 3441
     
3442
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3443
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3444
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3445
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3446
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3447
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3448
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3449
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3450
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3451
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3452
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3453
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3454
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3455
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3456
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3457
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3458
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3459
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3460
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3442
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3443
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3444
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3445
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3446
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3447
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3448
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3449
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3450
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3451
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3452
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3453
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3454
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3455
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3456
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3457
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3458
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3459
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3460
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3461 3461
 	
3462 3462
 		if (count($airline_array) == 0) 
3463 3463
 		{
@@ -3481,7 +3481,7 @@  discard block
 block discarded – undo
3481 3481
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3482 3482
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3483 3483
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3484
-                $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) 
3484
+                $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) 
3485 3485
                 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)";
3486 3486
 
3487 3487
                 $airline_name = $airline_array[0]['name'];
@@ -3491,7 +3491,7 @@  discard block
 block discarded – undo
3491 3491
 		if ($airline_type == '') {
3492 3492
 			$timeelapsed = microtime(true);
3493 3493
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3494
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3494
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3495 3495
 		}
3496 3496
 		if ($airline_type == null) $airline_type = '';
3497 3497
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3502,7 +3502,7 @@  discard block
 block discarded – undo
3502 3502
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3503 3503
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3504 3504
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3505
-                $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);
3505
+                $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);
3506 3506
 
3507 3507
 		try {
3508 3508
 		        
@@ -3528,13 +3528,13 @@  discard block
 block discarded – undo
3528 3528
 	{
3529 3529
 		global $globalDBdriver, $globalTimezone;
3530 3530
 		if ($globalDBdriver == 'mysql') {
3531
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3531
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3532 3532
 								WHERE spotter_output.ident = :ident 
3533 3533
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3534 3534
 								AND spotter_output.date < UTC_TIMESTAMP()";
3535 3535
 			$query_data = array(':ident' => $ident);
3536 3536
 		} else {
3537
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3537
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3538 3538
 								WHERE spotter_output.ident = :ident 
3539 3539
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3540 3540
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3543,8 +3543,8 @@  discard block
 block discarded – undo
3543 3543
 		
3544 3544
 		$sth = $this->db->prepare($query);
3545 3545
 		$sth->execute($query_data);
3546
-    		$ident_result='';
3547
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3546
+    		$ident_result = '';
3547
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3548 3548
 		{
3549 3549
 			$ident_result = $row['ident'];
3550 3550
 		}
@@ -3570,8 +3570,8 @@  discard block
 block discarded – undo
3570 3570
 				return false;
3571 3571
 			} else {
3572 3572
 				$q_array = explode(" ", $q);
3573
-				foreach ($q_array as $q_item){
3574
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3573
+				foreach ($q_array as $q_item) {
3574
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3575 3575
 					$additional_query .= " AND (";
3576 3576
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3577 3577
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3586,11 +3586,11 @@  discard block
 block discarded – undo
3586 3586
 			}
3587 3587
 		}
3588 3588
 		if ($globalDBdriver == 'mysql') {
3589
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3589
+			$query = "SELECT spotter_output.* FROM spotter_output 
3590 3590
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3591 3591
 				AND spotter_output.date < UTC_TIMESTAMP()";
3592 3592
 		} else {
3593
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3593
+			$query = "SELECT spotter_output.* FROM spotter_output 
3594 3594
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3595 3595
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3596 3596
 		}
@@ -3607,11 +3607,11 @@  discard block
 block discarded – undo
3607 3607
 	* @return Array the airline list
3608 3608
 	*
3609 3609
 	*/
3610
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3610
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3611 3611
 	{
3612 3612
 		global $globalDBdriver;
3613
-		$filter_query = $this->getFilter($filters,true,true);
3614
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3613
+		$filter_query = $this->getFilter($filters, true, true);
3614
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3615 3615
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3616 3616
 		if ($olderthanmonths > 0) {
3617 3617
 			if ($globalDBdriver == 'mysql') {
@@ -3635,7 +3635,7 @@  discard block
 block discarded – undo
3635 3635
  
3636 3636
 		$airline_array = array();
3637 3637
 		$temp_array = array();
3638
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3638
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3639 3639
 		{
3640 3640
 			$temp_array['airline_name'] = $row['airline_name'];
3641 3641
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3652,11 +3652,11 @@  discard block
 block discarded – undo
3652 3652
 	* @return Array the pilots list
3653 3653
 	*
3654 3654
 	*/
3655
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3655
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3656 3656
 	{
3657 3657
 		global $globalDBdriver;
3658
-		$filter_query = $this->getFilter($filters,true,true);
3659
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3658
+		$filter_query = $this->getFilter($filters, true, true);
3659
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3660 3660
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3661 3661
                 if ($olderthanmonths > 0) {
3662 3662
             		if ($globalDBdriver == 'mysql') {
@@ -3682,7 +3682,7 @@  discard block
 block discarded – undo
3682 3682
 		$airline_array = array();
3683 3683
 		$temp_array = array();
3684 3684
         
3685
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3685
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3686 3686
 		{
3687 3687
 			$temp_array['pilot_name'] = $row['pilot_name'];
3688 3688
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3701,7 +3701,7 @@  discard block
 block discarded – undo
3701 3701
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3702 3702
 	{
3703 3703
 		global $globalDBdriver;
3704
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3704
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3705 3705
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3706 3706
                 if ($olderthanmonths > 0) {
3707 3707
             		if ($globalDBdriver == 'mysql') {
@@ -3727,7 +3727,7 @@  discard block
 block discarded – undo
3727 3727
 		$airline_array = array();
3728 3728
 		$temp_array = array();
3729 3729
         
3730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3731 3731
 		{
3732 3732
 			$temp_array['pilot_name'] = $row['pilot_name'];
3733 3733
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3744,11 +3744,11 @@  discard block
 block discarded – undo
3744 3744
 	* @return Array the pilots list
3745 3745
 	*
3746 3746
 	*/
3747
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3747
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3748 3748
 	{
3749 3749
 		global $globalDBdriver;
3750
-		$filter_query = $this->getFilter($filters,true,true);
3751
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3750
+		$filter_query = $this->getFilter($filters, true, true);
3751
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3752 3752
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3753 3753
                 if ($olderthanmonths > 0) {
3754 3754
             		if ($globalDBdriver == 'mysql') {
@@ -3774,7 +3774,7 @@  discard block
 block discarded – undo
3774 3774
 		$airline_array = array();
3775 3775
 		$temp_array = array();
3776 3776
         
3777
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3777
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3778 3778
 		{
3779 3779
 			$temp_array['owner_name'] = $row['owner_name'];
3780 3780
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3789,11 +3789,11 @@  discard block
 block discarded – undo
3789 3789
 	* @return Array the pilots list
3790 3790
 	*
3791 3791
 	*/
3792
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3792
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3793 3793
 	{
3794 3794
 		global $globalDBdriver;
3795
-		$filter_query = $this->getFilter($filters,true,true);
3796
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3795
+		$filter_query = $this->getFilter($filters, true, true);
3796
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3797 3797
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3798 3798
                 if ($olderthanmonths > 0) {
3799 3799
             		if ($globalDBdriver == 'mysql') {
@@ -3819,7 +3819,7 @@  discard block
 block discarded – undo
3819 3819
 		$airline_array = array();
3820 3820
 		$temp_array = array();
3821 3821
         
3822
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3822
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3823 3823
 		{
3824 3824
 			$temp_array['owner_name'] = $row['owner_name'];
3825 3825
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3835,11 +3835,11 @@  discard block
 block discarded – undo
3835 3835
 	* @return Array the airline list
3836 3836
 	*
3837 3837
 	*/
3838
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3838
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
3839 3839
 	{
3840
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3841
-		$filter_query = $this->getFilter($filters,true,true);
3842
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3840
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3841
+		$filter_query = $this->getFilter($filters, true, true);
3842
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3843 3843
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3844 3844
                     GROUP BY spotter_output.airline_name
3845 3845
 					ORDER BY airline_count DESC";
@@ -3851,7 +3851,7 @@  discard block
 block discarded – undo
3851 3851
 		$airline_array = array();
3852 3852
 		$temp_array = array();
3853 3853
         
3854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3855 3855
 		{
3856 3856
 			$temp_array['airline_name'] = $row['airline_name'];
3857 3857
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3871,11 +3871,11 @@  discard block
 block discarded – undo
3871 3871
 	* @return Array the airline country list
3872 3872
 	*
3873 3873
 	*/
3874
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3874
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
3875 3875
 	{
3876
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3877
-		$filter_query = $this->getFilter($filters,true,true);
3878
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3876
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3877
+		$filter_query = $this->getFilter($filters, true, true);
3878
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3879 3879
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3880 3880
                     GROUP BY spotter_output.airline_country
3881 3881
 					ORDER BY airline_country_count DESC
@@ -3888,7 +3888,7 @@  discard block
 block discarded – undo
3888 3888
 		$airline_country_array = array();
3889 3889
 		$temp_array = array();
3890 3890
         
3891
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3891
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3892 3892
 		{
3893 3893
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3894 3894
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3907,11 +3907,11 @@  discard block
 block discarded – undo
3907 3907
 	* @return Array the airline list
3908 3908
 	*
3909 3909
 	*/
3910
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3910
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
3911 3911
 	{
3912
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3913
-		$filter_query = $this->getFilter($filters,true,true);
3914
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3912
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3913
+		$filter_query = $this->getFilter($filters, true, true);
3914
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3915 3915
 		 			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 ) 
3916 3916
                     GROUP BY spotter_output.airline_name
3917 3917
 					ORDER BY airline_count DESC";
@@ -3923,7 +3923,7 @@  discard block
 block discarded – undo
3923 3923
 		$airline_array = array();
3924 3924
 		$temp_array = array();
3925 3925
         
3926
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3926
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3927 3927
 		{
3928 3928
 			$temp_array['airline_name'] = $row['airline_name'];
3929 3929
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3942,11 +3942,11 @@  discard block
 block discarded – undo
3942 3942
 	* @return Array the airline country list
3943 3943
 	*
3944 3944
 	*/
3945
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3945
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
3946 3946
 	{
3947
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3948
-		$filter_query = $this->getFilter($filters,true,true);
3949
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3947
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3948
+		$filter_query = $this->getFilter($filters, true, true);
3949
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3950 3950
 		 			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 )
3951 3951
 					GROUP BY spotter_output.airline_country
3952 3952
 					ORDER BY airline_country_count DESC
@@ -3959,7 +3959,7 @@  discard block
 block discarded – undo
3959 3959
 		$airline_country_array = array();
3960 3960
 		$temp_array = array();
3961 3961
         
3962
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3962
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3963 3963
 		{
3964 3964
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3965 3965
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3976,11 +3976,11 @@  discard block
 block discarded – undo
3976 3976
 	* @return Array the airline list
3977 3977
 	*
3978 3978
 	*/
3979
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3979
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
3980 3980
 	{
3981
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
3982
-		$filter_query = $this->getFilter($filters,true,true);
3983
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3981
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
3982
+		$filter_query = $this->getFilter($filters, true, true);
3983
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3984 3984
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
3985 3985
 					GROUP BY spotter_output.airline_name
3986 3986
 					ORDER BY airline_count DESC";
@@ -3991,7 +3991,7 @@  discard block
 block discarded – undo
3991 3991
 		$airline_array = array();
3992 3992
 		$temp_array = array();
3993 3993
         
3994
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3994
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3995 3995
 		{
3996 3996
 			$temp_array['airline_name'] = $row['airline_name'];
3997 3997
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4011,11 +4011,11 @@  discard block
 block discarded – undo
4011 4011
 	* @return Array the airline country list
4012 4012
 	*
4013 4013
 	*/
4014
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4014
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4015 4015
 	{
4016
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4017
-		$filter_query = $this->getFilter($filters,true,true);
4018
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4016
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4017
+		$filter_query = $this->getFilter($filters, true, true);
4018
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4019 4019
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4020 4020
 					GROUP BY spotter_output.airline_country
4021 4021
 					ORDER BY airline_country_count DESC
@@ -4028,7 +4028,7 @@  discard block
 block discarded – undo
4028 4028
 		$airline_country_array = array();
4029 4029
 		$temp_array = array();
4030 4030
         
4031
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4031
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4032 4032
 		{
4033 4033
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4034 4034
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4044,11 +4044,11 @@  discard block
 block discarded – undo
4044 4044
 	* @return Array the airline list
4045 4045
 	*
4046 4046
 	*/
4047
-	public function countAllAirlinesByDate($date,$filters = array())
4047
+	public function countAllAirlinesByDate($date, $filters = array())
4048 4048
 	{
4049 4049
 		global $globalTimezone, $globalDBdriver;
4050
-		$filter_query = $this->getFilter($filters,true,true);
4051
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4050
+		$filter_query = $this->getFilter($filters, true, true);
4051
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4052 4052
 		if ($globalTimezone != '') {
4053 4053
 			date_default_timezone_set($globalTimezone);
4054 4054
 			$datetime = new DateTime($date);
@@ -4056,12 +4056,12 @@  discard block
 block discarded – undo
4056 4056
 		} else $offset = '+00:00';
4057 4057
 
4058 4058
 		if ($globalDBdriver == 'mysql') {
4059
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4059
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4060 4060
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4061 4061
 					GROUP BY spotter_output.airline_name
4062 4062
 					ORDER BY airline_count DESC";
4063 4063
 		} else {
4064
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4064
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4065 4065
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4066 4066
 					GROUP BY spotter_output.airline_name
4067 4067
 					ORDER BY airline_count DESC";
@@ -4072,7 +4072,7 @@  discard block
 block discarded – undo
4072 4072
 
4073 4073
 		$airline_array = array();
4074 4074
 		$temp_array = array();
4075
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4075
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4076 4076
 		{
4077 4077
 			$temp_array['airline_name'] = $row['airline_name'];
4078 4078
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4092,11 +4092,11 @@  discard block
 block discarded – undo
4092 4092
 	* @return Array the airline country list
4093 4093
 	*
4094 4094
 	*/
4095
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4095
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4096 4096
 	{
4097 4097
 		global $globalTimezone, $globalDBdriver;
4098
-		$filter_query = $this->getFilter($filters,true,true);
4099
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4098
+		$filter_query = $this->getFilter($filters, true, true);
4099
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4100 4100
 		if ($globalTimezone != '') {
4101 4101
 			date_default_timezone_set($globalTimezone);
4102 4102
 			$datetime = new DateTime($date);
@@ -4104,13 +4104,13 @@  discard block
 block discarded – undo
4104 4104
 		} else $offset = '+00:00';
4105 4105
 		
4106 4106
 		if ($globalDBdriver == 'mysql') {
4107
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4107
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4108 4108
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4109 4109
 					GROUP BY spotter_output.airline_country
4110 4110
 					ORDER BY airline_country_count DESC
4111 4111
 					LIMIT 10 OFFSET 0";
4112 4112
 		} else {
4113
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4113
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4114 4114
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4115 4115
 					GROUP BY spotter_output.airline_country
4116 4116
 					ORDER BY airline_country_count DESC
@@ -4122,7 +4122,7 @@  discard block
 block discarded – undo
4122 4122
  
4123 4123
 		$airline_country_array = array();
4124 4124
 		$temp_array = array();
4125
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4125
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4126 4126
 		{
4127 4127
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4128 4128
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4139,11 +4139,11 @@  discard block
 block discarded – undo
4139 4139
 	* @return Array the airline list
4140 4140
 	*
4141 4141
 	*/
4142
-	public function countAllAirlinesByIdent($ident,$filters = array())
4142
+	public function countAllAirlinesByIdent($ident, $filters = array())
4143 4143
 	{
4144
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4145
-		$filter_query = $this->getFilter($filters,true,true);
4146
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4144
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4145
+		$filter_query = $this->getFilter($filters, true, true);
4146
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4147 4147
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4148 4148
 				GROUP BY spotter_output.airline_name
4149 4149
 				ORDER BY airline_count DESC";
@@ -4155,7 +4155,7 @@  discard block
 block discarded – undo
4155 4155
 		$airline_array = array();
4156 4156
 		$temp_array = array();
4157 4157
         
4158
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4158
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4159 4159
 		{
4160 4160
 			$temp_array['airline_name'] = $row['airline_name'];
4161 4161
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4173,25 +4173,25 @@  discard block
 block discarded – undo
4173 4173
 	* @return Array the airline list
4174 4174
 	*
4175 4175
 	*/
4176
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4176
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4177 4177
 	{
4178
-		$filter_query = $this->getFilter($filters,true,true);
4179
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4180
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4178
+		$filter_query = $this->getFilter($filters, true, true);
4179
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4180
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4181 4181
 
4182
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4182
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4183 4183
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4184 4184
 					GROUP BY spotter_output.airline_name
4185 4185
 					ORDER BY airline_count DESC";
4186 4186
       
4187 4187
 		
4188 4188
 		$sth = $this->db->prepare($query);
4189
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4189
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4190 4190
       
4191 4191
 		$airline_array = array();
4192 4192
 		$temp_array = array();
4193 4193
         
4194
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4194
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4195 4195
 		{
4196 4196
 			$temp_array['airline_name'] = $row['airline_name'];
4197 4197
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4209,13 +4209,13 @@  discard block
 block discarded – undo
4209 4209
 	* @return Array the airline country list
4210 4210
 	*
4211 4211
 	*/
4212
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4212
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4213 4213
 	{
4214
-		$filter_query = $this->getFilter($filters,true,true);
4215
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4216
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4214
+		$filter_query = $this->getFilter($filters, true, true);
4215
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4216
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4217 4217
       
4218
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4218
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4219 4219
 		 		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) 
4220 4220
 				GROUP BY spotter_output.airline_country
4221 4221
 				ORDER BY airline_country_count DESC
@@ -4223,11 +4223,11 @@  discard block
 block discarded – undo
4223 4223
       
4224 4224
 		
4225 4225
 		$sth = $this->db->prepare($query);
4226
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4226
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4227 4227
       
4228 4228
 		$airline_country_array = array();
4229 4229
 		$temp_array = array();
4230
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4230
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4231 4231
 		{
4232 4232
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4233 4233
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4245,11 +4245,11 @@  discard block
 block discarded – undo
4245 4245
 	* @return Array the airline list
4246 4246
 	*
4247 4247
 	*/
4248
-	public function countAllAirlinesByCountry($country,$filters = array())
4248
+	public function countAllAirlinesByCountry($country, $filters = array())
4249 4249
 	{
4250
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4251
-		$filter_query = $this->getFilter($filters,true,true);
4252
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4250
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4251
+		$filter_query = $this->getFilter($filters, true, true);
4252
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4253 4253
 		 		FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4254 4254
 				GROUP BY spotter_output.airline_name
4255 4255
 				ORDER BY airline_count DESC";
@@ -4260,7 +4260,7 @@  discard block
 block discarded – undo
4260 4260
 
4261 4261
 		$airline_array = array();
4262 4262
 		$temp_array = array();
4263
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4263
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4264 4264
 		{
4265 4265
 			$temp_array['airline_name'] = $row['airline_name'];
4266 4266
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4279,11 +4279,11 @@  discard block
 block discarded – undo
4279 4279
 	* @return Array the airline country list
4280 4280
 	*
4281 4281
 	*/
4282
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4282
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4283 4283
 	{
4284
-		$filter_query = $this->getFilter($filters,true,true);
4285
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4286
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4284
+		$filter_query = $this->getFilter($filters, true, true);
4285
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4286
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4287 4287
 		 		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 
4288 4288
 				GROUP BY spotter_output.airline_country
4289 4289
 				ORDER BY airline_country_count DESC
@@ -4295,7 +4295,7 @@  discard block
 block discarded – undo
4295 4295
 
4296 4296
 		$airline_country_array = array();
4297 4297
 		$temp_array = array();
4298
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4298
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4299 4299
 		{
4300 4300
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4301 4301
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4314,8 +4314,8 @@  discard block
 block discarded – undo
4314 4314
 	*/
4315 4315
 	public function countAllAirlineCountries($limit = true, $filters = array())
4316 4316
 	{
4317
-		$filter_query = $this->getFilter($filters,true,true);
4318
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4317
+		$filter_query = $this->getFilter($filters, true, true);
4318
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4319 4319
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4320 4320
 					GROUP BY spotter_output.airline_country
4321 4321
 					ORDER BY airline_country_count DESC";
@@ -4326,7 +4326,7 @@  discard block
 block discarded – undo
4326 4326
 
4327 4327
 		$airline_array = array();
4328 4328
 		$temp_array = array();
4329
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4329
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4330 4330
 		{
4331 4331
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4332 4332
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4342,11 +4342,11 @@  discard block
 block discarded – undo
4342 4342
 	* @return Array the airline country list
4343 4343
 	*
4344 4344
 	*/
4345
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4345
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
4346 4346
 	{
4347 4347
 		global $globalDBdriver;
4348 4348
 		//$filter_query = $this->getFilter($filters,true,true);
4349
-		$Connection= new Connection($this->db);
4349
+		$Connection = new Connection($this->db);
4350 4350
 		if (!$Connection->tableExists('countries')) return array();
4351 4351
 		/*
4352 4352
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4381,7 +4381,7 @@  discard block
 block discarded – undo
4381 4381
 		$flight_array = array();
4382 4382
 		$temp_array = array();
4383 4383
         
4384
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4384
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4385 4385
 		{
4386 4386
 			$temp_array['flight_count'] = $row['nb'];
4387 4387
 			$temp_array['flight_country'] = $row['name'];
@@ -4399,12 +4399,12 @@  discard block
 block discarded – undo
4399 4399
 	* @return Array the aircraft list
4400 4400
 	*
4401 4401
 	*/
4402
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4402
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4403 4403
 	{
4404 4404
 		global $globalDBdriver;
4405
-		$filter_query = $this->getFilter($filters,true,true);
4405
+		$filter_query = $this->getFilter($filters, true, true);
4406 4406
 
4407
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4407
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4408 4408
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4409 4409
 		if ($olderthanmonths > 0) {
4410 4410
 			if ($globalDBdriver == 'mysql') {
@@ -4429,7 +4429,7 @@  discard block
 block discarded – undo
4429 4429
 
4430 4430
 		$aircraft_array = array();
4431 4431
 		$temp_array = array();
4432
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4432
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4433 4433
 		{
4434 4434
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4435 4435
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4446,11 +4446,11 @@  discard block
 block discarded – undo
4446 4446
 	* @return Array the aircraft list
4447 4447
 	*
4448 4448
 	*/
4449
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4449
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4450 4450
 	{
4451 4451
 		global $globalDBdriver;
4452
-		$filter_query = $this->getFilter($filters,true,true);
4453
-		$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 
4452
+		$filter_query = $this->getFilter($filters, true, true);
4453
+		$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 
4454 4454
 		    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' ";
4455 4455
 		if ($olderthanmonths > 0) {
4456 4456
 			if ($globalDBdriver == 'mysql') {
@@ -4475,7 +4475,7 @@  discard block
 block discarded – undo
4475 4475
 
4476 4476
 		$aircraft_array = array();
4477 4477
 		$temp_array = array();
4478
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4478
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4479 4479
 		{
4480 4480
 			$temp_array['airline_icao'] = $row['airline_icao'];
4481 4481
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4494,13 +4494,13 @@  discard block
 block discarded – undo
4494 4494
 	* @return Array the aircraft list
4495 4495
 	*
4496 4496
 	*/
4497
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4497
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4498 4498
 	{
4499 4499
 		$Image = new Image($this->db);
4500
-		$filter_query = $this->getFilter($filters,true,true);
4501
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4500
+		$filter_query = $this->getFilter($filters, true, true);
4501
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4502 4502
 
4503
-		$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  
4503
+		$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  
4504 4504
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4505 4505
 				GROUP BY spotter_output.registration 
4506 4506
 				ORDER BY registration_count DESC";
@@ -4511,14 +4511,14 @@  discard block
 block discarded – undo
4511 4511
 		$aircraft_array = array();
4512 4512
 		$temp_array = array();
4513 4513
         
4514
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4514
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4515 4515
 		{
4516 4516
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4517 4517
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4518 4518
 			$temp_array['registration'] = $row['registration'];
4519 4519
 			$temp_array['airline_name'] = $row['airline_name'];
4520 4520
 			$temp_array['image_thumbnail'] = "";
4521
-			if($row['registration'] != "")
4521
+			if ($row['registration'] != "")
4522 4522
 			{
4523 4523
 				$image_array = $Image->getSpotterImage($row['registration']);
4524 4524
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4537,11 +4537,11 @@  discard block
 block discarded – undo
4537 4537
 	* @return Array the aircraft list
4538 4538
 	*
4539 4539
 	*/
4540
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4540
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4541 4541
 	{
4542
-		$filter_query = $this->getFilter($filters,true,true);
4543
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4544
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4542
+		$filter_query = $this->getFilter($filters, true, true);
4543
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4544
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4545 4545
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4546 4546
 				GROUP BY spotter_output.aircraft_name 
4547 4547
 				ORDER BY aircraft_icao_count DESC";
@@ -4552,7 +4552,7 @@  discard block
 block discarded – undo
4552 4552
 		$aircraft_array = array();
4553 4553
 		$temp_array = array();
4554 4554
 
4555
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4555
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4556 4556
 		{
4557 4557
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4558 4558
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4570,13 +4570,13 @@  discard block
 block discarded – undo
4570 4570
 	* @return Array the aircraft list
4571 4571
 	*
4572 4572
 	*/
4573
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4573
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4574 4574
 	{
4575
-		$filter_query = $this->getFilter($filters,true,true);
4575
+		$filter_query = $this->getFilter($filters, true, true);
4576 4576
 		$Image = new Image($this->db);
4577
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4577
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4578 4578
 
4579
-		$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   
4579
+		$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   
4580 4580
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4581 4581
 				GROUP BY spotter_output.registration 
4582 4582
 				ORDER BY registration_count DESC";
@@ -4586,14 +4586,14 @@  discard block
 block discarded – undo
4586 4586
 
4587 4587
 		$aircraft_array = array();
4588 4588
 		$temp_array = array();
4589
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4589
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4590 4590
 		{
4591 4591
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4592 4592
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4593 4593
 			$temp_array['registration'] = $row['registration'];
4594 4594
 			$temp_array['airline_name'] = $row['airline_name'];
4595 4595
 			$temp_array['image_thumbnail'] = "";
4596
-			if($row['registration'] != "")
4596
+			if ($row['registration'] != "")
4597 4597
 			{
4598 4598
 				$image_array = $Image->getSpotterImage($row['registration']);
4599 4599
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4612,11 +4612,11 @@  discard block
 block discarded – undo
4612 4612
 	* @return Array the aircraft list
4613 4613
 	*
4614 4614
 	*/
4615
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4615
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4616 4616
 	{
4617
-		$filter_query = $this->getFilter($filters,true,true);
4618
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4619
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4617
+		$filter_query = $this->getFilter($filters, true, true);
4618
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4619
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4620 4620
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4621 4621
 				GROUP BY spotter_output.aircraft_manufacturer 
4622 4622
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4627,7 +4627,7 @@  discard block
 block discarded – undo
4627 4627
 		$aircraft_array = array();
4628 4628
 		$temp_array = array();
4629 4629
 
4630
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4630
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4631 4631
 		{
4632 4632
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4633 4633
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4644,12 +4644,12 @@  discard block
 block discarded – undo
4644 4644
 	* @return Array the aircraft list
4645 4645
 	*
4646 4646
 	*/
4647
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4647
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4648 4648
 	{
4649
-		$filter_query = $this->getFilter($filters,true,true);
4650
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4649
+		$filter_query = $this->getFilter($filters, true, true);
4650
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4651 4651
 
4652
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4652
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4653 4653
 				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) 
4654 4654
 				GROUP BY spotter_output.aircraft_name 
4655 4655
 				ORDER BY aircraft_icao_count DESC";
@@ -4659,7 +4659,7 @@  discard block
 block discarded – undo
4659 4659
 
4660 4660
 		$aircraft_array = array();
4661 4661
 		$temp_array = array();
4662
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4662
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4663 4663
 		{
4664 4664
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4665 4665
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4677,13 +4677,13 @@  discard block
 block discarded – undo
4677 4677
 	* @return Array the aircraft list
4678 4678
 	*
4679 4679
 	*/
4680
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4680
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4681 4681
 	{
4682
-		$filter_query = $this->getFilter($filters,true,true);
4682
+		$filter_query = $this->getFilter($filters, true, true);
4683 4683
 		$Image = new Image($this->db);
4684
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4684
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4685 4685
 
4686
-		$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  
4686
+		$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  
4687 4687
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4688 4688
                     GROUP BY spotter_output.registration 
4689 4689
 					ORDER BY registration_count DESC";
@@ -4694,14 +4694,14 @@  discard block
 block discarded – undo
4694 4694
 
4695 4695
 		$aircraft_array = array();
4696 4696
 		$temp_array = array();
4697
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4697
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4698 4698
 		{
4699 4699
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4700 4700
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4701 4701
 			$temp_array['registration'] = $row['registration'];
4702 4702
 			$temp_array['airline_name'] = $row['airline_name'];
4703 4703
 			$temp_array['image_thumbnail'] = "";
4704
-			if($row['registration'] != "")
4704
+			if ($row['registration'] != "")
4705 4705
 			{
4706 4706
 				$image_array = $Image->getSpotterImage($row['registration']);
4707 4707
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4719,11 +4719,11 @@  discard block
 block discarded – undo
4719 4719
 	* @return Array the aircraft list
4720 4720
 	*
4721 4721
 	*/
4722
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4722
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4723 4723
 	{
4724
-		$filter_query = $this->getFilter($filters,true,true);
4725
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4726
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4724
+		$filter_query = $this->getFilter($filters, true, true);
4725
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4726
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4727 4727
                     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)  
4728 4728
                     GROUP BY spotter_output.aircraft_manufacturer 
4729 4729
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4734,7 +4734,7 @@  discard block
 block discarded – undo
4734 4734
 
4735 4735
 		$aircraft_array = array();
4736 4736
 		$temp_array = array();
4737
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4737
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4738 4738
 		{
4739 4739
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4740 4740
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4749,12 +4749,12 @@  discard block
 block discarded – undo
4749 4749
 	* @return Array the aircraft list
4750 4750
 	*
4751 4751
 	*/
4752
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4752
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4753 4753
 	{
4754
-		$filter_query = $this->getFilter($filters,true,true);
4755
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4754
+		$filter_query = $this->getFilter($filters, true, true);
4755
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4756 4756
 
4757
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4757
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4758 4758
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4759 4759
                     GROUP BY spotter_output.aircraft_name 
4760 4760
 					ORDER BY aircraft_icao_count DESC";
@@ -4763,7 +4763,7 @@  discard block
 block discarded – undo
4763 4763
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4764 4764
 		$aircraft_array = array();
4765 4765
 		$temp_array = array();
4766
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4766
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4767 4767
 		{
4768 4768
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4769 4769
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4782,11 +4782,11 @@  discard block
 block discarded – undo
4782 4782
 	*/
4783 4783
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4784 4784
 	{
4785
-		$filter_query = $this->getFilter($filters,true,true);
4785
+		$filter_query = $this->getFilter($filters, true, true);
4786 4786
 		$Image = new Image($this->db);
4787
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4787
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4788 4788
 
4789
-		$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   
4789
+		$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   
4790 4790
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4791 4791
                     GROUP BY spotter_output.registration 
4792 4792
 					ORDER BY registration_count DESC";
@@ -4796,14 +4796,14 @@  discard block
 block discarded – undo
4796 4796
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4797 4797
 		$aircraft_array = array();
4798 4798
 		$temp_array = array();
4799
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4799
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4800 4800
 		{
4801 4801
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4802 4802
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4803 4803
 			$temp_array['registration'] = $row['registration'];
4804 4804
 			$temp_array['airline_name'] = $row['airline_name'];
4805 4805
 			$temp_array['image_thumbnail'] = "";
4806
-			if($row['registration'] != "")
4806
+			if ($row['registration'] != "")
4807 4807
 			{
4808 4808
 				$image_array = $Image->getSpotterImage($row['registration']);
4809 4809
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4820,11 +4820,11 @@  discard block
 block discarded – undo
4820 4820
 	* @return Array the aircraft list
4821 4821
 	*
4822 4822
 	*/
4823
-	public function countAllAircraftTypesByDate($date,$filters = array())
4823
+	public function countAllAircraftTypesByDate($date, $filters = array())
4824 4824
 	{
4825 4825
 		global $globalTimezone, $globalDBdriver;
4826
-		$filter_query = $this->getFilter($filters,true,true);
4827
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4826
+		$filter_query = $this->getFilter($filters, true, true);
4827
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4828 4828
 		if ($globalTimezone != '') {
4829 4829
 			date_default_timezone_set($globalTimezone);
4830 4830
 			$datetime = new DateTime($date);
@@ -4832,12 +4832,12 @@  discard block
 block discarded – undo
4832 4832
 		} else $offset = '+00:00';
4833 4833
 
4834 4834
 		if ($globalDBdriver == 'mysql') {
4835
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4835
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4836 4836
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4837 4837
 					GROUP BY spotter_output.aircraft_name 
4838 4838
 					ORDER BY aircraft_icao_count DESC";
4839 4839
 		} else {
4840
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4840
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4841 4841
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4842 4842
 					GROUP BY spotter_output.aircraft_name 
4843 4843
 					ORDER BY aircraft_icao_count DESC";
@@ -4848,7 +4848,7 @@  discard block
 block discarded – undo
4848 4848
 
4849 4849
 		$aircraft_array = array();
4850 4850
 		$temp_array = array();
4851
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4851
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4852 4852
 		{
4853 4853
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4854 4854
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4866,12 +4866,12 @@  discard block
 block discarded – undo
4866 4866
 	* @return Array the aircraft list
4867 4867
 	*
4868 4868
 	*/
4869
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
4869
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
4870 4870
 	{
4871 4871
 		global $globalTimezone, $globalDBdriver;
4872
-		$filter_query = $this->getFilter($filters,true,true);
4872
+		$filter_query = $this->getFilter($filters, true, true);
4873 4873
 		$Image = new Image($this->db);
4874
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4874
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4875 4875
 		if ($globalTimezone != '') {
4876 4876
 			date_default_timezone_set($globalTimezone);
4877 4877
 			$datetime = new DateTime($date);
@@ -4879,12 +4879,12 @@  discard block
 block discarded – undo
4879 4879
 		} else $offset = '+00:00';
4880 4880
 
4881 4881
 		if ($globalDBdriver == 'mysql') {
4882
-			$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    
4882
+			$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    
4883 4883
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4884 4884
 					GROUP BY spotter_output.registration 
4885 4885
 					ORDER BY registration_count DESC";
4886 4886
 		} else {
4887
-			$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    
4887
+			$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    
4888 4888
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4889 4889
 					GROUP BY spotter_output.registration 
4890 4890
 					ORDER BY registration_count DESC";
@@ -4895,14 +4895,14 @@  discard block
 block discarded – undo
4895 4895
 
4896 4896
 		$aircraft_array = array();
4897 4897
 		$temp_array = array();
4898
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4898
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4899 4899
 		{
4900 4900
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4901 4901
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4902 4902
 			$temp_array['registration'] = $row['registration'];
4903 4903
 			$temp_array['airline_name'] = $row['airline_name'];
4904 4904
 			$temp_array['image_thumbnail'] = "";
4905
-			if($row['registration'] != "")
4905
+			if ($row['registration'] != "")
4906 4906
 			{
4907 4907
 				$image_array = $Image->getSpotterImage($row['registration']);
4908 4908
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4921,11 +4921,11 @@  discard block
 block discarded – undo
4921 4921
 	* @return Array the aircraft manufacturer list
4922 4922
 	*
4923 4923
 	*/
4924
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
4924
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
4925 4925
 	{
4926 4926
 		global $globalTimezone, $globalDBdriver;
4927
-		$filter_query = $this->getFilter($filters,true,true);
4928
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4927
+		$filter_query = $this->getFilter($filters, true, true);
4928
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4929 4929
 		if ($globalTimezone != '') {
4930 4930
 			date_default_timezone_set($globalTimezone);
4931 4931
 			$datetime = new DateTime($date);
@@ -4933,12 +4933,12 @@  discard block
 block discarded – undo
4933 4933
 		} else $offset = '+00:00';
4934 4934
 
4935 4935
 		if ($globalDBdriver == 'mysql') {
4936
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4936
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4937 4937
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4938 4938
 				GROUP BY spotter_output.aircraft_manufacturer 
4939 4939
 				ORDER BY aircraft_manufacturer_count DESC";
4940 4940
 		} else {
4941
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4941
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4942 4942
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4943 4943
 				GROUP BY spotter_output.aircraft_manufacturer 
4944 4944
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4950,7 +4950,7 @@  discard block
 block discarded – undo
4950 4950
 		$aircraft_array = array();
4951 4951
 		$temp_array = array();
4952 4952
 
4953
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4953
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4954 4954
 		{
4955 4955
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4956 4956
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4967,11 +4967,11 @@  discard block
 block discarded – undo
4967 4967
 	* @return Array the aircraft list
4968 4968
 	*
4969 4969
 	*/
4970
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
4970
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
4971 4971
 	{
4972
-		$filter_query = $this->getFilter($filters,true,true);
4973
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4974
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4972
+		$filter_query = $this->getFilter($filters, true, true);
4973
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4974
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4975 4975
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
4976 4976
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
4977 4977
 				ORDER BY aircraft_icao_count DESC";
@@ -4982,7 +4982,7 @@  discard block
 block discarded – undo
4982 4982
 		$aircraft_array = array();
4983 4983
 		$temp_array = array();
4984 4984
 
4985
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4985
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4986 4986
 		{
4987 4987
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4988 4988
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5000,13 +5000,13 @@  discard block
 block discarded – undo
5000 5000
 	* @return Array the aircraft list
5001 5001
 	*
5002 5002
 	*/
5003
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5003
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5004 5004
 	{
5005
-		$filter_query = $this->getFilter($filters,true,true);
5005
+		$filter_query = $this->getFilter($filters, true, true);
5006 5006
 		$Image = new Image($this->db);
5007
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5007
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5008 5008
 
5009
-		$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  
5009
+		$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  
5010 5010
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5011 5011
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5012 5012
 		    ORDER BY registration_count DESC";
@@ -5018,14 +5018,14 @@  discard block
 block discarded – undo
5018 5018
 		$aircraft_array = array();
5019 5019
 		$temp_array = array();
5020 5020
         
5021
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5021
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5022 5022
 		{
5023 5023
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5024 5024
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5025 5025
 			$temp_array['registration'] = $row['registration'];
5026 5026
 			$temp_array['airline_name'] = $row['airline_name'];
5027 5027
 			$temp_array['image_thumbnail'] = "";
5028
-			if($row['registration'] != "")
5028
+			if ($row['registration'] != "")
5029 5029
 			{
5030 5030
 				$image_array = $Image->getSpotterImage($row['registration']);
5031 5031
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5044,11 +5044,11 @@  discard block
 block discarded – undo
5044 5044
 	* @return Array the aircraft manufacturer list
5045 5045
 	*
5046 5046
 	*/
5047
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5047
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5048 5048
 	{
5049
-		$filter_query = $this->getFilter($filters,true,true);
5050
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5051
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5049
+		$filter_query = $this->getFilter($filters, true, true);
5050
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5051
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5052 5052
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5053 5053
                     GROUP BY spotter_output.aircraft_manufacturer 
5054 5054
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5058,7 +5058,7 @@  discard block
 block discarded – undo
5058 5058
 		$sth->execute(array(':ident' => $ident));
5059 5059
 		$aircraft_array = array();
5060 5060
 		$temp_array = array();
5061
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5061
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5062 5062
 		{
5063 5063
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5064 5064
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5074,24 +5074,24 @@  discard block
 block discarded – undo
5074 5074
 	* @return Array the aircraft list
5075 5075
 	*
5076 5076
 	*/
5077
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5077
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5078 5078
 	{
5079
-		$filter_query = $this->getFilter($filters,true,true);
5080
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5081
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5079
+		$filter_query = $this->getFilter($filters, true, true);
5080
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5081
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5082 5082
 		
5083 5083
 
5084
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5084
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5085 5085
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5086 5086
                     GROUP BY spotter_output.aircraft_name 
5087 5087
 					ORDER BY aircraft_icao_count DESC";
5088 5088
  
5089 5089
 		
5090 5090
 		$sth = $this->db->prepare($query);
5091
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5091
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5092 5092
 		$aircraft_array = array();
5093 5093
 		$temp_array = array();
5094
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5094
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5095 5095
 		{
5096 5096
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5097 5097
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5107,33 +5107,33 @@  discard block
 block discarded – undo
5107 5107
 	* @return Array the aircraft list
5108 5108
 	*
5109 5109
 	*/
5110
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5110
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5111 5111
 	{
5112
-		$filter_query = $this->getFilter($filters,true,true);
5112
+		$filter_query = $this->getFilter($filters, true, true);
5113 5113
 		$Image = new Image($this->db);
5114
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5115
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5114
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5115
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5116 5116
 
5117
-		$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   
5117
+		$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   
5118 5118
                     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)   
5119 5119
                     GROUP BY spotter_output.registration 
5120 5120
 					ORDER BY registration_count DESC";
5121 5121
 
5122 5122
 		
5123 5123
 		$sth = $this->db->prepare($query);
5124
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5124
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5125 5125
       
5126 5126
 		$aircraft_array = array();
5127 5127
 		$temp_array = array();
5128 5128
         
5129
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5129
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5130 5130
 		{
5131 5131
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5132 5132
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5133 5133
 			$temp_array['registration'] = $row['registration'];
5134 5134
 			$temp_array['airline_name'] = $row['airline_name'];
5135 5135
 			$temp_array['image_thumbnail'] = "";
5136
-			if($row['registration'] != "")
5136
+			if ($row['registration'] != "")
5137 5137
 			{
5138 5138
 				$image_array = $Image->getSpotterImage($row['registration']);
5139 5139
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5153,25 +5153,25 @@  discard block
 block discarded – undo
5153 5153
 	* @return Array the aircraft manufacturer list
5154 5154
 	*
5155 5155
 	*/
5156
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5156
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5157 5157
 	{
5158
-		$filter_query = $this->getFilter($filters,true,true);
5159
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5160
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5158
+		$filter_query = $this->getFilter($filters, true, true);
5159
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5160
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5161 5161
 
5162
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5162
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5163 5163
                     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) 
5164 5164
                     GROUP BY spotter_output.aircraft_manufacturer 
5165 5165
 					ORDER BY aircraft_manufacturer_count DESC";
5166 5166
 
5167 5167
 		
5168 5168
 		$sth = $this->db->prepare($query);
5169
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5169
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5170 5170
       
5171 5171
 		$aircraft_array = array();
5172 5172
 		$temp_array = array();
5173 5173
         
5174
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5174
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5175 5175
 		{
5176 5176
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5177 5177
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5191,11 +5191,11 @@  discard block
 block discarded – undo
5191 5191
 	* @return Array the aircraft list
5192 5192
 	*
5193 5193
 	*/
5194
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5194
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5195 5195
 	{
5196
-		$filter_query = $this->getFilter($filters,true,true);
5197
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5198
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5196
+		$filter_query = $this->getFilter($filters, true, true);
5197
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5198
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5199 5199
                     FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5200 5200
                     GROUP BY spotter_output.aircraft_name 
5201 5201
 			ORDER BY aircraft_icao_count DESC";
@@ -5207,7 +5207,7 @@  discard block
 block discarded – undo
5207 5207
 		$aircraft_array = array();
5208 5208
 		$temp_array = array();
5209 5209
         
5210
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5210
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5211 5211
 		{
5212 5212
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5213 5213
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5226,12 +5226,12 @@  discard block
 block discarded – undo
5226 5226
 	* @return Array the aircraft list
5227 5227
 	*
5228 5228
 	*/
5229
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5229
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5230 5230
 	{
5231
-		$filter_query = $this->getFilter($filters,true,true);
5231
+		$filter_query = $this->getFilter($filters, true, true);
5232 5232
 		$Image = new Image($this->db);
5233
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5234
-		$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 
5233
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5234
+		$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 
5235 5235
                     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)    
5236 5236
                     GROUP BY spotter_output.registration 
5237 5237
 					ORDER BY registration_count DESC";
@@ -5243,14 +5243,14 @@  discard block
 block discarded – undo
5243 5243
 		$aircraft_array = array();
5244 5244
 		$temp_array = array();
5245 5245
         
5246
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5246
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5247 5247
 		{
5248 5248
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5249 5249
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5250 5250
 			$temp_array['registration'] = $row['registration'];
5251 5251
 			$temp_array['airline_name'] = $row['airline_name'];
5252 5252
 			$temp_array['image_thumbnail'] = "";
5253
-			if($row['registration'] != "")
5253
+			if ($row['registration'] != "")
5254 5254
 			{
5255 5255
 				$image_array = $Image->getSpotterImage($row['registration']);
5256 5256
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5270,11 +5270,11 @@  discard block
 block discarded – undo
5270 5270
 	* @return Array the aircraft manufacturer list
5271 5271
 	*
5272 5272
 	*/
5273
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5273
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5274 5274
 	{
5275
-		$filter_query = $this->getFilter($filters,true,true);
5276
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5277
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5275
+		$filter_query = $this->getFilter($filters, true, true);
5276
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5277
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5278 5278
                     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) 
5279 5279
                     GROUP BY spotter_output.aircraft_manufacturer 
5280 5280
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5286,7 +5286,7 @@  discard block
 block discarded – undo
5286 5286
 		$aircraft_array = array();
5287 5287
 		$temp_array = array();
5288 5288
         
5289
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5289
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5290 5290
 		{
5291 5291
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5292 5292
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5307,8 +5307,8 @@  discard block
 block discarded – undo
5307 5307
 	*/
5308 5308
 	public function countAllAircraftManufacturers($filters = array())
5309 5309
 	{
5310
-		$filter_query = $this->getFilter($filters,true,true);
5311
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5310
+		$filter_query = $this->getFilter($filters, true, true);
5311
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5312 5312
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5313 5313
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5314 5314
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5321,7 +5321,7 @@  discard block
 block discarded – undo
5321 5321
 		$manufacturer_array = array();
5322 5322
 		$temp_array = array();
5323 5323
         
5324
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5324
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5325 5325
 		{
5326 5326
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5327 5327
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5340,12 +5340,12 @@  discard block
 block discarded – undo
5340 5340
 	* @return Array the aircraft list
5341 5341
 	*
5342 5342
 	*/
5343
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5343
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5344 5344
 	{
5345 5345
 		global $globalDBdriver;
5346 5346
 		$Image = new Image($this->db);
5347
-		$filter_query = $this->getFilter($filters,true,true);
5348
-		$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    
5347
+		$filter_query = $this->getFilter($filters, true, true);
5348
+		$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    
5349 5349
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5350 5350
                 if ($olderthanmonths > 0) {
5351 5351
             		if ($globalDBdriver == 'mysql') {
@@ -5373,7 +5373,7 @@  discard block
 block discarded – undo
5373 5373
 		$aircraft_array = array();
5374 5374
 		$temp_array = array();
5375 5375
         
5376
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5376
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5377 5377
 		{
5378 5378
 			$temp_array['registration'] = $row['registration'];
5379 5379
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5381,7 +5381,7 @@  discard block
 block discarded – undo
5381 5381
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5382 5382
 			$temp_array['airline_name'] = $row['airline_name'];
5383 5383
 			$temp_array['image_thumbnail'] = "";
5384
-			if($row['registration'] != "")
5384
+			if ($row['registration'] != "")
5385 5385
 			{
5386 5386
 				$image_array = $Image->getSpotterImage($row['registration']);
5387 5387
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5400,12 +5400,12 @@  discard block
 block discarded – undo
5400 5400
 	* @return Array the aircraft list
5401 5401
 	*
5402 5402
 	*/
5403
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5403
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5404 5404
 	{
5405 5405
 		global $globalDBdriver;
5406
-		$filter_query = $this->getFilter($filters,true,true);
5406
+		$filter_query = $this->getFilter($filters, true, true);
5407 5407
 		$Image = new Image($this->db);
5408
-		$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    
5408
+		$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    
5409 5409
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5410 5410
                 if ($olderthanmonths > 0) {
5411 5411
             		if ($globalDBdriver == 'mysql') {
@@ -5433,7 +5433,7 @@  discard block
 block discarded – undo
5433 5433
 		$aircraft_array = array();
5434 5434
 		$temp_array = array();
5435 5435
         
5436
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5436
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5437 5437
 		{
5438 5438
 			$temp_array['registration'] = $row['registration'];
5439 5439
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5442,7 +5442,7 @@  discard block
 block discarded – undo
5442 5442
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5443 5443
 			$temp_array['airline_name'] = $row['airline_name'];
5444 5444
 			$temp_array['image_thumbnail'] = "";
5445
-			if($row['registration'] != "")
5445
+			if ($row['registration'] != "")
5446 5446
 			{
5447 5447
 				$image_array = $Image->getSpotterImage($row['registration']);
5448 5448
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5461,11 +5461,11 @@  discard block
 block discarded – undo
5461 5461
 	* @return Array the airport list
5462 5462
 	*
5463 5463
 	*/
5464
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5464
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5465 5465
 	{
5466 5466
 		global $globalDBdriver;
5467
-		$filter_query = $this->getFilter($filters,true,true);
5468
-		$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 
5467
+		$filter_query = $this->getFilter($filters, true, true);
5468
+		$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 
5469 5469
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5470 5470
                 if ($olderthanmonths > 0) {
5471 5471
             		if ($globalDBdriver == 'mysql') {
@@ -5494,7 +5494,7 @@  discard block
 block discarded – undo
5494 5494
 		$airport_array = array();
5495 5495
 		$temp_array = array();
5496 5496
         
5497
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5497
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5498 5498
 		{
5499 5499
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5500 5500
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5513,11 +5513,11 @@  discard block
 block discarded – undo
5513 5513
 	* @return Array the airport list
5514 5514
 	*
5515 5515
 	*/
5516
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5516
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5517 5517
 	{
5518 5518
 		global $globalDBdriver;
5519
-		$filter_query = $this->getFilter($filters,true,true);
5520
-		$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 
5519
+		$filter_query = $this->getFilter($filters, true, true);
5520
+		$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 
5521 5521
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5522 5522
                 if ($olderthanmonths > 0) {
5523 5523
             		if ($globalDBdriver == 'mysql') {
@@ -5546,7 +5546,7 @@  discard block
 block discarded – undo
5546 5546
 		$airport_array = array();
5547 5547
 		$temp_array = array();
5548 5548
         
5549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5550 5550
 		{
5551 5551
 			$temp_array['airline_icao'] = $row['airline_icao'];
5552 5552
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5566,11 +5566,11 @@  discard block
 block discarded – undo
5566 5566
 	* @return Array the airport list
5567 5567
 	*
5568 5568
 	*/
5569
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5569
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5570 5570
 	{
5571 5571
 		global $globalDBdriver;
5572
-		$filter_query = $this->getFilter($filters,true,true);
5573
-		$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
5572
+		$filter_query = $this->getFilter($filters, true, true);
5573
+		$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
5574 5574
 				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";
5575 5575
                 if ($olderthanmonths > 0) {
5576 5576
             		if ($globalDBdriver == 'mysql') {
@@ -5598,7 +5598,7 @@  discard block
 block discarded – undo
5598 5598
 		$airport_array = array();
5599 5599
 		$temp_array = array();
5600 5600
         
5601
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5601
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5602 5602
 		{
5603 5603
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5604 5604
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5617,11 +5617,11 @@  discard block
 block discarded – undo
5617 5617
 	* @return Array the airport list
5618 5618
 	*
5619 5619
 	*/
5620
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5620
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5621 5621
 	{
5622 5622
 		global $globalDBdriver;
5623
-		$filter_query = $this->getFilter($filters,true,true);
5624
-		$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
5623
+		$filter_query = $this->getFilter($filters, true, true);
5624
+		$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
5625 5625
 				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 ";
5626 5626
                 if ($olderthanmonths > 0) {
5627 5627
             		if ($globalDBdriver == 'mysql') {
@@ -5650,7 +5650,7 @@  discard block
 block discarded – undo
5650 5650
 		$airport_array = array();
5651 5651
 		$temp_array = array();
5652 5652
         
5653
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5653
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5654 5654
 		{
5655 5655
 			$temp_array['airline_icao'] = $row['airline_icao'];
5656 5656
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5670,11 +5670,11 @@  discard block
 block discarded – undo
5670 5670
 	* @return Array the airport list
5671 5671
 	*
5672 5672
 	*/
5673
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5673
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5674 5674
 	{
5675
-		$filter_query = $this->getFilter($filters,true,true);
5676
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5677
-		$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 
5675
+		$filter_query = $this->getFilter($filters, true, true);
5676
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5677
+		$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 
5678 5678
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5679 5679
                     GROUP BY spotter_output.departure_airport_icao
5680 5680
 					ORDER BY airport_departure_icao_count DESC";
@@ -5686,7 +5686,7 @@  discard block
 block discarded – undo
5686 5686
 		$airport_array = array();
5687 5687
 		$temp_array = array();
5688 5688
         
5689
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5689
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5690 5690
 		{
5691 5691
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5692 5692
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5708,11 +5708,11 @@  discard block
 block discarded – undo
5708 5708
 	* @return Array the airport list
5709 5709
 	*
5710 5710
 	*/
5711
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5711
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5712 5712
 	{
5713
-		$filter_query = $this->getFilter($filters,true,true);
5714
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5715
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5713
+		$filter_query = $this->getFilter($filters, true, true);
5714
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5715
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5716 5716
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5717 5717
                     GROUP BY spotter_output.departure_airport_country
5718 5718
 					ORDER BY airport_departure_country_count DESC";
@@ -5724,7 +5724,7 @@  discard block
 block discarded – undo
5724 5724
 		$airport_array = array();
5725 5725
 		$temp_array = array();
5726 5726
         
5727
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5727
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5728 5728
 		{
5729 5729
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5730 5730
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5743,11 +5743,11 @@  discard block
 block discarded – undo
5743 5743
 	* @return Array the airport list
5744 5744
 	*
5745 5745
 	*/
5746
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5746
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5747 5747
 	{
5748
-		$filter_query = $this->getFilter($filters,true,true);
5749
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5750
-		$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 
5748
+		$filter_query = $this->getFilter($filters, true, true);
5749
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5750
+		$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 
5751 5751
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5752 5752
                     GROUP BY spotter_output.departure_airport_icao
5753 5753
 					ORDER BY airport_departure_icao_count DESC";
@@ -5759,7 +5759,7 @@  discard block
 block discarded – undo
5759 5759
 		$airport_array = array();
5760 5760
 		$temp_array = array();
5761 5761
         
5762
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5762
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5763 5763
 		{
5764 5764
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5765 5765
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5780,11 +5780,11 @@  discard block
 block discarded – undo
5780 5780
 	* @return Array the airport list
5781 5781
 	*
5782 5782
 	*/
5783
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5783
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
5784 5784
 	{
5785
-		$filter_query = $this->getFilter($filters,true,true);
5786
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5787
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5785
+		$filter_query = $this->getFilter($filters, true, true);
5786
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5787
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5788 5788
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5789 5789
                     GROUP BY spotter_output.departure_airport_country
5790 5790
 					ORDER BY airport_departure_country_count DESC";
@@ -5796,7 +5796,7 @@  discard block
 block discarded – undo
5796 5796
 		$airport_array = array();
5797 5797
 		$temp_array = array();
5798 5798
         
5799
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5799
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5800 5800
 		{
5801 5801
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5802 5802
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5814,11 +5814,11 @@  discard block
 block discarded – undo
5814 5814
 	* @return Array the airport list
5815 5815
 	*
5816 5816
 	*/
5817
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5817
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
5818 5818
 	{
5819
-		$filter_query = $this->getFilter($filters,true,true);
5820
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5821
-		$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 
5819
+		$filter_query = $this->getFilter($filters, true, true);
5820
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5821
+		$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 
5822 5822
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5823 5823
                     GROUP BY spotter_output.departure_airport_icao
5824 5824
 					ORDER BY airport_departure_icao_count DESC";
@@ -5830,7 +5830,7 @@  discard block
 block discarded – undo
5830 5830
 		$airport_array = array();
5831 5831
 		$temp_array = array();
5832 5832
         
5833
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5833
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5834 5834
 		{
5835 5835
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5836 5836
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5851,11 +5851,11 @@  discard block
 block discarded – undo
5851 5851
 	* @return Array the airport list
5852 5852
 	*
5853 5853
 	*/
5854
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5854
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
5855 5855
 	{
5856
-		$filter_query = $this->getFilter($filters,true,true);
5857
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5858
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5856
+		$filter_query = $this->getFilter($filters, true, true);
5857
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5858
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5859 5859
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5860 5860
                     GROUP BY spotter_output.departure_airport_country
5861 5861
 					ORDER BY airport_departure_country_count DESC";
@@ -5867,7 +5867,7 @@  discard block
 block discarded – undo
5867 5867
 		$airport_array = array();
5868 5868
 		$temp_array = array();
5869 5869
         
5870
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5870
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5871 5871
 		{
5872 5872
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5873 5873
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5885,11 +5885,11 @@  discard block
 block discarded – undo
5885 5885
 	* @return Array the airport list
5886 5886
 	*
5887 5887
 	*/
5888
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5888
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
5889 5889
 	{
5890
-		$filter_query = $this->getFilter($filters,true,true);
5891
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5892
-		$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 
5890
+		$filter_query = $this->getFilter($filters, true, true);
5891
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5892
+		$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 
5893 5893
 			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 
5894 5894
                     GROUP BY spotter_output.departure_airport_icao
5895 5895
 					ORDER BY airport_departure_icao_count DESC";
@@ -5901,7 +5901,7 @@  discard block
 block discarded – undo
5901 5901
 		$airport_array = array();
5902 5902
 		$temp_array = array();
5903 5903
         
5904
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5904
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5905 5905
 		{
5906 5906
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5907 5907
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5922,11 +5922,11 @@  discard block
 block discarded – undo
5922 5922
 	* @return Array the airport list
5923 5923
 	*
5924 5924
 	*/
5925
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5925
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
5926 5926
 	{
5927
-		$filter_query = $this->getFilter($filters,true,true);
5928
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5929
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5927
+		$filter_query = $this->getFilter($filters, true, true);
5928
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5929
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5930 5930
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
5931 5931
                     GROUP BY spotter_output.departure_airport_country
5932 5932
 					ORDER BY airport_departure_country_count DESC";
@@ -5938,7 +5938,7 @@  discard block
 block discarded – undo
5938 5938
 		$airport_array = array();
5939 5939
 		$temp_array = array();
5940 5940
         
5941
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5941
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5942 5942
 		{
5943 5943
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5944 5944
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5957,11 +5957,11 @@  discard block
 block discarded – undo
5957 5957
 	* @return Array the airport list
5958 5958
 	*
5959 5959
 	*/
5960
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5960
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
5961 5961
 	{
5962
-		$filter_query = $this->getFilter($filters,true,true);
5963
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5964
-		$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 
5962
+		$filter_query = $this->getFilter($filters, true, true);
5963
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5964
+		$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 
5965 5965
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5966 5966
                     GROUP BY spotter_output.departure_airport_icao
5967 5967
 					ORDER BY airport_departure_icao_count DESC";
@@ -5973,7 +5973,7 @@  discard block
 block discarded – undo
5973 5973
 		$airport_array = array();
5974 5974
 		$temp_array = array();
5975 5975
         
5976
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5976
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5977 5977
 		{
5978 5978
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5979 5979
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5994,11 +5994,11 @@  discard block
 block discarded – undo
5994 5994
 	* @return Array the airport list
5995 5995
 	*
5996 5996
 	*/
5997
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5997
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
5998 5998
 	{
5999
-		$filter_query = $this->getFilter($filters,true,true);
6000
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6001
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5999
+		$filter_query = $this->getFilter($filters, true, true);
6000
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6001
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6002 6002
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6003 6003
                     GROUP BY spotter_output.departure_airport_country
6004 6004
 					ORDER BY airport_departure_country_count DESC";
@@ -6010,7 +6010,7 @@  discard block
 block discarded – undo
6010 6010
 		$airport_array = array();
6011 6011
 		$temp_array = array();
6012 6012
         
6013
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6013
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6014 6014
 		{
6015 6015
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6016 6016
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6028,11 +6028,11 @@  discard block
 block discarded – undo
6028 6028
 	* @return Array the airport list
6029 6029
 	*
6030 6030
 	*/
6031
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6031
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6032 6032
 	{
6033 6033
 		global $globalTimezone, $globalDBdriver;
6034
-		$filter_query = $this->getFilter($filters,true,true);
6035
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6034
+		$filter_query = $this->getFilter($filters, true, true);
6035
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6036 6036
 		if ($globalTimezone != '') {
6037 6037
 			date_default_timezone_set($globalTimezone);
6038 6038
 			$datetime = new DateTime($date);
@@ -6040,12 +6040,12 @@  discard block
 block discarded – undo
6040 6040
 		} else $offset = '+00:00';
6041 6041
 
6042 6042
 		if ($globalDBdriver == 'mysql') {
6043
-			$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 
6043
+			$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 
6044 6044
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6045 6045
 					GROUP BY spotter_output.departure_airport_icao
6046 6046
 					ORDER BY airport_departure_icao_count DESC";
6047 6047
 		} else {
6048
-			$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 
6048
+			$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 
6049 6049
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6050 6050
 					GROUP BY spotter_output.departure_airport_icao
6051 6051
 					ORDER BY airport_departure_icao_count DESC";
@@ -6057,7 +6057,7 @@  discard block
 block discarded – undo
6057 6057
 		$airport_array = array();
6058 6058
 		$temp_array = array();
6059 6059
         
6060
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6060
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6061 6061
 		{
6062 6062
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6063 6063
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6078,11 +6078,11 @@  discard block
 block discarded – undo
6078 6078
 	* @return Array the airport list
6079 6079
 	*
6080 6080
 	*/
6081
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6081
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6082 6082
 	{
6083 6083
 		global $globalTimezone, $globalDBdriver;
6084
-		$filter_query = $this->getFilter($filters,true,true);
6085
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6084
+		$filter_query = $this->getFilter($filters, true, true);
6085
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6086 6086
 		if ($globalTimezone != '') {
6087 6087
 			date_default_timezone_set($globalTimezone);
6088 6088
 			$datetime = new DateTime($date);
@@ -6090,12 +6090,12 @@  discard block
 block discarded – undo
6090 6090
 		} else $offset = '+00:00';
6091 6091
 
6092 6092
 		if ($globalDBdriver == 'mysql') {
6093
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6093
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6094 6094
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6095 6095
 					GROUP BY spotter_output.departure_airport_country
6096 6096
 					ORDER BY airport_departure_country_count DESC";
6097 6097
 		} else {
6098
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6098
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6099 6099
 					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 
6100 6100
 					GROUP BY spotter_output.departure_airport_country
6101 6101
 					ORDER BY airport_departure_country_count DESC";
@@ -6107,7 +6107,7 @@  discard block
 block discarded – undo
6107 6107
 		$airport_array = array();
6108 6108
 		$temp_array = array();
6109 6109
         
6110
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6110
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6111 6111
 		{
6112 6112
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6113 6113
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6125,11 +6125,11 @@  discard block
 block discarded – undo
6125 6125
 	* @return Array the airport list
6126 6126
 	*
6127 6127
 	*/
6128
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6128
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6129 6129
 	{
6130
-		$filter_query = $this->getFilter($filters,true,true);
6131
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6132
-		$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 
6130
+		$filter_query = $this->getFilter($filters, true, true);
6131
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6132
+		$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 
6133 6133
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6134 6134
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6135 6135
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6141,7 +6141,7 @@  discard block
 block discarded – undo
6141 6141
 		$airport_array = array();
6142 6142
 		$temp_array = array();
6143 6143
         
6144
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6144
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6145 6145
 		{
6146 6146
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6147 6147
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6163,11 +6163,11 @@  discard block
 block discarded – undo
6163 6163
 	* @return Array the airport list
6164 6164
 	*
6165 6165
 	*/
6166
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6166
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6167 6167
 	{
6168
-		$filter_query = $this->getFilter($filters,true,true);
6169
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6170
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6168
+		$filter_query = $this->getFilter($filters, true, true);
6169
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6170
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6171 6171
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6172 6172
                     GROUP BY spotter_output.departure_airport_country
6173 6173
 					ORDER BY airport_departure_country_count DESC";
@@ -6179,7 +6179,7 @@  discard block
 block discarded – undo
6179 6179
 		$airport_array = array();
6180 6180
 		$temp_array = array();
6181 6181
         
6182
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6182
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6183 6183
 		{
6184 6184
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6185 6185
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6198,12 +6198,12 @@  discard block
 block discarded – undo
6198 6198
 	* @return Array the airport list
6199 6199
 	*
6200 6200
 	*/
6201
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6201
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6202 6202
 	{
6203
-		$filter_query = $this->getFilter($filters,true,true);
6204
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6203
+		$filter_query = $this->getFilter($filters, true, true);
6204
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6205 6205
 
6206
-		$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 
6206
+		$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 
6207 6207
 			FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6208 6208
                     GROUP BY spotter_output.departure_airport_icao
6209 6209
 					ORDER BY airport_departure_icao_count DESC";
@@ -6215,7 +6215,7 @@  discard block
 block discarded – undo
6215 6215
 		$airport_array = array();
6216 6216
 		$temp_array = array();
6217 6217
         
6218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6219 6219
 		{
6220 6220
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6221 6221
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6236,11 +6236,11 @@  discard block
 block discarded – undo
6236 6236
 	* @return Array the airport list
6237 6237
 	*
6238 6238
 	*/
6239
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6239
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6240 6240
 	{
6241
-		$filter_query = $this->getFilter($filters,true,true);
6242
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6243
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6241
+		$filter_query = $this->getFilter($filters, true, true);
6242
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6243
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6244 6244
 			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 
6245 6245
                     GROUP BY spotter_output.departure_airport_country
6246 6246
 					ORDER BY airport_departure_country_count DESC";
@@ -6252,7 +6252,7 @@  discard block
 block discarded – undo
6252 6252
 		$airport_array = array();
6253 6253
 		$temp_array = array();
6254 6254
         
6255
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6255
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6256 6256
 		{
6257 6257
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6258 6258
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6270,11 +6270,11 @@  discard block
 block discarded – undo
6270 6270
 	* @return Array the airport list
6271 6271
 	*
6272 6272
 	*/
6273
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6273
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6274 6274
 	{
6275 6275
 		global $globalDBdriver;
6276
-		$filter_query = $this->getFilter($filters,true,true);
6277
-		$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 
6276
+		$filter_query = $this->getFilter($filters, true, true);
6277
+		$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 
6278 6278
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6279 6279
                 if ($olderthanmonths > 0) {
6280 6280
             		if ($globalDBdriver == 'mysql') {
@@ -6309,7 +6309,7 @@  discard block
 block discarded – undo
6309 6309
 		$airport_array = array();
6310 6310
 		$temp_array = array();
6311 6311
         
6312
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6312
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6313 6313
 		{
6314 6314
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6315 6315
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6332,11 +6332,11 @@  discard block
 block discarded – undo
6332 6332
 	* @return Array the airport list
6333 6333
 	*
6334 6334
 	*/
6335
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6335
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6336 6336
 	{
6337 6337
 		global $globalDBdriver;
6338
-		$filter_query = $this->getFilter($filters,true,true);
6339
-		$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 
6338
+		$filter_query = $this->getFilter($filters, true, true);
6339
+		$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 
6340 6340
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6341 6341
                 if ($olderthanmonths > 0) {
6342 6342
             		if ($globalDBdriver == 'mysql') {
@@ -6371,7 +6371,7 @@  discard block
 block discarded – undo
6371 6371
 		$airport_array = array();
6372 6372
 		$temp_array = array();
6373 6373
         
6374
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6374
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6375 6375
 		{
6376 6376
 			$temp_array['airline_icao'] = $row['airline_icao'];
6377 6377
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6396,11 +6396,11 @@  discard block
 block discarded – undo
6396 6396
 	* @return Array the airport list
6397 6397
 	*
6398 6398
 	*/
6399
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6399
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6400 6400
 	{
6401 6401
 		global $globalDBdriver;
6402
-		$filter_query = $this->getFilter($filters,true,true);
6403
-		$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 
6402
+		$filter_query = $this->getFilter($filters, true, true);
6403
+		$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 
6404 6404
 			FROM spotter_output, airport".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6405 6405
                 if ($olderthanmonths > 0) {
6406 6406
             		if ($globalDBdriver == 'mysql') {
@@ -6434,7 +6434,7 @@  discard block
 block discarded – undo
6434 6434
 		$airport_array = array();
6435 6435
 		$temp_array = array();
6436 6436
         
6437
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6437
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6438 6438
 		{
6439 6439
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6440 6440
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6457,11 +6457,11 @@  discard block
 block discarded – undo
6457 6457
 	* @return Array the airport list
6458 6458
 	*
6459 6459
 	*/
6460
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6460
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6461 6461
 	{
6462 6462
 		global $globalDBdriver;
6463
-		$filter_query = $this->getFilter($filters,true,true);
6464
-		$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 
6463
+		$filter_query = $this->getFilter($filters, true, true);
6464
+		$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 
6465 6465
 			FROM spotter_output, airport".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6466 6466
                 if ($olderthanmonths > 0) {
6467 6467
             		if ($globalDBdriver == 'mysql') {
@@ -6496,7 +6496,7 @@  discard block
 block discarded – undo
6496 6496
 		$airport_array = array();
6497 6497
 		$temp_array = array();
6498 6498
         
6499
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6499
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6500 6500
 		{
6501 6501
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6502 6502
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6522,9 +6522,9 @@  discard block
 block discarded – undo
6522 6522
 	*/
6523 6523
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6524 6524
 	{
6525
-		$filter_query = $this->getFilter($filters,true,true);
6526
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6527
-		$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 
6525
+		$filter_query = $this->getFilter($filters, true, true);
6526
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6527
+		$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 
6528 6528
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6529 6529
                     GROUP BY spotter_output.arrival_airport_icao
6530 6530
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6535,7 +6535,7 @@  discard block
 block discarded – undo
6535 6535
 		$airport_array = array();
6536 6536
 		$temp_array = array();
6537 6537
         
6538
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6538
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6539 6539
 		{
6540 6540
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6541 6541
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6556,12 +6556,12 @@  discard block
 block discarded – undo
6556 6556
 	* @return Array the airport list
6557 6557
 	*
6558 6558
 	*/
6559
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6559
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6560 6560
 	{
6561
-		$filter_query = $this->getFilter($filters,true,true);
6562
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6561
+		$filter_query = $this->getFilter($filters, true, true);
6562
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6563 6563
 					
6564
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6564
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6565 6565
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6566 6566
                     GROUP BY spotter_output.arrival_airport_country
6567 6567
 					ORDER BY airport_arrival_country_count DESC";
@@ -6573,7 +6573,7 @@  discard block
 block discarded – undo
6573 6573
 		$airport_array = array();
6574 6574
 		$temp_array = array();
6575 6575
         
6576
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6576
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6577 6577
 		{
6578 6578
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6579 6579
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6591,11 +6591,11 @@  discard block
 block discarded – undo
6591 6591
 	* @return Array the airport list
6592 6592
 	*
6593 6593
 	*/
6594
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6594
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6595 6595
 	{
6596
-		$filter_query = $this->getFilter($filters,true,true);
6597
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6598
-		$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 
6596
+		$filter_query = $this->getFilter($filters, true, true);
6597
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6598
+		$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 
6599 6599
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6600 6600
                     GROUP BY spotter_output.arrival_airport_icao
6601 6601
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6607,7 +6607,7 @@  discard block
 block discarded – undo
6607 6607
 		$airport_array = array();
6608 6608
 		$temp_array = array();
6609 6609
         
6610
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6610
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6611 6611
 		{
6612 6612
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6613 6613
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6629,11 +6629,11 @@  discard block
 block discarded – undo
6629 6629
 	* @return Array the airport list
6630 6630
 	*
6631 6631
 	*/
6632
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6632
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6633 6633
 	{
6634
-		$filter_query = $this->getFilter($filters,true,true);
6635
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6636
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6634
+		$filter_query = $this->getFilter($filters, true, true);
6635
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6636
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6637 6637
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6638 6638
                     GROUP BY spotter_output.arrival_airport_country
6639 6639
 					ORDER BY airport_arrival_country_count DESC";
@@ -6645,7 +6645,7 @@  discard block
 block discarded – undo
6645 6645
 		$airport_array = array();
6646 6646
 		$temp_array = array();
6647 6647
         
6648
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6648
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6649 6649
 		{
6650 6650
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6651 6651
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6663,12 +6663,12 @@  discard block
 block discarded – undo
6663 6663
 	* @return Array the airport list
6664 6664
 	*
6665 6665
 	*/
6666
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6666
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6667 6667
 	{
6668
-		$filter_query = $this->getFilter($filters,true,true);
6669
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6668
+		$filter_query = $this->getFilter($filters, true, true);
6669
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6670 6670
 
6671
-		$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 
6671
+		$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 
6672 6672
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6673 6673
                     GROUP BY spotter_output.arrival_airport_icao
6674 6674
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6680,7 +6680,7 @@  discard block
 block discarded – undo
6680 6680
 		$airport_array = array();
6681 6681
 		$temp_array = array();
6682 6682
         
6683
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6683
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6684 6684
 		{
6685 6685
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6686 6686
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6701,11 +6701,11 @@  discard block
 block discarded – undo
6701 6701
 	* @return Array the airport list
6702 6702
 	*
6703 6703
 	*/
6704
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6704
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6705 6705
 	{
6706
-		$filter_query = $this->getFilter($filters,true,true);
6707
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6708
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6706
+		$filter_query = $this->getFilter($filters, true, true);
6707
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6708
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6709 6709
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6710 6710
                     GROUP BY spotter_output.arrival_airport_country
6711 6711
 					ORDER BY airport_arrival_country_count DESC";
@@ -6717,7 +6717,7 @@  discard block
 block discarded – undo
6717 6717
 		$airport_array = array();
6718 6718
 		$temp_array = array();
6719 6719
         
6720
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6720
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6721 6721
 		{
6722 6722
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6723 6723
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6736,11 +6736,11 @@  discard block
 block discarded – undo
6736 6736
 	* @return Array the airport list
6737 6737
 	*
6738 6738
 	*/
6739
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6739
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6740 6740
 	{
6741
-		$filter_query = $this->getFilter($filters,true,true);
6742
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6743
-		$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 
6741
+		$filter_query = $this->getFilter($filters, true, true);
6742
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6743
+		$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 
6744 6744
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao 
6745 6745
                     GROUP BY spotter_output.arrival_airport_icao
6746 6746
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6752,7 +6752,7 @@  discard block
 block discarded – undo
6752 6752
 		$airport_array = array();
6753 6753
 		$temp_array = array();
6754 6754
         
6755
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6755
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6756 6756
 		{
6757 6757
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6758 6758
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6773,11 +6773,11 @@  discard block
 block discarded – undo
6773 6773
 	* @return Array the airport list
6774 6774
 	*
6775 6775
 	*/
6776
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6776
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6777 6777
 	{
6778
-		$filter_query = $this->getFilter($filters,true,true);
6779
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6780
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6778
+		$filter_query = $this->getFilter($filters, true, true);
6779
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6780
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6781 6781
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6782 6782
                     GROUP BY spotter_output.arrival_airport_country
6783 6783
 					ORDER BY airport_arrival_country_count DESC";
@@ -6789,7 +6789,7 @@  discard block
 block discarded – undo
6789 6789
 		$airport_array = array();
6790 6790
 		$temp_array = array();
6791 6791
         
6792
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6792
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6793 6793
 		{
6794 6794
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6795 6795
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6807,11 +6807,11 @@  discard block
 block discarded – undo
6807 6807
 	* @return Array the airport list
6808 6808
 	*
6809 6809
 	*/
6810
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6810
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6811 6811
 	{
6812
-		$filter_query = $this->getFilter($filters,true,true);
6813
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6814
-		$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 
6812
+		$filter_query = $this->getFilter($filters, true, true);
6813
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6814
+		$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 
6815 6815
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6816 6816
                     GROUP BY spotter_output.arrival_airport_icao
6817 6817
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6823,7 +6823,7 @@  discard block
 block discarded – undo
6823 6823
 		$airport_array = array();
6824 6824
 		$temp_array = array();
6825 6825
         
6826
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6826
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6827 6827
 		{
6828 6828
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6829 6829
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6845,11 +6845,11 @@  discard block
 block discarded – undo
6845 6845
 	* @return Array the airport list
6846 6846
 	*
6847 6847
 	*/
6848
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6848
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6849 6849
 	{
6850
-		$filter_query = $this->getFilter($filters,true,true);
6851
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6852
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6850
+		$filter_query = $this->getFilter($filters, true, true);
6851
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6852
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6853 6853
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6854 6854
                     GROUP BY spotter_output.arrival_airport_country
6855 6855
 					ORDER BY airport_arrival_country_count DESC";
@@ -6861,7 +6861,7 @@  discard block
 block discarded – undo
6861 6861
 		$airport_array = array();
6862 6862
 		$temp_array = array();
6863 6863
         
6864
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6864
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6865 6865
 		{
6866 6866
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6867 6867
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6880,11 +6880,11 @@  discard block
 block discarded – undo
6880 6880
 	* @return Array the airport list
6881 6881
 	*
6882 6882
 	*/
6883
-	public function countAllArrivalAirportsByDate($date,$filters = array())
6883
+	public function countAllArrivalAirportsByDate($date, $filters = array())
6884 6884
 	{
6885 6885
 		global $globalTimezone, $globalDBdriver;
6886
-		$filter_query = $this->getFilter($filters,true,true);
6887
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6886
+		$filter_query = $this->getFilter($filters, true, true);
6887
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6888 6888
 		if ($globalTimezone != '') {
6889 6889
 			date_default_timezone_set($globalTimezone);
6890 6890
 			$datetime = new DateTime($date);
@@ -6892,12 +6892,12 @@  discard block
 block discarded – undo
6892 6892
 		} else $offset = '+00:00';
6893 6893
 
6894 6894
 		if ($globalDBdriver == 'mysql') {
6895
-			$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 
6895
+			$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 
6896 6896
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
6897 6897
 					GROUP BY spotter_output.arrival_airport_icao
6898 6898
 					ORDER BY airport_arrival_icao_count DESC";
6899 6899
 		} else {
6900
-			$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 
6900
+			$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 
6901 6901
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
6902 6902
 					GROUP BY spotter_output.arrival_airport_icao
6903 6903
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6909,7 +6909,7 @@  discard block
 block discarded – undo
6909 6909
 		$airport_array = array();
6910 6910
 		$temp_array = array();
6911 6911
         
6912
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6912
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6913 6913
 		{
6914 6914
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6915 6915
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6933,8 +6933,8 @@  discard block
 block discarded – undo
6933 6933
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6934 6934
 	{
6935 6935
 		global $globalTimezone, $globalDBdriver;
6936
-		$filter_query = $this->getFilter($filters,true,true);
6937
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6936
+		$filter_query = $this->getFilter($filters, true, true);
6937
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6938 6938
 		if ($globalTimezone != '') {
6939 6939
 			date_default_timezone_set($globalTimezone);
6940 6940
 			$datetime = new DateTime($date);
@@ -6942,12 +6942,12 @@  discard block
 block discarded – undo
6942 6942
 		} else $offset = '+00:00';
6943 6943
 
6944 6944
 		if ($globalDBdriver == 'mysql') {
6945
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6945
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6946 6946
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6947 6947
 					GROUP BY spotter_output.arrival_airport_country
6948 6948
 					ORDER BY airport_arrival_country_count DESC";
6949 6949
 		} else {
6950
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6950
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6951 6951
 					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 
6952 6952
 					GROUP BY spotter_output.arrival_airport_country
6953 6953
 					ORDER BY airport_arrival_country_count DESC";
@@ -6959,7 +6959,7 @@  discard block
 block discarded – undo
6959 6959
 		$airport_array = array();
6960 6960
 		$temp_array = array();
6961 6961
         
6962
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6962
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6963 6963
 		{
6964 6964
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6965 6965
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6977,11 +6977,11 @@  discard block
 block discarded – undo
6977 6977
 	* @return Array the airport list
6978 6978
 	*
6979 6979
 	*/
6980
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6980
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
6981 6981
 	{
6982
-		$filter_query = $this->getFilter($filters,true,true);
6983
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6984
-		$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 
6982
+		$filter_query = $this->getFilter($filters, true, true);
6983
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6984
+		$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 
6985 6985
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
6986 6986
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6987 6987
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -6993,7 +6993,7 @@  discard block
 block discarded – undo
6993 6993
 		$airport_array = array();
6994 6994
 		$temp_array = array();
6995 6995
         
6996
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6996
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6997 6997
 		{
6998 6998
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6999 6999
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7016,9 +7016,9 @@  discard block
 block discarded – undo
7016 7016
 	*/
7017 7017
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7018 7018
 	{
7019
-		$filter_query = $this->getFilter($filters,true,true);
7020
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7021
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7019
+		$filter_query = $this->getFilter($filters, true, true);
7020
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7021
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7022 7022
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7023 7023
                     GROUP BY spotter_output.arrival_airport_country
7024 7024
 					ORDER BY airport_arrival_country_count DESC";
@@ -7030,7 +7030,7 @@  discard block
 block discarded – undo
7030 7030
 		$airport_array = array();
7031 7031
 		$temp_array = array();
7032 7032
         
7033
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7033
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7034 7034
 		{
7035 7035
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7036 7036
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7049,11 +7049,11 @@  discard block
 block discarded – undo
7049 7049
 	* @return Array the airport list
7050 7050
 	*
7051 7051
 	*/
7052
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7052
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7053 7053
 	{
7054
-		$filter_query = $this->getFilter($filters,true,true);
7055
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7056
-		$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 
7054
+		$filter_query = $this->getFilter($filters, true, true);
7055
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7056
+		$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 
7057 7057
 			FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7058 7058
                     GROUP BY spotter_output.arrival_airport_icao
7059 7059
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7065,7 +7065,7 @@  discard block
 block discarded – undo
7065 7065
 		$airport_array = array();
7066 7066
 		$temp_array = array();
7067 7067
         
7068
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7068
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7069 7069
 		{
7070 7070
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7071 7071
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7086,11 +7086,11 @@  discard block
 block discarded – undo
7086 7086
 	* @return Array the airport list
7087 7087
 	*
7088 7088
 	*/
7089
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7089
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7090 7090
 	{
7091
-		$filter_query = $this->getFilter($filters,true,true);
7092
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7093
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7091
+		$filter_query = $this->getFilter($filters, true, true);
7092
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7093
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7094 7094
 			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 
7095 7095
                     GROUP BY spotter_output.arrival_airport_country
7096 7096
 					ORDER BY airport_arrival_country_count DESC";
@@ -7102,7 +7102,7 @@  discard block
 block discarded – undo
7102 7102
 		$airport_array = array();
7103 7103
 		$temp_array = array();
7104 7104
         
7105
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7105
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7106 7106
 		{
7107 7107
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7108 7108
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7123,7 +7123,7 @@  discard block
 block discarded – undo
7123 7123
 	*/
7124 7124
 	public function countAllDepartureCountries($filters = array())
7125 7125
 	{
7126
-		$filter_query = $this->getFilter($filters,true,true);
7126
+		$filter_query = $this->getFilter($filters, true, true);
7127 7127
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7128 7128
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7129 7129
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7137,7 +7137,7 @@  discard block
 block discarded – undo
7137 7137
 		$airport_array = array();
7138 7138
 		$temp_array = array();
7139 7139
         
7140
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7140
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7141 7141
 		{
7142 7142
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7143 7143
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7155,9 +7155,9 @@  discard block
 block discarded – undo
7155 7155
 	* @return Array the airport arrival list
7156 7156
 	*
7157 7157
 	*/
7158
-	public function countAllArrivalCountries($limit = true,$filters = array())
7158
+	public function countAllArrivalCountries($limit = true, $filters = array())
7159 7159
 	{
7160
-		$filter_query = $this->getFilter($filters,true,true);
7160
+		$filter_query = $this->getFilter($filters, true, true);
7161 7161
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7162 7162
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7163 7163
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7171,7 +7171,7 @@  discard block
 block discarded – undo
7171 7171
 		$airport_array = array();
7172 7172
 		$temp_array = array();
7173 7173
         
7174
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7174
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7175 7175
 		{
7176 7176
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7177 7177
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7194,8 +7194,8 @@  discard block
 block discarded – undo
7194 7194
 	*/
7195 7195
 	public function countAllRoutes($filters = array())
7196 7196
 	{
7197
-		$filter_query = $this->getFilter($filters,true,true);
7198
-		$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
7197
+		$filter_query = $this->getFilter($filters, true, true);
7198
+		$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
7199 7199
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7200 7200
                     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
7201 7201
                     ORDER BY route_count DESC
@@ -7208,7 +7208,7 @@  discard block
 block discarded – undo
7208 7208
 		$routes_array = array();
7209 7209
 		$temp_array = array();
7210 7210
         
7211
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7211
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7212 7212
 		{
7213 7213
 			$temp_array['route_count'] = $row['route_count'];
7214 7214
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7235,11 +7235,11 @@  discard block
 block discarded – undo
7235 7235
 	* @return Array the route list
7236 7236
 	*
7237 7237
 	*/
7238
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7238
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7239 7239
 	{
7240
-		$filter_query = $this->getFilter($filters,true,true);
7241
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7242
-		$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
7240
+		$filter_query = $this->getFilter($filters, true, true);
7241
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7242
+		$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
7243 7243
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7244 7244
                     GROUP BY route
7245 7245
                     ORDER BY route_count DESC";
@@ -7250,7 +7250,7 @@  discard block
 block discarded – undo
7250 7250
 		$routes_array = array();
7251 7251
 		$temp_array = array();
7252 7252
         
7253
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7253
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7254 7254
 		{
7255 7255
 			$temp_array['route_count'] = $row['route_count'];
7256 7256
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7277,9 +7277,9 @@  discard block
 block discarded – undo
7277 7277
 	*/
7278 7278
 	public function countAllRoutesByRegistration($registration, $filters = array())
7279 7279
 	{
7280
-		$filter_query = $this->getFilter($filters,true,true);
7280
+		$filter_query = $this->getFilter($filters, true, true);
7281 7281
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7282
-		$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
7282
+		$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
7283 7283
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7284 7284
                     GROUP BY route
7285 7285
                     ORDER BY route_count DESC";
@@ -7291,7 +7291,7 @@  discard block
 block discarded – undo
7291 7291
 		$routes_array = array();
7292 7292
 		$temp_array = array();
7293 7293
         
7294
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7294
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7295 7295
 		{
7296 7296
 			$temp_array['route_count'] = $row['route_count'];
7297 7297
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7319,9 +7319,9 @@  discard block
 block discarded – undo
7319 7319
 	*/
7320 7320
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7321 7321
 	{
7322
-		$filter_query = $this->getFilter($filters,true,true);
7323
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7324
-		$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
7322
+		$filter_query = $this->getFilter($filters, true, true);
7323
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7324
+		$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
7325 7325
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7326 7326
                     GROUP BY route
7327 7327
                     ORDER BY route_count DESC";
@@ -7333,7 +7333,7 @@  discard block
 block discarded – undo
7333 7333
 		$routes_array = array();
7334 7334
 		$temp_array = array();
7335 7335
         
7336
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7336
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7337 7337
 		{
7338 7338
 			$temp_array['route_count'] = $row['route_count'];
7339 7339
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7361,9 +7361,9 @@  discard block
 block discarded – undo
7361 7361
 	*/
7362 7362
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7363 7363
 	{
7364
-		$filter_query = $this->getFilter($filters,true,true);
7365
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7366
-		$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
7364
+		$filter_query = $this->getFilter($filters, true, true);
7365
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7366
+		$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
7367 7367
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7368 7368
                     GROUP BY route
7369 7369
                     ORDER BY route_count DESC";
@@ -7374,7 +7374,7 @@  discard block
 block discarded – undo
7374 7374
 		$routes_array = array();
7375 7375
 		$temp_array = array();
7376 7376
         
7377
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7377
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7378 7378
 		{
7379 7379
 			$temp_array['route_count'] = $row['route_count'];
7380 7380
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7402,9 +7402,9 @@  discard block
 block discarded – undo
7402 7402
 	*/
7403 7403
 	public function countAllRoutesByCountry($country, $filters = array())
7404 7404
 	{
7405
-		$filter_query = $this->getFilter($filters,true,true);
7406
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7407
-		$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
7405
+		$filter_query = $this->getFilter($filters, true, true);
7406
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7407
+		$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
7408 7408
 			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 
7409 7409
                     GROUP BY route
7410 7410
                     ORDER BY route_count DESC";
@@ -7415,7 +7415,7 @@  discard block
 block discarded – undo
7415 7415
 		$routes_array = array();
7416 7416
 		$temp_array = array();
7417 7417
         
7418
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7418
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7419 7419
 		{
7420 7420
 			$temp_array['route_count'] = $row['route_count'];
7421 7421
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7443,8 +7443,8 @@  discard block
 block discarded – undo
7443 7443
 	public function countAllRoutesByDate($date, $filters = array())
7444 7444
 	{
7445 7445
 		global $globalTimezone, $globalDBdriver;
7446
-		$filter_query = $this->getFilter($filters,true,true);
7447
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7446
+		$filter_query = $this->getFilter($filters, true, true);
7447
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7448 7448
 		if ($globalTimezone != '') {
7449 7449
 			date_default_timezone_set($globalTimezone);
7450 7450
 			$datetime = new DateTime($date);
@@ -7452,12 +7452,12 @@  discard block
 block discarded – undo
7452 7452
 		} else $offset = '+00:00';
7453 7453
 		
7454 7454
 		if ($globalDBdriver == 'mysql') {
7455
-			$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
7455
+			$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
7456 7456
 					FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7457 7457
 					GROUP BY route
7458 7458
 					ORDER BY route_count DESC";
7459 7459
 		} else {
7460
-			$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
7460
+			$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
7461 7461
 					FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7462 7462
 					GROUP BY route
7463 7463
 					ORDER BY route_count DESC";
@@ -7469,7 +7469,7 @@  discard block
 block discarded – undo
7469 7469
 		$routes_array = array();
7470 7470
 		$temp_array = array();
7471 7471
         
7472
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7472
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7473 7473
 		{
7474 7474
 			$temp_array['route_count'] = $row['route_count'];
7475 7475
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7496,9 +7496,9 @@  discard block
 block discarded – undo
7496 7496
 	*/
7497 7497
 	public function countAllRoutesByIdent($ident, $filters = array())
7498 7498
 	{
7499
-		$filter_query = $this->getFilter($filters,true,true);
7500
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7501
-		$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
7499
+		$filter_query = $this->getFilter($filters, true, true);
7500
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7501
+		$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
7502 7502
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7503 7503
                     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
7504 7504
                     ORDER BY route_count DESC";
@@ -7510,7 +7510,7 @@  discard block
 block discarded – undo
7510 7510
 		$routes_array = array();
7511 7511
 		$temp_array = array();
7512 7512
         
7513
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7513
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7514 7514
 		{
7515 7515
 			$temp_array['route_count'] = $row['route_count'];
7516 7516
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7537,9 +7537,9 @@  discard block
 block discarded – undo
7537 7537
 	*/
7538 7538
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7539 7539
 	{
7540
-		$filter_query = $this->getFilter($filters,true,true);
7541
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7542
-		$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
7540
+		$filter_query = $this->getFilter($filters, true, true);
7541
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7542
+		$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
7543 7543
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7544 7544
                     GROUP BY route
7545 7545
                     ORDER BY route_count DESC";
@@ -7551,7 +7551,7 @@  discard block
 block discarded – undo
7551 7551
 		$routes_array = array();
7552 7552
 		$temp_array = array();
7553 7553
         
7554
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7554
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7555 7555
 		{
7556 7556
 			$temp_array['route_count'] = $row['route_count'];
7557 7557
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7579,8 +7579,8 @@  discard block
 block discarded – undo
7579 7579
 	*/
7580 7580
 	public function countAllRoutesWithWaypoints($filters = array())
7581 7581
 	{
7582
-		$filter_query = $this->getFilter($filters,true,true);
7583
-		$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
7582
+		$filter_query = $this->getFilter($filters, true, true);
7583
+		$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
7584 7584
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7585 7585
                     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
7586 7586
                     ORDER BY route_count DESC
@@ -7593,7 +7593,7 @@  discard block
 block discarded – undo
7593 7593
 		$routes_array = array();
7594 7594
 		$temp_array = array();
7595 7595
         
7596
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7596
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7597 7597
 		{
7598 7598
 			$temp_array['spotter_id'] = $row['spotter_id'];
7599 7599
 			$temp_array['route_count'] = $row['route_count'];
@@ -7618,11 +7618,11 @@  discard block
 block discarded – undo
7618 7618
 	* @return Array the callsign list
7619 7619
 	*
7620 7620
 	*/
7621
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7621
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7622 7622
 	{
7623 7623
 		global $globalDBdriver;
7624
-		$filter_query = $this->getFilter($filters,true,true);
7625
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7624
+		$filter_query = $this->getFilter($filters, true, true);
7625
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7626 7626
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7627 7627
 		 if ($olderthanmonths > 0) {
7628 7628
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7641,7 +7641,7 @@  discard block
 block discarded – undo
7641 7641
 		$callsign_array = array();
7642 7642
 		$temp_array = array();
7643 7643
         
7644
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7644
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7645 7645
 		{
7646 7646
 			$temp_array['callsign_icao'] = $row['ident'];
7647 7647
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7663,8 +7663,8 @@  discard block
 block discarded – undo
7663 7663
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7664 7664
 	{
7665 7665
 		global $globalDBdriver;
7666
-		$filter_query = $this->getFilter($filters,true,true);
7667
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7666
+		$filter_query = $this->getFilter($filters, true, true);
7667
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7668 7668
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7669 7669
 		 if ($olderthanmonths > 0) {
7670 7670
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7683,7 +7683,7 @@  discard block
 block discarded – undo
7683 7683
 		$callsign_array = array();
7684 7684
 		$temp_array = array();
7685 7685
         
7686
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7686
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7687 7687
 		{
7688 7688
 			$temp_array['callsign_icao'] = $row['ident'];
7689 7689
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7737,7 +7737,7 @@  discard block
 block discarded – undo
7737 7737
 		$date_array = array();
7738 7738
 		$temp_array = array();
7739 7739
         
7740
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7740
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7741 7741
 		{
7742 7742
 			$temp_array['date_name'] = $row['date_name'];
7743 7743
 			$temp_array['date_count'] = $row['date_count'];
@@ -7762,15 +7762,15 @@  discard block
 block discarded – undo
7762 7762
 			$datetime = new DateTime();
7763 7763
 			$offset = $datetime->format('P');
7764 7764
 		} else $offset = '+00:00';
7765
-		$filter_query = $this->getFilter($filters,true,true);
7765
+		$filter_query = $this->getFilter($filters, true, true);
7766 7766
 		if ($globalDBdriver == 'mysql') {
7767
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7767
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7768 7768
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7769 7769
 								GROUP BY spotter_output.airline_icao, date_name 
7770 7770
 								ORDER BY date_count DESC
7771 7771
 								LIMIT 10 OFFSET 0";
7772 7772
 		} else {
7773
-			$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
7773
+			$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
7774 7774
 								FROM spotter_output 
7775 7775
 								WHERE spotter_output.airline_icao <> '' 
7776 7776
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7785,7 +7785,7 @@  discard block
 block discarded – undo
7785 7785
 		$date_array = array();
7786 7786
 		$temp_array = array();
7787 7787
         
7788
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7788
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7789 7789
 		{
7790 7790
 			$temp_array['date_name'] = $row['date_name'];
7791 7791
 			$temp_array['date_count'] = $row['date_count'];
@@ -7811,7 +7811,7 @@  discard block
 block discarded – undo
7811 7811
 			$datetime = new DateTime();
7812 7812
 			$offset = $datetime->format('P');
7813 7813
 		} else $offset = '+00:00';
7814
-		$filter_query = $this->getFilter($filters,true,true);
7814
+		$filter_query = $this->getFilter($filters, true, true);
7815 7815
 		if ($globalDBdriver == 'mysql') {
7816 7816
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7817 7817
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7832,7 +7832,7 @@  discard block
 block discarded – undo
7832 7832
 		$date_array = array();
7833 7833
 		$temp_array = array();
7834 7834
         
7835
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7835
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7836 7836
 		{
7837 7837
 			$temp_array['date_name'] = $row['date_name'];
7838 7838
 			$temp_array['date_count'] = $row['date_count'];
@@ -7857,7 +7857,7 @@  discard block
 block discarded – undo
7857 7857
 			$datetime = new DateTime();
7858 7858
 			$offset = $datetime->format('P');
7859 7859
 		} else $offset = '+00:00';
7860
-		$filter_query = $this->getFilter($filters,true,true);
7860
+		$filter_query = $this->getFilter($filters, true, true);
7861 7861
 		if ($globalDBdriver == 'mysql') {
7862 7862
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7863 7863
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7878,7 +7878,7 @@  discard block
 block discarded – undo
7878 7878
 		$date_array = array();
7879 7879
 		$temp_array = array();
7880 7880
         
7881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7882 7882
 		{
7883 7883
 			$temp_array['date_name'] = $row['date_name'];
7884 7884
 			$temp_array['date_count'] = $row['date_count'];
@@ -7899,7 +7899,7 @@  discard block
 block discarded – undo
7899 7899
 	public function countAllDatesLastMonthByAirlines($filters = array())
7900 7900
 	{
7901 7901
 		global $globalTimezone, $globalDBdriver;
7902
-		$filter_query = $this->getFilter($filters,true,true);
7902
+		$filter_query = $this->getFilter($filters, true, true);
7903 7903
 		if ($globalTimezone != '') {
7904 7904
 			date_default_timezone_set($globalTimezone);
7905 7905
 			$datetime = new DateTime();
@@ -7907,13 +7907,13 @@  discard block
 block discarded – undo
7907 7907
 		} else $offset = '+00:00';
7908 7908
 		
7909 7909
 		if ($globalDBdriver == 'mysql') {
7910
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7910
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7911 7911
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
7912 7912
 								GROUP BY spotter_output.airline_icao, date_name 
7913 7913
 								ORDER BY spotter_output.date ASC";
7914 7914
 			$query_data = array(':offset' => $offset);
7915 7915
 		} else {
7916
-			$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
7916
+			$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
7917 7917
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
7918 7918
 								GROUP BY spotter_output.airline_icao, date_name 
7919 7919
 								ORDER BY date_name ASC";
@@ -7926,7 +7926,7 @@  discard block
 block discarded – undo
7926 7926
 		$date_array = array();
7927 7927
 		$temp_array = array();
7928 7928
         
7929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7930 7930
 		{
7931 7931
 			$temp_array['date_name'] = $row['date_name'];
7932 7932
 			$temp_array['date_count'] = $row['date_count'];
@@ -7973,7 +7973,7 @@  discard block
 block discarded – undo
7973 7973
 		$date_array = array();
7974 7974
 		$temp_array = array();
7975 7975
         
7976
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7976
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7977 7977
 		{
7978 7978
 			$temp_array['month_name'] = $row['month_name'];
7979 7979
 			$temp_array['year_name'] = $row['year_name'];
@@ -7994,7 +7994,7 @@  discard block
 block discarded – undo
7994 7994
 	public function countAllMonthsByAirlines($filters = array())
7995 7995
 	{
7996 7996
 		global $globalTimezone, $globalDBdriver;
7997
-		$filter_query = $this->getFilter($filters,true,true);
7997
+		$filter_query = $this->getFilter($filters, true, true);
7998 7998
 		if ($globalTimezone != '') {
7999 7999
 			date_default_timezone_set($globalTimezone);
8000 8000
 			$datetime = new DateTime();
@@ -8002,12 +8002,12 @@  discard block
 block discarded – undo
8002 8002
 		} else $offset = '+00:00';
8003 8003
 
8004 8004
 		if ($globalDBdriver == 'mysql') {
8005
-			$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
8005
+			$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
8006 8006
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8007 8007
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8008 8008
 								ORDER BY date_count DESC";
8009 8009
 		} else {
8010
-			$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
8010
+			$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
8011 8011
 								FROM spotter_output 
8012 8012
 								WHERE spotter_output.airline_icao <> '' 
8013 8013
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8021,7 +8021,7 @@  discard block
 block discarded – undo
8021 8021
 		$date_array = array();
8022 8022
 		$temp_array = array();
8023 8023
         
8024
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8024
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8025 8025
 		{
8026 8026
 			$temp_array['month_name'] = $row['month_name'];
8027 8027
 			$temp_array['year_name'] = $row['year_name'];
@@ -8048,14 +8048,14 @@  discard block
 block discarded – undo
8048 8048
 			$datetime = new DateTime();
8049 8049
 			$offset = $datetime->format('P');
8050 8050
 		} else $offset = '+00:00';
8051
-		$filter_query = $this->getFilter($filters,true,true);
8051
+		$filter_query = $this->getFilter($filters, true, true);
8052 8052
 		if ($globalDBdriver == 'mysql') {
8053
-			$query  = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8053
+			$query = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8054 8054
 								FROM spotter_output s".$filter_query." s.airline_type = 'military'
8055 8055
 								GROUP BY year_name, month_name 
8056 8056
 								ORDER BY date_count DESC";
8057 8057
 		} else {
8058
-			$query  = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8058
+			$query = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8059 8059
 								FROM spotter_output s".$filter_query." s.airline_type = 'military'
8060 8060
 								GROUP BY year_name, month_name 
8061 8061
 								ORDER BY date_count DESC";
@@ -8067,7 +8067,7 @@  discard block
 block discarded – undo
8067 8067
 		$date_array = array();
8068 8068
 		$temp_array = array();
8069 8069
         
8070
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8070
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8071 8071
 		{
8072 8072
 			$temp_array['month_name'] = $row['month_name'];
8073 8073
 			$temp_array['year_name'] = $row['year_name'];
@@ -8093,15 +8093,15 @@  discard block
 block discarded – undo
8093 8093
 			$datetime = new DateTime();
8094 8094
 			$offset = $datetime->format('P');
8095 8095
 		} else $offset = '+00:00';
8096
-		$filter_query = $this->getFilter($filters,true,true);
8096
+		$filter_query = $this->getFilter($filters, true, true);
8097 8097
 
8098 8098
 		if ($globalDBdriver == 'mysql') {
8099
-			$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
8099
+			$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
8100 8100
 								FROM spotter_output".$filter_query." owner_name <> ''
8101 8101
 								GROUP BY year_name, month_name
8102 8102
 								ORDER BY date_count DESC";
8103 8103
 		} else {
8104
-			$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
8104
+			$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
8105 8105
 								FROM spotter_output".$filter_query." owner_name <> ''
8106 8106
 								GROUP BY year_name, month_name
8107 8107
 								ORDER BY date_count DESC";
@@ -8113,7 +8113,7 @@  discard block
 block discarded – undo
8113 8113
 		$date_array = array();
8114 8114
 		$temp_array = array();
8115 8115
         
8116
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8116
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8117 8117
 		{
8118 8118
 			$temp_array['month_name'] = $row['month_name'];
8119 8119
 			$temp_array['year_name'] = $row['year_name'];
@@ -8134,7 +8134,7 @@  discard block
 block discarded – undo
8134 8134
 	public function countAllMonthsOwnersByAirlines($filters = array())
8135 8135
 	{
8136 8136
 		global $globalTimezone, $globalDBdriver;
8137
-		$filter_query = $this->getFilter($filters,true,true);
8137
+		$filter_query = $this->getFilter($filters, true, true);
8138 8138
 		if ($globalTimezone != '') {
8139 8139
 			date_default_timezone_set($globalTimezone);
8140 8140
 			$datetime = new DateTime();
@@ -8142,12 +8142,12 @@  discard block
 block discarded – undo
8142 8142
 		} else $offset = '+00:00';
8143 8143
 
8144 8144
 		if ($globalDBdriver == 'mysql') {
8145
-			$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
8145
+			$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
8146 8146
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8147 8147
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8148 8148
 								ORDER BY date_count DESC";
8149 8149
 		} else {
8150
-			$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
8150
+			$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
8151 8151
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8152 8152
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8153 8153
 								ORDER BY date_count DESC";
@@ -8159,7 +8159,7 @@  discard block
 block discarded – undo
8159 8159
 		$date_array = array();
8160 8160
 		$temp_array = array();
8161 8161
         
8162
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8162
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8163 8163
 		{
8164 8164
 			$temp_array['month_name'] = $row['month_name'];
8165 8165
 			$temp_array['year_name'] = $row['year_name'];
@@ -8186,15 +8186,15 @@  discard block
 block discarded – undo
8186 8186
 			$datetime = new DateTime();
8187 8187
 			$offset = $datetime->format('P');
8188 8188
 		} else $offset = '+00:00';
8189
-		$filter_query = $this->getFilter($filters,true,true);
8189
+		$filter_query = $this->getFilter($filters, true, true);
8190 8190
 
8191 8191
 		if ($globalDBdriver == 'mysql') {
8192
-			$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
8192
+			$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
8193 8193
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8194 8194
 								GROUP BY year_name, month_name
8195 8195
 								ORDER BY date_count DESC";
8196 8196
 		} else {
8197
-			$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
8197
+			$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
8198 8198
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8199 8199
 								GROUP BY year_name, month_name
8200 8200
 								ORDER BY date_count DESC";
@@ -8206,7 +8206,7 @@  discard block
 block discarded – undo
8206 8206
 		$date_array = array();
8207 8207
 		$temp_array = array();
8208 8208
         
8209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8210 8210
 		{
8211 8211
 			$temp_array['month_name'] = $row['month_name'];
8212 8212
 			$temp_array['year_name'] = $row['year_name'];
@@ -8227,7 +8227,7 @@  discard block
 block discarded – undo
8227 8227
 	public function countAllMonthsPilotsByAirlines($filters = array())
8228 8228
 	{
8229 8229
 		global $globalTimezone, $globalDBdriver;
8230
-		$filter_query = $this->getFilter($filters,true,true);
8230
+		$filter_query = $this->getFilter($filters, true, true);
8231 8231
 		if ($globalTimezone != '') {
8232 8232
 			date_default_timezone_set($globalTimezone);
8233 8233
 			$datetime = new DateTime();
@@ -8235,12 +8235,12 @@  discard block
 block discarded – undo
8235 8235
 		} else $offset = '+00:00';
8236 8236
 
8237 8237
 		if ($globalDBdriver == 'mysql') {
8238
-			$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
8238
+			$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
8239 8239
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8240 8240
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8241 8241
 								ORDER BY date_count DESC";
8242 8242
 		} else {
8243
-			$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
8243
+			$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
8244 8244
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8245 8245
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8246 8246
 								ORDER BY date_count DESC";
@@ -8252,7 +8252,7 @@  discard block
 block discarded – undo
8252 8252
 		$date_array = array();
8253 8253
 		$temp_array = array();
8254 8254
         
8255
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8255
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8256 8256
 		{
8257 8257
 			$temp_array['month_name'] = $row['month_name'];
8258 8258
 			$temp_array['year_name'] = $row['year_name'];
@@ -8274,7 +8274,7 @@  discard block
 block discarded – undo
8274 8274
 	public function countAllMonthsAirlines($filters = array())
8275 8275
 	{
8276 8276
 		global $globalTimezone, $globalDBdriver;
8277
-		$filter_query = $this->getFilter($filters,true,true);
8277
+		$filter_query = $this->getFilter($filters, true, true);
8278 8278
 		if ($globalTimezone != '') {
8279 8279
 			date_default_timezone_set($globalTimezone);
8280 8280
 			$datetime = new DateTime();
@@ -8282,12 +8282,12 @@  discard block
 block discarded – undo
8282 8282
 		} else $offset = '+00:00';
8283 8283
 
8284 8284
 		if ($globalDBdriver == 'mysql') {
8285
-			$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
8285
+			$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
8286 8286
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8287 8287
 								GROUP BY year_name, month_name
8288 8288
 								ORDER BY date_count DESC";
8289 8289
 		} else {
8290
-			$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
8290
+			$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
8291 8291
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8292 8292
 								GROUP BY year_name, month_name
8293 8293
 								ORDER BY date_count DESC";
@@ -8299,7 +8299,7 @@  discard block
 block discarded – undo
8299 8299
 		$date_array = array();
8300 8300
 		$temp_array = array();
8301 8301
         
8302
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8302
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8303 8303
 		{
8304 8304
 			$temp_array['month_name'] = $row['month_name'];
8305 8305
 			$temp_array['year_name'] = $row['year_name'];
@@ -8325,15 +8325,15 @@  discard block
 block discarded – undo
8325 8325
 			$datetime = new DateTime();
8326 8326
 			$offset = $datetime->format('P');
8327 8327
 		} else $offset = '+00:00';
8328
-		$filter_query = $this->getFilter($filters,true,true);
8328
+		$filter_query = $this->getFilter($filters, true, true);
8329 8329
 
8330 8330
 		if ($globalDBdriver == 'mysql') {
8331
-			$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
8331
+			$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
8332 8332
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8333 8333
 								GROUP BY year_name, month_name
8334 8334
 								ORDER BY date_count DESC";
8335 8335
 		} else {
8336
-			$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
8336
+			$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
8337 8337
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8338 8338
 								GROUP BY year_name, month_name
8339 8339
 								ORDER BY date_count DESC";
@@ -8345,7 +8345,7 @@  discard block
 block discarded – undo
8345 8345
 		$date_array = array();
8346 8346
 		$temp_array = array();
8347 8347
         
8348
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8348
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8349 8349
 		{
8350 8350
 			$temp_array['month_name'] = $row['month_name'];
8351 8351
 			$temp_array['year_name'] = $row['year_name'];
@@ -8367,7 +8367,7 @@  discard block
 block discarded – undo
8367 8367
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8368 8368
 	{
8369 8369
 		global $globalTimezone, $globalDBdriver;
8370
-		$filter_query = $this->getFilter($filters,true,true);
8370
+		$filter_query = $this->getFilter($filters, true, true);
8371 8371
 		if ($globalTimezone != '') {
8372 8372
 			date_default_timezone_set($globalTimezone);
8373 8373
 			$datetime = new DateTime();
@@ -8375,12 +8375,12 @@  discard block
 block discarded – undo
8375 8375
 		} else $offset = '+00:00';
8376 8376
 
8377 8377
 		if ($globalDBdriver == 'mysql') {
8378
-			$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
8378
+			$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
8379 8379
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8380 8380
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8381 8381
 								ORDER BY date_count DESC";
8382 8382
 		} else {
8383
-			$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
8383
+			$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
8384 8384
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8385 8385
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8386 8386
 								ORDER BY date_count DESC";
@@ -8392,7 +8392,7 @@  discard block
 block discarded – undo
8392 8392
 		$date_array = array();
8393 8393
 		$temp_array = array();
8394 8394
         
8395
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8395
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8396 8396
 		{
8397 8397
 			$temp_array['month_name'] = $row['month_name'];
8398 8398
 			$temp_array['year_name'] = $row['year_name'];
@@ -8419,15 +8419,15 @@  discard block
 block discarded – undo
8419 8419
 			$datetime = new DateTime();
8420 8420
 			$offset = $datetime->format('P');
8421 8421
 		} else $offset = '+00:00';
8422
-		$filter_query = $this->getFilter($filters,true,true);
8422
+		$filter_query = $this->getFilter($filters, true, true);
8423 8423
 
8424 8424
 		if ($globalDBdriver == 'mysql') {
8425
-			$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
8425
+			$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
8426 8426
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8427 8427
 								GROUP BY year_name, month_name
8428 8428
 								ORDER BY date_count DESC";
8429 8429
 		} else {
8430
-			$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
8430
+			$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
8431 8431
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8432 8432
 								GROUP BY year_name, month_name
8433 8433
 								ORDER BY date_count DESC";
@@ -8439,7 +8439,7 @@  discard block
 block discarded – undo
8439 8439
 		$date_array = array();
8440 8440
 		$temp_array = array();
8441 8441
         
8442
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8442
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8443 8443
 		{
8444 8444
 			$temp_array['month_name'] = $row['month_name'];
8445 8445
 			$temp_array['year_name'] = $row['year_name'];
@@ -8461,7 +8461,7 @@  discard block
 block discarded – undo
8461 8461
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8462 8462
 	{
8463 8463
 		global $globalTimezone, $globalDBdriver;
8464
-		$filter_query = $this->getFilter($filters,true,true);
8464
+		$filter_query = $this->getFilter($filters, true, true);
8465 8465
 		if ($globalTimezone != '') {
8466 8466
 			date_default_timezone_set($globalTimezone);
8467 8467
 			$datetime = new DateTime();
@@ -8469,12 +8469,12 @@  discard block
 block discarded – undo
8469 8469
 		} else $offset = '+00:00';
8470 8470
 
8471 8471
 		if ($globalDBdriver == 'mysql') {
8472
-			$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
8472
+			$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
8473 8473
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8474 8474
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8475 8475
 								ORDER BY date_count DESC";
8476 8476
 		} else {
8477
-			$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
8477
+			$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
8478 8478
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8479 8479
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8480 8480
 								ORDER BY date_count DESC";
@@ -8486,7 +8486,7 @@  discard block
 block discarded – undo
8486 8486
 		$date_array = array();
8487 8487
 		$temp_array = array();
8488 8488
         
8489
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8489
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8490 8490
 		{
8491 8491
 			$temp_array['month_name'] = $row['month_name'];
8492 8492
 			$temp_array['year_name'] = $row['year_name'];
@@ -8514,7 +8514,7 @@  discard block
 block discarded – undo
8514 8514
 			$datetime = new DateTime();
8515 8515
 			$offset = $datetime->format('P');
8516 8516
 		} else $offset = '+00:00';
8517
-		$filter_query = $this->getFilter($filters,true,true);
8517
+		$filter_query = $this->getFilter($filters, true, true);
8518 8518
 		if ($globalDBdriver == 'mysql') {
8519 8519
 			$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
8520 8520
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8535,7 +8535,7 @@  discard block
 block discarded – undo
8535 8535
 		$date_array = array();
8536 8536
 		$temp_array = array();
8537 8537
         
8538
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8538
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8539 8539
 		{
8540 8540
 			$temp_array['year_name'] = $row['year_name'];
8541 8541
 			$temp_array['month_name'] = $row['month_name'];
@@ -8555,7 +8555,7 @@  discard block
 block discarded – undo
8555 8555
 	* @return Array the hour list
8556 8556
 	*
8557 8557
 	*/
8558
-	public function countAllHours($orderby,$filters = array())
8558
+	public function countAllHours($orderby, $filters = array())
8559 8559
 	{
8560 8560
 		global $globalTimezone, $globalDBdriver;
8561 8561
 		if ($globalTimezone != '') {
@@ -8603,7 +8603,7 @@  discard block
 block discarded – undo
8603 8603
 		$hour_array = array();
8604 8604
 		$temp_array = array();
8605 8605
         
8606
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8606
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8607 8607
 		{
8608 8608
 			$temp_array['hour_name'] = $row['hour_name'];
8609 8609
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8623,7 +8623,7 @@  discard block
 block discarded – undo
8623 8623
 	public function countAllHoursByAirlines($orderby, $filters = array())
8624 8624
 	{
8625 8625
 		global $globalTimezone, $globalDBdriver;
8626
-		$filter_query = $this->getFilter($filters,true,true);
8626
+		$filter_query = $this->getFilter($filters, true, true);
8627 8627
 		if ($globalTimezone != '') {
8628 8628
 			date_default_timezone_set($globalTimezone);
8629 8629
 			$datetime = new DateTime();
@@ -8641,7 +8641,7 @@  discard block
 block discarded – undo
8641 8641
 		}
8642 8642
 		
8643 8643
 		if ($globalDBdriver == 'mysql') {
8644
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8644
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8645 8645
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8646 8646
 								GROUP BY spotter_output.airline_icao, hour_name 
8647 8647
 								".$orderby_sql;
@@ -8654,7 +8654,7 @@  discard block
 block discarded – undo
8654 8654
   */    
8655 8655
 		$query_data = array(':offset' => $offset);
8656 8656
 		} else {
8657
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8657
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8658 8658
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8659 8659
 								GROUP BY spotter_output.airline_icao, hour_name 
8660 8660
 								".$orderby_sql;
@@ -8667,7 +8667,7 @@  discard block
 block discarded – undo
8667 8667
 		$hour_array = array();
8668 8668
 		$temp_array = array();
8669 8669
         
8670
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8670
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8671 8671
 		{
8672 8672
 			$temp_array['hour_name'] = $row['hour_name'];
8673 8673
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8690,34 +8690,34 @@  discard block
 block discarded – undo
8690 8690
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8691 8691
 	{
8692 8692
 		global $globalTimezone, $globalDBdriver;
8693
-		$filter_query = $this->getFilter($filters,true,true);
8693
+		$filter_query = $this->getFilter($filters, true, true);
8694 8694
 		if ($globalTimezone != '') {
8695 8695
 			date_default_timezone_set($globalTimezone);
8696 8696
 			$datetime = new DateTime();
8697 8697
 			$offset = $datetime->format('P');
8698 8698
 		} else $offset = '+00:00';
8699 8699
 
8700
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8700
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8701 8701
 
8702 8702
 		if ($globalDBdriver == 'mysql') {
8703
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8703
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8704 8704
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8705 8705
 								GROUP BY hour_name 
8706 8706
 								ORDER BY hour_name ASC";
8707 8707
 		} else {
8708
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8708
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8709 8709
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8710 8710
 								GROUP BY hour_name 
8711 8711
 								ORDER BY hour_name ASC";
8712 8712
 		}
8713 8713
 		
8714 8714
 		$sth = $this->db->prepare($query);
8715
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8715
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8716 8716
       
8717 8717
 		$hour_array = array();
8718 8718
 		$temp_array = array();
8719 8719
         
8720
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8720
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8721 8721
 		{
8722 8722
 			$temp_array['hour_name'] = $row['hour_name'];
8723 8723
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8740,8 +8740,8 @@  discard block
 block discarded – undo
8740 8740
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8741 8741
 	{
8742 8742
 		global $globalTimezone, $globalDBdriver;
8743
-		$filter_query = $this->getFilter($filters,true,true);
8744
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8743
+		$filter_query = $this->getFilter($filters, true, true);
8744
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8745 8745
 		if ($globalTimezone != '') {
8746 8746
 			date_default_timezone_set($globalTimezone);
8747 8747
 			$datetime = new DateTime();
@@ -8749,24 +8749,24 @@  discard block
 block discarded – undo
8749 8749
 		} else $offset = '+00:00';
8750 8750
 
8751 8751
 		if ($globalDBdriver == 'mysql') {
8752
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8752
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8753 8753
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8754 8754
 								GROUP BY hour_name 
8755 8755
 								ORDER BY hour_name ASC";
8756 8756
 		} else {
8757
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8757
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8758 8758
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8759 8759
 								GROUP BY hour_name 
8760 8760
 								ORDER BY hour_name ASC";
8761 8761
 		}
8762 8762
 		
8763 8763
 		$sth = $this->db->prepare($query);
8764
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8764
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8765 8765
       
8766 8766
 		$hour_array = array();
8767 8767
 		$temp_array = array();
8768 8768
         
8769
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8769
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8770 8770
 		{
8771 8771
 			$temp_array['hour_name'] = $row['hour_name'];
8772 8772
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8787,8 +8787,8 @@  discard block
 block discarded – undo
8787 8787
 	public function countAllHoursByRegistration($registration, $filters = array())
8788 8788
 	{
8789 8789
 		global $globalTimezone, $globalDBdriver;
8790
-		$filter_query = $this->getFilter($filters,true,true);
8791
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8790
+		$filter_query = $this->getFilter($filters, true, true);
8791
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8792 8792
 		if ($globalTimezone != '') {
8793 8793
 			date_default_timezone_set($globalTimezone);
8794 8794
 			$datetime = new DateTime();
@@ -8796,24 +8796,24 @@  discard block
 block discarded – undo
8796 8796
 		} else $offset = '+00:00';
8797 8797
 
8798 8798
 		if ($globalDBdriver == 'mysql') {
8799
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8799
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8800 8800
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8801 8801
 								GROUP BY hour_name 
8802 8802
 								ORDER BY hour_name ASC";
8803 8803
 		} else {
8804
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8804
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8805 8805
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8806 8806
 								GROUP BY hour_name 
8807 8807
 								ORDER BY hour_name ASC";
8808 8808
 		}
8809 8809
 		
8810 8810
 		$sth = $this->db->prepare($query);
8811
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8811
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8812 8812
       
8813 8813
 		$hour_array = array();
8814 8814
 		$temp_array = array();
8815 8815
         
8816
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8816
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8817 8817
 		{
8818 8818
 			$temp_array['hour_name'] = $row['hour_name'];
8819 8819
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8834,8 +8834,8 @@  discard block
 block discarded – undo
8834 8834
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8835 8835
 	{
8836 8836
 		global $globalTimezone, $globalDBdriver;
8837
-		$filter_query = $this->getFilter($filters,true,true);
8838
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8837
+		$filter_query = $this->getFilter($filters, true, true);
8838
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8839 8839
 		if ($globalTimezone != '') {
8840 8840
 			date_default_timezone_set($globalTimezone);
8841 8841
 			$datetime = new DateTime();
@@ -8843,24 +8843,24 @@  discard block
 block discarded – undo
8843 8843
 		} else $offset = '+00:00';
8844 8844
 
8845 8845
 		if ($globalDBdriver == 'mysql') {
8846
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8846
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8847 8847
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8848 8848
 								GROUP BY hour_name 
8849 8849
 								ORDER BY hour_name ASC";
8850 8850
 		} else {
8851
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8851
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8852 8852
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8853 8853
 								GROUP BY hour_name 
8854 8854
 								ORDER BY hour_name ASC";
8855 8855
 		}
8856 8856
 		
8857 8857
 		$sth = $this->db->prepare($query);
8858
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8858
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8859 8859
       
8860 8860
 		$hour_array = array();
8861 8861
 		$temp_array = array();
8862 8862
         
8863
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8863
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8864 8864
 		{
8865 8865
 			$temp_array['hour_name'] = $row['hour_name'];
8866 8866
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8879,11 +8879,11 @@  discard block
 block discarded – undo
8879 8879
 	* @return Array the hour list
8880 8880
 	*
8881 8881
 	*/
8882
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8882
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
8883 8883
 	{
8884 8884
 		global $globalTimezone, $globalDBdriver;
8885
-		$filter_query = $this->getFilter($filters,true,true);
8886
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8885
+		$filter_query = $this->getFilter($filters, true, true);
8886
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8887 8887
 		if ($globalTimezone != '') {
8888 8888
 			date_default_timezone_set($globalTimezone);
8889 8889
 			$datetime = new DateTime();
@@ -8891,24 +8891,24 @@  discard block
 block discarded – undo
8891 8891
 		} else $offset = '+00:00';
8892 8892
 
8893 8893
 		if ($globalDBdriver == 'mysql') {
8894
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8894
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8895 8895
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8896 8896
 								GROUP BY hour_name 
8897 8897
 								ORDER BY hour_name ASC";
8898 8898
 		} else {
8899
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8899
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8900 8900
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8901 8901
 								GROUP BY hour_name 
8902 8902
 								ORDER BY hour_name ASC";
8903 8903
 		}
8904 8904
 		
8905 8905
 		$sth = $this->db->prepare($query);
8906
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
8906
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
8907 8907
       
8908 8908
 		$hour_array = array();
8909 8909
 		$temp_array = array();
8910 8910
         
8911
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8911
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8912 8912
 		{
8913 8913
 			$temp_array['hour_name'] = $row['hour_name'];
8914 8914
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8930,8 +8930,8 @@  discard block
 block discarded – undo
8930 8930
 	public function countAllHoursByDate($date, $filters = array())
8931 8931
 	{
8932 8932
 		global $globalTimezone, $globalDBdriver;
8933
-		$filter_query = $this->getFilter($filters,true,true);
8934
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8933
+		$filter_query = $this->getFilter($filters, true, true);
8934
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8935 8935
 		if ($globalTimezone != '') {
8936 8936
 			date_default_timezone_set($globalTimezone);
8937 8937
 			$datetime = new DateTime($date);
@@ -8939,12 +8939,12 @@  discard block
 block discarded – undo
8939 8939
 		} else $offset = '+00:00';
8940 8940
 
8941 8941
 		if ($globalDBdriver == 'mysql') {
8942
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8942
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8943 8943
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
8944 8944
 								GROUP BY hour_name 
8945 8945
 								ORDER BY hour_name ASC";
8946 8946
 		} else {
8947
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8947
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8948 8948
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
8949 8949
 								GROUP BY hour_name 
8950 8950
 								ORDER BY hour_name ASC";
@@ -8956,7 +8956,7 @@  discard block
 block discarded – undo
8956 8956
 		$hour_array = array();
8957 8957
 		$temp_array = array();
8958 8958
         
8959
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8959
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8960 8960
 		{
8961 8961
 			$temp_array['hour_name'] = $row['hour_name'];
8962 8962
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8978,8 +8978,8 @@  discard block
 block discarded – undo
8978 8978
 	public function countAllHoursByIdent($ident, $filters = array())
8979 8979
 	{
8980 8980
 		global $globalTimezone, $globalDBdriver;
8981
-		$filter_query = $this->getFilter($filters,true,true);
8982
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8981
+		$filter_query = $this->getFilter($filters, true, true);
8982
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8983 8983
 		if ($globalTimezone != '') {
8984 8984
 			date_default_timezone_set($globalTimezone);
8985 8985
 			$datetime = new DateTime();
@@ -8987,12 +8987,12 @@  discard block
 block discarded – undo
8987 8987
 		} else $offset = '+00:00';
8988 8988
 
8989 8989
 		if ($globalDBdriver == 'mysql') {
8990
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8990
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8991 8991
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
8992 8992
 								GROUP BY hour_name 
8993 8993
 								ORDER BY hour_name ASC";
8994 8994
 		} else {
8995
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8995
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8996 8996
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
8997 8997
 								GROUP BY hour_name 
8998 8998
 								ORDER BY hour_name ASC";
@@ -9000,12 +9000,12 @@  discard block
 block discarded – undo
9000 9000
       
9001 9001
 		
9002 9002
 		$sth = $this->db->prepare($query);
9003
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9003
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9004 9004
       
9005 9005
 		$hour_array = array();
9006 9006
 		$temp_array = array();
9007 9007
         
9008
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9008
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9009 9009
 		{
9010 9010
 			$temp_array['hour_name'] = $row['hour_name'];
9011 9011
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9024,12 +9024,12 @@  discard block
 block discarded – undo
9024 9024
 	* @return Array the hour list
9025 9025
 	*
9026 9026
 	*/
9027
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9027
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9028 9028
 	{
9029 9029
 		global $globalTimezone, $globalDBdriver;
9030
-		$filter_query = $this->getFilter($filters,true,true);
9031
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9032
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9030
+		$filter_query = $this->getFilter($filters, true, true);
9031
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9032
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9033 9033
 		if ($globalTimezone != '') {
9034 9034
 			date_default_timezone_set($globalTimezone);
9035 9035
 			$datetime = new DateTime();
@@ -9037,24 +9037,24 @@  discard block
 block discarded – undo
9037 9037
 		} else $offset = '+00:00';
9038 9038
 
9039 9039
 		if ($globalDBdriver == 'mysql') {
9040
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9040
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9041 9041
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9042 9042
 								GROUP BY hour_name 
9043 9043
 								ORDER BY hour_name ASC";
9044 9044
 		} else {
9045
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9045
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9046 9046
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9047 9047
 								GROUP BY hour_name 
9048 9048
 								ORDER BY hour_name ASC";
9049 9049
 		}
9050 9050
 		
9051 9051
 		$sth = $this->db->prepare($query);
9052
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9052
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9053 9053
       
9054 9054
 		$hour_array = array();
9055 9055
 		$temp_array = array();
9056 9056
         
9057
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9057
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9058 9058
 		{
9059 9059
 			$temp_array['hour_name'] = $row['hour_name'];
9060 9060
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9075,8 +9075,8 @@  discard block
 block discarded – undo
9075 9075
 	public function countAllHoursByCountry($country, $filters = array())
9076 9076
 	{
9077 9077
 		global $globalTimezone, $globalDBdriver;
9078
-		$filter_query = $this->getFilter($filters,true,true);
9079
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9078
+		$filter_query = $this->getFilter($filters, true, true);
9079
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9080 9080
 		if ($globalTimezone != '') {
9081 9081
 			date_default_timezone_set($globalTimezone);
9082 9082
 			$datetime = new DateTime();
@@ -9084,24 +9084,24 @@  discard block
 block discarded – undo
9084 9084
 		} else $offset = '+00:00';
9085 9085
 
9086 9086
 		if ($globalDBdriver == 'mysql') {
9087
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9087
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9088 9088
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9089 9089
 								GROUP BY hour_name 
9090 9090
 								ORDER BY hour_name ASC";
9091 9091
 		} else {
9092
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9092
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9093 9093
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9094 9094
 								GROUP BY hour_name 
9095 9095
 								ORDER BY hour_name ASC";
9096 9096
 		}
9097 9097
 		
9098 9098
 		$sth = $this->db->prepare($query);
9099
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9099
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9100 9100
       
9101 9101
 		$hour_array = array();
9102 9102
 		$temp_array = array();
9103 9103
         
9104
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9104
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9105 9105
 		{
9106 9106
 			$temp_array['hour_name'] = $row['hour_name'];
9107 9107
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9123,8 +9123,8 @@  discard block
 block discarded – undo
9123 9123
 	*/
9124 9124
 	public function countOverallAircrafts($filters = array())
9125 9125
 	{
9126
-		$filter_query = $this->getFilter($filters,true,true);
9127
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9126
+		$filter_query = $this->getFilter($filters, true, true);
9127
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9128 9128
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9129 9129
 		$sth = $this->db->prepare($query);
9130 9130
 		$sth->execute();
@@ -9139,8 +9139,8 @@  discard block
 block discarded – undo
9139 9139
 	*/
9140 9140
 	public function countOverallArrival($filters = array())
9141 9141
 	{
9142
-		$filter_query = $this->getFilter($filters,true,true);
9143
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9142
+		$filter_query = $this->getFilter($filters, true, true);
9143
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9144 9144
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9145 9145
 		
9146 9146
 		$sth = $this->db->prepare($query);
@@ -9156,8 +9156,8 @@  discard block
 block discarded – undo
9156 9156
 	*/
9157 9157
 	public function countOverallPilots($filters = array())
9158 9158
 	{
9159
-		$filter_query = $this->getFilter($filters,true,true);
9160
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9159
+		$filter_query = $this->getFilter($filters, true, true);
9160
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9161 9161
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9162 9162
 		$sth = $this->db->prepare($query);
9163 9163
 		$sth->execute();
@@ -9172,8 +9172,8 @@  discard block
 block discarded – undo
9172 9172
 	*/
9173 9173
 	public function countOverallOwners($filters = array())
9174 9174
 	{
9175
-		$filter_query = $this->getFilter($filters,true,true);
9176
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9175
+		$filter_query = $this->getFilter($filters, true, true);
9176
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9177 9177
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9178 9178
 		$sth = $this->db->prepare($query);
9179 9179
 		$sth->execute();
@@ -9206,8 +9206,8 @@  discard block
 block discarded – undo
9206 9206
 	*/
9207 9207
 	public function countOverallMilitaryFlights($filters = array())
9208 9208
 	{
9209
-		$filter_query = $this->getFilter($filters,true,true);
9210
-		$query  = "SELECT COUNT(s.spotter_id) AS flight_count  
9209
+		$filter_query = $this->getFilter($filters, true, true);
9210
+		$query = "SELECT COUNT(s.spotter_id) AS flight_count  
9211 9211
                     FROM spotter_output s, airlines a".$filter_query." s.airline_icao = a.icao AND a.type = 'military'";
9212 9212
       
9213 9213
 		$sth = $this->db->prepare($query);
@@ -9244,7 +9244,7 @@  discard block
 block discarded – undo
9244 9244
 	public function countAllHoursFromToday($filters = array())
9245 9245
 	{
9246 9246
 		global $globalTimezone, $globalDBdriver;
9247
-		$filter_query = $this->getFilter($filters,true,true);
9247
+		$filter_query = $this->getFilter($filters, true, true);
9248 9248
 		if ($globalTimezone != '') {
9249 9249
 			date_default_timezone_set($globalTimezone);
9250 9250
 			$datetime = new DateTime();
@@ -9252,12 +9252,12 @@  discard block
 block discarded – undo
9252 9252
 		} else $offset = '+00:00';
9253 9253
 
9254 9254
 		if ($globalDBdriver == 'mysql') {
9255
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9255
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9256 9256
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9257 9257
 								GROUP BY hour_name 
9258 9258
 								ORDER BY hour_name ASC";
9259 9259
 		} else {
9260
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9260
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9261 9261
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9262 9262
 								GROUP BY hour_name 
9263 9263
 								ORDER BY hour_name ASC";
@@ -9269,7 +9269,7 @@  discard block
 block discarded – undo
9269 9269
 		$hour_array = array();
9270 9270
 		$temp_array = array();
9271 9271
         
9272
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9272
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9273 9273
 		{
9274 9274
 			$temp_array['hour_name'] = $row['hour_name'];
9275 9275
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9288,14 +9288,14 @@  discard block
 block discarded – undo
9288 9288
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9289 9289
 	{
9290 9290
 		global $global_query, $globalDBdriver, $globalTimezone;
9291
-		$filter_query = $this->getFilter($filters,true,true);
9291
+		$filter_query = $this->getFilter($filters, true, true);
9292 9292
 		date_default_timezone_set('UTC');
9293 9293
 		$limit_query = '';
9294 9294
 		if ($limit != "")
9295 9295
 		{
9296 9296
 			$limit_array = explode(",", $limit);
9297
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9298
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9297
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9298
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9299 9299
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9300 9300
 			{
9301 9301
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9348,7 +9348,7 @@  discard block
 block discarded – undo
9348 9348
 			    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')
9349 9349
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9350 9350
 			//echo $query;
9351
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9351
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9352 9352
 			/*
9353 9353
 			$sth = $this->db->prepare($query);
9354 9354
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9367,9 +9367,9 @@  discard block
 block discarded – undo
9367 9367
 	*/
9368 9368
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9369 9369
 	{
9370
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9370
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9371 9371
 
9372
-		$query  = "SELECT spotter_output.spotter_id
9372
+		$query = "SELECT spotter_output.spotter_id
9373 9373
 								FROM spotter_output 
9374 9374
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9375 9375
         
@@ -9377,7 +9377,7 @@  discard block
 block discarded – undo
9377 9377
 		$sth = $this->db->prepare($query);
9378 9378
 		$sth->execute();
9379 9379
 
9380
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9380
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9381 9381
 		{
9382 9382
 			return $row['spotter_id'];
9383 9383
 		}
@@ -9402,23 +9402,23 @@  discard block
 block discarded – undo
9402 9402
 		}
9403 9403
 		
9404 9404
 		$current_date = date("Y-m-d H:i:s");
9405
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9405
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9406 9406
 		
9407 9407
 		$diff = abs(strtotime($current_date) - strtotime($date));
9408 9408
 
9409
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9409
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9410 9410
 		$years = $time_array['years'];
9411 9411
 		
9412
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9412
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9413 9413
 		$months = $time_array['months'];
9414 9414
 		
9415
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9415
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9416 9416
 		$days = $time_array['days'];
9417
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9417
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9418 9418
 		$hours = $time_array['hours'];
9419
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9419
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9420 9420
 		$minutes = $time_array['minutes'];
9421
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9421
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9422 9422
 		
9423 9423
 		return $time_array;	
9424 9424
 	}	
@@ -9444,63 +9444,63 @@  discard block
 block discarded – undo
9444 9444
 			$temp_array['direction_degree'] = $direction;
9445 9445
 			$temp_array['direction_shortname'] = "N";
9446 9446
 			$temp_array['direction_fullname'] = "North";
9447
-		} elseif ($direction >= 22.5 && $direction < 45){
9447
+		} elseif ($direction >= 22.5 && $direction < 45) {
9448 9448
 			$temp_array['direction_degree'] = $direction;
9449 9449
 			$temp_array['direction_shortname'] = "NNE";
9450 9450
 			$temp_array['direction_fullname'] = "North-Northeast";
9451
-		} elseif ($direction >= 45 && $direction < 67.5){
9451
+		} elseif ($direction >= 45 && $direction < 67.5) {
9452 9452
 			$temp_array['direction_degree'] = $direction;
9453 9453
 			$temp_array['direction_shortname'] = "NE";
9454 9454
 			$temp_array['direction_fullname'] = "Northeast";
9455
-		} elseif ($direction >= 67.5 && $direction < 90){
9455
+		} elseif ($direction >= 67.5 && $direction < 90) {
9456 9456
 			$temp_array['direction_degree'] = $direction;
9457 9457
 			$temp_array['direction_shortname'] = "ENE";
9458 9458
 			$temp_array['direction_fullname'] = "East-Northeast";
9459
-		} elseif ($direction >= 90 && $direction < 112.5){
9459
+		} elseif ($direction >= 90 && $direction < 112.5) {
9460 9460
 			$temp_array['direction_degree'] = $direction;
9461 9461
 			$temp_array['direction_shortname'] = "E";
9462 9462
 			$temp_array['direction_fullname'] = "East";
9463
-		} elseif ($direction >= 112.5 && $direction < 135){
9463
+		} elseif ($direction >= 112.5 && $direction < 135) {
9464 9464
 			$temp_array['direction_degree'] = $direction;
9465 9465
 			$temp_array['direction_shortname'] = "ESE";
9466 9466
 			$temp_array['direction_fullname'] = "East-Southeast";
9467
-		} elseif ($direction >= 135 && $direction < 157.5){
9467
+		} elseif ($direction >= 135 && $direction < 157.5) {
9468 9468
 			$temp_array['direction_degree'] = $direction;
9469 9469
 			$temp_array['direction_shortname'] = "SE";
9470 9470
 			$temp_array['direction_fullname'] = "Southeast";
9471
-		} elseif ($direction >= 157.5 && $direction < 180){
9471
+		} elseif ($direction >= 157.5 && $direction < 180) {
9472 9472
 			$temp_array['direction_degree'] = $direction;
9473 9473
 			$temp_array['direction_shortname'] = "SSE";
9474 9474
 			$temp_array['direction_fullname'] = "South-Southeast";
9475
-		} elseif ($direction >= 180 && $direction < 202.5){
9475
+		} elseif ($direction >= 180 && $direction < 202.5) {
9476 9476
 			$temp_array['direction_degree'] = $direction;
9477 9477
 			$temp_array['direction_shortname'] = "S";
9478 9478
 			$temp_array['direction_fullname'] = "South";
9479
-		} elseif ($direction >= 202.5 && $direction < 225){
9479
+		} elseif ($direction >= 202.5 && $direction < 225) {
9480 9480
 			$temp_array['direction_degree'] = $direction;
9481 9481
 			$temp_array['direction_shortname'] = "SSW";
9482 9482
 			$temp_array['direction_fullname'] = "South-Southwest";
9483
-		} elseif ($direction >= 225 && $direction < 247.5){
9483
+		} elseif ($direction >= 225 && $direction < 247.5) {
9484 9484
 			$temp_array['direction_degree'] = $direction;
9485 9485
 			$temp_array['direction_shortname'] = "SW";
9486 9486
 			$temp_array['direction_fullname'] = "Southwest";
9487
-		} elseif ($direction >= 247.5 && $direction < 270){
9487
+		} elseif ($direction >= 247.5 && $direction < 270) {
9488 9488
 			$temp_array['direction_degree'] = $direction;
9489 9489
 			$temp_array['direction_shortname'] = "WSW";
9490 9490
 			$temp_array['direction_fullname'] = "West-Southwest";
9491
-		} elseif ($direction >= 270 && $direction < 292.5){
9491
+		} elseif ($direction >= 270 && $direction < 292.5) {
9492 9492
 			$temp_array['direction_degree'] = $direction;
9493 9493
 			$temp_array['direction_shortname'] = "W";
9494 9494
 			$temp_array['direction_fullname'] = "West";
9495
-		} elseif ($direction >= 292.5 && $direction < 315){
9495
+		} elseif ($direction >= 292.5 && $direction < 315) {
9496 9496
 			$temp_array['direction_degree'] = $direction;
9497 9497
 			$temp_array['direction_shortname'] = "WNW";
9498 9498
 			$temp_array['direction_fullname'] = "West-Northwest";
9499
-		} elseif ($direction >= 315 && $direction < 337.5){
9499
+		} elseif ($direction >= 315 && $direction < 337.5) {
9500 9500
 			$temp_array['direction_degree'] = $direction;
9501 9501
 			$temp_array['direction_shortname'] = "NW";
9502 9502
 			$temp_array['direction_fullname'] = "Northwest";
9503
-		} elseif ($direction >= 337.5 && $direction < 360){
9503
+		} elseif ($direction >= 337.5 && $direction < 360) {
9504 9504
 			$temp_array['direction_degree'] = $direction;
9505 9505
 			$temp_array['direction_shortname'] = "NNW";
9506 9506
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9553,9 +9553,9 @@  discard block
 block discarded – undo
9553 9553
 	*/
9554 9554
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9555 9555
 	{
9556
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9556
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9557 9557
 	
9558
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9558
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9559 9559
 		
9560 9560
 		$sth = $this->db->prepare($query);
9561 9561
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9578,9 +9578,9 @@  discard block
 block discarded – undo
9578 9578
 	*/
9579 9579
 	public function getAircraftTypeBymodeS($aircraft_modes)
9580 9580
 	{
9581
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9581
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9582 9582
 	
9583
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9583
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9584 9584
 		
9585 9585
 		$sth = $this->db->prepare($query);
9586 9586
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9601,11 +9601,11 @@  discard block
 block discarded – undo
9601 9601
 	* @param Float $longitude longitute of the flight
9602 9602
 	* @return String the countrie
9603 9603
 	*/
9604
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9604
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9605 9605
 	{
9606 9606
 		global $globalDBdriver, $globalDebug;
9607
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9608
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9607
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9608
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9609 9609
 	
9610 9610
 		$Connection = new Connection($this->db);
9611 9611
 		if (!$Connection->tableExists('countries')) return '';
@@ -9645,19 +9645,19 @@  discard block
 block discarded – undo
9645 9645
 	*/
9646 9646
 	public function convertAircraftRegistration($registration)
9647 9647
 	{
9648
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9648
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9649 9649
 		$registration_prefix = '';
9650 9650
 		$registration_1 = substr($registration, 0, 1);
9651 9651
 		$registration_2 = substr($registration, 0, 2);
9652 9652
 
9653 9653
 		//first get the prefix based on two characters
9654
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9654
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9655 9655
       
9656 9656
 		
9657 9657
 		$sth = $this->db->prepare($query);
9658 9658
 		$sth->execute(array(':registration_2' => $registration_2));
9659 9659
         
9660
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9660
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9661 9661
 		{
9662 9662
 			$registration_prefix = $row['registration_prefix'];
9663 9663
 		}
@@ -9665,11 +9665,11 @@  discard block
 block discarded – undo
9665 9665
 		//if we didn't find a two chracter prefix lets just search the one with one character
9666 9666
 		if ($registration_prefix == '')
9667 9667
 		{
9668
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9668
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9669 9669
 			$sth = $this->db->prepare($query);
9670 9670
 			$sth->execute(array(':registration_1' => $registration_1));
9671 9671
 	        
9672
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9672
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9673 9673
 			{
9674 9674
 				$registration_prefix = $row['registration_prefix'];
9675 9675
 			}
@@ -9683,7 +9683,7 @@  discard block
 block discarded – undo
9683 9683
 			} else {
9684 9684
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9685 9685
 			}
9686
-		} else if(strlen($registration_prefix) == 2){
9686
+		} else if (strlen($registration_prefix) == 2) {
9687 9687
 			if (0 === strpos($registration, 'N')) {
9688 9688
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9689 9689
 			} else {
@@ -9702,17 +9702,17 @@  discard block
 block discarded – undo
9702 9702
 	*/
9703 9703
 	public function countryFromAircraftRegistration($registration)
9704 9704
 	{
9705
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9705
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9706 9706
 		
9707 9707
 		$registration_prefix = '';
9708
-		$registration_test = explode('-',$registration);
9708
+		$registration_test = explode('-', $registration);
9709 9709
 		$country = '';
9710 9710
 		if ($registration_test[0] != $registration) {
9711 9711
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9712 9712
 	      
9713 9713
 			$sth = $this->db->prepare($query);
9714 9714
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9715
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9715
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9716 9716
 			{
9717 9717
 				//$registration_prefix = $row['registration_prefix'];
9718 9718
 				$country = $row['country'];
@@ -9723,13 +9723,13 @@  discard block
 block discarded – undo
9723 9723
 
9724 9724
 			$country = '';
9725 9725
 			//first get the prefix based on two characters
9726
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9726
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9727 9727
       
9728 9728
 			
9729 9729
 			$sth = $this->db->prepare($query);
9730 9730
 			$sth->execute(array(':registration_2' => $registration_2));
9731 9731
         
9732
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9732
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9733 9733
 			{
9734 9734
 				$registration_prefix = $row['registration_prefix'];
9735 9735
 				$country = $row['country'];
@@ -9738,12 +9738,12 @@  discard block
 block discarded – undo
9738 9738
 			//if we didn't find a two chracter prefix lets just search the one with one character
9739 9739
 			if ($registration_prefix == "")
9740 9740
 			{
9741
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9741
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9742 9742
 	      
9743 9743
 				$sth = $this->db->prepare($query);
9744 9744
 				$sth->execute(array(':registration_1' => $registration_1));
9745 9745
 	        
9746
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9746
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9747 9747
 				{
9748 9748
 					//$registration_prefix = $row['registration_prefix'];
9749 9749
 					$country = $row['country'];
@@ -9760,9 +9760,9 @@  discard block
 block discarded – undo
9760 9760
 	* @param String $flightaware_id flightaware_id from spotter_output table
9761 9761
 	* @param String $highlight New highlight value
9762 9762
 	*/
9763
-	public function setHighlightFlight($flightaware_id,$highlight) {
9763
+	public function setHighlightFlight($flightaware_id, $highlight) {
9764 9764
 		
9765
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9765
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9766 9766
 		$sth = $this->db->prepare($query);
9767 9767
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9768 9768
 	}
@@ -9791,7 +9791,7 @@  discard block
 block discarded – undo
9791 9791
 		
9792 9792
 		$bitly_data = json_decode($bitly_data);
9793 9793
 		$bitly_url = '';
9794
-		if ($bitly_data->status_txt = "OK"){
9794
+		if ($bitly_data->status_txt = "OK") {
9795 9795
 			$bitly_url = $bitly_data->data->url;
9796 9796
 		}
9797 9797
 
@@ -9801,7 +9801,7 @@  discard block
 block discarded – undo
9801 9801
 
9802 9802
 	public function getOrderBy()
9803 9803
 	{
9804
-		$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"));
9804
+		$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"));
9805 9805
 		
9806 9806
 		return $orderby;
9807 9807
 		
@@ -9935,14 +9935,14 @@  discard block
 block discarded – undo
9935 9935
 		}
9936 9936
 		$sth = $this->db->prepare($query);
9937 9937
 		$sth->execute();
9938
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9938
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9939 9939
 		{
9940 9940
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
9941 9941
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
9942 9942
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
9943
-				$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";
9943
+				$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";
9944 9944
 				$sthu = $this->db->prepare($update_query);
9945
-				$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']));
9945
+				$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']));
9946 9946
 			}
9947 9947
 		}
9948 9948
 		
@@ -9955,7 +9955,7 @@  discard block
 block discarded – undo
9955 9955
 		}
9956 9956
 		$sth = $this->db->prepare($query);
9957 9957
 		$sth->execute();
9958
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9958
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9959 9959
 		{
9960 9960
 			if (is_numeric(substr($row['ident'], -1, 1)))
9961 9961
 			{
@@ -9964,11 +9964,11 @@  discard block
 block discarded – undo
9964 9964
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9965 9965
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9966 9966
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
9967
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9967
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
9968 9968
 				if (isset($airline_array[0]['name'])) {
9969
-					$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";
9969
+					$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";
9970 9970
 					$sthu = $this->db->prepare($update_query);
9971
-					$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']));
9971
+					$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']));
9972 9972
 				}
9973 9973
 			}
9974 9974
 		}
@@ -9988,18 +9988,18 @@  discard block
 block discarded – undo
9988 9988
 		}
9989 9989
 		$sth = $this->db->prepare($query);
9990 9990
 		$sth->execute();
9991
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9991
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9992 9992
 		{
9993 9993
 			if ($row['aircraft_icao'] != '') {
9994 9994
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
9995
-				if ($row['registration'] != ""){
9995
+				if ($row['registration'] != "") {
9996 9996
 					$image_array = $Image->getSpotterImage($row['registration']);
9997 9997
 					if (count($image_array) == 0) {
9998 9998
 						$Image->addSpotterImage($row['registration']);
9999 9999
 					}
10000 10000
 				}
10001 10001
 				if (count($aircraft_name) > 0) {
10002
-					$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";
10002
+					$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";
10003 10003
 					$sthu = $this->db->prepare($update_query);
10004 10004
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10005 10005
 				}
@@ -10014,10 +10014,10 @@  discard block
 block discarded – undo
10014 10014
 		$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";
10015 10015
 		$sth = $this->db->prepare($query);
10016 10016
 		$sth->execute();
10017
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10017
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10018 10018
 		{
10019 10019
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10020
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10020
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10021 10021
 				$airport_icao = '';
10022 10022
 				 if (isset($closestAirports[0])) {
10023 10023
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10031,7 +10031,7 @@  discard block
 block discarded – undo
10031 10031
 								break;
10032 10032
 							}
10033 10033
 						}
10034
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10034
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10035 10035
 						$airport_icao = $closestAirports[0]['icao'];
10036 10036
 						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";
10037 10037
 					} else {
@@ -10042,28 +10042,28 @@  discard block
 block discarded – undo
10042 10042
 				}
10043 10043
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10044 10044
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10045
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10045
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10046 10046
 					$sthu = $this->db->prepare($update_query);
10047
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10047
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10048 10048
 				}
10049 10049
 			}
10050 10050
 		}
10051 10051
 	}
10052 10052
 	
10053
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10053
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10054 10054
 		global $globalDBdriver;
10055
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10055
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10056 10056
 /*
10057 10057
 		$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 
10058 10058
                       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)) 
10059 10059
                       having distance < $dist ORDER BY distance limit 100;";
10060 10060
 */
10061 10061
 		if ($globalDBdriver == 'mysql') {
10062
-			$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 
10062
+			$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 
10063 10063
 	                      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)) 
10064 10064
 	                      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;";
10065 10065
                 } else {
10066
-			$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 
10066
+			$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 
10067 10067
 	                      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)) 
10068 10068
 	                      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;";
10069 10069
     		}
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 } else {
20 20
 	unset($_COOKIE['MapTrack']);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		        <div class="form-group">
168 168
 			    <label>From (UTC):</label>
169 169
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
170
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required />
171 171
 		                <span class="input-group-addon">
172 172
             			    <span class="glyphicon glyphicon-calendar"></span>
173 173
 		                </span>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		        <div class="form-group">
177 177
 			    <label>To (UTC):</label>
178 178
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
179
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" />
180 180
             			<span class="input-group-addon">
181 181
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 182
             			</span>
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 		    <li><?php echo _("Type of Terrain:"); ?>
302 302
 			<select  class="selectpicker" onchange="terrainType(this);">
303 303
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
304
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
305
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
306 306
 			</select>
307 307
 		    </li>
308 308
 <?php
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
430 430
 			    <?php
431 431
 				$Spotter = new Spotter();
432
-				foreach($Spotter->getAllAirlineNames() as $airline) {
432
+				foreach ($Spotter->getAllAirlineNames() as $airline) {
433 433
 					$airline_name = $airline['airline_name'];
434
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
435
-					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
434
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
435
+					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['Airlines']))) {
436 436
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
437 437
 					} else {
438 438
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 			<select class="selectpicker" multiple onchange="sources(this);">
449 449
 			    <?php
450 450
 				$Spotter = new Spotter();
451
-				foreach($Spotter->getAllSourceName('aprs') as $source) {
452
-					if (isset($_COOKIE['Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['Sources']))) {
451
+				foreach ($Spotter->getAllSourceName('aprs') as $source) {
452
+					if (isset($_COOKIE['Sources']) && in_array($source['source_name'], explode(',', $_COOKIE['Sources']))) {
453 453
 						echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>';
454 454
 					} else {
455 455
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
522 522
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
523 523
 					
524
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
524
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
525 525
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
526 526
 					} else {
527 527
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Braces   +357 added lines, -95 removed lines patch added patch discarded remove patch
@@ -135,11 +135,26 @@  discard block
 block discarded – undo
135 135
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
136 136
 				<li><?php echo _("NOTAM scope:"); ?>
137 137
 					<select class="selectpicker" onchange="notamscope(this);">
138
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
139
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
140
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
141
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
142
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
138
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
139
+	print ' selected';
140
+}
141
+?>>All</option>
142
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
143
+	print ' selected';
144
+}
145
+?>>Airport/Enroute warning</option>
146
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
147
+	print ' selected';
148
+}
149
+?>>Airport warning</option>
150
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
151
+	print ' selected';
152
+}
153
+?>>Navigation warning</option>
154
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
155
+	print ' selected';
156
+}
157
+?>>Enroute warning</option>
143 158
 					</select
144 159
 				</li>
145 160
 			</ul>
@@ -167,7 +182,12 @@  discard block
 block discarded – undo
167 182
 		        <div class="form-group">
168 183
 			    <label>From (UTC):</label>
169 184
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
185
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
186
+	print $_POST['start_date'];
187
+} elseif (isset($_COOKIE['archive_begin'])) {
188
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
189
+}
190
+?>" required />
171 191
 		                <span class="input-group-addon">
172 192
             			    <span class="glyphicon glyphicon-calendar"></span>
173 193
 		                </span>
@@ -176,7 +196,12 @@  discard block
 block discarded – undo
176 196
 		        <div class="form-group">
177 197
 			    <label>To (UTC):</label>
178 198
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
199
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
200
+	print $_POST['end_date'];
201
+} elseif (isset($_COOKIE['archive_end'])) {
202
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
203
+}
204
+?>" />
180 205
             			<span class="input-group-addon">
181 206
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 207
             			</span>
@@ -202,8 +227,20 @@  discard block
 block discarded – undo
202 227
 
203 228
 		    <li><?php echo _("Playback speed:"); ?>
204 229
 			<div class="range">
205
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
206
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
230
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
231
+	print $_POST['archivespeed'];
232
+} elseif (isset($_COOKIE['archive_speed'])) {
233
+	print $_COOKIE['archive_speed'];
234
+} else {
235
+	print '1';
236
+}
237
+?>">
238
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
239
+	print $_COOKIE['archive_speed'];
240
+} else {
241
+	print '1';
242
+}
243
+?></output>
207 244
 			</div>
208 245
 		    </li>
209 246
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -225,15 +262,27 @@  discard block
 block discarded – undo
225 262
 		    <li><?php echo _("Type of Map:"); ?>
226 263
 			<select  class="selectpicker" onchange="mapType(this);">
227 264
 			    <?php
228
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229
-				else $MapType = $_COOKIE['MapType'];
265
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
266
+					$MapType = $globalMapProvider;
267
+				} else {
268
+					$MapType = $_COOKIE['MapType'];
269
+				}
230 270
 			    ?>
231 271
 			    <?php
232 272
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233 273
 			    ?>
234
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
274
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
275
+	print ' selected';
276
+}
277
+?>>Bing-Aerial</option>
278
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
279
+	print ' selected';
280
+}
281
+?>>Bing-Hybrid</option>
282
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
283
+	print ' selected';
284
+}
285
+?>>Bing-Road</option>
237 286
 			    <?php
238 287
 				}
239 288
 			    ?>
@@ -243,56 +292,131 @@  discard block
 block discarded – undo
243 292
 			    <?php
244 293
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245 294
 			    ?>
246
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
295
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
296
+	print ' selected';
297
+}
298
+?>>Here-Aerial</option>
299
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
300
+	print ' selected';
301
+}
302
+?>>Here-Hybrid</option>
303
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
304
+	print ' selected';
305
+}
306
+?>>Here-Road</option>
249 307
 			    <?php
250 308
 				    }
251 309
 			    ?>
252 310
 			    <?php
253 311
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254 312
 			    ?>
255
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
313
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
314
+	print ' selected';
315
+}
316
+?>>Google Roadmap</option>
317
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
318
+	print ' selected';
319
+}
320
+?>>Google Satellite</option>
321
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
322
+	print ' selected';
323
+}
324
+?>>Google Hybrid</option>
325
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
326
+	print ' selected';
327
+}
328
+?>>Google Terrain</option>
259 329
 			    <?php
260 330
 				    }
261 331
 			    ?>
262 332
 			    <?php
263 333
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264 334
 			    ?>
265
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
335
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
336
+	print ' selected';
337
+}
338
+?>>MapQuest-OSM</option>
339
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
340
+	print ' selected';
341
+}
342
+?>>MapQuest-Aerial</option>
343
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
344
+	print ' selected';
345
+}
346
+?>>MapQuest-Hybrid</option>
268 347
 			    <?php
269 348
 				    }
270 349
 			    ?>
271
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
350
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
351
+	print ' selected';
352
+}
353
+?>>Yandex</option>
272 354
 			    <?php
273 355
 				}
274 356
 			    ?>
275 357
 			    <?php
276 358
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278
-					else $MapBoxId = $_COOKIE['MapTypeId'];
359
+					if (!isset($_COOKIE['MapTypeId'])) {
360
+						$MapBoxId = 'default';
361
+					} else {
362
+						$MapBoxId = $_COOKIE['MapTypeId'];
363
+					}
279 364
 			    ?>
280
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
283
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
284
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
285
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
286
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
287
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
288
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
289
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
290
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
365
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
366
+	print ' selected';
367
+}
368
+?>>Mapbox default</option>
369
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
370
+	print ' selected';
371
+}
372
+?>>Mapbox streets</option>
373
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
374
+	print ' selected';
375
+}
376
+?>>Mapbox light</option>
377
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
378
+	print ' selected';
379
+}
380
+?>>Mapbox dark</option>
381
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
382
+	print ' selected';
383
+}
384
+?>>Mapbox satellite</option>
385
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
386
+	print ' selected';
387
+}
388
+?>>Mapbox streets-satellite</option>
389
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
390
+	print ' selected';
391
+}
392
+?>>Mapbox streets-basic</option>
393
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
394
+	print ' selected';
395
+}
396
+?>>Mapbox comic</option>
397
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
398
+	print ' selected';
399
+}
400
+?>>Mapbox outdoors</option>
401
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
402
+	print ' selected';
403
+}
404
+?>>Mapbox pencil</option>
405
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
406
+	print ' selected';
407
+}
408
+?>>Mapbox pirates</option>
409
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
410
+	print ' selected';
411
+}
412
+?>>Mapbox emerald</option>
292 413
 			    <?php
293 414
 				    }
294 415
 			    ?>
295
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
416
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
417
+	print ' selected';
418
+}
419
+?>>OpenStreetMap</option>
296 420
 			</select>
297 421
 		    </li>
298 422
 <?php
@@ -300,9 +424,18 @@  discard block
 block discarded – undo
300 424
 ?>
301 425
 		    <li><?php echo _("Type of Terrain:"); ?>
302 426
 			<select  class="selectpicker" onchange="terrainType(this);">
303
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
427
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
428
+	print ' selected';
429
+}
430
+?>>stk terrain</option>
431
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
432
+	print ' selected';
433
+}
434
+?>>ellipsoid</option>
435
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
436
+	print ' selected';
437
+}
438
+?>>vr terrain</option>
306 439
 			</select>
307 440
 		    </li>
308 441
 <?php
@@ -312,18 +445,36 @@  discard block
 block discarded – undo
312 445
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 446
 ?>
314 447
 		    
315
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
316
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
317
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
318
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
448
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
449
+	print 'checked';
450
+}
451
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
452
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) {
453
+	print 'checked';
454
+}
455
+?> ><?php echo _("Display flight path"); ?></label></div></li>
456
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) {
457
+	print 'checked';
458
+}
459
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
460
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
461
+	print 'checked';
462
+}
463
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319 464
 <?php
320 465
     }
321 466
 ?>
322
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
323 471
 <?php
324 472
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 473
 ?>
326
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
474
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
475
+	print 'checked';
476
+}
477
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 478
 <?php
328 479
     }
329 480
 ?>
@@ -332,17 +483,25 @@  discard block
 block discarded – undo
332 483
 			if (function_exists('array_column')) {
333 484
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334 485
 		    ?>
335
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
486
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
487
+	print 'checked';
488
+}
489
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
336 490
 		    <?php
337 491
 			    }
338 492
 			} elseif (isset($globalSources)) {
339 493
 			    $dispolar = false;
340 494
 			    foreach ($globalSources as $testsource) {
341
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
495
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
496
+			        	$dispolar = true;
497
+			        }
342 498
 			    }
343 499
 			    if ($dispolar) {
344 500
 		    ?>
345
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
501
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
502
+	print 'checked';
503
+}
504
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
346 505
 		    <?php
347 506
 			    }
348 507
 		        }
@@ -354,12 +513,22 @@  discard block
 block discarded – undo
354 513
 		    <?php
355 514
 		        if (extension_loaded('gd') && function_exists('gd_info')) {
356 515
 		    ?>
357
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
516
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
517
+	print 'checked';
518
+}
519
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
358 520
 		    <?php 
359 521
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
360 522
 		    ?>
361 523
 		    <li><?php echo _("Aircraft icon color:"); ?>
362
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
524
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
525
+	print $_COOKIE['IconColor'];
526
+} elseif (isset($globalAircraftIconColor)) {
527
+	print $globalAircraftIconColor;
528
+} else {
529
+	print '1a3151';
530
+}
531
+?>">
363 532
 		    </li>
364 533
 		    <?php
365 534
 			    }
@@ -367,8 +536,22 @@  discard block
 block discarded – undo
367 536
 		    ?>
368 537
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
369 538
 			<div class="range">
370
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
371
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
539
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
540
+	print $_COOKIE['AirportZoom'];
541
+} elseif (isset($globalAirportZoom)) {
542
+	print $globalAirportZoom;
543
+} else {
544
+	print '7';
545
+}
546
+?>">
547
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
548
+	print $_COOKIE['AirportZoom'];
549
+} elseif (isset($globalAirportZoom)) {
550
+	print $globalAirportZoom;
551
+} else {
552
+	print '7';
553
+}
554
+?></output>
372 555
 			</div>
373 556
 		    </li>
374 557
 <?php
@@ -376,22 +559,46 @@  discard block
 block discarded – undo
376 559
 ?>
377 560
 		    <li><?php echo _("Distance unit:"); ?>
378 561
 			<select class="selectpicker" onchange="unitdistance(this);">
379
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
380
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
381
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
562
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
563
+	echo ' selected';
564
+}
565
+?>>km</option>
566
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
567
+	echo ' selected';
568
+}
569
+?>>nm</option>
570
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
571
+	echo ' selected';
572
+}
573
+?>>mi</option>
382 574
 		        </select>
383 575
 		    </li>
384 576
 		    <li><?php echo _("Altitude unit:"); ?>
385 577
 			<select class="selectpicker" onchange="unitaltitude(this);">
386
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
387
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
578
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
579
+	echo ' selected';
580
+}
581
+?>>m</option>
582
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
583
+	echo ' selected';
584
+}
585
+?>>feet</option>
388 586
 		        </select>
389 587
 		    </li>
390 588
 		    <li><?php echo _("Speed unit:"); ?>
391 589
 			<select class="selectpicker" onchange="unitspeed(this);">
392
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
393
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
394
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
590
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
591
+	echo ' selected';
592
+}
593
+?>>km/h</option>
594
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
595
+	echo ' selected';
596
+}
597
+?>>mph</option>
598
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
599
+	echo ' selected';
600
+}
601
+?>>knots</option>
395 602
 		        </select>
396 603
 		    </li>
397 604
 
@@ -406,9 +613,18 @@  discard block
 block discarded – undo
406 613
 		    <?php
407 614
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
408 615
 		    ?>
409
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
410
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
411
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
616
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
617
+	print 'checked';
618
+}
619
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
620
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
621
+	print 'checked';
622
+}
623
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
624
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
625
+	print 'checked';
626
+}
627
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
412 628
 		    <?php
413 629
 			}
414 630
 		    ?>
@@ -416,10 +632,16 @@  discard block
 block discarded – undo
416 632
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
417 633
 		    ?>
418 634
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
419
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
635
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
636
+	print 'checked';
637
+}
638
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
420 639
 			<?php } ?>
421 640
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
422
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
641
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
642
+	print 'checked';
643
+}
644
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
423 645
 			<?php } ?>
424 646
 		    <?php
425 647
 			}
@@ -431,7 +653,9 @@  discard block
 block discarded – undo
431 653
 				$Spotter = new Spotter();
432 654
 				foreach($Spotter->getAllAirlineNames() as $airline) {
433 655
 					$airline_name = $airline['airline_name'];
434
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
656
+					if (strlen($airline_name) > 30) {
657
+						$airline_name = substr($airline_name,0,30).'...';
658
+					}
435 659
 					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
436 660
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
437 661
 					} else {
@@ -466,10 +690,22 @@  discard block
 block discarded – undo
466 690
 		    ?>
467 691
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
468 692
 			<select class="selectpicker" onchange="airlinestype(this);">
469
-			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
470
-			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
471
-			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
472
-			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
693
+			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') {
694
+	echo ' selected';
695
+}
696
+?>><?php echo _("All"); ?></option>
697
+			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') {
698
+	echo ' selected';
699
+}
700
+?>><?php echo _("Passenger"); ?></option>
701
+			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') {
702
+	echo ' selected';
703
+}
704
+?>><?php echo _("Cargo"); ?></option>
705
+			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') {
706
+	echo ' selected';
707
+}
708
+?>><?php echo _("Military"); ?></option>
473 709
 			</select>
474 710
 		    </li>
475 711
 		    <?php
@@ -477,7 +713,10 @@  discard block
 block discarded – undo
477 713
 		    ?>
478 714
 		    <li>
479 715
 			<?php echo _("Display flight with ident:"); ?>
480
-			<input type="text" name="identfilter" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" />
716
+			<input type="text" name="identfilter" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) {
717
+	print $_COOKIE['identfilter'];
718
+}
719
+?>" />
481 720
 		    </li>
482 721
 		</ul>
483 722
 	    </form>
@@ -493,7 +732,10 @@  discard block
 block discarded – undo
493 732
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
494 733
 	    <form>
495 734
 		<ul>
496
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
735
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
736
+	print 'checked';
737
+}
738
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
497 739
 		    <li><?php echo _("Type:"); ?>
498 740
 			<select class="selectpicker" multiple onchange="sattypes(this);">
499 741
 			    <?php
@@ -501,25 +743,45 @@  discard block
 block discarded – undo
501 743
 				$types = $Satellite->get_tle_types();
502 744
 				foreach ($types as $type) {
503 745
 					$type_name = $type['tle_type'];
504
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
505
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
506
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
507
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
508
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
509
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
510
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
511
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
512
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
513
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
514
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
515
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
516
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
517
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
518
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
519
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
520
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
521
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
522
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
746
+					if ($type_name == 'musson') {
747
+						$type_name = 'Russian LEO Navigation';
748
+					} else if ($type_name == 'nnss') {
749
+						$type_name = 'Navi Navigation Satellite System';
750
+					} else if ($type_name == 'sbas') {
751
+						$type_name = 'Satellite-Based Augmentation System';
752
+					} else if ($type_name == 'glo-ops') {
753
+						$type_name = 'Glonass Operational';
754
+					} else if ($type_name == 'gps-ops') {
755
+						$type_name = 'GPS Operational';
756
+					} else if ($type_name == 'argos') {
757
+						$type_name = 'ARGOS Data Collection System';
758
+					} else if ($type_name == 'tdrss') {
759
+						$type_name = 'Tracking and Data Relay Satellite System';
760
+					} else if ($type_name == 'sarsat') {
761
+						$type_name = 'Search & Rescue';
762
+					} else if ($type_name == 'dmc') {
763
+						$type_name = 'Disaster Monitoring';
764
+					} else if ($type_name == 'resource') {
765
+						$type_name = 'Earth Resources';
766
+					} else if ($type_name == 'stations') {
767
+						$type_name = 'Space Stations';
768
+					} else if ($type_name == 'geo') {
769
+						$type_name = 'Geostationary';
770
+					} else if ($type_name == 'amateur') {
771
+						$type_name = 'Amateur Radio';
772
+					} else if ($type_name == 'x-comm') {
773
+						$type_name = 'Experimental';
774
+					} else if ($type_name == 'other-comm') {
775
+						$type_name = 'Other Comm';
776
+					} else if ($type_name == 'science') {
777
+						$type_name = 'Space & Earth Science';
778
+					} else if ($type_name == 'military') {
779
+						$type_name = 'Miscellaneous Military';
780
+					} else if ($type_name == 'radar') {
781
+						$type_name = 'Radar Calibration';
782
+					} else if ($type_name == 'tle-new') {
783
+						$type_name = 'Last 30 days launches';
784
+					}
523 785
 					
524 786
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
525 787
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.