Completed
Push — master ( 5bb40b...bd4c06 )
by Yannick
05:56
created
require/class.Spotter.php 2 patches
Indentation   +1437 added lines, -1437 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
64 64
 		$filters = array();
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-	* Executes the SQL statements to get the spotter information
133
-	*
134
-	* @param String $query the SQL query
135
-	* @param Array $params parameter of the query
136
-	* @param String $limitQuery the limit query
137
-	* @return Array the spotter information
138
-	*
139
-	*/
132
+	 * Executes the SQL statements to get the spotter information
133
+	 *
134
+	 * @param String $query the SQL query
135
+	 * @param Array $params parameter of the query
136
+	 * @param String $limitQuery the limit query
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
141 141
 	{
142 142
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
301 301
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
302 302
 					} else $temp_array['aircraft_shadow'] = 'default.png';
303
-                                } else {
304
-                            		$temp_array['aircraft_shadow'] = 'default.png';
303
+								} else {
304
+									$temp_array['aircraft_shadow'] = 'default.png';
305 305
 					$temp_array['aircraft_name'] = 'N/A';
306 306
 					$temp_array['aircraft_manufacturer'] = 'N/A';
307
-                            	}
307
+								}
308 308
 			}
309 309
 			$fromsource = NULL;
310 310
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -500,11 +500,11 @@  discard block
 block discarded – undo
500 500
 	
501 501
 	
502 502
 	/**
503
-	* Gets all the spotter information
504
-	*
505
-	* @return Array the spotter information
506
-	*
507
-	*/
503
+	 * Gets all the spotter information
504
+	 *
505
+	 * @return Array the spotter information
506
+	 *
507
+	 */
508 508
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
509 509
 	{
510 510
 		global $globalTimezone, $globalDBdriver;
@@ -851,11 +851,11 @@  discard block
 block discarded – undo
851 851
 	
852 852
 	
853 853
 	/**
854
-	* Gets all the spotter information based on the latest data entry
855
-	*
856
-	* @return Array the spotter information
857
-	*
858
-	*/
854
+	 * Gets all the spotter information based on the latest data entry
855
+	 *
856
+	 * @return Array the spotter information
857
+	 *
858
+	 */
859 859
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
860 860
 	{
861 861
 		global $global_query;
@@ -894,12 +894,12 @@  discard block
 block discarded – undo
894 894
 	}
895 895
     
896 896
     
897
-    /**
898
-	* Gets all the spotter information based on a user's latitude and longitude
899
-	*
900
-	* @return Array the spotter information
901
-	*
902
-	*/
897
+	/**
898
+	 * Gets all the spotter information based on a user's latitude and longitude
899
+	 *
900
+	 * @return Array the spotter information
901
+	 *
902
+	 */
903 903
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
904 904
 	{
905 905
 		date_default_timezone_set('UTC');
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 				return false;
928 928
 			}
929 929
 		}
930
-    		$additional_query = '';
930
+			$additional_query = '';
931 931
 		if ($interval != "")
932 932
 		{
933 933
 			if (!is_string($interval))
@@ -967,12 +967,12 @@  discard block
 block discarded – undo
967 967
 	}
968 968
     
969 969
     
970
-    /**
971
-	* Gets all the spotter information sorted by the newest aircraft type
972
-	*
973
-	* @return Array the spotter information
974
-	*
975
-	*/
970
+	/**
971
+	 * Gets all the spotter information sorted by the newest aircraft type
972
+	 *
973
+	 * @return Array the spotter information
974
+	 *
975
+	 */
976 976
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
977 977
 	{
978 978
 		global $global_query;
@@ -1013,11 +1013,11 @@  discard block
 block discarded – undo
1013 1013
     
1014 1014
     
1015 1015
 	/**
1016
-	* Gets all the spotter information sorted by the newest aircraft registration
1017
-	*
1018
-	* @return Array the spotter information
1019
-	*
1020
-	*/
1016
+	 * Gets all the spotter information sorted by the newest aircraft registration
1017
+	 *
1018
+	 * @return Array the spotter information
1019
+	 *
1020
+	 */
1021 1021
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1022 1022
 	{
1023 1023
 		global $global_query;
@@ -1057,11 +1057,11 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 
1059 1059
 	/**
1060
-	* Gets all the spotter information sorted by the newest airline
1061
-	*
1062
-	* @return Array the spotter information
1063
-	*
1064
-	*/
1060
+	 * Gets all the spotter information sorted by the newest airline
1061
+	 *
1062
+	 * @return Array the spotter information
1063
+	 *
1064
+	 */
1065 1065
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1066 1066
 	{
1067 1067
 		global $global_query;
@@ -1100,12 +1100,12 @@  discard block
 block discarded – undo
1100 1100
 	}
1101 1101
     
1102 1102
     
1103
-    /**
1104
-	* Gets all the spotter information sorted by the newest departure airport
1105
-	*
1106
-	* @return Array the spotter information
1107
-	*
1108
-	*/
1103
+	/**
1104
+	 * Gets all the spotter information sorted by the newest departure airport
1105
+	 *
1106
+	 * @return Array the spotter information
1107
+	 *
1108
+	 */
1109 1109
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1110 1110
 	{
1111 1111
 		global $global_query;
@@ -1147,11 +1147,11 @@  discard block
 block discarded – undo
1147 1147
 
1148 1148
 
1149 1149
 	/**
1150
-	* Gets all the spotter information sorted by the newest arrival airport
1151
-	*
1152
-	* @return Array the spotter information
1153
-	*
1154
-	*/
1150
+	 * Gets all the spotter information sorted by the newest arrival airport
1151
+	 *
1152
+	 * @return Array the spotter information
1153
+	 *
1154
+	 */
1155 1155
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1156 1156
 	{
1157 1157
 		global $global_query;
@@ -1190,11 +1190,11 @@  discard block
 block discarded – undo
1190 1190
 	
1191 1191
 
1192 1192
 	/**
1193
-	* Gets all the spotter information based on the spotter id
1194
-	*
1195
-	* @return Array the spotter information
1196
-	*
1197
-	*/
1193
+	 * Gets all the spotter information based on the spotter id
1194
+	 *
1195
+	 * @return Array the spotter information
1196
+	 *
1197
+	 */
1198 1198
 	public function getSpotterDataByID($id = '')
1199 1199
 	{
1200 1200
 		global $global_query;
@@ -1216,11 +1216,11 @@  discard block
 block discarded – undo
1216 1216
 	
1217 1217
 	
1218 1218
 	/**
1219
-	* Gets all the spotter information based on the callsign
1220
-	*
1221
-	* @return Array the spotter information
1222
-	*
1223
-	*/
1219
+	 * Gets all the spotter information based on the callsign
1220
+	 *
1221
+	 * @return Array the spotter information
1222
+	 *
1223
+	 */
1224 1224
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1225 1225
 	{
1226 1226
 		global $global_query;
@@ -1271,11 +1271,11 @@  discard block
 block discarded – undo
1271 1271
 	}
1272 1272
 	
1273 1273
 	/**
1274
-	* Gets all the spotter information based on the owner
1275
-	*
1276
-	* @return Array the spotter information
1277
-	*
1278
-	*/
1274
+	 * Gets all the spotter information based on the owner
1275
+	 *
1276
+	 * @return Array the spotter information
1277
+	 *
1278
+	 */
1279 1279
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '')
1280 1280
 	{
1281 1281
 		global $global_query;
@@ -1326,11 +1326,11 @@  discard block
 block discarded – undo
1326 1326
 	}
1327 1327
 	
1328 1328
 	/**
1329
-	* Gets all the spotter information based on the pilot
1330
-	*
1331
-	* @return Array the spotter information
1332
-	*
1333
-	*/
1329
+	 * Gets all the spotter information based on the pilot
1330
+	 *
1331
+	 * @return Array the spotter information
1332
+	 *
1333
+	 */
1334 1334
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '')
1335 1335
 	{
1336 1336
 		global $global_query;
@@ -1378,11 +1378,11 @@  discard block
 block discarded – undo
1378 1378
 	
1379 1379
 	
1380 1380
 	/**
1381
-	* Gets all the spotter information based on the aircraft type
1382
-	*
1383
-	* @return Array the spotter information
1384
-	*
1385
-	*/
1381
+	 * Gets all the spotter information based on the aircraft type
1382
+	 *
1383
+	 * @return Array the spotter information
1384
+	 *
1385
+	 */
1386 1386
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1387 1387
 	{
1388 1388
 		global $global_query;
@@ -1436,11 +1436,11 @@  discard block
 block discarded – undo
1436 1436
 	
1437 1437
 	
1438 1438
 	/**
1439
-	* Gets all the spotter information based on the aircraft registration
1440
-	*
1441
-	* @return Array the spotter information
1442
-	*
1443
-	*/
1439
+	 * Gets all the spotter information based on the aircraft registration
1440
+	 *
1441
+	 * @return Array the spotter information
1442
+	 *
1443
+	 */
1444 1444
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1445 1445
 	{
1446 1446
 		global $global_query;
@@ -1497,11 +1497,11 @@  discard block
 block discarded – undo
1497 1497
 	
1498 1498
 	
1499 1499
 	/**
1500
-	* Gets all the spotter information based on the airline
1501
-	*
1502
-	* @return Array the spotter information
1503
-	*
1504
-	*/
1500
+	 * Gets all the spotter information based on the airline
1501
+	 *
1502
+	 * @return Array the spotter information
1503
+	 *
1504
+	 */
1505 1505
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1506 1506
 	{
1507 1507
 		global $global_query;
@@ -1554,11 +1554,11 @@  discard block
 block discarded – undo
1554 1554
 	
1555 1555
 	
1556 1556
 	/**
1557
-	* Gets all the spotter information based on the airport
1558
-	*
1559
-	* @return Array the spotter information
1560
-	*
1561
-	*/
1557
+	 * Gets all the spotter information based on the airport
1558
+	 *
1559
+	 * @return Array the spotter information
1560
+	 *
1561
+	 */
1562 1562
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1563 1563
 	{
1564 1564
 		global $global_query;
@@ -1612,11 +1612,11 @@  discard block
 block discarded – undo
1612 1612
 
1613 1613
 
1614 1614
 	/**
1615
-	* Gets all the spotter information based on the date
1616
-	*
1617
-	* @return Array the spotter information
1618
-	*
1619
-	*/
1615
+	 * Gets all the spotter information based on the date
1616
+	 *
1617
+	 * @return Array the spotter information
1618
+	 *
1619
+	 */
1620 1620
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1621 1621
 	{
1622 1622
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1680,11 +1680,11 @@  discard block
 block discarded – undo
1680 1680
 
1681 1681
 
1682 1682
 	/**
1683
-	* Gets all the spotter information based on the country name
1684
-	*
1685
-	* @return Array the spotter information
1686
-	*
1687
-	*/
1683
+	 * Gets all the spotter information based on the country name
1684
+	 *
1685
+	 * @return Array the spotter information
1686
+	 *
1687
+	 */
1688 1688
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1689 1689
 	{
1690 1690
 		global $global_query;
@@ -1738,11 +1738,11 @@  discard block
 block discarded – undo
1738 1738
 	
1739 1739
 	
1740 1740
 	/**
1741
-	* Gets all the spotter information based on the manufacturer name
1742
-	*
1743
-	* @return Array the spotter information
1744
-	*
1745
-	*/
1741
+	 * Gets all the spotter information based on the manufacturer name
1742
+	 *
1743
+	 * @return Array the spotter information
1744
+	 *
1745
+	 */
1746 1746
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1747 1747
 	{
1748 1748
 		global $global_query;
@@ -1798,13 +1798,13 @@  discard block
 block discarded – undo
1798 1798
   
1799 1799
   
1800 1800
 	/**
1801
-	* Gets a list of all aircraft that take a route
1802
-	*
1803
-	* @param String $departure_airport_icao ICAO code of departure airport
1804
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1805
-	* @return Array the spotter information
1806
-	*
1807
-	*/
1801
+	 * Gets a list of all aircraft that take a route
1802
+	 *
1803
+	 * @param String $departure_airport_icao ICAO code of departure airport
1804
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1805
+	 * @return Array the spotter information
1806
+	 *
1807
+	 */
1808 1808
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1809 1809
 	{
1810 1810
 		global $global_query;
@@ -1873,11 +1873,11 @@  discard block
 block discarded – undo
1873 1873
 	
1874 1874
 	
1875 1875
 	/**
1876
-	* Gets all the spotter information based on the special column in the table
1877
-	*
1878
-	* @return Array the spotter information
1879
-	*
1880
-	*/
1876
+	 * Gets all the spotter information based on the special column in the table
1877
+	 *
1878
+	 * @return Array the spotter information
1879
+	 *
1880
+	 */
1881 1881
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1882 1882
 	{
1883 1883
 		global $global_query;
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
 	}
1917 1917
 
1918 1918
 	/**
1919
-	* Gets all the highlight based on a aircraft registration
1920
-	*
1921
-	* @return String the highlight text
1922
-	*
1923
-	*/
1919
+	 * Gets all the highlight based on a aircraft registration
1920
+	 *
1921
+	 * @return String the highlight text
1922
+	 *
1923
+	 */
1924 1924
 	public function getHighlightByRegistration($registration,$filter = array())
1925 1925
 	{
1926 1926
 		global $global_query;
@@ -1942,13 +1942,13 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
 	
1944 1944
 	/**
1945
-	* Gets the squawk usage from squawk code
1946
-	*
1947
-	* @param String $squawk squawk code
1948
-	* @param String $country country
1949
-	* @return String usage
1950
-	*
1951
-	*/
1945
+	 * Gets the squawk usage from squawk code
1946
+	 *
1947
+	 * @param String $squawk squawk code
1948
+	 * @param String $country country
1949
+	 * @return String usage
1950
+	 *
1951
+	 */
1952 1952
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1953 1953
 	{
1954 1954
 		
@@ -1969,12 +1969,12 @@  discard block
 block discarded – undo
1969 1969
 	}
1970 1970
 
1971 1971
 	/**
1972
-	* Gets the airport icao from the iata
1973
-	*
1974
-	* @param String $airport_iata the iata code of the airport
1975
-	* @return String airport iata
1976
-	*
1977
-	*/
1972
+	 * Gets the airport icao from the iata
1973
+	 *
1974
+	 * @param String $airport_iata the iata code of the airport
1975
+	 * @return String airport iata
1976
+	 *
1977
+	 */
1978 1978
 	public function getAirportIcao($airport_iata = '')
1979 1979
 	{
1980 1980
 		
@@ -1994,14 +1994,14 @@  discard block
 block discarded – undo
1994 1994
 	}
1995 1995
 
1996 1996
 	/**
1997
-	* Gets the airport distance
1998
-	*
1999
-	* @param String $airport_icao the icao code of the airport
2000
-	* @param Float $latitude the latitude
2001
-	* @param Float $longitude the longitude
2002
-	* @return Float distance to the airport
2003
-	*
2004
-	*/
1997
+	 * Gets the airport distance
1998
+	 *
1999
+	 * @param String $airport_icao the icao code of the airport
2000
+	 * @param Float $latitude the latitude
2001
+	 * @param Float $longitude the longitude
2002
+	 * @return Float distance to the airport
2003
+	 *
2004
+	 */
2005 2005
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2006 2006
 	{
2007 2007
 		
@@ -2022,12 +2022,12 @@  discard block
 block discarded – undo
2022 2022
 	}
2023 2023
 	
2024 2024
 	/**
2025
-	* Gets the airport info based on the icao
2026
-	*
2027
-	* @param String $airport the icao code of the airport
2028
-	* @return Array airport information
2029
-	*
2030
-	*/
2025
+	 * Gets the airport info based on the icao
2026
+	 *
2027
+	 * @param String $airport the icao code of the airport
2028
+	 * @return Array airport information
2029
+	 *
2030
+	 */
2031 2031
 	public function getAllAirportInfo($airport = '')
2032 2032
 	{
2033 2033
 		
@@ -2073,12 +2073,12 @@  discard block
 block discarded – undo
2073 2073
 	}
2074 2074
 	
2075 2075
 	/**
2076
-	* Gets the airport info based on the country
2077
-	*
2078
-	* @param Array $countries Airports countries
2079
-	* @return Array airport information
2080
-	*
2081
-	*/
2076
+	 * Gets the airport info based on the country
2077
+	 *
2078
+	 * @param Array $countries Airports countries
2079
+	 * @return Array airport information
2080
+	 *
2081
+	 */
2082 2082
 	public function getAllAirportInfobyCountry($countries)
2083 2083
 	{
2084 2084
 		$lst_countries = '';
@@ -2116,12 +2116,12 @@  discard block
 block discarded – undo
2116 2116
 	}
2117 2117
 	
2118 2118
 	/**
2119
-	* Gets airports info based on the coord
2120
-	*
2121
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2122
-	* @return Array airport information
2123
-	*
2124
-	*/
2119
+	 * Gets airports info based on the coord
2120
+	 *
2121
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2122
+	 * @return Array airport information
2123
+	 *
2124
+	 */
2125 2125
 	public function getAllAirportInfobyCoord($coord)
2126 2126
 	{
2127 2127
 		global $globalDBdriver;
@@ -2152,12 +2152,12 @@  discard block
 block discarded – undo
2152 2152
 	}
2153 2153
 
2154 2154
 	/**
2155
-	* Gets waypoints info based on the coord
2156
-	*
2157
-	* @param Array $coord waypoints coord
2158
-	* @return Array airport information
2159
-	*
2160
-	*/
2155
+	 * Gets waypoints info based on the coord
2156
+	 *
2157
+	 * @param Array $coord waypoints coord
2158
+	 * @return Array airport information
2159
+	 *
2160
+	 */
2161 2161
 	public function getAllWaypointsInfobyCoord($coord)
2162 2162
 	{
2163 2163
 		if (is_array($coord)) {
@@ -2191,12 +2191,12 @@  discard block
 block discarded – undo
2191 2191
 	
2192 2192
 	
2193 2193
 	/**
2194
-	* Gets the airline info based on the icao code or iata code
2195
-	*
2196
-	* @param String $airline_icao the iata code of the airport
2197
-	* @return Array airport information
2198
-	*
2199
-	*/
2194
+	 * Gets the airline info based on the icao code or iata code
2195
+	 *
2196
+	 * @param String $airline_icao the iata code of the airport
2197
+	 * @return Array airport information
2198
+	 *
2199
+	 */
2200 2200
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2201 2201
 	{
2202 2202
 		global $globalUseRealAirlines;
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
 			} else {
2228 2228
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2229 2229
 			}
2230
-                        /*
2230
+						/*
2231 2231
 			$airline_array = array();
2232 2232
 			$temp_array = array();
2233 2233
 		
@@ -2260,12 +2260,12 @@  discard block
 block discarded – undo
2260 2260
 	}
2261 2261
 	
2262 2262
 	/**
2263
-	* Gets the airline info based on the airline name
2264
-	*
2265
-	* @param String $airline_name the name of the airline
2266
-	* @return Array airline information
2267
-	*
2268
-	*/
2263
+	 * Gets the airline info based on the airline name
2264
+	 *
2265
+	 * @param String $airline_name the name of the airline
2266
+	 * @return Array airline information
2267
+	 *
2268
+	 */
2269 2269
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2270 2270
 	{
2271 2271
 		global $globalUseRealAirlines;
@@ -2293,12 +2293,12 @@  discard block
 block discarded – undo
2293 2293
 	
2294 2294
 	
2295 2295
 	/**
2296
-	* Gets the aircraft info based on the aircraft type
2297
-	*
2298
-	* @param String $aircraft_type the aircraft type
2299
-	* @return Array aircraft information
2300
-	*
2301
-	*/
2296
+	 * Gets the aircraft info based on the aircraft type
2297
+	 *
2298
+	 * @param String $aircraft_type the aircraft type
2299
+	 * @return Array aircraft information
2300
+	 *
2301
+	 */
2302 2302
 	public function getAllAircraftInfo($aircraft_type)
2303 2303
 	{
2304 2304
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2330,12 +2330,12 @@  discard block
 block discarded – undo
2330 2330
 	}
2331 2331
 
2332 2332
 	/**
2333
-	* Gets the aircraft icao based on the aircraft name/type
2334
-	*
2335
-	* @param String $aircraft_type the aircraft type
2336
-	* @return String aircraft information
2337
-	*
2338
-	*/
2333
+	 * Gets the aircraft icao based on the aircraft name/type
2334
+	 *
2335
+	 * @param String $aircraft_type the aircraft type
2336
+	 * @return String aircraft information
2337
+	 *
2338
+	 */
2339 2339
 	public function getAircraftIcao($aircraft_type)
2340 2340
 	{
2341 2341
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2360,12 +2360,12 @@  discard block
 block discarded – undo
2360 2360
 	}
2361 2361
 	
2362 2362
 	/**
2363
-	* Gets the aircraft info based on the aircraft modes
2364
-	*
2365
-	* @param String $aircraft_modes the aircraft ident (hex)
2366
-	* @return String aircraft type
2367
-	*
2368
-	*/
2363
+	 * Gets the aircraft info based on the aircraft modes
2364
+	 *
2365
+	 * @param String $aircraft_modes the aircraft ident (hex)
2366
+	 * @return String aircraft type
2367
+	 *
2368
+	 */
2369 2369
 	public function getAllAircraftType($aircraft_modes)
2370 2370
 	{
2371 2371
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2385,12 +2385,12 @@  discard block
 block discarded – undo
2385 2385
 	}
2386 2386
 
2387 2387
 	/**
2388
-	* Gets the aircraft info based on the aircraft registration
2389
-	*
2390
-	* @param String $registration the aircraft registration
2391
-	* @return String aircraft type
2392
-	*
2393
-	*/
2388
+	 * Gets the aircraft info based on the aircraft registration
2389
+	 *
2390
+	 * @param String $registration the aircraft registration
2391
+	 * @return String aircraft type
2392
+	 *
2393
+	 */
2394 2394
 	public function getAllAircraftTypeByRegistration($registration)
2395 2395
 	{
2396 2396
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2408,12 +2408,12 @@  discard block
 block discarded – undo
2408 2408
 	}
2409 2409
 
2410 2410
 	/**
2411
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2412
-	*
2413
-	* @param String $registration the aircraft registration
2414
-	* @return Array spotter_id and flightaware_id
2415
-	*
2416
-	*/
2411
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2412
+	 *
2413
+	 * @param String $registration the aircraft registration
2414
+	 * @return Array spotter_id and flightaware_id
2415
+	 *
2416
+	 */
2417 2417
 	public function getAllIDByRegistration($registration)
2418 2418
 	{
2419 2419
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2432,12 +2432,12 @@  discard block
 block discarded – undo
2432 2432
 	}
2433 2433
 
2434 2434
 	/**
2435
-	* Gets correct aircraft operator code
2436
-	*
2437
-	* @param String $operator the aircraft operator code (callsign)
2438
-	* @return String aircraft operator code
2439
-	*
2440
-	*/
2435
+	 * Gets correct aircraft operator code
2436
+	 *
2437
+	 * @param String $operator the aircraft operator code (callsign)
2438
+	 * @return String aircraft operator code
2439
+	 *
2440
+	 */
2441 2441
 	public function getOperator($operator)
2442 2442
 	{
2443 2443
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2454,16 +2454,16 @@  discard block
 block discarded – undo
2454 2454
 	}
2455 2455
 
2456 2456
 	/**
2457
-	* Gets the aircraft route based on the aircraft callsign
2458
-	*
2459
-	* @param String $callsign the aircraft callsign
2460
-	* @return Array aircraft type
2461
-	*
2462
-	*/
2457
+	 * Gets the aircraft route based on the aircraft callsign
2458
+	 *
2459
+	 * @param String $callsign the aircraft callsign
2460
+	 * @return Array aircraft type
2461
+	 *
2462
+	 */
2463 2463
 	public function getRouteInfo($callsign)
2464 2464
 	{
2465 2465
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2466
-                if ($callsign == '') return array();
2466
+				if ($callsign == '') return array();
2467 2467
 		$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";
2468 2468
 		
2469 2469
 		$sth = $this->db->prepare($query);
@@ -2477,12 +2477,12 @@  discard block
 block discarded – undo
2477 2477
 	}
2478 2478
 	
2479 2479
 	/**
2480
-	* Gets the aircraft info based on the aircraft registration
2481
-	*
2482
-	* @param String $registration the aircraft registration
2483
-	* @return Array aircraft information
2484
-	*
2485
-	*/
2480
+	 * Gets the aircraft info based on the aircraft registration
2481
+	 *
2482
+	 * @param String $registration the aircraft registration
2483
+	 * @return Array aircraft information
2484
+	 *
2485
+	 */
2486 2486
 	public function getAircraftInfoByRegistration($registration)
2487 2487
 	{
2488 2488
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2509,12 +2509,12 @@  discard block
 block discarded – undo
2509 2509
 	}
2510 2510
 	
2511 2511
 	/**
2512
-	* Gets the aircraft owner & base based on the aircraft registration
2513
-	*
2514
-	* @param String $registration the aircraft registration
2515
-	* @return Array aircraft information
2516
-	*
2517
-	*/
2512
+	 * Gets the aircraft owner & base based on the aircraft registration
2513
+	 *
2514
+	 * @param String $registration the aircraft registration
2515
+	 * @return Array aircraft information
2516
+	 *
2517
+	 */
2518 2518
 	public function getAircraftOwnerByRegistration($registration)
2519 2519
 	{
2520 2520
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2531,11 +2531,11 @@  discard block
 block discarded – undo
2531 2531
 	
2532 2532
   
2533 2533
   /**
2534
-	* Gets all flights (but with only little info)
2535
-	*
2536
-	* @return Array basic flight information
2537
-	*
2538
-	*/
2534
+   * Gets all flights (but with only little info)
2535
+   *
2536
+   * @return Array basic flight information
2537
+   *
2538
+   */
2539 2539
 	public function getAllFlightsforSitemap()
2540 2540
 	{
2541 2541
 		//$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 ";
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
 		
2544 2544
 		$sth = $this->db->prepare($query);
2545 2545
 		$sth->execute();
2546
-                  /*
2546
+				  /*
2547 2547
 		$flight_array = array();
2548 2548
 		$temp_array = array();
2549 2549
 		
@@ -2565,11 +2565,11 @@  discard block
 block discarded – undo
2565 2565
 	}
2566 2566
   
2567 2567
 	/**
2568
-	* Gets a list of all aircraft manufacturers
2569
-	*
2570
-	* @return Array list of aircraft types
2571
-	*
2572
-	*/
2568
+	 * Gets a list of all aircraft manufacturers
2569
+	 *
2570
+	 * @return Array list of aircraft types
2571
+	 *
2572
+	 */
2573 2573
 	public function getAllManufacturers()
2574 2574
 	{
2575 2575
 		/*
@@ -2598,11 +2598,11 @@  discard block
 block discarded – undo
2598 2598
   
2599 2599
   
2600 2600
   /**
2601
-	* Gets a list of all aircraft types
2602
-	*
2603
-	* @return Array list of aircraft types
2604
-	*
2605
-	*/
2601
+   * Gets a list of all aircraft types
2602
+   *
2603
+   * @return Array list of aircraft types
2604
+   *
2605
+   */
2606 2606
 	public function getAllAircraftTypes($filters = array())
2607 2607
 	{
2608 2608
 		/*
@@ -2637,11 +2637,11 @@  discard block
 block discarded – undo
2637 2637
 	
2638 2638
 	
2639 2639
 	/**
2640
-	* Gets a list of all aircraft registrations
2641
-	*
2642
-	* @return Array list of aircraft registrations
2643
-	*
2644
-	*/
2640
+	 * Gets a list of all aircraft registrations
2641
+	 *
2642
+	 * @return Array list of aircraft registrations
2643
+	 *
2644
+	 */
2645 2645
 	public function getAllAircraftRegistrations($filters = array())
2646 2646
 	{
2647 2647
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2666,12 +2666,12 @@  discard block
 block discarded – undo
2666 2666
 	}
2667 2667
 
2668 2668
 	/**
2669
-	* Gets all source name
2670
-	*
2671
-	* @param String type format of source
2672
-	* @return Array list of source name
2673
-	*
2674
-	*/
2669
+	 * Gets all source name
2670
+	 *
2671
+	 * @param String type format of source
2672
+	 * @return Array list of source name
2673
+	 *
2674
+	 */
2675 2675
 	public function getAllSourceName($type = '',$filters = array())
2676 2676
 	{
2677 2677
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 
2703 2703
 
2704 2704
 	/**
2705
-	* Gets a list of all airline names
2706
-	*
2707
-	* @return Array list of airline names
2708
-	*
2709
-	*/
2705
+	 * Gets a list of all airline names
2706
+	 *
2707
+	 * @return Array list of airline names
2708
+	 *
2709
+	 */
2710 2710
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2711 2711
 	{
2712 2712
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2755,11 +2755,11 @@  discard block
 block discarded – undo
2755 2755
 	}
2756 2756
 	
2757 2757
 	/**
2758
-	* Gets a list of all alliance names
2759
-	*
2760
-	* @return Array list of alliance names
2761
-	*
2762
-	*/
2758
+	 * Gets a list of all alliance names
2759
+	 *
2760
+	 * @return Array list of alliance names
2761
+	 *
2762
+	 */
2763 2763
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2764 2764
 	{
2765 2765
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2784,11 +2784,11 @@  discard block
 block discarded – undo
2784 2784
 	}
2785 2785
 	
2786 2786
 	/**
2787
-	* Gets a list of all airline countries
2788
-	*
2789
-	* @return Array list of airline countries
2790
-	*
2791
-	*/
2787
+	 * Gets a list of all airline countries
2788
+	 *
2789
+	 * @return Array list of airline countries
2790
+	 *
2791
+	 */
2792 2792
 	public function getAllAirlineCountries($filters = array())
2793 2793
 	{
2794 2794
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2816,11 +2816,11 @@  discard block
 block discarded – undo
2816 2816
 	
2817 2817
 	
2818 2818
 	/**
2819
-	* Gets a list of all departure & arrival names
2820
-	*
2821
-	* @return Array list of airport names
2822
-	*
2823
-	*/
2819
+	 * Gets a list of all departure & arrival names
2820
+	 *
2821
+	 * @return Array list of airport names
2822
+	 *
2823
+	 */
2824 2824
 	public function getAllAirportNames($filters = array())
2825 2825
 	{
2826 2826
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2868,11 +2868,11 @@  discard block
 block discarded – undo
2868 2868
 	} 
2869 2869
 
2870 2870
 	/**
2871
-	* Gets a list of all owner names
2872
-	*
2873
-	* @return Array list of owner names
2874
-	*
2875
-	*/
2871
+	 * Gets a list of all owner names
2872
+	 *
2873
+	 * @return Array list of owner names
2874
+	 *
2875
+	 */
2876 2876
 	public function getAllOwnerNames($filters = array())
2877 2877
 	{
2878 2878
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2886,11 +2886,11 @@  discard block
 block discarded – undo
2886 2886
 	} 
2887 2887
 
2888 2888
 	/**
2889
-	* Gets a list of all pilot names and pilot ids
2890
-	*
2891
-	* @return Array list of pilot names and pilot ids
2892
-	*
2893
-	*/
2889
+	 * Gets a list of all pilot names and pilot ids
2890
+	 *
2891
+	 * @return Array list of pilot names and pilot ids
2892
+	 *
2893
+	 */
2894 2894
 	public function getAllPilotNames($filters = array())
2895 2895
 	{
2896 2896
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2905,11 +2905,11 @@  discard block
 block discarded – undo
2905 2905
 	
2906 2906
 	
2907 2907
 	/**
2908
-	* Gets a list of all departure & arrival airport countries
2909
-	*
2910
-	* @return Array list of airport countries
2911
-	*
2912
-	*/
2908
+	 * Gets a list of all departure & arrival airport countries
2909
+	 *
2910
+	 * @return Array list of airport countries
2911
+	 *
2912
+	 */
2913 2913
 	public function getAllAirportCountries($filters = array())
2914 2914
 	{
2915 2915
 		$airport_array = array();
@@ -2957,11 +2957,11 @@  discard block
 block discarded – undo
2957 2957
 	
2958 2958
 	
2959 2959
 	/**
2960
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2961
-	*
2962
-	* @return Array list of countries
2963
-	*
2964
-	*/
2960
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2961
+	 *
2962
+	 * @return Array list of countries
2963
+	 *
2964
+	 */
2965 2965
 	public function getAllCountries($filters = array())
2966 2966
 	{
2967 2967
 		$Connection= new Connection($this->db);
@@ -3038,11 +3038,11 @@  discard block
 block discarded – undo
3038 3038
 	
3039 3039
 	
3040 3040
 	/**
3041
-	* Gets a list of all idents/callsigns
3042
-	*
3043
-	* @return Array list of ident/callsign names
3044
-	*
3045
-	*/
3041
+	 * Gets a list of all idents/callsigns
3042
+	 *
3043
+	 * @return Array list of ident/callsign names
3044
+	 *
3045
+	 */
3046 3046
 	public function getAllIdents($filters = array())
3047 3047
 	{
3048 3048
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3066,9 +3066,9 @@  discard block
 block discarded – undo
3066 3066
 	}
3067 3067
 
3068 3068
 	/**
3069
-	* Get a list of flights from airport since 7 days
3070
-	* @return Array number, icao, name and city of airports
3071
-	*/
3069
+	 * Get a list of flights from airport since 7 days
3070
+	 * @return Array number, icao, name and city of airports
3071
+	 */
3072 3072
 
3073 3073
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3074 3074
 		global $globalTimezone, $globalDBdriver;
@@ -3099,9 +3099,9 @@  discard block
 block discarded – undo
3099 3099
 	}
3100 3100
 
3101 3101
 	/**
3102
-	* Get a list of flights from airport since 7 days
3103
-	* @return Array number, icao, name and city of airports
3104
-	*/
3102
+	 * Get a list of flights from airport since 7 days
3103
+	 * @return Array number, icao, name and city of airports
3104
+	 */
3105 3105
 
3106 3106
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3107 3107
 		global $globalTimezone, $globalDBdriver;
@@ -3131,9 +3131,9 @@  discard block
 block discarded – undo
3131 3131
 	}
3132 3132
 
3133 3133
 	/**
3134
-	* Get a list of flights from detected airport since 7 days
3135
-	* @return Array number, icao, name and city of airports
3136
-	*/
3134
+	 * Get a list of flights from detected airport since 7 days
3135
+	 * @return Array number, icao, name and city of airports
3136
+	 */
3137 3137
 
3138 3138
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3139 3139
 		global $globalTimezone, $globalDBdriver;
@@ -3171,9 +3171,9 @@  discard block
 block discarded – undo
3171 3171
 	}
3172 3172
 
3173 3173
 	/**
3174
-	* Get a list of flights from detected airport since 7 days
3175
-	* @return Array number, icao, name and city of airports
3176
-	*/
3174
+	 * Get a list of flights from detected airport since 7 days
3175
+	 * @return Array number, icao, name and city of airports
3176
+	 */
3177 3177
 
3178 3178
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3179 3179
 		global $globalTimezone, $globalDBdriver;
@@ -3215,9 +3215,9 @@  discard block
 block discarded – undo
3215 3215
 
3216 3216
 
3217 3217
 	/**
3218
-	* Get a list of flights to airport since 7 days
3219
-	* @return Array number, icao, name and city of airports
3220
-	*/
3218
+	 * Get a list of flights to airport since 7 days
3219
+	 * @return Array number, icao, name and city of airports
3220
+	 */
3221 3221
 
3222 3222
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3223 3223
 		global $globalTimezone, $globalDBdriver;
@@ -3250,9 +3250,9 @@  discard block
 block discarded – undo
3250 3250
 
3251 3251
 
3252 3252
 	/**
3253
-	* Get a list of flights detected to airport since 7 days
3254
-	* @return Array number, icao, name and city of airports
3255
-	*/
3253
+	 * Get a list of flights detected to airport since 7 days
3254
+	 * @return Array number, icao, name and city of airports
3255
+	 */
3256 3256
 
3257 3257
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3258 3258
 		global $globalTimezone, $globalDBdriver;
@@ -3293,9 +3293,9 @@  discard block
 block discarded – undo
3293 3293
 
3294 3294
 
3295 3295
 	/**
3296
-	* Get a list of flights to airport since 7 days
3297
-	* @return Array number, icao, name and city of airports
3298
-	*/
3296
+	 * Get a list of flights to airport since 7 days
3297
+	 * @return Array number, icao, name and city of airports
3298
+	 */
3299 3299
 
3300 3300
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3301 3301
 		global $globalTimezone, $globalDBdriver;
@@ -3327,9 +3327,9 @@  discard block
 block discarded – undo
3327 3327
 
3328 3328
 
3329 3329
 	/**
3330
-	* Get a list of flights detected to airport since 7 days
3331
-	* @return Array number, icao, name and city of airports
3332
-	*/
3330
+	 * Get a list of flights detected to airport since 7 days
3331
+	 * @return Array number, icao, name and city of airports
3332
+	 */
3333 3333
 
3334 3334
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3335 3335
 		global $globalTimezone, $globalDBdriver;
@@ -3373,11 +3373,11 @@  discard block
 block discarded – undo
3373 3373
 
3374 3374
 
3375 3375
 	/**
3376
-	* Gets a list of all dates
3377
-	*
3378
-	* @return Array list of date names
3379
-	*
3380
-	*/
3376
+	 * Gets a list of all dates
3377
+	 *
3378
+	 * @return Array list of date names
3379
+	 *
3380
+	 */
3381 3381
 	public function getAllDates()
3382 3382
 	{
3383 3383
 		global $globalTimezone, $globalDBdriver;
@@ -3418,11 +3418,11 @@  discard block
 block discarded – undo
3418 3418
 	
3419 3419
 	
3420 3420
 	/**
3421
-	* Gets all route combinations
3422
-	*
3423
-	* @return Array the route list
3424
-	*
3425
-	*/
3421
+	 * Gets all route combinations
3422
+	 *
3423
+	 * @return Array the route list
3424
+	 *
3425
+	 */
3426 3426
 	public function getAllRoutes()
3427 3427
 	{
3428 3428
 		$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 
@@ -3448,13 +3448,13 @@  discard block
 block discarded – undo
3448 3448
 	}
3449 3449
 
3450 3450
 	/**
3451
-	* Update ident spotter data
3452
-	*
3453
-	* @param String $flightaware_id the ID from flightaware
3454
-	* @param String $ident the flight ident
3455
-	* @return String success or false
3456
-	*
3457
-	*/	
3451
+	 * Update ident spotter data
3452
+	 *
3453
+	 * @param String $flightaware_id the ID from flightaware
3454
+	 * @param String $ident the flight ident
3455
+	 * @return String success or false
3456
+	 *
3457
+	 */	
3458 3458
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3459 3459
 	{
3460 3460
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3475,14 +3475,14 @@  discard block
 block discarded – undo
3475 3475
 		} else {
3476 3476
 			$airline_array = $this->getAllAirlineInfo("NA");
3477 3477
 		}
3478
-                $airline_name = $airline_array[0]['name'];
3479
-                $airline_icao = $airline_array[0]['icao'];
3480
-                $airline_country = $airline_array[0]['country'];
3481
-                $airline_type = $airline_array[0]['type'];
3478
+				$airline_name = $airline_array[0]['name'];
3479
+				$airline_icao = $airline_array[0]['icao'];
3480
+				$airline_country = $airline_array[0]['country'];
3481
+				$airline_type = $airline_array[0]['type'];
3482 3482
 
3483 3483
 
3484 3484
 		$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';
3485
-                $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);
3485
+				$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);
3486 3486
 
3487 3487
 		try {
3488 3488
 			$sth = $this->db->prepare($query);
@@ -3495,19 +3495,19 @@  discard block
 block discarded – undo
3495 3495
 
3496 3496
 	}
3497 3497
 	/**
3498
-	* Update latest spotter data
3499
-	*
3500
-	* @param String $flightaware_id the ID from flightaware
3501
-	* @param String $ident the flight ident
3502
-	* @param String $arrival_airport_icao the arrival airport
3503
-	* @return String success or false
3504
-	*
3505
-	*/	
3498
+	 * Update latest spotter data
3499
+	 *
3500
+	 * @param String $flightaware_id the ID from flightaware
3501
+	 * @param String $ident the flight ident
3502
+	 * @param String $arrival_airport_icao the arrival airport
3503
+	 * @return String success or false
3504
+	 *
3505
+	 */	
3506 3506
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3507 3507
 	{
3508 3508
 		if ($groundspeed == '') $groundspeed = NULL;
3509 3509
 		$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';
3510
-                $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);
3510
+				$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);
3511 3511
 
3512 3512
 		try {
3513 3513
 			$sth = $this->db->prepare($query);
@@ -3521,32 +3521,32 @@  discard block
 block discarded – undo
3521 3521
 	}
3522 3522
 
3523 3523
 	/**
3524
-	* Adds a new spotter data
3525
-	*
3526
-	* @param String $flightaware_id the ID from flightaware
3527
-	* @param String $ident the flight ident
3528
-	* @param String $aircraft_icao the aircraft type
3529
-	* @param String $departure_airport_icao the departure airport
3530
-	* @param String $arrival_airport_icao the arrival airport
3531
-	* @param String $latitude latitude of flight
3532
-	* @param String $longitude latitude of flight
3533
-	* @param String $waypoints waypoints of flight
3534
-	* @param String $altitude altitude of flight
3535
-	* @param String $heading heading of flight
3536
-	* @param String $groundspeed speed of flight
3537
-	* @param String $date date of flight
3538
-	* @param String $departure_airport_time departure time of flight
3539
-	* @param String $arrival_airport_time arrival time of flight
3540
-	* @param String $squawk squawk code of flight
3541
-	* @param String $route_stop route stop of flight
3542
-	* @param String $highlight highlight or not
3543
-	* @param String $ModeS ModesS code of flight
3544
-	* @param String $registration registration code of flight
3545
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3546
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3547
-	* @param String $verticalrate vertival rate of flight
3548
-	* @return String success or false
3549
-	*/
3524
+	 * Adds a new spotter data
3525
+	 *
3526
+	 * @param String $flightaware_id the ID from flightaware
3527
+	 * @param String $ident the flight ident
3528
+	 * @param String $aircraft_icao the aircraft type
3529
+	 * @param String $departure_airport_icao the departure airport
3530
+	 * @param String $arrival_airport_icao the arrival airport
3531
+	 * @param String $latitude latitude of flight
3532
+	 * @param String $longitude latitude of flight
3533
+	 * @param String $waypoints waypoints of flight
3534
+	 * @param String $altitude altitude of flight
3535
+	 * @param String $heading heading of flight
3536
+	 * @param String $groundspeed speed of flight
3537
+	 * @param String $date date of flight
3538
+	 * @param String $departure_airport_time departure time of flight
3539
+	 * @param String $arrival_airport_time arrival time of flight
3540
+	 * @param String $squawk squawk code of flight
3541
+	 * @param String $route_stop route stop of flight
3542
+	 * @param String $highlight highlight or not
3543
+	 * @param String $ModeS ModesS code of flight
3544
+	 * @param String $registration registration code of flight
3545
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3546
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3547
+	 * @param String $verticalrate vertival rate of flight
3548
+	 * @return String success or false
3549
+	 */
3550 3550
 	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 = '')
3551 3551
 	{
3552 3552
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3761,8 +3761,8 @@  discard block
 block discarded – undo
3761 3761
     
3762 3762
 		if ($globalIVAO && $aircraft_icao != '')
3763 3763
 		{
3764
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3765
-            		else $airline_icao = '';
3764
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3765
+					else $airline_icao = '';
3766 3766
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3767 3767
 			if (!isset($image_array[0]['registration']))
3768 3768
 			{
@@ -3793,53 +3793,53 @@  discard block
 block discarded – undo
3793 3793
 	
3794 3794
 		if (count($airline_array) == 0) 
3795 3795
 		{
3796
-                        $airline_array = $this->getAllAirlineInfo('NA');
3797
-                }
3798
-                if (count($aircraft_array) == 0) 
3799
-                {
3800
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3801
-                }
3802
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3803
-                {
3804
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3805
-                }
3806
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3807
-                {
3808
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3809
-                }
3810
-                if ($registration == '') $registration = 'NA';
3811
-                if ($latitude == '' && $longitude == '') {
3812
-            		$latitude = 0;
3813
-            		$longitude = 0;
3814
-            	}
3815
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3816
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3817
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3818
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3819
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3820
-                $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) 
3796
+						$airline_array = $this->getAllAirlineInfo('NA');
3797
+				}
3798
+				if (count($aircraft_array) == 0) 
3799
+				{
3800
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3801
+				}
3802
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3803
+				{
3804
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3805
+				}
3806
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3807
+				{
3808
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3809
+				}
3810
+				if ($registration == '') $registration = 'NA';
3811
+				if ($latitude == '' && $longitude == '') {
3812
+					$latitude = 0;
3813
+					$longitude = 0;
3814
+				}
3815
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3816
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3817
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3818
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3819
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3820
+				$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) 
3821 3821
                 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)";
3822 3822
 
3823
-                $airline_name = $airline_array[0]['name'];
3824
-                $airline_icao = $airline_array[0]['icao'];
3825
-                $airline_country = $airline_array[0]['country'];
3826
-                $airline_type = $airline_array[0]['type'];
3823
+				$airline_name = $airline_array[0]['name'];
3824
+				$airline_icao = $airline_array[0]['icao'];
3825
+				$airline_country = $airline_array[0]['country'];
3826
+				$airline_type = $airline_array[0]['type'];
3827 3827
 		if ($airline_type == '') {
3828 3828
 			$timeelapsed = microtime(true);
3829 3829
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3830 3830
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3831 3831
 		}
3832 3832
 		if ($airline_type == null) $airline_type = '';
3833
-                $aircraft_type = $aircraft_array[0]['type'];
3834
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3835
-                $departure_airport_name = $departure_airport_array[0]['name'];
3836
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3837
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3833
+				$aircraft_type = $aircraft_array[0]['type'];
3834
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3835
+				$departure_airport_name = $departure_airport_array[0]['name'];
3836
+			$departure_airport_city = $departure_airport_array[0]['city'];
3837
+				$departure_airport_country = $departure_airport_array[0]['country'];
3838 3838
                 
3839
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3840
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3841
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3842
-                $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);
3839
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3840
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3841
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3842
+				$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);
3843 3843
 
3844 3844
 		try {
3845 3845
 		        
@@ -3847,7 +3847,7 @@  discard block
 block discarded – undo
3847 3847
 			$sth->execute($query_values);
3848 3848
 			$this->db = null;
3849 3849
 		} catch (PDOException $e) {
3850
-		    return "error : ".$e->getMessage();
3850
+			return "error : ".$e->getMessage();
3851 3851
 		}
3852 3852
 		
3853 3853
 		return "success";
@@ -3856,11 +3856,11 @@  discard block
 block discarded – undo
3856 3856
 	
3857 3857
   
3858 3858
 	/**
3859
-	* Gets the aircraft ident within the last hour
3860
-	*
3861
-	* @return String the ident
3862
-	*
3863
-	*/
3859
+	 * Gets the aircraft ident within the last hour
3860
+	 *
3861
+	 * @return String the ident
3862
+	 *
3863
+	 */
3864 3864
 	public function getIdentFromLastHour($ident)
3865 3865
 	{
3866 3866
 		global $globalDBdriver, $globalTimezone;
@@ -3876,11 +3876,11 @@  discard block
 block discarded – undo
3876 3876
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3877 3877
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3878 3878
 			$query_data = array(':ident' => $ident);
3879
-    		}
3879
+			}
3880 3880
 		
3881 3881
 		$sth = $this->db->prepare($query);
3882 3882
 		$sth->execute($query_data);
3883
-    		$ident_result='';
3883
+			$ident_result='';
3884 3884
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3885 3885
 		{
3886 3886
 			$ident_result = $row['ident'];
@@ -3891,11 +3891,11 @@  discard block
 block discarded – undo
3891 3891
 	
3892 3892
 	
3893 3893
 	/**
3894
-	* Gets the aircraft data from the last 20 seconds
3895
-	*
3896
-	* @return Array the spotter data
3897
-	*
3898
-	*/
3894
+	 * Gets the aircraft data from the last 20 seconds
3895
+	 *
3896
+	 * @return Array the spotter data
3897
+	 *
3898
+	 */
3899 3899
 	public function getRealTimeData($q = '')
3900 3900
 	{
3901 3901
 		global $globalDBdriver;
@@ -3939,11 +3939,11 @@  discard block
 block discarded – undo
3939 3939
 	
3940 3940
 	
3941 3941
 	 /**
3942
-	* Gets all airlines that have flown over
3943
-	*
3944
-	* @return Array the airline list
3945
-	*
3946
-	*/
3942
+	  * Gets all airlines that have flown over
3943
+	  *
3944
+	  * @return Array the airline list
3945
+	  *
3946
+	  */
3947 3947
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3948 3948
 	{
3949 3949
 		global $globalDBdriver;
@@ -3957,7 +3957,7 @@  discard block
 block discarded – undo
3957 3957
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
3958 3958
 			}
3959 3959
 		}
3960
-                if ($sincedate != '') {
3960
+				if ($sincedate != '') {
3961 3961
 			if ($globalDBdriver == 'mysql') {
3962 3962
 				$query .= " AND spotter_output.date > '".$sincedate."'";
3963 3963
 			} else {
@@ -4011,26 +4011,26 @@  discard block
 block discarded – undo
4011 4011
 	}
4012 4012
 
4013 4013
 	 /**
4014
-	* Gets all pilots that have flown over
4015
-	*
4016
-	* @return Array the pilots list
4017
-	*
4018
-	*/
4014
+	  * Gets all pilots that have flown over
4015
+	  *
4016
+	  * @return Array the pilots list
4017
+	  *
4018
+	  */
4019 4019
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4020 4020
 	{
4021 4021
 		global $globalDBdriver;
4022 4022
 		$filter_query = $this->getFilter($filters,true,true);
4023 4023
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4024 4024
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
4025
-                if ($olderthanmonths > 0) {
4026
-            		if ($globalDBdriver == 'mysql') {
4025
+				if ($olderthanmonths > 0) {
4026
+					if ($globalDBdriver == 'mysql') {
4027 4027
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4028 4028
 			} else {
4029 4029
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4030 4030
 			}
4031 4031
 		}
4032
-                if ($sincedate != '') {
4033
-            		if ($globalDBdriver == 'mysql') {
4032
+				if ($sincedate != '') {
4033
+					if ($globalDBdriver == 'mysql') {
4034 4034
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4035 4035
 			} else {
4036 4036
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4085,25 +4085,25 @@  discard block
 block discarded – undo
4085 4085
 	}
4086 4086
 	
4087 4087
 	/**
4088
-	* Gets all pilots that have flown over
4089
-	*
4090
-	* @return Array the pilots list
4091
-	*
4092
-	*/
4088
+	 * Gets all pilots that have flown over
4089
+	 *
4090
+	 * @return Array the pilots list
4091
+	 *
4092
+	 */
4093 4093
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4094 4094
 	{
4095 4095
 		global $globalDBdriver;
4096 4096
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4097 4097
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4098
-                if ($olderthanmonths > 0) {
4099
-            		if ($globalDBdriver == 'mysql') {
4098
+				if ($olderthanmonths > 0) {
4099
+					if ($globalDBdriver == 'mysql') {
4100 4100
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4101 4101
 			} else {
4102 4102
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4103 4103
 			}
4104 4104
 		}
4105
-                if ($sincedate != '') {
4106
-            		if ($globalDBdriver == 'mysql') {
4105
+				if ($sincedate != '') {
4106
+					if ($globalDBdriver == 'mysql') {
4107 4107
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4108 4108
 			} else {
4109 4109
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4132,26 +4132,26 @@  discard block
 block discarded – undo
4132 4132
 	}
4133 4133
 	
4134 4134
 	 /**
4135
-	* Gets all owner that have flown over
4136
-	*
4137
-	* @return Array the pilots list
4138
-	*
4139
-	*/
4135
+	  * Gets all owner that have flown over
4136
+	  *
4137
+	  * @return Array the pilots list
4138
+	  *
4139
+	  */
4140 4140
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4141 4141
 	{
4142 4142
 		global $globalDBdriver;
4143 4143
 		$filter_query = $this->getFilter($filters,true,true);
4144 4144
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4145 4145
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4146
-                if ($olderthanmonths > 0) {
4147
-            		if ($globalDBdriver == 'mysql') {
4146
+				if ($olderthanmonths > 0) {
4147
+					if ($globalDBdriver == 'mysql') {
4148 4148
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4149 4149
 			} else {
4150 4150
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4151 4151
 			}
4152 4152
 		}
4153
-                if ($sincedate != '') {
4154
-            		if ($globalDBdriver == 'mysql') {
4153
+				if ($sincedate != '') {
4154
+					if ($globalDBdriver == 'mysql') {
4155 4155
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4156 4156
 			} else {
4157 4157
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4202,26 +4202,26 @@  discard block
 block discarded – undo
4202 4202
 	}
4203 4203
 	
4204 4204
 	 /**
4205
-	* Gets all owner that have flown over
4206
-	*
4207
-	* @return Array the pilots list
4208
-	*
4209
-	*/
4205
+	  * Gets all owner that have flown over
4206
+	  *
4207
+	  * @return Array the pilots list
4208
+	  *
4209
+	  */
4210 4210
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4211 4211
 	{
4212 4212
 		global $globalDBdriver;
4213 4213
 		$filter_query = $this->getFilter($filters,true,true);
4214 4214
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4215 4215
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4216
-                if ($olderthanmonths > 0) {
4217
-            		if ($globalDBdriver == 'mysql') {
4216
+				if ($olderthanmonths > 0) {
4217
+					if ($globalDBdriver == 'mysql') {
4218 4218
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4219 4219
 			} else {
4220 4220
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4221 4221
 			}
4222 4222
 		}
4223
-                if ($sincedate != '') {
4224
-            		if ($globalDBdriver == 'mysql') {
4223
+				if ($sincedate != '') {
4224
+					if ($globalDBdriver == 'mysql') {
4225 4225
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4226 4226
 			} else {
4227 4227
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4248,11 +4248,11 @@  discard block
 block discarded – undo
4248 4248
 	}
4249 4249
 
4250 4250
 	/**
4251
-	* Gets all airlines that have flown over by aircraft
4252
-	*
4253
-	* @return Array the airline list
4254
-	*
4255
-	*/
4251
+	 * Gets all airlines that have flown over by aircraft
4252
+	 *
4253
+	 * @return Array the airline list
4254
+	 *
4255
+	 */
4256 4256
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4257 4257
 	{
4258 4258
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4284,11 +4284,11 @@  discard block
 block discarded – undo
4284 4284
 
4285 4285
 
4286 4286
 	/**
4287
-	* Gets all airline countries that have flown over by aircraft
4288
-	*
4289
-	* @return Array the airline country list
4290
-	*
4291
-	*/
4287
+	 * Gets all airline countries that have flown over by aircraft
4288
+	 *
4289
+	 * @return Array the airline country list
4290
+	 *
4291
+	 */
4292 4292
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4293 4293
 	{
4294 4294
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4320,11 +4320,11 @@  discard block
 block discarded – undo
4320 4320
 	
4321 4321
 	
4322 4322
 	/**
4323
-	* Gets all airlines that have flown over by airport
4324
-	*
4325
-	* @return Array the airline list
4326
-	*
4327
-	*/
4323
+	 * Gets all airlines that have flown over by airport
4324
+	 *
4325
+	 * @return Array the airline list
4326
+	 *
4327
+	 */
4328 4328
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4329 4329
 	{
4330 4330
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4355,11 +4355,11 @@  discard block
 block discarded – undo
4355 4355
 
4356 4356
 
4357 4357
 	/**
4358
-	* Gets all airline countries that have flown over by airport icao
4359
-	*
4360
-	* @return Array the airline country list
4361
-	*
4362
-	*/
4358
+	 * Gets all airline countries that have flown over by airport icao
4359
+	 *
4360
+	 * @return Array the airline country list
4361
+	 *
4362
+	 */
4363 4363
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4364 4364
 	{
4365 4365
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4389,11 +4389,11 @@  discard block
 block discarded – undo
4389 4389
 
4390 4390
 
4391 4391
 	/**
4392
-	* Gets all airlines that have flown over by aircraft manufacturer
4393
-	*
4394
-	* @return Array the airline list
4395
-	*
4396
-	*/
4392
+	 * Gets all airlines that have flown over by aircraft manufacturer
4393
+	 *
4394
+	 * @return Array the airline list
4395
+	 *
4396
+	 */
4397 4397
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4398 4398
 	{
4399 4399
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4424,11 +4424,11 @@  discard block
 block discarded – undo
4424 4424
 
4425 4425
 
4426 4426
 	/**
4427
-	* Gets all airline countries that have flown over by aircraft manufacturer
4428
-	*
4429
-	* @return Array the airline country list
4430
-	*
4431
-	*/
4427
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4428
+	 *
4429
+	 * @return Array the airline country list
4430
+	 *
4431
+	 */
4432 4432
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4433 4433
 	{
4434 4434
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4457,11 +4457,11 @@  discard block
 block discarded – undo
4457 4457
 
4458 4458
 
4459 4459
 	/**
4460
-	* Gets all airlines that have flown over by date
4461
-	*
4462
-	* @return Array the airline list
4463
-	*
4464
-	*/
4460
+	 * Gets all airlines that have flown over by date
4461
+	 *
4462
+	 * @return Array the airline list
4463
+	 *
4464
+	 */
4465 4465
 	public function countAllAirlinesByDate($date,$filters = array())
4466 4466
 	{
4467 4467
 		global $globalTimezone, $globalDBdriver;
@@ -4505,11 +4505,11 @@  discard block
 block discarded – undo
4505 4505
 	
4506 4506
 	
4507 4507
 	/**
4508
-	* Gets all airline countries that have flown over by date
4509
-	*
4510
-	* @return Array the airline country list
4511
-	*
4512
-	*/
4508
+	 * Gets all airline countries that have flown over by date
4509
+	 *
4510
+	 * @return Array the airline country list
4511
+	 *
4512
+	 */
4513 4513
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4514 4514
 	{
4515 4515
 		global $globalTimezone, $globalDBdriver;
@@ -4552,11 +4552,11 @@  discard block
 block discarded – undo
4552 4552
 
4553 4553
 
4554 4554
 	/**
4555
-	* Gets all airlines that have flown over by ident/callsign
4556
-	*
4557
-	* @return Array the airline list
4558
-	*
4559
-	*/
4555
+	 * Gets all airlines that have flown over by ident/callsign
4556
+	 *
4557
+	 * @return Array the airline list
4558
+	 *
4559
+	 */
4560 4560
 	public function countAllAirlinesByIdent($ident,$filters = array())
4561 4561
 	{
4562 4562
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4573,11 +4573,11 @@  discard block
 block discarded – undo
4573 4573
 	}
4574 4574
 
4575 4575
 	/**
4576
-	* Gets all airlines by owner
4577
-	*
4578
-	* @return Array the airline list
4579
-	*
4580
-	*/
4576
+	 * Gets all airlines by owner
4577
+	 *
4578
+	 * @return Array the airline list
4579
+	 *
4580
+	 */
4581 4581
 	public function countAllAirlinesByOwner($owner,$filters = array())
4582 4582
 	{
4583 4583
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4594,11 +4594,11 @@  discard block
 block discarded – undo
4594 4594
 	}
4595 4595
 
4596 4596
 	/**
4597
-	* Gets all airlines used by pilot
4598
-	*
4599
-	* @return Array the airline list
4600
-	*
4601
-	*/
4597
+	 * Gets all airlines used by pilot
4598
+	 *
4599
+	 * @return Array the airline list
4600
+	 *
4601
+	 */
4602 4602
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4603 4603
 	{
4604 4604
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4615,11 +4615,11 @@  discard block
 block discarded – undo
4615 4615
 	}
4616 4616
 
4617 4617
 	/**
4618
-	* Gets all airlines that have flown over by route
4619
-	*
4620
-	* @return Array the airline list
4621
-	*
4622
-	*/
4618
+	 * Gets all airlines that have flown over by route
4619
+	 *
4620
+	 * @return Array the airline list
4621
+	 *
4622
+	 */
4623 4623
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4624 4624
 	{
4625 4625
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4651,11 +4651,11 @@  discard block
 block discarded – undo
4651 4651
 	}
4652 4652
 
4653 4653
 	/**
4654
-	* Gets all airline countries that have flown over by route
4655
-	*
4656
-	* @return Array the airline country list
4657
-	*
4658
-	*/
4654
+	 * Gets all airline countries that have flown over by route
4655
+	 *
4656
+	 * @return Array the airline country list
4657
+	 *
4658
+	 */
4659 4659
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4660 4660
 	{
4661 4661
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4687,11 +4687,11 @@  discard block
 block discarded – undo
4687 4687
 
4688 4688
 
4689 4689
 	/**
4690
-	* Gets all airlines that have flown over by country
4691
-	*
4692
-	* @return Array the airline list
4693
-	*
4694
-	*/
4690
+	 * Gets all airlines that have flown over by country
4691
+	 *
4692
+	 * @return Array the airline list
4693
+	 *
4694
+	 */
4695 4695
 	public function countAllAirlinesByCountry($country,$filters = array())
4696 4696
 	{
4697 4697
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4721,11 +4721,11 @@  discard block
 block discarded – undo
4721 4721
 
4722 4722
 
4723 4723
 	/**
4724
-	* Gets all airline countries that have flown over by country
4725
-	*
4726
-	* @return Array the airline country list
4727
-	*
4728
-	*/
4724
+	 * Gets all airline countries that have flown over by country
4725
+	 *
4726
+	 * @return Array the airline country list
4727
+	 *
4728
+	 */
4729 4729
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4730 4730
 	{
4731 4731
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4754,11 +4754,11 @@  discard block
 block discarded – undo
4754 4754
 
4755 4755
 
4756 4756
 	/**
4757
-	* Gets all airlines countries
4758
-	*
4759
-	* @return Array the airline country list
4760
-	*
4761
-	*/
4757
+	 * Gets all airlines countries
4758
+	 *
4759
+	 * @return Array the airline country list
4760
+	 *
4761
+	 */
4762 4762
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4763 4763
 	{
4764 4764
 		global $globalDBdriver;
@@ -4813,11 +4813,11 @@  discard block
 block discarded – undo
4813 4813
 	}
4814 4814
 
4815 4815
 	/**
4816
-	* Gets all number of flight over countries
4817
-	*
4818
-	* @return Array the airline country list
4819
-	*
4820
-	*/
4816
+	 * Gets all number of flight over countries
4817
+	 *
4818
+	 * @return Array the airline country list
4819
+	 *
4820
+	 */
4821 4821
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4822 4822
 	{
4823 4823
 		global $globalDBdriver;
@@ -4839,15 +4839,15 @@  discard block
 block discarded – undo
4839 4839
 		$SpotterLive = new SpotterLive();
4840 4840
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4841 4841
 		$filter_query .= ' over_country IS NOT NULL';
4842
-                if ($olderthanmonths > 0) {
4842
+				if ($olderthanmonths > 0) {
4843 4843
 			if ($globalDBdriver == 'mysql') {
4844 4844
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4845 4845
 			} else {
4846 4846
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4847 4847
 			}
4848 4848
 		}
4849
-                if ($sincedate != '') {
4850
-            		if ($globalDBdriver == 'mysql') {
4849
+				if ($sincedate != '') {
4850
+					if ($globalDBdriver == 'mysql') {
4851 4851
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4852 4852
 			} else {
4853 4853
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4877,11 +4877,11 @@  discard block
 block discarded – undo
4877 4877
 	
4878 4878
 	
4879 4879
 	/**
4880
-	* Gets all aircraft types that have flown over
4881
-	*
4882
-	* @return Array the aircraft list
4883
-	*
4884
-	*/
4880
+	 * Gets all aircraft types that have flown over
4881
+	 *
4882
+	 * @return Array the aircraft list
4883
+	 *
4884
+	 */
4885 4885
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4886 4886
 	{
4887 4887
 		global $globalDBdriver;
@@ -4951,11 +4951,11 @@  discard block
 block discarded – undo
4951 4951
 	}
4952 4952
 
4953 4953
 	/**
4954
-	* Gets all aircraft types that have flown over by airline
4955
-	*
4956
-	* @return Array the aircraft list
4957
-	*
4958
-	*/
4954
+	 * Gets all aircraft types that have flown over by airline
4955
+	 *
4956
+	 * @return Array the aircraft list
4957
+	 *
4958
+	 */
4959 4959
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4960 4960
 	{
4961 4961
 		global $globalDBdriver;
@@ -5026,11 +5026,11 @@  discard block
 block discarded – undo
5026 5026
 	}
5027 5027
 
5028 5028
 	/**
5029
-	* Gets all aircraft types that have flown over by months
5030
-	*
5031
-	* @return Array the aircraft list
5032
-	*
5033
-	*/
5029
+	 * Gets all aircraft types that have flown over by months
5030
+	 *
5031
+	 * @return Array the aircraft list
5032
+	 *
5033
+	 */
5034 5034
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5035 5035
 	{
5036 5036
 		global $globalDBdriver;
@@ -5074,11 +5074,11 @@  discard block
 block discarded – undo
5074 5074
 
5075 5075
 
5076 5076
 	/**
5077
-	* Gets all aircraft registration that have flown over by aircaft icao
5078
-	*
5079
-	* @return Array the aircraft list
5080
-	*
5081
-	*/
5077
+	 * Gets all aircraft registration that have flown over by aircaft icao
5078
+	 *
5079
+	 * @return Array the aircraft list
5080
+	 *
5081
+	 */
5082 5082
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5083 5083
 	{
5084 5084
 		$Image = new Image($this->db);
@@ -5117,11 +5117,11 @@  discard block
 block discarded – undo
5117 5117
 
5118 5118
 
5119 5119
 	/**
5120
-	* Gets all aircraft types that have flown over by airline icao
5121
-	*
5122
-	* @return Array the aircraft list
5123
-	*
5124
-	*/
5120
+	 * Gets all aircraft types that have flown over by airline icao
5121
+	 *
5122
+	 * @return Array the aircraft list
5123
+	 *
5124
+	 */
5125 5125
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5126 5126
 	{
5127 5127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5150,11 +5150,11 @@  discard block
 block discarded – undo
5150 5150
 
5151 5151
 
5152 5152
 	/**
5153
-	* Gets all aircraft registration that have flown over by airline icao
5154
-	*
5155
-	* @return Array the aircraft list
5156
-	*
5157
-	*/
5153
+	 * Gets all aircraft registration that have flown over by airline icao
5154
+	 *
5155
+	 * @return Array the aircraft list
5156
+	 *
5157
+	 */
5158 5158
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5159 5159
 	{
5160 5160
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5192,11 +5192,11 @@  discard block
 block discarded – undo
5192 5192
 
5193 5193
 
5194 5194
 	/**
5195
-	* Gets all aircraft manufacturer that have flown over by airline icao
5196
-	*
5197
-	* @return Array the aircraft list
5198
-	*
5199
-	*/
5195
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5196
+	 *
5197
+	 * @return Array the aircraft list
5198
+	 *
5199
+	 */
5200 5200
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5201 5201
 	{
5202 5202
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5224,11 +5224,11 @@  discard block
 block discarded – undo
5224 5224
 
5225 5225
 
5226 5226
 	/**
5227
-	* Gets all aircraft types that have flown over by airline icao
5228
-	*
5229
-	* @return Array the aircraft list
5230
-	*
5231
-	*/
5227
+	 * Gets all aircraft types that have flown over by airline icao
5228
+	 *
5229
+	 * @return Array the aircraft list
5230
+	 *
5231
+	 */
5232 5232
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5233 5233
 	{
5234 5234
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5257,11 +5257,11 @@  discard block
 block discarded – undo
5257 5257
 
5258 5258
 
5259 5259
 	/**
5260
-	* Gets all aircraft registration that have flown over by airport icao
5261
-	*
5262
-	* @return Array the aircraft list
5263
-	*
5264
-	*/
5260
+	 * Gets all aircraft registration that have flown over by airport icao
5261
+	 *
5262
+	 * @return Array the aircraft list
5263
+	 *
5264
+	 */
5265 5265
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5266 5266
 	{
5267 5267
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5298,11 +5298,11 @@  discard block
 block discarded – undo
5298 5298
 	
5299 5299
 	
5300 5300
 	/**
5301
-	* Gets all aircraft manufacturer that have flown over by airport icao
5302
-	*
5303
-	* @return Array the aircraft list
5304
-	*
5305
-	*/
5301
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5302
+	 *
5303
+	 * @return Array the aircraft list
5304
+	 *
5305
+	 */
5306 5306
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5307 5307
 	{
5308 5308
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5328,11 +5328,11 @@  discard block
 block discarded – undo
5328 5328
 	}
5329 5329
 
5330 5330
 	/**
5331
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5332
-	*
5333
-	* @return Array the aircraft list
5334
-	*
5335
-	*/
5331
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5332
+	 *
5333
+	 * @return Array the aircraft list
5334
+	 *
5335
+	 */
5336 5336
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5337 5337
 	{
5338 5338
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5359,11 +5359,11 @@  discard block
 block discarded – undo
5359 5359
 
5360 5360
 
5361 5361
 	/**
5362
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5363
-	*
5364
-	* @return Array the aircraft list
5365
-	*
5366
-	*/
5362
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5363
+	 *
5364
+	 * @return Array the aircraft list
5365
+	 *
5366
+	 */
5367 5367
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5368 5368
 	{
5369 5369
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5399,11 +5399,11 @@  discard block
 block discarded – undo
5399 5399
 	}
5400 5400
 
5401 5401
 	/**
5402
-	* Gets all aircraft types that have flown over by date
5403
-	*
5404
-	* @return Array the aircraft list
5405
-	*
5406
-	*/
5402
+	 * Gets all aircraft types that have flown over by date
5403
+	 *
5404
+	 * @return Array the aircraft list
5405
+	 *
5406
+	 */
5407 5407
 	public function countAllAircraftTypesByDate($date,$filters = array())
5408 5408
 	{
5409 5409
 		global $globalTimezone, $globalDBdriver;
@@ -5445,11 +5445,11 @@  discard block
 block discarded – undo
5445 5445
 
5446 5446
 
5447 5447
 	/**
5448
-	* Gets all aircraft registration that have flown over by date
5449
-	*
5450
-	* @return Array the aircraft list
5451
-	*
5452
-	*/
5448
+	 * Gets all aircraft registration that have flown over by date
5449
+	 *
5450
+	 * @return Array the aircraft list
5451
+	 *
5452
+	 */
5453 5453
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5454 5454
 	{
5455 5455
 		global $globalTimezone, $globalDBdriver;
@@ -5500,11 +5500,11 @@  discard block
 block discarded – undo
5500 5500
 
5501 5501
 
5502 5502
 	/**
5503
-	* Gets all aircraft manufacturer that have flown over by date
5504
-	*
5505
-	* @return Array the aircraft manufacturer list
5506
-	*
5507
-	*/
5503
+	 * Gets all aircraft manufacturer that have flown over by date
5504
+	 *
5505
+	 * @return Array the aircraft manufacturer list
5506
+	 *
5507
+	 */
5508 5508
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5509 5509
 	{
5510 5510
 		global $globalTimezone, $globalDBdriver;
@@ -5546,11 +5546,11 @@  discard block
 block discarded – undo
5546 5546
 
5547 5547
 
5548 5548
 	/**
5549
-	* Gets all aircraft types that have flown over by ident/callsign
5550
-	*
5551
-	* @return Array the aircraft list
5552
-	*
5553
-	*/
5549
+	 * Gets all aircraft types that have flown over by ident/callsign
5550
+	 *
5551
+	 * @return Array the aircraft list
5552
+	 *
5553
+	 */
5554 5554
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5555 5555
 	{
5556 5556
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5578,11 +5578,11 @@  discard block
 block discarded – undo
5578 5578
 	}
5579 5579
 
5580 5580
 	/**
5581
-	* Gets all aircraft types that have flown over by pilot
5582
-	*
5583
-	* @return Array the aircraft list
5584
-	*
5585
-	*/
5581
+	 * Gets all aircraft types that have flown over by pilot
5582
+	 *
5583
+	 * @return Array the aircraft list
5584
+	 *
5585
+	 */
5586 5586
 	public function countAllAircraftTypesByPilot($pilot,$filters = array())
5587 5587
 	{
5588 5588
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5598,11 +5598,11 @@  discard block
 block discarded – undo
5598 5598
 	}
5599 5599
 
5600 5600
 	/**
5601
-	* Gets all aircraft types that have flown over by owner
5602
-	*
5603
-	* @return Array the aircraft list
5604
-	*
5605
-	*/
5601
+	 * Gets all aircraft types that have flown over by owner
5602
+	 *
5603
+	 * @return Array the aircraft list
5604
+	 *
5605
+	 */
5606 5606
 	public function countAllAircraftTypesByOwner($owner,$filters = array())
5607 5607
 	{
5608 5608
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5619,11 +5619,11 @@  discard block
 block discarded – undo
5619 5619
 
5620 5620
 
5621 5621
 	/**
5622
-	* Gets all aircraft registration that have flown over by ident/callsign
5623
-	*
5624
-	* @return Array the aircraft list
5625
-	*
5626
-	*/
5622
+	 * Gets all aircraft registration that have flown over by ident/callsign
5623
+	 *
5624
+	 * @return Array the aircraft list
5625
+	 *
5626
+	 */
5627 5627
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5628 5628
 	{
5629 5629
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5662,11 +5662,11 @@  discard block
 block discarded – undo
5662 5662
 	}
5663 5663
 
5664 5664
 	/**
5665
-	* Gets all aircraft registration that have flown over by owner
5666
-	*
5667
-	* @return Array the aircraft list
5668
-	*
5669
-	*/
5665
+	 * Gets all aircraft registration that have flown over by owner
5666
+	 *
5667
+	 * @return Array the aircraft list
5668
+	 *
5669
+	 */
5670 5670
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array())
5671 5671
 	{
5672 5672
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5706,11 +5706,11 @@  discard block
 block discarded – undo
5706 5706
 	}
5707 5707
 
5708 5708
 	/**
5709
-	* Gets all aircraft registration that have flown over by pilot
5710
-	*
5711
-	* @return Array the aircraft list
5712
-	*
5713
-	*/
5709
+	 * Gets all aircraft registration that have flown over by pilot
5710
+	 *
5711
+	 * @return Array the aircraft list
5712
+	 *
5713
+	 */
5714 5714
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array())
5715 5715
 	{
5716 5716
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5751,11 +5751,11 @@  discard block
 block discarded – undo
5751 5751
 
5752 5752
 
5753 5753
 	/**
5754
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5755
-	*
5756
-	* @return Array the aircraft manufacturer list
5757
-	*
5758
-	*/
5754
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5755
+	 *
5756
+	 * @return Array the aircraft manufacturer list
5757
+	 *
5758
+	 */
5759 5759
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5760 5760
 	{
5761 5761
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5780,11 +5780,11 @@  discard block
 block discarded – undo
5780 5780
 	}
5781 5781
 
5782 5782
 	/**
5783
-	* Gets all aircraft manufacturer that have flown over by owner
5784
-	*
5785
-	* @return Array the aircraft manufacturer list
5786
-	*
5787
-	*/
5783
+	 * Gets all aircraft manufacturer that have flown over by owner
5784
+	 *
5785
+	 * @return Array the aircraft manufacturer list
5786
+	 *
5787
+	 */
5788 5788
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array())
5789 5789
 	{
5790 5790
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5801,11 +5801,11 @@  discard block
 block discarded – undo
5801 5801
 	}
5802 5802
 
5803 5803
 	/**
5804
-	* Gets all aircraft manufacturer that have flown over by pilot
5805
-	*
5806
-	* @return Array the aircraft manufacturer list
5807
-	*
5808
-	*/
5804
+	 * Gets all aircraft manufacturer that have flown over by pilot
5805
+	 *
5806
+	 * @return Array the aircraft manufacturer list
5807
+	 *
5808
+	 */
5809 5809
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array())
5810 5810
 	{
5811 5811
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5823,11 +5823,11 @@  discard block
 block discarded – undo
5823 5823
 
5824 5824
 
5825 5825
 	/**
5826
-	* Gets all aircraft types that have flown over by route
5827
-	*
5828
-	* @return Array the aircraft list
5829
-	*
5830
-	*/
5826
+	 * Gets all aircraft types that have flown over by route
5827
+	 *
5828
+	 * @return Array the aircraft list
5829
+	 *
5830
+	 */
5831 5831
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5832 5832
 	{
5833 5833
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5856,11 +5856,11 @@  discard block
 block discarded – undo
5856 5856
 	}
5857 5857
 
5858 5858
 	/**
5859
-	* Gets all aircraft registration that have flown over by route
5860
-	*
5861
-	* @return Array the aircraft list
5862
-	*
5863
-	*/
5859
+	 * Gets all aircraft registration that have flown over by route
5860
+	 *
5861
+	 * @return Array the aircraft list
5862
+	 *
5863
+	 */
5864 5864
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5865 5865
 	{
5866 5866
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5902,11 +5902,11 @@  discard block
 block discarded – undo
5902 5902
 	
5903 5903
 	
5904 5904
 	/**
5905
-	* Gets all aircraft manufacturer that have flown over by route
5906
-	*
5907
-	* @return Array the aircraft manufacturer list
5908
-	*
5909
-	*/
5905
+	 * Gets all aircraft manufacturer that have flown over by route
5906
+	 *
5907
+	 * @return Array the aircraft manufacturer list
5908
+	 *
5909
+	 */
5910 5910
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5911 5911
 	{
5912 5912
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5940,11 +5940,11 @@  discard block
 block discarded – undo
5940 5940
 	
5941 5941
 	
5942 5942
 	/**
5943
-	* Gets all aircraft types that have flown over by country
5944
-	*
5945
-	* @return Array the aircraft list
5946
-	*
5947
-	*/
5943
+	 * Gets all aircraft types that have flown over by country
5944
+	 *
5945
+	 * @return Array the aircraft list
5946
+	 *
5947
+	 */
5948 5948
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5949 5949
 	{
5950 5950
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5975,11 +5975,11 @@  discard block
 block discarded – undo
5975 5975
 
5976 5976
 
5977 5977
 	/**
5978
-	* Gets all aircraft registration that have flown over by country
5979
-	*
5980
-	* @return Array the aircraft list
5981
-	*
5982
-	*/
5978
+	 * Gets all aircraft registration that have flown over by country
5979
+	 *
5980
+	 * @return Array the aircraft list
5981
+	 *
5982
+	 */
5983 5983
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5984 5984
 	{
5985 5985
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6019,11 +6019,11 @@  discard block
 block discarded – undo
6019 6019
 	
6020 6020
 	
6021 6021
 	/**
6022
-	* Gets all aircraft manufacturer that have flown over by country
6023
-	*
6024
-	* @return Array the aircraft manufacturer list
6025
-	*
6026
-	*/
6022
+	 * Gets all aircraft manufacturer that have flown over by country
6023
+	 *
6024
+	 * @return Array the aircraft manufacturer list
6025
+	 *
6026
+	 */
6027 6027
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6028 6028
 	{
6029 6029
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6054,18 +6054,18 @@  discard block
 block discarded – undo
6054 6054
 	
6055 6055
 	
6056 6056
 	/**
6057
-	* Gets all aircraft manufacturers that have flown over
6058
-	*
6059
-	* @return Array the aircraft list
6060
-	*
6061
-	*/
6057
+	 * Gets all aircraft manufacturers that have flown over
6058
+	 *
6059
+	 * @return Array the aircraft list
6060
+	 *
6061
+	 */
6062 6062
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6063 6063
 	{
6064 6064
 		global $globalDBdriver;
6065 6065
 		$filter_query = $this->getFilter($filters,true,true);
6066 6066
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6067 6067
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6068
-                $query_values = array();
6068
+				$query_values = array();
6069 6069
 		if ($year != '') {
6070 6070
 			if ($globalDBdriver == 'mysql') {
6071 6071
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6118,11 +6118,11 @@  discard block
 block discarded – undo
6118 6118
 	
6119 6119
 	
6120 6120
 	/**
6121
-	* Gets all aircraft registrations that have flown over
6122
-	*
6123
-	* @return Array the aircraft list
6124
-	*
6125
-	*/
6121
+	 * Gets all aircraft registrations that have flown over
6122
+	 *
6123
+	 * @return Array the aircraft list
6124
+	 *
6125
+	 */
6126 6126
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6127 6127
 	{
6128 6128
 		global $globalDBdriver;
@@ -6130,15 +6130,15 @@  discard block
 block discarded – undo
6130 6130
 		$filter_query = $this->getFilter($filters,true,true);
6131 6131
 		$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    
6132 6132
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6133
-                if ($olderthanmonths > 0) {
6134
-            		if ($globalDBdriver == 'mysql') {
6133
+				if ($olderthanmonths > 0) {
6134
+					if ($globalDBdriver == 'mysql') {
6135 6135
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6136 6136
 			} else {
6137 6137
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6138 6138
 			}
6139 6139
 		}
6140
-                if ($sincedate != '') {
6141
-            		if ($globalDBdriver == 'mysql') {
6140
+				if ($sincedate != '') {
6141
+					if ($globalDBdriver == 'mysql') {
6142 6142
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6143 6143
 			} else {
6144 6144
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6203,11 +6203,11 @@  discard block
 block discarded – undo
6203 6203
 
6204 6204
 
6205 6205
 	/**
6206
-	* Gets all aircraft registrations that have flown over
6207
-	*
6208
-	* @return Array the aircraft list
6209
-	*
6210
-	*/
6206
+	 * Gets all aircraft registrations that have flown over
6207
+	 *
6208
+	 * @return Array the aircraft list
6209
+	 *
6210
+	 */
6211 6211
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6212 6212
 	{
6213 6213
 		global $globalDBdriver;
@@ -6215,15 +6215,15 @@  discard block
 block discarded – undo
6215 6215
 		$Image = new Image($this->db);
6216 6216
 		$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    
6217 6217
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6218
-                if ($olderthanmonths > 0) {
6219
-            		if ($globalDBdriver == 'mysql') {
6218
+				if ($olderthanmonths > 0) {
6219
+					if ($globalDBdriver == 'mysql') {
6220 6220
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6221 6221
 			} else {
6222 6222
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6223 6223
 			}
6224 6224
 		}
6225
-                if ($sincedate != '') {
6226
-            		if ($globalDBdriver == 'mysql') {
6225
+				if ($sincedate != '') {
6226
+					if ($globalDBdriver == 'mysql') {
6227 6227
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6228 6228
 			} else {
6229 6229
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6232,7 +6232,7 @@  discard block
 block discarded – undo
6232 6232
 
6233 6233
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6234 6234
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6235
-                $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";
6235
+				$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";
6236 6236
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6237 6237
 		
6238 6238
 		$sth = $this->db->prepare($query);
@@ -6264,26 +6264,26 @@  discard block
 block discarded – undo
6264 6264
 	
6265 6265
 	
6266 6266
 	/**
6267
-	* Gets all departure airports of the airplanes that have flown over
6268
-	*
6269
-	* @return Array the airport list
6270
-	*
6271
-	*/
6267
+	 * Gets all departure airports of the airplanes that have flown over
6268
+	 *
6269
+	 * @return Array the airport list
6270
+	 *
6271
+	 */
6272 6272
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6273 6273
 	{
6274 6274
 		global $globalDBdriver;
6275 6275
 		$filter_query = $this->getFilter($filters,true,true);
6276 6276
 		$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 
6277 6277
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6278
-                if ($olderthanmonths > 0) {
6279
-            		if ($globalDBdriver == 'mysql') {
6278
+				if ($olderthanmonths > 0) {
6279
+					if ($globalDBdriver == 'mysql') {
6280 6280
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6281 6281
 			} else {
6282 6282
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6283 6283
 			}
6284
-                }
6285
-                if ($sincedate != '') {
6286
-            		if ($globalDBdriver == 'mysql') {
6284
+				}
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)";
@@ -6317,7 +6317,7 @@  discard block
 block discarded – undo
6317 6317
 				$query_values = array_merge($query_values,array(':day' => $day));
6318 6318
 			}
6319 6319
 		}
6320
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6320
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6321 6321
 				ORDER BY airport_departure_icao_count DESC";
6322 6322
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6323 6323
 
@@ -6340,35 +6340,35 @@  discard block
 block discarded – undo
6340 6340
 	}
6341 6341
 
6342 6342
 	/**
6343
-	* Gets all departure airports of the airplanes that have flown over
6344
-	*
6345
-	* @return Array the airport list
6346
-	*
6347
-	*/
6343
+	 * Gets all departure airports of the airplanes that have flown over
6344
+	 *
6345
+	 * @return Array the airport list
6346
+	 *
6347
+	 */
6348 6348
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6349 6349
 	{
6350 6350
 		global $globalDBdriver;
6351 6351
 		$filter_query = $this->getFilter($filters,true,true);
6352 6352
 		$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 
6353 6353
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6354
-                if ($olderthanmonths > 0) {
6355
-            		if ($globalDBdriver == 'mysql') {
6354
+				if ($olderthanmonths > 0) {
6355
+					if ($globalDBdriver == 'mysql') {
6356 6356
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6357 6357
 			} else {
6358 6358
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6359 6359
 			}
6360
-                }
6361
-                if ($sincedate != '') {
6362
-            		if ($globalDBdriver == 'mysql') {
6360
+				}
6361
+				if ($sincedate != '') {
6362
+					if ($globalDBdriver == 'mysql') {
6363 6363
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6364 6364
 			} else {
6365 6365
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6366 6366
 			}
6367 6367
 		}
6368 6368
 
6369
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6370
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6371
-                $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
6369
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6370
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6371
+				$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
6372 6372
 				ORDER BY airport_departure_icao_count DESC";
6373 6373
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6374 6374
       
@@ -6393,26 +6393,26 @@  discard block
 block discarded – undo
6393 6393
 	}
6394 6394
 
6395 6395
 	/**
6396
-	* Gets all detected departure airports of the airplanes that have flown over
6397
-	*
6398
-	* @return Array the airport list
6399
-	*
6400
-	*/
6396
+	 * Gets all detected departure airports of the airplanes that have flown over
6397
+	 *
6398
+	 * @return Array the airport list
6399
+	 *
6400
+	 */
6401 6401
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6402 6402
 	{
6403 6403
 		global $globalDBdriver;
6404 6404
 		$filter_query = $this->getFilter($filters,true,true);
6405 6405
 		$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
6406 6406
 				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";
6407
-                if ($olderthanmonths > 0) {
6408
-            		if ($globalDBdriver == 'mysql') {
6407
+				if ($olderthanmonths > 0) {
6408
+					if ($globalDBdriver == 'mysql') {
6409 6409
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6410 6410
 			} else {
6411 6411
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6412 6412
 			}
6413
-                }
6414
-                if ($sincedate != '') {
6415
-            		if ($globalDBdriver == 'mysql') {
6413
+				}
6414
+				if ($sincedate != '') {
6415
+					if ($globalDBdriver == 'mysql') {
6416 6416
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6417 6417
 			} else {
6418 6418
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6446,10 +6446,10 @@  discard block
 block discarded – undo
6446 6446
 				$query_values = array_merge($query_values,array(':day' => $day));
6447 6447
 			}
6448 6448
 		}
6449
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6449
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6450 6450
 				ORDER BY airport_departure_icao_count DESC";
6451 6451
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6452
-    		//echo $query;
6452
+			//echo $query;
6453 6453
 		$sth = $this->db->prepare($query);
6454 6454
 		$sth->execute($query_values);
6455 6455
       
@@ -6470,35 +6470,35 @@  discard block
 block discarded – undo
6470 6470
 	}
6471 6471
 	
6472 6472
 	/**
6473
-	* Gets all detected departure airports of the airplanes that have flown over
6474
-	*
6475
-	* @return Array the airport list
6476
-	*
6477
-	*/
6473
+	 * Gets all detected departure airports of the airplanes that have flown over
6474
+	 *
6475
+	 * @return Array the airport list
6476
+	 *
6477
+	 */
6478 6478
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6479 6479
 	{
6480 6480
 		global $globalDBdriver;
6481 6481
 		$filter_query = $this->getFilter($filters,true,true);
6482 6482
 		$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
6483 6483
 				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 ";
6484
-                if ($olderthanmonths > 0) {
6485
-            		if ($globalDBdriver == 'mysql') {
6484
+				if ($olderthanmonths > 0) {
6485
+					if ($globalDBdriver == 'mysql') {
6486 6486
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6487 6487
 			} else {
6488 6488
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6489 6489
 			}
6490
-                }
6491
-                if ($sincedate != '') {
6492
-            		if ($globalDBdriver == 'mysql') {
6490
+				}
6491
+				if ($sincedate != '') {
6492
+					if ($globalDBdriver == 'mysql') {
6493 6493
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6494 6494
 			} else {
6495 6495
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6496 6496
 			}
6497 6497
 		}
6498 6498
 
6499
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6500
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6501
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6499
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6500
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6501
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6502 6502
 				ORDER BY airport_departure_icao_count DESC";
6503 6503
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6504 6504
       
@@ -6523,11 +6523,11 @@  discard block
 block discarded – undo
6523 6523
 	}	
6524 6524
 	
6525 6525
 	/**
6526
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6527
-	*
6528
-	* @return Array the airport list
6529
-	*
6530
-	*/
6526
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6527
+	 *
6528
+	 * @return Array the airport list
6529
+	 *
6530
+	 */
6531 6531
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6532 6532
 	{
6533 6533
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6561,11 +6561,11 @@  discard block
 block discarded – undo
6561 6561
 	
6562 6562
 	
6563 6563
 	/**
6564
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6565
-	*
6566
-	* @return Array the airport list
6567
-	*
6568
-	*/
6564
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6565
+	 *
6566
+	 * @return Array the airport list
6567
+	 *
6568
+	 */
6569 6569
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6570 6570
 	{
6571 6571
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6596,11 +6596,11 @@  discard block
 block discarded – undo
6596 6596
 	
6597 6597
 	
6598 6598
 	/**
6599
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6600
-	*
6601
-	* @return Array the airport list
6602
-	*
6603
-	*/
6599
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6600
+	 *
6601
+	 * @return Array the airport list
6602
+	 *
6603
+	 */
6604 6604
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6605 6605
 	{
6606 6606
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6633,11 +6633,11 @@  discard block
 block discarded – undo
6633 6633
 	
6634 6634
 	
6635 6635
 	/**
6636
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6637
-	*
6638
-	* @return Array the airport list
6639
-	*
6640
-	*/
6636
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6637
+	 *
6638
+	 * @return Array the airport list
6639
+	 *
6640
+	 */
6641 6641
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6642 6642
 	{
6643 6643
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6667,11 +6667,11 @@  discard block
 block discarded – undo
6667 6667
 	
6668 6668
 	
6669 6669
 	/**
6670
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6671
-	*
6672
-	* @return Array the airport list
6673
-	*
6674
-	*/
6670
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6671
+	 *
6672
+	 * @return Array the airport list
6673
+	 *
6674
+	 */
6675 6675
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6676 6676
 	{
6677 6677
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6704,11 +6704,11 @@  discard block
 block discarded – undo
6704 6704
 	
6705 6705
 	
6706 6706
 	/**
6707
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6708
-	*
6709
-	* @return Array the airport list
6710
-	*
6711
-	*/
6707
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6708
+	 *
6709
+	 * @return Array the airport list
6710
+	 *
6711
+	 */
6712 6712
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6713 6713
 	{
6714 6714
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6738,11 +6738,11 @@  discard block
 block discarded – undo
6738 6738
 	
6739 6739
 	
6740 6740
 	/**
6741
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6742
-	*
6743
-	* @return Array the airport list
6744
-	*
6745
-	*/
6741
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6742
+	 *
6743
+	 * @return Array the airport list
6744
+	 *
6745
+	 */
6746 6746
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6747 6747
 	{
6748 6748
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6775,11 +6775,11 @@  discard block
 block discarded – undo
6775 6775
 	
6776 6776
 	
6777 6777
 	/**
6778
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6779
-	*
6780
-	* @return Array the airport list
6781
-	*
6782
-	*/
6778
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6779
+	 *
6780
+	 * @return Array the airport list
6781
+	 *
6782
+	 */
6783 6783
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6784 6784
 	{
6785 6785
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6810,11 +6810,11 @@  discard block
 block discarded – undo
6810 6810
 	
6811 6811
 	
6812 6812
 	/**
6813
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6814
-	*
6815
-	* @return Array the airport list
6816
-	*
6817
-	*/
6813
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6814
+	 *
6815
+	 * @return Array the airport list
6816
+	 *
6817
+	 */
6818 6818
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6819 6819
 	{
6820 6820
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6847,11 +6847,11 @@  discard block
 block discarded – undo
6847 6847
 	
6848 6848
 	
6849 6849
 	/**
6850
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6851
-	*
6852
-	* @return Array the airport list
6853
-	*
6854
-	*/
6850
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6851
+	 *
6852
+	 * @return Array the airport list
6853
+	 *
6854
+	 */
6855 6855
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6856 6856
 	{
6857 6857
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6881,11 +6881,11 @@  discard block
 block discarded – undo
6881 6881
 	
6882 6882
 	
6883 6883
 	/**
6884
-	* Gets all departure airports of the airplanes that have flown over based on a date
6885
-	*
6886
-	* @return Array the airport list
6887
-	*
6888
-	*/
6884
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6885
+	 *
6886
+	 * @return Array the airport list
6887
+	 *
6888
+	 */
6889 6889
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6890 6890
 	{
6891 6891
 		global $globalTimezone, $globalDBdriver;
@@ -6931,11 +6931,11 @@  discard block
 block discarded – undo
6931 6931
 	
6932 6932
 	
6933 6933
 	/**
6934
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6935
-	*
6936
-	* @return Array the airport list
6937
-	*
6938
-	*/
6934
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6935
+	 *
6936
+	 * @return Array the airport list
6937
+	 *
6938
+	 */
6939 6939
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6940 6940
 	{
6941 6941
 		global $globalTimezone, $globalDBdriver;
@@ -6978,11 +6978,11 @@  discard block
 block discarded – undo
6978 6978
 	
6979 6979
 	
6980 6980
 	/**
6981
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6982
-	*
6983
-	* @return Array the airport list
6984
-	*
6985
-	*/
6981
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6982
+	 *
6983
+	 * @return Array the airport list
6984
+	 *
6985
+	 */
6986 6986
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6987 6987
 	{
6988 6988
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7014,11 +7014,11 @@  discard block
 block discarded – undo
7014 7014
 	}
7015 7015
 	
7016 7016
 	/**
7017
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7018
-	*
7019
-	* @return Array the airport list
7020
-	*
7021
-	*/
7017
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7018
+	 *
7019
+	 * @return Array the airport list
7020
+	 *
7021
+	 */
7022 7022
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7023 7023
 	{
7024 7024
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7050,11 +7050,11 @@  discard block
 block discarded – undo
7050 7050
 	}
7051 7051
 	
7052 7052
 	/**
7053
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7054
-	*
7055
-	* @return Array the airport list
7056
-	*
7057
-	*/
7053
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7054
+	 *
7055
+	 * @return Array the airport list
7056
+	 *
7057
+	 */
7058 7058
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7059 7059
 	{
7060 7060
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7087,11 +7087,11 @@  discard block
 block discarded – undo
7087 7087
 	
7088 7088
 	
7089 7089
 	/**
7090
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7091
-	*
7092
-	* @return Array the airport list
7093
-	*
7094
-	*/
7090
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7091
+	 *
7092
+	 * @return Array the airport list
7093
+	 *
7094
+	 */
7095 7095
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7096 7096
 	{
7097 7097
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7120,11 +7120,11 @@  discard block
 block discarded – undo
7120 7120
 	}
7121 7121
 	
7122 7122
 	/**
7123
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7124
-	*
7125
-	* @return Array the airport list
7126
-	*
7127
-	*/
7123
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7124
+	 *
7125
+	 * @return Array the airport list
7126
+	 *
7127
+	 */
7128 7128
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7129 7129
 	{
7130 7130
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7140,11 +7140,11 @@  discard block
 block discarded – undo
7140 7140
 	}
7141 7141
 	
7142 7142
 	/**
7143
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7144
-	*
7145
-	* @return Array the airport list
7146
-	*
7147
-	*/
7143
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7144
+	 *
7145
+	 * @return Array the airport list
7146
+	 *
7147
+	 */
7148 7148
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7149 7149
 	{
7150 7150
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7162,11 +7162,11 @@  discard block
 block discarded – undo
7162 7162
 	
7163 7163
 	
7164 7164
 	/**
7165
-	* Gets all departure airports of the airplanes that have flown over based on a country
7166
-	*
7167
-	* @return Array the airport list
7168
-	*
7169
-	*/
7165
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7166
+	 *
7167
+	 * @return Array the airport list
7168
+	 *
7169
+	 */
7170 7170
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7171 7171
 	{
7172 7172
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7200,11 +7200,11 @@  discard block
 block discarded – undo
7200 7200
 
7201 7201
 
7202 7202
 	/**
7203
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7204
-	*
7205
-	* @return Array the airport list
7206
-	*
7207
-	*/
7203
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7204
+	 *
7205
+	 * @return Array the airport list
7206
+	 *
7207
+	 */
7208 7208
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7209 7209
 	{
7210 7210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7234,31 +7234,31 @@  discard block
 block discarded – undo
7234 7234
 	
7235 7235
 
7236 7236
 	/**
7237
-	* Gets all arrival airports of the airplanes that have flown over
7238
-	*
7239
-	* @param Boolean $limit Limit result to 10 or not
7240
-	* @param Integer $olderthanmonths Only show result older than x months
7241
-	* @param String $sincedate Only show result since x date
7242
-	* @param Boolean $icaoaskey Show result by ICAO
7243
-	* @param Array $filters Filter used here
7244
-	* @return Array the airport list
7245
-	*
7246
-	*/
7237
+	 * Gets all arrival airports of the airplanes that have flown over
7238
+	 *
7239
+	 * @param Boolean $limit Limit result to 10 or not
7240
+	 * @param Integer $olderthanmonths Only show result older than x months
7241
+	 * @param String $sincedate Only show result since x date
7242
+	 * @param Boolean $icaoaskey Show result by ICAO
7243
+	 * @param Array $filters Filter used here
7244
+	 * @return Array the airport list
7245
+	 *
7246
+	 */
7247 7247
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7248 7248
 	{
7249 7249
 		global $globalDBdriver;
7250 7250
 		$filter_query = $this->getFilter($filters,true,true);
7251 7251
 		$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 
7252 7252
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7253
-                if ($olderthanmonths > 0) {
7254
-            		if ($globalDBdriver == 'mysql') {
7253
+				if ($olderthanmonths > 0) {
7254
+					if ($globalDBdriver == 'mysql') {
7255 7255
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7256 7256
 			} else {
7257 7257
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7258 7258
 			}
7259 7259
 		}
7260
-                if ($sincedate != '') {
7261
-            		if ($globalDBdriver == 'mysql') {
7260
+				if ($sincedate != '') {
7261
+					if ($globalDBdriver == 'mysql') {
7262 7262
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7263 7263
 			} else {
7264 7264
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7292,7 +7292,7 @@  discard block
 block discarded – undo
7292 7292
 				$query_values = array_merge($query_values,array(':day' => $day));
7293 7293
 			}
7294 7294
 		}
7295
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7295
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7296 7296
 					ORDER BY airport_arrival_icao_count DESC";
7297 7297
 		if ($limit) $query .= " LIMIT 10";
7298 7298
       
@@ -7321,35 +7321,35 @@  discard block
 block discarded – undo
7321 7321
 	}
7322 7322
 
7323 7323
 	/**
7324
-	* Gets all arrival airports of the airplanes that have flown over
7325
-	*
7326
-	* @return Array the airport list
7327
-	*
7328
-	*/
7324
+	 * Gets all arrival airports of the airplanes that have flown over
7325
+	 *
7326
+	 * @return Array the airport list
7327
+	 *
7328
+	 */
7329 7329
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7330 7330
 	{
7331 7331
 		global $globalDBdriver;
7332 7332
 		$filter_query = $this->getFilter($filters,true,true);
7333 7333
 		$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 
7334 7334
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7335
-                if ($olderthanmonths > 0) {
7336
-            		if ($globalDBdriver == 'mysql') {
7335
+				if ($olderthanmonths > 0) {
7336
+					if ($globalDBdriver == 'mysql') {
7337 7337
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7338 7338
 			} else {
7339 7339
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7340 7340
 			}
7341 7341
 		}
7342
-                if ($sincedate != '') {
7343
-            		if ($globalDBdriver == 'mysql') {
7342
+				if ($sincedate != '') {
7343
+					if ($globalDBdriver == 'mysql') {
7344 7344
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7345 7345
 			} else {
7346 7346
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7347 7347
 			}
7348 7348
 		}
7349 7349
 
7350
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7351
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7352
-                $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
7350
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7351
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7352
+				$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
7353 7353
 					ORDER BY airport_arrival_icao_count DESC";
7354 7354
 		if ($limit) $query .= " LIMIT 10";
7355 7355
       
@@ -7380,26 +7380,26 @@  discard block
 block discarded – undo
7380 7380
 
7381 7381
 
7382 7382
 	/**
7383
-	* Gets all detected arrival airports of the airplanes that have flown over
7384
-	*
7385
-	* @return Array the airport list
7386
-	*
7387
-	*/
7383
+	 * Gets all detected arrival airports of the airplanes that have flown over
7384
+	 *
7385
+	 * @return Array the airport list
7386
+	 *
7387
+	 */
7388 7388
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7389 7389
 	{
7390 7390
 		global $globalDBdriver;
7391 7391
 		$filter_query = $this->getFilter($filters,true,true);
7392 7392
 		$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 
7393 7393
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
7394
-                if ($olderthanmonths > 0) {
7395
-            		if ($globalDBdriver == 'mysql') {
7394
+				if ($olderthanmonths > 0) {
7395
+					if ($globalDBdriver == 'mysql') {
7396 7396
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7397 7397
 			} else {
7398 7398
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7399 7399
 			}
7400 7400
 		}
7401
-                if ($sincedate != '') {
7402
-            		if ($globalDBdriver == 'mysql') {
7401
+				if ($sincedate != '') {
7402
+					if ($globalDBdriver == 'mysql') {
7403 7403
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7404 7404
 			} else {
7405 7405
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7433,7 +7433,7 @@  discard block
 block discarded – undo
7433 7433
 				$query_values = array_merge($query_values,array(':day' => $day));
7434 7434
 			}
7435 7435
 		}
7436
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7436
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7437 7437
 					ORDER BY airport_arrival_icao_count DESC";
7438 7438
 		if ($limit) $query .= " LIMIT 10";
7439 7439
       
@@ -7461,35 +7461,35 @@  discard block
 block discarded – undo
7461 7461
 	}
7462 7462
 	
7463 7463
 	/**
7464
-	* Gets all detected arrival airports of the airplanes that have flown over
7465
-	*
7466
-	* @return Array the airport list
7467
-	*
7468
-	*/
7464
+	 * Gets all detected arrival airports of the airplanes that have flown over
7465
+	 *
7466
+	 * @return Array the airport list
7467
+	 *
7468
+	 */
7469 7469
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7470 7470
 	{
7471 7471
 		global $globalDBdriver;
7472 7472
 		$filter_query = $this->getFilter($filters,true,true);
7473 7473
 		$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 
7474 7474
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
7475
-                if ($olderthanmonths > 0) {
7476
-            		if ($globalDBdriver == 'mysql') {
7475
+				if ($olderthanmonths > 0) {
7476
+					if ($globalDBdriver == 'mysql') {
7477 7477
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7478 7478
 			} else {
7479 7479
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7480 7480
 			}
7481 7481
 		}
7482
-                if ($sincedate != '') {
7483
-            		if ($globalDBdriver == 'mysql') {
7482
+				if ($sincedate != '') {
7483
+					if ($globalDBdriver == 'mysql') {
7484 7484
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7485 7485
 			} else {
7486 7486
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7487 7487
 			}
7488 7488
 		}
7489 7489
 
7490
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7491
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7492
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7490
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7491
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7492
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7493 7493
 					ORDER BY airport_arrival_icao_count DESC";
7494 7494
 		if ($limit) $query .= " LIMIT 10";
7495 7495
       
@@ -7519,11 +7519,11 @@  discard block
 block discarded – undo
7519 7519
 	}	
7520 7520
 	
7521 7521
 	/**
7522
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7523
-	*
7524
-	* @return Array the airport list
7525
-	*
7526
-	*/
7522
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7523
+	 *
7524
+	 * @return Array the airport list
7525
+	 *
7526
+	 */
7527 7527
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7528 7528
 	{
7529 7529
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7555,11 +7555,11 @@  discard block
 block discarded – undo
7555 7555
 	
7556 7556
 	
7557 7557
 	/**
7558
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7559
-	*
7560
-	* @return Array the airport list
7561
-	*
7562
-	*/
7558
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7559
+	 *
7560
+	 * @return Array the airport list
7561
+	 *
7562
+	 */
7563 7563
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7564 7564
 	{
7565 7565
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7590,11 +7590,11 @@  discard block
 block discarded – undo
7590 7590
 	
7591 7591
 	
7592 7592
 	/**
7593
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7594
-	*
7595
-	* @return Array the airport list
7596
-	*
7597
-	*/
7593
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7594
+	 *
7595
+	 * @return Array the airport list
7596
+	 *
7597
+	 */
7598 7598
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7599 7599
 	{
7600 7600
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7628,11 +7628,11 @@  discard block
 block discarded – undo
7628 7628
 	
7629 7629
 	
7630 7630
 	/**
7631
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7632
-	*
7633
-	* @return Array the airport list
7634
-	*
7635
-	*/
7631
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7632
+	 *
7633
+	 * @return Array the airport list
7634
+	 *
7635
+	 */
7636 7636
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7637 7637
 	{
7638 7638
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7662,11 +7662,11 @@  discard block
 block discarded – undo
7662 7662
 	
7663 7663
 	
7664 7664
 	/**
7665
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7666
-	*
7667
-	* @return Array the airport list
7668
-	*
7669
-	*/
7665
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7666
+	 *
7667
+	 * @return Array the airport list
7668
+	 *
7669
+	 */
7670 7670
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7671 7671
 	{
7672 7672
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7700,11 +7700,11 @@  discard block
 block discarded – undo
7700 7700
 	
7701 7701
 	
7702 7702
 	/**
7703
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7704
-	*
7705
-	* @return Array the airport list
7706
-	*
7707
-	*/
7703
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7704
+	 *
7705
+	 * @return Array the airport list
7706
+	 *
7707
+	 */
7708 7708
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7709 7709
 	{
7710 7710
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7735,11 +7735,11 @@  discard block
 block discarded – undo
7735 7735
 	
7736 7736
 	
7737 7737
 	/**
7738
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
7739
-	*
7740
-	* @return Array the airport list
7741
-	*
7742
-	*/
7738
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
7739
+	 *
7740
+	 * @return Array the airport list
7741
+	 *
7742
+	 */
7743 7743
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7744 7744
 	{
7745 7745
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7772,11 +7772,11 @@  discard block
 block discarded – undo
7772 7772
 	
7773 7773
 	
7774 7774
 	/**
7775
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7776
-	*
7777
-	* @return Array the airport list
7778
-	*
7779
-	*/
7775
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7776
+	 *
7777
+	 * @return Array the airport list
7778
+	 *
7779
+	 */
7780 7780
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7781 7781
 	{
7782 7782
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7806,11 +7806,11 @@  discard block
 block discarded – undo
7806 7806
 	
7807 7807
 	
7808 7808
 	/**
7809
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7810
-	*
7811
-	* @return Array the airport list
7812
-	*
7813
-	*/
7809
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7810
+	 *
7811
+	 * @return Array the airport list
7812
+	 *
7813
+	 */
7814 7814
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7815 7815
 	{
7816 7816
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7844,11 +7844,11 @@  discard block
 block discarded – undo
7844 7844
 	
7845 7845
 	
7846 7846
 	/**
7847
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7848
-	*
7849
-	* @return Array the airport list
7850
-	*
7851
-	*/
7847
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7848
+	 *
7849
+	 * @return Array the airport list
7850
+	 *
7851
+	 */
7852 7852
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7853 7853
 	{
7854 7854
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7879,11 +7879,11 @@  discard block
 block discarded – undo
7879 7879
 	
7880 7880
 	
7881 7881
 	/**
7882
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7883
-	*
7884
-	* @return Array the airport list
7885
-	*
7886
-	*/
7882
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7883
+	 *
7884
+	 * @return Array the airport list
7885
+	 *
7886
+	 */
7887 7887
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7888 7888
 	{
7889 7889
 		global $globalTimezone, $globalDBdriver;
@@ -7929,11 +7929,11 @@  discard block
 block discarded – undo
7929 7929
 	
7930 7930
 	
7931 7931
 	/**
7932
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7933
-	*
7934
-	* @return Array the airport list
7935
-	*
7936
-	*/
7932
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7933
+	 *
7934
+	 * @return Array the airport list
7935
+	 *
7936
+	 */
7937 7937
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7938 7938
 	{
7939 7939
 		global $globalTimezone, $globalDBdriver;
@@ -7976,11 +7976,11 @@  discard block
 block discarded – undo
7976 7976
 	
7977 7977
 	
7978 7978
 	/**
7979
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7980
-	*
7981
-	* @return Array the airport list
7982
-	*
7983
-	*/
7979
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7980
+	 *
7981
+	 * @return Array the airport list
7982
+	 *
7983
+	 */
7984 7984
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7985 7985
 	{
7986 7986
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8012,11 +8012,11 @@  discard block
 block discarded – undo
8012 8012
 	}
8013 8013
 	
8014 8014
 	/**
8015
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8016
-	*
8017
-	* @return Array the airport list
8018
-	*
8019
-	*/
8015
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8016
+	 *
8017
+	 * @return Array the airport list
8018
+	 *
8019
+	 */
8020 8020
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8021 8021
 	{
8022 8022
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8047,11 +8047,11 @@  discard block
 block discarded – undo
8047 8047
 	}
8048 8048
 
8049 8049
 	/**
8050
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8051
-	*
8052
-	* @return Array the airport list
8053
-	*
8054
-	*/
8050
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8051
+	 *
8052
+	 * @return Array the airport list
8053
+	 *
8054
+	 */
8055 8055
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8056 8056
 	{
8057 8057
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8082,11 +8082,11 @@  discard block
 block discarded – undo
8082 8082
 	}
8083 8083
 	
8084 8084
 	/**
8085
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8086
-	*
8087
-	* @return Array the airport list
8088
-	*
8089
-	*/
8085
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8086
+	 *
8087
+	 * @return Array the airport list
8088
+	 *
8089
+	 */
8090 8090
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8091 8091
 	{
8092 8092
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8115,11 +8115,11 @@  discard block
 block discarded – undo
8115 8115
 	}
8116 8116
 	
8117 8117
 	/**
8118
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8119
-	*
8120
-	* @return Array the airport list
8121
-	*
8122
-	*/
8118
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8119
+	 *
8120
+	 * @return Array the airport list
8121
+	 *
8122
+	 */
8123 8123
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8124 8124
 	{
8125 8125
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8135,11 +8135,11 @@  discard block
 block discarded – undo
8135 8135
 	}
8136 8136
 	
8137 8137
 	/**
8138
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8139
-	*
8140
-	* @return Array the airport list
8141
-	*
8142
-	*/
8138
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8139
+	 *
8140
+	 * @return Array the airport list
8141
+	 *
8142
+	 */
8143 8143
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8144 8144
 	{
8145 8145
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8157,11 +8157,11 @@  discard block
 block discarded – undo
8157 8157
 	
8158 8158
 	
8159 8159
 	/**
8160
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8161
-	*
8162
-	* @return Array the airport list
8163
-	*
8164
-	*/
8160
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8161
+	 *
8162
+	 * @return Array the airport list
8163
+	 *
8164
+	 */
8165 8165
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8166 8166
 	{
8167 8167
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8194,11 +8194,11 @@  discard block
 block discarded – undo
8194 8194
 	
8195 8195
 	
8196 8196
 	/**
8197
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8198
-	*
8199
-	* @return Array the airport list
8200
-	*
8201
-	*/
8197
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8198
+	 *
8199
+	 * @return Array the airport list
8200
+	 *
8201
+	 */
8202 8202
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8203 8203
 	{
8204 8204
 		global $globalDBdriver;
@@ -8230,11 +8230,11 @@  discard block
 block discarded – undo
8230 8230
 
8231 8231
 
8232 8232
 	/**
8233
-	* Counts all airport departure countries
8234
-	*
8235
-	* @return Array the airport departure list
8236
-	*
8237
-	*/
8233
+	 * Counts all airport departure countries
8234
+	 *
8235
+	 * @return Array the airport departure list
8236
+	 *
8237
+	 */
8238 8238
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8239 8239
 	{
8240 8240
 		global $globalDBdriver;
@@ -8293,11 +8293,11 @@  discard block
 block discarded – undo
8293 8293
 	
8294 8294
 	
8295 8295
 	/**
8296
-	* Counts all airport arrival countries
8297
-	*
8298
-	* @return Array the airport arrival list
8299
-	*
8300
-	*/
8296
+	 * Counts all airport arrival countries
8297
+	 *
8298
+	 * @return Array the airport arrival list
8299
+	 *
8300
+	 */
8301 8301
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8302 8302
 	{
8303 8303
 		global $globalDBdriver;
@@ -8359,11 +8359,11 @@  discard block
 block discarded – undo
8359 8359
 
8360 8360
 
8361 8361
 	/**
8362
-	* Gets all route combinations
8363
-	*
8364
-	* @return Array the route list
8365
-	*
8366
-	*/
8362
+	 * Gets all route combinations
8363
+	 *
8364
+	 * @return Array the route list
8365
+	 *
8366
+	 */
8367 8367
 	public function countAllRoutes($filters = array())
8368 8368
 	{
8369 8369
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8402,11 +8402,11 @@  discard block
 block discarded – undo
8402 8402
 	
8403 8403
 	
8404 8404
 	/**
8405
-	* Gets all route combinations based on an aircraft
8406
-	*
8407
-	* @return Array the route list
8408
-	*
8409
-	*/
8405
+	 * Gets all route combinations based on an aircraft
8406
+	 *
8407
+	 * @return Array the route list
8408
+	 *
8409
+	 */
8410 8410
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8411 8411
 	{
8412 8412
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8442,11 +8442,11 @@  discard block
 block discarded – undo
8442 8442
 	
8443 8443
 	
8444 8444
 	/**
8445
-	* Gets all route combinations based on an aircraft registration
8446
-	*
8447
-	* @return Array the route list
8448
-	*
8449
-	*/
8445
+	 * Gets all route combinations based on an aircraft registration
8446
+	 *
8447
+	 * @return Array the route list
8448
+	 *
8449
+	 */
8450 8450
 	public function countAllRoutesByRegistration($registration, $filters = array())
8451 8451
 	{
8452 8452
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8484,11 +8484,11 @@  discard block
 block discarded – undo
8484 8484
 	
8485 8485
 	
8486 8486
 	/**
8487
-	* Gets all route combinations based on an airline
8488
-	*
8489
-	* @return Array the route list
8490
-	*
8491
-	*/
8487
+	 * Gets all route combinations based on an airline
8488
+	 *
8489
+	 * @return Array the route list
8490
+	 *
8491
+	 */
8492 8492
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8493 8493
 	{
8494 8494
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8526,11 +8526,11 @@  discard block
 block discarded – undo
8526 8526
 	
8527 8527
 	
8528 8528
 	/**
8529
-	* Gets all route combinations based on an airport
8530
-	*
8531
-	* @return Array the route list
8532
-	*
8533
-	*/
8529
+	 * Gets all route combinations based on an airport
8530
+	 *
8531
+	 * @return Array the route list
8532
+	 *
8533
+	 */
8534 8534
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8535 8535
 	{
8536 8536
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8567,11 +8567,11 @@  discard block
 block discarded – undo
8567 8567
 	
8568 8568
 	
8569 8569
 	/**
8570
-	* Gets all route combinations based on an country
8571
-	*
8572
-	* @return Array the route list
8573
-	*
8574
-	*/
8570
+	 * Gets all route combinations based on an country
8571
+	 *
8572
+	 * @return Array the route list
8573
+	 *
8574
+	 */
8575 8575
 	public function countAllRoutesByCountry($country, $filters = array())
8576 8576
 	{
8577 8577
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8607,11 +8607,11 @@  discard block
 block discarded – undo
8607 8607
 
8608 8608
 
8609 8609
 	/**
8610
-	* Gets all route combinations based on an date
8611
-	*
8612
-	* @return Array the route list
8613
-	*
8614
-	*/
8610
+	 * Gets all route combinations based on an date
8611
+	 *
8612
+	 * @return Array the route list
8613
+	 *
8614
+	 */
8615 8615
 	public function countAllRoutesByDate($date, $filters = array())
8616 8616
 	{
8617 8617
 		global $globalTimezone, $globalDBdriver;
@@ -8661,11 +8661,11 @@  discard block
 block discarded – undo
8661 8661
 	
8662 8662
 	
8663 8663
 	/**
8664
-	* Gets all route combinations based on an ident/callsign
8665
-	*
8666
-	* @return Array the route list
8667
-	*
8668
-	*/
8664
+	 * Gets all route combinations based on an ident/callsign
8665
+	 *
8666
+	 * @return Array the route list
8667
+	 *
8668
+	 */
8669 8669
 	public function countAllRoutesByIdent($ident, $filters = array())
8670 8670
 	{
8671 8671
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8701,11 +8701,11 @@  discard block
 block discarded – undo
8701 8701
 	}
8702 8702
 	
8703 8703
 	/**
8704
-	* Gets all route combinations based on an owner
8705
-	*
8706
-	* @return Array the route list
8707
-	*
8708
-	*/
8704
+	 * Gets all route combinations based on an owner
8705
+	 *
8706
+	 * @return Array the route list
8707
+	 *
8708
+	 */
8709 8709
 	public function countAllRoutesByOwner($owner,$filters = array())
8710 8710
 	{
8711 8711
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8741,11 +8741,11 @@  discard block
 block discarded – undo
8741 8741
 	}
8742 8742
 	
8743 8743
 	/**
8744
-	* Gets all route combinations based on a pilot
8745
-	*
8746
-	* @return Array the route list
8747
-	*
8748
-	*/
8744
+	 * Gets all route combinations based on a pilot
8745
+	 *
8746
+	 * @return Array the route list
8747
+	 *
8748
+	 */
8749 8749
 	public function countAllRoutesByPilot($pilot,$filters = array())
8750 8750
 	{
8751 8751
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8782,11 +8782,11 @@  discard block
 block discarded – undo
8782 8782
 	
8783 8783
 	
8784 8784
 	/**
8785
-	* Gets all route combinations based on an manufacturer
8786
-	*
8787
-	* @return Array the route list
8788
-	*
8789
-	*/
8785
+	 * Gets all route combinations based on an manufacturer
8786
+	 *
8787
+	 * @return Array the route list
8788
+	 *
8789
+	 */
8790 8790
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8791 8791
 	{
8792 8792
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8824,11 +8824,11 @@  discard block
 block discarded – undo
8824 8824
 	
8825 8825
 	
8826 8826
 	/**
8827
-	* Gets all route combinations with waypoints
8828
-	*
8829
-	* @return Array the route list
8830
-	*
8831
-	*/
8827
+	 * Gets all route combinations with waypoints
8828
+	 *
8829
+	 * @return Array the route list
8830
+	 *
8831
+	 */
8832 8832
 	public function countAllRoutesWithWaypoints($filters = array())
8833 8833
 	{
8834 8834
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8865,11 +8865,11 @@  discard block
 block discarded – undo
8865 8865
 	}
8866 8866
 	
8867 8867
 	/**
8868
-	* Gets all callsigns that have flown over
8869
-	*
8870
-	* @return Array the callsign list
8871
-	*
8872
-	*/
8868
+	 * Gets all callsigns that have flown over
8869
+	 *
8870
+	 * @return Array the callsign list
8871
+	 *
8872
+	 */
8873 8873
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8874 8874
 	{
8875 8875
 		global $globalDBdriver;
@@ -8935,11 +8935,11 @@  discard block
 block discarded – undo
8935 8935
 	}
8936 8936
 
8937 8937
 	/**
8938
-	* Gets all callsigns that have flown over
8939
-	*
8940
-	* @return Array the callsign list
8941
-	*
8942
-	*/
8938
+	 * Gets all callsigns that have flown over
8939
+	 *
8940
+	 * @return Array the callsign list
8941
+	 *
8942
+	 */
8943 8943
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8944 8944
 	{
8945 8945
 		global $globalDBdriver;
@@ -8980,11 +8980,11 @@  discard block
 block discarded – undo
8980 8980
 
8981 8981
 
8982 8982
 	/**
8983
-	* Counts all dates
8984
-	*
8985
-	* @return Array the date list
8986
-	*
8987
-	*/
8983
+	 * Counts all dates
8984
+	 *
8985
+	 * @return Array the date list
8986
+	 *
8987
+	 */
8988 8988
 	public function countAllDates($filters = array())
8989 8989
 	{
8990 8990
 		global $globalTimezone, $globalDBdriver;
@@ -9029,11 +9029,11 @@  discard block
 block discarded – undo
9029 9029
 	}
9030 9030
 	
9031 9031
 	/**
9032
-	* Counts all dates
9033
-	*
9034
-	* @return Array the date list
9035
-	*
9036
-	*/
9032
+	 * Counts all dates
9033
+	 *
9034
+	 * @return Array the date list
9035
+	 *
9036
+	 */
9037 9037
 	public function countAllDatesByAirlines($filters = array())
9038 9038
 	{
9039 9039
 		global $globalTimezone, $globalDBdriver;
@@ -9078,11 +9078,11 @@  discard block
 block discarded – undo
9078 9078
 	}	
9079 9079
 	
9080 9080
 	/**
9081
-	* Counts all dates during the last 7 days
9082
-	*
9083
-	* @return Array the date list
9084
-	*
9085
-	*/
9081
+	 * Counts all dates during the last 7 days
9082
+	 *
9083
+	 * @return Array the date list
9084
+	 *
9085
+	 */
9086 9086
 	public function countAllDatesLast7Days($filters = array())
9087 9087
 	{
9088 9088
 		global $globalTimezone, $globalDBdriver;
@@ -9104,7 +9104,7 @@  discard block
 block discarded – undo
9104 9104
 			$query .= " GROUP BY date_name 
9105 9105
 								ORDER BY date_name ASC";
9106 9106
 			$query_data = array(':offset' => $offset);
9107
-    		}
9107
+			}
9108 9108
 		
9109 9109
 		$sth = $this->db->prepare($query);
9110 9110
 		$sth->execute($query_data);
@@ -9124,11 +9124,11 @@  discard block
 block discarded – undo
9124 9124
 	}
9125 9125
 
9126 9126
 	/**
9127
-	* Counts all dates during the last month
9128
-	*
9129
-	* @return Array the date list
9130
-	*
9131
-	*/
9127
+	 * Counts all dates during the last month
9128
+	 *
9129
+	 * @return Array the date list
9130
+	 *
9131
+	 */
9132 9132
 	public function countAllDatesLastMonth($filters = array())
9133 9133
 	{
9134 9134
 		global $globalTimezone, $globalDBdriver;
@@ -9150,7 +9150,7 @@  discard block
 block discarded – undo
9150 9150
 			$query .= " GROUP BY date_name 
9151 9151
 								ORDER BY date_name ASC";
9152 9152
 			$query_data = array(':offset' => $offset);
9153
-    		}
9153
+			}
9154 9154
 		
9155 9155
 		$sth = $this->db->prepare($query);
9156 9156
 		$sth->execute($query_data);
@@ -9171,11 +9171,11 @@  discard block
 block discarded – undo
9171 9171
 
9172 9172
 
9173 9173
 	/**
9174
-	* Counts all dates during the last month
9175
-	*
9176
-	* @return Array the date list
9177
-	*
9178
-	*/
9174
+	 * Counts all dates during the last month
9175
+	 *
9176
+	 * @return Array the date list
9177
+	 *
9178
+	 */
9179 9179
 	public function countAllDatesLastMonthByAirlines($filters = array())
9180 9180
 	{
9181 9181
 		global $globalTimezone, $globalDBdriver;
@@ -9198,7 +9198,7 @@  discard block
 block discarded – undo
9198 9198
 								GROUP BY spotter_output.airline_icao, date_name 
9199 9199
 								ORDER BY date_name ASC";
9200 9200
 			$query_data = array(':offset' => $offset);
9201
-    		}
9201
+			}
9202 9202
 		
9203 9203
 		$sth = $this->db->prepare($query);
9204 9204
 		$sth->execute($query_data);
@@ -9220,11 +9220,11 @@  discard block
 block discarded – undo
9220 9220
 	
9221 9221
 
9222 9222
 	/**
9223
-	* Counts all month
9224
-	*
9225
-	* @return Array the month list
9226
-	*
9227
-	*/
9223
+	 * Counts all month
9224
+	 *
9225
+	 * @return Array the month list
9226
+	 *
9227
+	 */
9228 9228
 	public function countAllMonths($filters = array())
9229 9229
 	{
9230 9230
 		global $globalTimezone, $globalDBdriver;
@@ -9266,11 +9266,11 @@  discard block
 block discarded – undo
9266 9266
 	}
9267 9267
 
9268 9268
 	/**
9269
-	* Counts all month
9270
-	*
9271
-	* @return Array the month list
9272
-	*
9273
-	*/
9269
+	 * Counts all month
9270
+	 *
9271
+	 * @return Array the month list
9272
+	 *
9273
+	 */
9274 9274
 	public function countAllMonthsByAirlines($filters = array())
9275 9275
 	{
9276 9276
 		global $globalTimezone, $globalDBdriver;
@@ -9315,11 +9315,11 @@  discard block
 block discarded – undo
9315 9315
 	}
9316 9316
 
9317 9317
 	/**
9318
-	* Counts all military month
9319
-	*
9320
-	* @return Array the month list
9321
-	*
9322
-	*/
9318
+	 * Counts all military month
9319
+	 *
9320
+	 * @return Array the month list
9321
+	 *
9322
+	 */
9323 9323
 	public function countAllMilitaryMonths($filters = array())
9324 9324
 	{
9325 9325
 		global $globalTimezone, $globalDBdriver;
@@ -9360,11 +9360,11 @@  discard block
 block discarded – undo
9360 9360
 	}
9361 9361
 	
9362 9362
 	/**
9363
-	* Counts all month owners
9364
-	*
9365
-	* @return Array the month list
9366
-	*
9367
-	*/
9363
+	 * Counts all month owners
9364
+	 *
9365
+	 * @return Array the month list
9366
+	 *
9367
+	 */
9368 9368
 	public function countAllMonthsOwners($filters = array())
9369 9369
 	{
9370 9370
 		global $globalTimezone, $globalDBdriver;
@@ -9406,11 +9406,11 @@  discard block
 block discarded – undo
9406 9406
 	}
9407 9407
 	
9408 9408
 	/**
9409
-	* Counts all month owners
9410
-	*
9411
-	* @return Array the month list
9412
-	*
9413
-	*/
9409
+	 * Counts all month owners
9410
+	 *
9411
+	 * @return Array the month list
9412
+	 *
9413
+	 */
9414 9414
 	public function countAllMonthsOwnersByAirlines($filters = array())
9415 9415
 	{
9416 9416
 		global $globalTimezone, $globalDBdriver;
@@ -9453,11 +9453,11 @@  discard block
 block discarded – undo
9453 9453
 	}
9454 9454
 
9455 9455
 	/**
9456
-	* Counts all month pilot
9457
-	*
9458
-	* @return Array the month list
9459
-	*
9460
-	*/
9456
+	 * Counts all month pilot
9457
+	 *
9458
+	 * @return Array the month list
9459
+	 *
9460
+	 */
9461 9461
 	public function countAllMonthsPilots($filters = array())
9462 9462
 	{
9463 9463
 		global $globalTimezone, $globalDBdriver;
@@ -9499,11 +9499,11 @@  discard block
 block discarded – undo
9499 9499
 	}
9500 9500
 	
9501 9501
 	/**
9502
-	* Counts all month pilot
9503
-	*
9504
-	* @return Array the month list
9505
-	*
9506
-	*/
9502
+	 * Counts all month pilot
9503
+	 *
9504
+	 * @return Array the month list
9505
+	 *
9506
+	 */
9507 9507
 	public function countAllMonthsPilotsByAirlines($filters = array())
9508 9508
 	{
9509 9509
 		global $globalTimezone, $globalDBdriver;
@@ -9546,11 +9546,11 @@  discard block
 block discarded – undo
9546 9546
 	}
9547 9547
 
9548 9548
 	/**
9549
-	* Counts all month airline
9550
-	*
9551
-	* @return Array the month list
9552
-	*
9553
-	*/
9549
+	 * Counts all month airline
9550
+	 *
9551
+	 * @return Array the month list
9552
+	 *
9553
+	 */
9554 9554
 	public function countAllMonthsAirlines($filters = array())
9555 9555
 	{
9556 9556
 		global $globalTimezone, $globalDBdriver;
@@ -9592,11 +9592,11 @@  discard block
 block discarded – undo
9592 9592
 	}
9593 9593
 	
9594 9594
 	/**
9595
-	* Counts all month aircraft
9596
-	*
9597
-	* @return Array the month list
9598
-	*
9599
-	*/
9595
+	 * Counts all month aircraft
9596
+	 *
9597
+	 * @return Array the month list
9598
+	 *
9599
+	 */
9600 9600
 	public function countAllMonthsAircrafts($filters = array())
9601 9601
 	{
9602 9602
 		global $globalTimezone, $globalDBdriver;
@@ -9639,11 +9639,11 @@  discard block
 block discarded – undo
9639 9639
 	
9640 9640
 
9641 9641
 	/**
9642
-	* Counts all month aircraft
9643
-	*
9644
-	* @return Array the month list
9645
-	*
9646
-	*/
9642
+	 * Counts all month aircraft
9643
+	 *
9644
+	 * @return Array the month list
9645
+	 *
9646
+	 */
9647 9647
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9648 9648
 	{
9649 9649
 		global $globalTimezone, $globalDBdriver;
@@ -9686,11 +9686,11 @@  discard block
 block discarded – undo
9686 9686
 	}
9687 9687
 
9688 9688
 	/**
9689
-	* Counts all month real arrival
9690
-	*
9691
-	* @return Array the month list
9692
-	*
9693
-	*/
9689
+	 * Counts all month real arrival
9690
+	 *
9691
+	 * @return Array the month list
9692
+	 *
9693
+	 */
9694 9694
 	public function countAllMonthsRealArrivals($filters = array())
9695 9695
 	{
9696 9696
 		global $globalTimezone, $globalDBdriver;
@@ -9733,11 +9733,11 @@  discard block
 block discarded – undo
9733 9733
 	
9734 9734
 
9735 9735
 	/**
9736
-	* Counts all month real arrival
9737
-	*
9738
-	* @return Array the month list
9739
-	*
9740
-	*/
9736
+	 * Counts all month real arrival
9737
+	 *
9738
+	 * @return Array the month list
9739
+	 *
9740
+	 */
9741 9741
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9742 9742
 	{
9743 9743
 		global $globalTimezone, $globalDBdriver;
@@ -9781,11 +9781,11 @@  discard block
 block discarded – undo
9781 9781
 	
9782 9782
 
9783 9783
 	/**
9784
-	* Counts all dates during the last year
9785
-	*
9786
-	* @return Array the date list
9787
-	*
9788
-	*/
9784
+	 * Counts all dates during the last year
9785
+	 *
9786
+	 * @return Array the date list
9787
+	 *
9788
+	 */
9789 9789
 	public function countAllMonthsLastYear($filters)
9790 9790
 	{
9791 9791
 		global $globalTimezone, $globalDBdriver;
@@ -9807,7 +9807,7 @@  discard block
 block discarded – undo
9807 9807
 			$query .= " GROUP BY year_name, month_name
9808 9808
 								ORDER BY year_name, month_name ASC";
9809 9809
 			$query_data = array(':offset' => $offset);
9810
-    		}
9810
+			}
9811 9811
 		
9812 9812
 		$sth = $this->db->prepare($query);
9813 9813
 		$sth->execute($query_data);
@@ -9830,11 +9830,11 @@  discard block
 block discarded – undo
9830 9830
 	
9831 9831
 	
9832 9832
 	/**
9833
-	* Counts all hours
9834
-	*
9835
-	* @return Array the hour list
9836
-	*
9837
-	*/
9833
+	 * Counts all hours
9834
+	 *
9835
+	 * @return Array the hour list
9836
+	 *
9837
+	 */
9838 9838
 	public function countAllHours($orderby,$filters = array())
9839 9839
 	{
9840 9840
 		global $globalTimezone, $globalDBdriver;
@@ -9895,11 +9895,11 @@  discard block
 block discarded – undo
9895 9895
 	}
9896 9896
 	
9897 9897
 	/**
9898
-	* Counts all hours
9899
-	*
9900
-	* @return Array the hour list
9901
-	*
9902
-	*/
9898
+	 * Counts all hours
9899
+	 *
9900
+	 * @return Array the hour list
9901
+	 *
9902
+	 */
9903 9903
 	public function countAllHoursByAirlines($orderby, $filters = array())
9904 9904
 	{
9905 9905
 		global $globalTimezone, $globalDBdriver;
@@ -9962,11 +9962,11 @@  discard block
 block discarded – undo
9962 9962
 
9963 9963
 
9964 9964
 	/**
9965
-	* Counts all hours by airline
9966
-	*
9967
-	* @return Array the hour list
9968
-	*
9969
-	*/
9965
+	 * Counts all hours by airline
9966
+	 *
9967
+	 * @return Array the hour list
9968
+	 *
9969
+	 */
9970 9970
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9971 9971
 	{
9972 9972
 		global $globalTimezone, $globalDBdriver;
@@ -10012,11 +10012,11 @@  discard block
 block discarded – undo
10012 10012
 	
10013 10013
 	
10014 10014
 	/**
10015
-	* Counts all hours by aircraft
10016
-	*
10017
-	* @return Array the hour list
10018
-	*
10019
-	*/
10015
+	 * Counts all hours by aircraft
10016
+	 *
10017
+	 * @return Array the hour list
10018
+	 *
10019
+	 */
10020 10020
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10021 10021
 	{
10022 10022
 		global $globalTimezone, $globalDBdriver;
@@ -10059,11 +10059,11 @@  discard block
 block discarded – undo
10059 10059
 	
10060 10060
 	
10061 10061
 	/**
10062
-	* Counts all hours by aircraft registration
10063
-	*
10064
-	* @return Array the hour list
10065
-	*
10066
-	*/
10062
+	 * Counts all hours by aircraft registration
10063
+	 *
10064
+	 * @return Array the hour list
10065
+	 *
10066
+	 */
10067 10067
 	public function countAllHoursByRegistration($registration, $filters = array())
10068 10068
 	{
10069 10069
 		global $globalTimezone, $globalDBdriver;
@@ -10106,11 +10106,11 @@  discard block
 block discarded – undo
10106 10106
 	
10107 10107
 	
10108 10108
 	/**
10109
-	* Counts all hours by airport
10110
-	*
10111
-	* @return Array the hour list
10112
-	*
10113
-	*/
10109
+	 * Counts all hours by airport
10110
+	 *
10111
+	 * @return Array the hour list
10112
+	 *
10113
+	 */
10114 10114
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10115 10115
 	{
10116 10116
 		global $globalTimezone, $globalDBdriver;
@@ -10154,11 +10154,11 @@  discard block
 block discarded – undo
10154 10154
 	
10155 10155
 	
10156 10156
 	/**
10157
-	* Counts all hours by manufacturer
10158
-	*
10159
-	* @return Array the hour list
10160
-	*
10161
-	*/
10157
+	 * Counts all hours by manufacturer
10158
+	 *
10159
+	 * @return Array the hour list
10160
+	 *
10161
+	 */
10162 10162
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10163 10163
 	{
10164 10164
 		global $globalTimezone, $globalDBdriver;
@@ -10202,11 +10202,11 @@  discard block
 block discarded – undo
10202 10202
 	
10203 10203
 	
10204 10204
 	/**
10205
-	* Counts all hours by date
10206
-	*
10207
-	* @return Array the hour list
10208
-	*
10209
-	*/
10205
+	 * Counts all hours by date
10206
+	 *
10207
+	 * @return Array the hour list
10208
+	 *
10209
+	 */
10210 10210
 	public function countAllHoursByDate($date, $filters = array())
10211 10211
 	{
10212 10212
 		global $globalTimezone, $globalDBdriver;
@@ -10250,11 +10250,11 @@  discard block
 block discarded – undo
10250 10250
 	
10251 10251
 	
10252 10252
 	/**
10253
-	* Counts all hours by a ident/callsign
10254
-	*
10255
-	* @return Array the hour list
10256
-	*
10257
-	*/
10253
+	 * Counts all hours by a ident/callsign
10254
+	 *
10255
+	 * @return Array the hour list
10256
+	 *
10257
+	 */
10258 10258
 	public function countAllHoursByIdent($ident, $filters = array())
10259 10259
 	{
10260 10260
 		global $globalTimezone, $globalDBdriver;
@@ -10297,11 +10297,11 @@  discard block
 block discarded – undo
10297 10297
 	}
10298 10298
 	
10299 10299
 	/**
10300
-	* Counts all hours by a owner
10301
-	*
10302
-	* @return Array the hour list
10303
-	*
10304
-	*/
10300
+	 * Counts all hours by a owner
10301
+	 *
10302
+	 * @return Array the hour list
10303
+	 *
10304
+	 */
10305 10305
 	public function countAllHoursByOwner($owner, $filters = array())
10306 10306
 	{
10307 10307
 		global $globalTimezone, $globalDBdriver;
@@ -10344,11 +10344,11 @@  discard block
 block discarded – undo
10344 10344
 	}
10345 10345
 	
10346 10346
 	/**
10347
-	* Counts all hours by a pilot
10348
-	*
10349
-	* @return Array the hour list
10350
-	*
10351
-	*/
10347
+	 * Counts all hours by a pilot
10348
+	 *
10349
+	 * @return Array the hour list
10350
+	 *
10351
+	 */
10352 10352
 	public function countAllHoursByPilot($pilot, $filters = array())
10353 10353
 	{
10354 10354
 		global $globalTimezone, $globalDBdriver;
@@ -10393,11 +10393,11 @@  discard block
 block discarded – undo
10393 10393
 	
10394 10394
 	
10395 10395
 	/**
10396
-	* Counts all hours by route
10397
-	*
10398
-	* @return Array the hour list
10399
-	*
10400
-	*/
10396
+	 * Counts all hours by route
10397
+	 *
10398
+	 * @return Array the hour list
10399
+	 *
10400
+	 */
10401 10401
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10402 10402
 	{
10403 10403
 		global $globalTimezone, $globalDBdriver;
@@ -10441,11 +10441,11 @@  discard block
 block discarded – undo
10441 10441
 	
10442 10442
 	
10443 10443
 	/**
10444
-	* Counts all hours by country
10445
-	*
10446
-	* @return Array the hour list
10447
-	*
10448
-	*/
10444
+	 * Counts all hours by country
10445
+	 *
10446
+	 * @return Array the hour list
10447
+	 *
10448
+	 */
10449 10449
 	public function countAllHoursByCountry($country, $filters = array())
10450 10450
 	{
10451 10451
 		global $globalTimezone, $globalDBdriver;
@@ -10490,11 +10490,11 @@  discard block
 block discarded – undo
10490 10490
 
10491 10491
 
10492 10492
 	/**
10493
-	* Counts all aircraft that have flown over
10494
-	*
10495
-	* @return Integer the number of aircrafts
10496
-	*
10497
-	*/
10493
+	 * Counts all aircraft that have flown over
10494
+	 *
10495
+	 * @return Integer the number of aircrafts
10496
+	 *
10497
+	 */
10498 10498
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10499 10499
 	{
10500 10500
 		global $globalDBdriver;
@@ -10527,11 +10527,11 @@  discard block
 block discarded – undo
10527 10527
 	}
10528 10528
 
10529 10529
 	/**
10530
-	* Counts all flight that really arrival
10531
-	*
10532
-	* @return Integer the number of aircrafts
10533
-	*
10534
-	*/
10530
+	 * Counts all flight that really arrival
10531
+	 *
10532
+	 * @return Integer the number of aircrafts
10533
+	 *
10534
+	 */
10535 10535
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10536 10536
 	{
10537 10537
 		global $globalDBdriver;
@@ -10564,11 +10564,11 @@  discard block
 block discarded – undo
10564 10564
 	}
10565 10565
 
10566 10566
 	/**
10567
-	* Counts all pilots that have flown over
10568
-	*
10569
-	* @return Integer the number of pilots
10570
-	*
10571
-	*/
10567
+	 * Counts all pilots that have flown over
10568
+	 *
10569
+	 * @return Integer the number of pilots
10570
+	 *
10571
+	 */
10572 10572
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10573 10573
 	{
10574 10574
 		global $globalDBdriver;
@@ -10600,11 +10600,11 @@  discard block
 block discarded – undo
10600 10600
 	}
10601 10601
 
10602 10602
 	/**
10603
-	* Counts all owners that have flown over
10604
-	*
10605
-	* @return Integer the number of owners
10606
-	*
10607
-	*/
10603
+	 * Counts all owners that have flown over
10604
+	 *
10605
+	 * @return Integer the number of owners
10606
+	 *
10607
+	 */
10608 10608
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10609 10609
 	{
10610 10610
 		global $globalDBdriver;
@@ -10637,11 +10637,11 @@  discard block
 block discarded – undo
10637 10637
 	
10638 10638
 	
10639 10639
 	/**
10640
-	* Counts all flights that have flown over
10641
-	*
10642
-	* @return Integer the number of flights
10643
-	*
10644
-	*/
10640
+	 * Counts all flights that have flown over
10641
+	 *
10642
+	 * @return Integer the number of flights
10643
+	 *
10644
+	 */
10645 10645
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
10646 10646
 	{
10647 10647
 		global $globalDBdriver;
@@ -10676,11 +10676,11 @@  discard block
 block discarded – undo
10676 10676
 	}
10677 10677
 	
10678 10678
 	/**
10679
-	* Counts all military flights that have flown over
10680
-	*
10681
-	* @return Integer the number of flights
10682
-	*
10683
-	*/
10679
+	 * Counts all military flights that have flown over
10680
+	 *
10681
+	 * @return Integer the number of flights
10682
+	 *
10683
+	 */
10684 10684
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10685 10685
 	{
10686 10686
 		global $globalDBdriver;
@@ -10715,11 +10715,11 @@  discard block
 block discarded – undo
10715 10715
 	
10716 10716
 	
10717 10717
 	/**
10718
-	* Counts all airlines that have flown over
10719
-	*
10720
-	* @return Integer the number of airlines
10721
-	*
10722
-	*/
10718
+	 * Counts all airlines that have flown over
10719
+	 *
10720
+	 * @return Integer the number of airlines
10721
+	 *
10722
+	 */
10723 10723
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10724 10724
 	{
10725 10725
 		global $globalDBdriver;
@@ -10746,8 +10746,8 @@  discard block
 block discarded – undo
10746 10746
 				$query_values = array_merge($query_values,array(':month' => $month));
10747 10747
 			}
10748 10748
 		}
10749
-                if ($query == '') $queryi .= $this->getFilter($filters);
10750
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10749
+				if ($query == '') $queryi .= $this->getFilter($filters);
10750
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10751 10751
 
10752 10752
 
10753 10753
 		$sth = $this->db->prepare($queryi);
@@ -10757,11 +10757,11 @@  discard block
 block discarded – undo
10757 10757
 
10758 10758
   
10759 10759
 	/**
10760
-	* Counts all hours of today
10761
-	*
10762
-	* @return Array the hour list
10763
-	*
10764
-	*/
10760
+	 * Counts all hours of today
10761
+	 *
10762
+	 * @return Array the hour list
10763
+	 *
10764
+	 */
10765 10765
 	public function countAllHoursFromToday($filters = array())
10766 10766
 	{
10767 10767
 		global $globalTimezone, $globalDBdriver;
@@ -10801,11 +10801,11 @@  discard block
 block discarded – undo
10801 10801
 	}
10802 10802
     
10803 10803
 	/**
10804
-	* Gets all the spotter information based on calculated upcoming flights
10805
-	*
10806
-	* @return Array the spotter information
10807
-	*
10808
-	*/
10804
+	 * Gets all the spotter information based on calculated upcoming flights
10805
+	 *
10806
+	 * @return Array the spotter information
10807
+	 *
10808
+	 */
10809 10809
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10810 10810
 	{
10811 10811
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -10880,12 +10880,12 @@  discard block
 block discarded – undo
10880 10880
 	}
10881 10881
     
10882 10882
     
10883
-     /**
10884
-	* Gets the Barrie Spotter ID based on the FlightAware ID
10885
-	*
10886
-	* @return Integer the Barrie Spotter ID
10883
+	 /**
10884
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
10885
+	  *
10886
+	  * @return Integer the Barrie Spotter ID
10887 10887
 q	*
10888
-	*/
10888
+	  */
10889 10889
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10890 10890
 	{
10891 10891
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -10906,13 +10906,13 @@  discard block
 block discarded – undo
10906 10906
   
10907 10907
  
10908 10908
 	/**
10909
-	* Parses a date string
10910
-	*
10911
-	* @param String $dateString the date string
10912
-	* @param String $timezone the timezone of a user
10913
-	* @return Array the time information
10914
-	*
10915
-	*/
10909
+	 * Parses a date string
10910
+	 *
10911
+	 * @param String $dateString the date string
10912
+	 * @param String $timezone the timezone of a user
10913
+	 * @return Array the time information
10914
+	 *
10915
+	 */
10916 10916
 	public function parseDateString($dateString, $timezone = '')
10917 10917
 	{
10918 10918
 		$time_array = array();
@@ -10948,12 +10948,12 @@  discard block
 block discarded – undo
10948 10948
 	
10949 10949
 	
10950 10950
 	/**
10951
-	* Parses the direction degrees to working
10952
-	*
10953
-	* @param Float $direction the direction in degrees
10954
-	* @return Array the direction information
10955
-	*
10956
-	*/
10951
+	 * Parses the direction degrees to working
10952
+	 *
10953
+	 * @param Float $direction the direction in degrees
10954
+	 * @return Array the direction information
10955
+	 *
10956
+	 */
10957 10957
 	public function parseDirection($direction = 0)
10958 10958
 	{
10959 10959
 		if ($direction == '') $direction = 0;
@@ -11032,12 +11032,12 @@  discard block
 block discarded – undo
11032 11032
 	
11033 11033
 	
11034 11034
 	/**
11035
-	* Gets the aircraft registration
11036
-	*
11037
-	* @param String $flightaware_id the flight aware id
11038
-	* @return String the aircraft registration
11039
-	*
11040
-	*/
11035
+	 * Gets the aircraft registration
11036
+	 *
11037
+	 * @param String $flightaware_id the flight aware id
11038
+	 * @return String the aircraft registration
11039
+	 *
11040
+	 */
11041 11041
 	
11042 11042
 	public function getAircraftRegistration($flightaware_id)
11043 11043
 	{
@@ -11066,12 +11066,12 @@  discard block
 block discarded – undo
11066 11066
 
11067 11067
 
11068 11068
 	/**
11069
-	* Gets the aircraft registration from ModeS
11070
-	*
11071
-	* @param String $aircraft_modes the flight ModeS in hex
11072
-	* @return String the aircraft registration
11073
-	*
11074
-	*/
11069
+	 * Gets the aircraft registration from ModeS
11070
+	 *
11071
+	 * @param String $aircraft_modes the flight ModeS in hex
11072
+	 * @return String the aircraft registration
11073
+	 *
11074
+	 */
11075 11075
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11076 11076
 	{
11077 11077
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11084,19 +11084,19 @@  discard block
 block discarded – undo
11084 11084
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11085 11085
 		$sth->closeCursor();
11086 11086
 		if (count($row) > 0) {
11087
-		    //return $row['Registration'];
11088
-		    return $row['registration'];
11087
+			//return $row['Registration'];
11088
+			return $row['registration'];
11089 11089
 		} else return '';
11090 11090
 	
11091 11091
 	}
11092 11092
 
11093 11093
 	/**
11094
-	* Gets the aircraft type from ModeS
11095
-	*
11096
-	* @param String $aircraft_modes the flight ModeS in hex
11097
-	* @return String the aircraft type
11098
-	*
11099
-	*/
11094
+	 * Gets the aircraft type from ModeS
11095
+	 *
11096
+	 * @param String $aircraft_modes the flight ModeS in hex
11097
+	 * @return String the aircraft type
11098
+	 *
11099
+	 */
11100 11100
 	public function getAircraftTypeBymodeS($aircraft_modes)
11101 11101
 	{
11102 11102
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11109,19 +11109,19 @@  discard block
 block discarded – undo
11109 11109
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11110 11110
 		$sth->closeCursor();
11111 11111
 		if (count($row) > 0) {
11112
-		    if ($row['type_flight'] == null) return '';
11113
-		    else return $row['type_flight'];
11112
+			if ($row['type_flight'] == null) return '';
11113
+			else return $row['type_flight'];
11114 11114
 		} else return '';
11115 11115
 	
11116 11116
 	}
11117 11117
 
11118 11118
 	/**
11119
-	* Gets Country from latitude/longitude
11120
-	*
11121
-	* @param Float $latitude latitute of the flight
11122
-	* @param Float $longitude longitute of the flight
11123
-	* @return String the countrie
11124
-	*/
11119
+	 * Gets Country from latitude/longitude
11120
+	 *
11121
+	 * @param Float $latitude latitute of the flight
11122
+	 * @param Float $longitude longitute of the flight
11123
+	 * @return String the countrie
11124
+	 */
11125 11125
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11126 11126
 	{
11127 11127
 		global $globalDBdriver, $globalDebug;
@@ -11158,11 +11158,11 @@  discard block
 block discarded – undo
11158 11158
 	}
11159 11159
 
11160 11160
 	/**
11161
-	* Gets Country from iso2
11162
-	*
11163
-	* @param String $iso2 ISO2 country code
11164
-	* @return String the countrie
11165
-	*/
11161
+	 * Gets Country from iso2
11162
+	 *
11163
+	 * @param String $iso2 ISO2 country code
11164
+	 * @return String the countrie
11165
+	 */
11166 11166
 	public function getCountryFromISO2($iso2)
11167 11167
 	{
11168 11168
 		global $globalDBdriver, $globalDebug;
@@ -11190,12 +11190,12 @@  discard block
 block discarded – undo
11190 11190
 	}
11191 11191
 
11192 11192
 	/**
11193
-	* converts the registration code using the country prefix
11194
-	*
11195
-	* @param String $registration the aircraft registration
11196
-	* @return String the aircraft registration
11197
-	*
11198
-	*/
11193
+	 * converts the registration code using the country prefix
11194
+	 *
11195
+	 * @param String $registration the aircraft registration
11196
+	 * @return String the aircraft registration
11197
+	 *
11198
+	 */
11199 11199
 	public function convertAircraftRegistration($registration)
11200 11200
 	{
11201 11201
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11247,12 +11247,12 @@  discard block
 block discarded – undo
11247 11247
 	}
11248 11248
 
11249 11249
 	/**
11250
-	* Country from the registration code
11251
-	*
11252
-	* @param String $registration the aircraft registration
11253
-	* @return String the country
11254
-	*
11255
-	*/
11250
+	 * Country from the registration code
11251
+	 *
11252
+	 * @param String $registration the aircraft registration
11253
+	 * @return String the country
11254
+	 *
11255
+	 */
11256 11256
 	public function countryFromAircraftRegistration($registration)
11257 11257
 	{
11258 11258
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11271,8 +11271,8 @@  discard block
 block discarded – undo
11271 11271
 				$country = $row['country'];
11272 11272
 			}
11273 11273
 		} else {
11274
-    			$registration_1 = substr($registration, 0, 1);
11275
-		        $registration_2 = substr($registration, 0, 2);
11274
+				$registration_1 = substr($registration, 0, 1);
11275
+				$registration_2 = substr($registration, 0, 2);
11276 11276
 
11277 11277
 			$country = '';
11278 11278
 			//first get the prefix based on two characters
@@ -11308,12 +11308,12 @@  discard block
 block discarded – undo
11308 11308
 	}
11309 11309
 
11310 11310
 	/**
11311
-	* Registration prefix from the registration code
11312
-	*
11313
-	* @param String $registration the aircraft registration
11314
-	* @return String the registration prefix
11315
-	*
11316
-	*/
11311
+	 * Registration prefix from the registration code
11312
+	 *
11313
+	 * @param String $registration the aircraft registration
11314
+	 * @return String the registration prefix
11315
+	 *
11316
+	 */
11317 11317
 	public function registrationPrefixFromAircraftRegistration($registration)
11318 11318
 	{
11319 11319
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11332,8 +11332,8 @@  discard block
 block discarded – undo
11332 11332
 				//$country = $row['country'];
11333 11333
 			}
11334 11334
 		} else {
11335
-    			$registration_1 = substr($registration, 0, 1);
11336
-		        $registration_2 = substr($registration, 0, 2);
11335
+				$registration_1 = substr($registration, 0, 1);
11336
+				$registration_2 = substr($registration, 0, 2);
11337 11337
 
11338 11338
 			//first get the prefix based on two characters
11339 11339
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11369,12 +11369,12 @@  discard block
 block discarded – undo
11369 11369
 
11370 11370
 
11371 11371
 	/**
11372
-	* Country from the registration code
11373
-	*
11374
-	* @param String $registration the aircraft registration
11375
-	* @return String the country
11376
-	*
11377
-	*/
11372
+	 * Country from the registration code
11373
+	 *
11374
+	 * @param String $registration the aircraft registration
11375
+	 * @return String the country
11376
+	 *
11377
+	 */
11378 11378
 	public function countryFromAircraftRegistrationCode($registration)
11379 11379
 	{
11380 11380
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11391,11 +11391,11 @@  discard block
 block discarded – undo
11391 11391
 	}
11392 11392
 	
11393 11393
 	/**
11394
-	* Set a new highlight value for a flight
11395
-	*
11396
-	* @param String $flightaware_id flightaware_id from spotter_output table
11397
-	* @param String $highlight New highlight value
11398
-	*/
11394
+	 * Set a new highlight value for a flight
11395
+	 *
11396
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11397
+	 * @param String $highlight New highlight value
11398
+	 */
11399 11399
 	public function setHighlightFlight($flightaware_id,$highlight) {
11400 11400
 		
11401 11401
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11404,12 +11404,12 @@  discard block
 block discarded – undo
11404 11404
 	}
11405 11405
 
11406 11406
 	/**
11407
-	* Set a new highlight value for a flight by Registration
11408
-	*
11409
-	* @param String $registration Registration of the aircraft
11410
-	* @param String $date Date of spotted aircraft
11411
-	* @param String $highlight New highlight value
11412
-	*/
11407
+	 * Set a new highlight value for a flight by Registration
11408
+	 *
11409
+	 * @param String $registration Registration of the aircraft
11410
+	 * @param String $date Date of spotted aircraft
11411
+	 * @param String $highlight New highlight value
11412
+	 */
11413 11413
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11414 11414
 		if ($date == '') {
11415 11415
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11423,12 +11423,12 @@  discard block
 block discarded – undo
11423 11423
 	}
11424 11424
 	
11425 11425
 	/**
11426
-	* Gets the short url from bit.ly
11427
-	*
11428
-	* @param String $url the full url
11429
-	* @return String the bit.ly url
11430
-	*
11431
-	*/
11426
+	 * Gets the short url from bit.ly
11427
+	 *
11428
+	 * @param String $url the full url
11429
+	 * @return String the bit.ly url
11430
+	 *
11431
+	 */
11432 11432
 	public function getBitlyURL($url)
11433 11433
 	{
11434 11434
 		global $globalBitlyAccessToken;
@@ -11717,11 +11717,11 @@  discard block
 block discarded – undo
11717 11717
 			$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 
11718 11718
 	                      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)) 
11719 11719
 	                      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;";
11720
-                } else {
11720
+				} else {
11721 11721
 			$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 
11722 11722
 	                      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)) 
11723 11723
 	                      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;";
11724
-    		}
11724
+			}
11725 11725
 		$sth = $this->db->prepare($query);
11726 11726
 		$sth->execute();
11727 11727
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +718 added lines, -250 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) {
73
+			$filter = array_merge($filter,$globalFilter);
74
+		}
73 75
 		$filter_query_join = '';
74 76
 		$filter_query_where = '';
75 77
 		foreach($filters as $flt) {
@@ -122,8 +124,11 @@  discard block
 block discarded – undo
122 124
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
123 125
 			}
124 126
 		}
125
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
126
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
127
+		if ($filter_query_where == '' && $where) {
128
+			$filter_query_where = ' WHERE';
129
+		} elseif ($filter_query_where != '' && $and) {
130
+			$filter_query_where .= ' AND';
131
+		}
127 132
 		$filter_query = $filter_query_join.$filter_query_where;
128 133
 		return $filter_query;
129 134
 	}
@@ -143,10 +148,18 @@  discard block
 block discarded – undo
143 148
 		$Image = new Image($this->db);
144 149
 		$Schedule = new Schedule($this->db);
145 150
 		$ACARS = new ACARS($this->db);
146
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
147
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
148
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
149
-		if (!isset($globalVAM)) $globalVAM = FALSE;
151
+		if (!isset($globalIVAO)) {
152
+			$globalIVAO = FALSE;
153
+		}
154
+		if (!isset($globalVATSIM)) {
155
+			$globalVATSIM = FALSE;
156
+		}
157
+		if (!isset($globalphpVMS)) {
158
+			$globalphpVMS = FALSE;
159
+		}
160
+		if (!isset($globalVAM)) {
161
+			$globalVAM = FALSE;
162
+		}
150 163
 		date_default_timezone_set('UTC');
151 164
 		
152 165
 		if (!is_string($query))
@@ -193,21 +206,35 @@  discard block
 block discarded – undo
193 206
 			} else {
194 207
 				$temp_array['spotter_id'] = '';
195 208
 			}
196
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
197
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
209
+			if (isset($row['flightaware_id'])) {
210
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
211
+			}
212
+			if (isset($row['modes'])) {
213
+				$temp_array['modes'] = $row['modes'];
214
+			}
198 215
 			$temp_array['ident'] = $row['ident'];
199 216
 			if (isset($row['registration']) && $row['registration'] != '') {
200 217
 				$temp_array['registration'] = $row['registration'];
201 218
 			} elseif (isset($temp_array['modes'])) {
202 219
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
203
-			} else $temp_array['registration'] = '';
204
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
220
+			} else {
221
+				$temp_array['registration'] = '';
222
+			}
223
+			if (isset($row['aircraft_icao'])) {
224
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
225
+			}
205 226
 			
206 227
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
207 228
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
208
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
209
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
210
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
229
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
230
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
231
+			}
232
+			if (isset($row['latitude'])) {
233
+				$temp_array['latitude'] = $row['latitude'];
234
+			}
235
+			if (isset($row['longitude'])) {
236
+				$temp_array['longitude'] = $row['longitude'];
237
+			}
211 238
 			/*
212 239
 			if (Connection->tableExists('countries')) {
213 240
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -217,8 +244,12 @@  discard block
 block discarded – undo
217 244
 				}
218 245
 			}
219 246
 			*/
220
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
221
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
247
+			if (isset($row['waypoints'])) {
248
+				$temp_array['waypoints'] = $row['waypoints'];
249
+			}
250
+			if (isset($row['format_source'])) {
251
+				$temp_array['format_source'] = $row['format_source'];
252
+			}
222 253
 			if (isset($row['route_stop'])) {
223 254
 				$temp_array['route_stop'] = $row['route_stop'];
224 255
 				if ($row['route_stop'] != '') {
@@ -237,13 +268,19 @@  discard block
 block discarded – undo
237 268
 					}
238 269
 				}
239 270
 			}
240
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
271
+			if (isset($row['altitude'])) {
272
+				$temp_array['altitude'] = $row['altitude'];
273
+			}
241 274
 			if (isset($row['heading'])) {
242 275
 				$temp_array['heading'] = $row['heading'];
243 276
 				$heading_direction = $this->parseDirection($row['heading']);
244
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
277
+				if (isset($heading_direction[0]['direction_fullname'])) {
278
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
279
+				}
280
+			}
281
+			if (isset($row['ground_speed'])) {
282
+				$temp_array['ground_speed'] = $row['ground_speed'];
245 283
 			}
246
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
247 284
 			$temp_array['image'] = "";
248 285
 			$temp_array['image_thumbnail'] = "";
249 286
 			$temp_array['image_source'] = "";
@@ -251,7 +288,9 @@  discard block
 block discarded – undo
251 288
  
252 289
 			if (isset($row['highlight'])) {
253 290
 				$temp_array['highlight'] = $row['highlight'];
254
-			} else $temp_array['highlight'] = '';
291
+			} else {
292
+				$temp_array['highlight'] = '';
293
+			}
255 294
 			
256 295
 			if (isset($row['date'])) {
257 296
 				$dateArray = $this->parseDateString($row['date']);
@@ -299,7 +338,9 @@  discard block
 block discarded – undo
299 338
 				
300 339
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
301 340
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
302
-					} else $temp_array['aircraft_shadow'] = 'default.png';
341
+					} else {
342
+						$temp_array['aircraft_shadow'] = 'default.png';
343
+					}
303 344
                                 } else {
304 345
                             		$temp_array['aircraft_shadow'] = 'default.png';
305 346
 					$temp_array['aircraft_name'] = 'N/A';
@@ -307,11 +348,17 @@  discard block
 block discarded – undo
307 348
                             	}
308 349
 			}
309 350
 			$fromsource = NULL;
310
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
311
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
312
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
313
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
314
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
351
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
352
+				$fromsource = $globalAirlinesSource;
353
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
354
+				$fromsource = 'vatsim';
355
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
356
+				$fromsource = 'ivao';
357
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
358
+				$fromsource = 'vatsim';
359
+			} elseif (isset($globalIVAO) && $globalIVAO) {
360
+				$fromsource = 'ivao';
361
+			}
315 362
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
316 363
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
317 364
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -334,12 +381,18 @@  discard block
 block discarded – undo
334 381
 				}
335 382
 			} else {
336 383
 				$temp_array['airline_icao'] = $row['airline_icao'];
337
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
338
-				else $temp_array['airline_iata'] = 'N/A';
384
+				if (isset($row['airline_iata'])) {
385
+					$temp_array['airline_iata'] = $row['airline_iata'];
386
+				} else {
387
+					$temp_array['airline_iata'] = 'N/A';
388
+				}
339 389
 				$temp_array['airline_name'] = $row['airline_name'];
340 390
 				$temp_array['airline_country'] = $row['airline_country'];
341
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
342
-				else $temp_array['airline_callsign'] = 'N/A';
391
+				if (isset($row['airline_callsign'])) {
392
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
393
+				} else {
394
+					$temp_array['airline_callsign'] = 'N/A';
395
+				}
343 396
 				$temp_array['airline_type'] = $row['airline_type'];
344 397
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
345 398
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -366,7 +419,9 @@  discard block
 block discarded – undo
366 419
 			}
367 420
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
368 421
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
369
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
422
+				if ($owner_info['owner'] != '') {
423
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
424
+				}
370 425
 				$temp_array['aircraft_base'] = $owner_info['base'];
371 426
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
372 427
 			}
@@ -374,9 +429,14 @@  discard block
 block discarded – undo
374 429
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
375 430
 			{
376 431
 				if ($globalIVAO) {
377
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
378
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
379
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
432
+					if (isset($temp_array['airline_icao'])) {
433
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
434
+					} else {
435
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
436
+					}
437
+				} else {
438
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
439
+				}
380 440
 				if (count($image_array) > 0) {
381 441
 					$temp_array['image'] = $image_array[0]['image'];
382 442
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -428,7 +488,9 @@  discard block
 block discarded – undo
428 488
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
429 489
 			if ($row['departure_airport_icao'] != '') {
430 490
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
431
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
491
+				if (!isset($departure_airport_array[0]['name'])) {
492
+					$departure_airport_array = $this->getAllAirportInfo('NA');
493
+				}
432 494
 			/*
433 495
 			} elseif ($row['departure_airport_name'] != '') {
434 496
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -436,7 +498,9 @@  discard block
 block discarded – undo
436 498
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
437 499
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
438 500
 			*/
439
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
501
+			} else {
502
+				$departure_airport_array = $this->getAllAirportInfo('NA');
503
+			}
440 504
 			if (isset($departure_airport_array[0]['name'])) {
441 505
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
442 506
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -456,8 +520,12 @@  discard block
 block discarded – undo
456 520
 			
457 521
 			if ($row['arrival_airport_icao'] != '') {
458 522
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
459
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
460
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
523
+				if (count($arrival_airport_array) == 0) {
524
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
525
+				}
526
+			} else {
527
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
528
+			}
461 529
 			if (isset($arrival_airport_array[0]['name'])) {
462 530
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
463 531
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -473,27 +541,45 @@  discard block
 block discarded – undo
473 541
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
474 542
 			}
475 543
 			*/
476
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
477
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
478
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
479
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
480
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
544
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
545
+				$temp_array['pilot_id'] = $row['pilot_id'];
546
+			}
547
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
548
+				$temp_array['pilot_name'] = $row['pilot_name'];
549
+			}
550
+			if (isset($row['source_name']) && $row['source_name'] != '') {
551
+				$temp_array['source_name'] = $row['source_name'];
552
+			}
553
+			if (isset($row['over_country']) && $row['over_country'] != '') {
554
+				$temp_array['over_country'] = $row['over_country'];
555
+			}
556
+			if (isset($row['distance']) && $row['distance'] != '') {
557
+				$temp_array['distance'] = $row['distance'];
558
+			}
481 559
 			if (isset($row['squawk'])) {
482 560
 				$temp_array['squawk'] = $row['squawk'];
483 561
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
484 562
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
485
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
563
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
564
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
565
+					}
486 566
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
487 567
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
488
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
489
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
568
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
569
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
570
+					}
571
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
572
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
573
+				}
490 574
 			}
491 575
     			
492 576
 			$temp_array['query_number_rows'] = $num_rows;
493 577
 			
494 578
 			$spotter_array[] = $temp_array;
495 579
 		}
496
-		if ($num_rows == 0) return array();
580
+		if ($num_rows == 0) {
581
+			return array();
582
+		}
497 583
 		$spotter_array[0]['query_number_rows'] = $num_rows;
498 584
 		return $spotter_array;
499 585
 	}	
@@ -526,7 +612,9 @@  discard block
 block discarded – undo
526 612
 				foreach ($q_array as $q_item){
527 613
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
528 614
 					$additional_query .= " AND (";
529
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
615
+					if (is_int($q_item)) {
616
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
617
+					}
530 618
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
531 619
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
532 620
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -547,7 +635,9 @@  discard block
 block discarded – undo
547 635
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
548 636
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
549 637
 					$translate = $Translation->ident2icao($q_item);
550
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
638
+					if ($translate != $q_item) {
639
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
640
+					}
551 641
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
552 642
 					$additional_query .= ")";
553 643
 				}
@@ -774,7 +864,9 @@  discard block
 block discarded – undo
774 864
 				date_default_timezone_set($globalTimezone);
775 865
 				$datetime = new DateTime();
776 866
 				$offset = $datetime->format('P');
777
-			} else $offset = '+00:00';
867
+			} else {
868
+				$offset = '+00:00';
869
+			}
778 870
 
779 871
 			if ($date_array[1] != "")
780 872
 			{
@@ -806,8 +898,12 @@  discard block
 block discarded – undo
806 898
 			{
807 899
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
808 900
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
809
-			} else $limit_query = "";
810
-		} else $limit_query = "";
901
+			} else {
902
+				$limit_query = "";
903
+			}
904
+		} else {
905
+			$limit_query = "";
906
+		}
811 907
 
812 908
 
813 909
 		if ($sort != "")
@@ -875,8 +971,12 @@  discard block
 block discarded – undo
875 971
 			{
876 972
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
877 973
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
878
-			} else $limit_query = "";
879
-		} else $limit_query = "";
974
+			} else {
975
+				$limit_query = "";
976
+			}
977
+		} else {
978
+			$limit_query = "";
979
+		}
880 980
 		
881 981
 		if ($sort != "")
882 982
 		{
@@ -1200,7 +1300,9 @@  discard block
 block discarded – undo
1200 1300
 		global $global_query;
1201 1301
 		
1202 1302
 		date_default_timezone_set('UTC');
1203
-		if ($id == '') return array();
1303
+		if ($id == '') {
1304
+			return array();
1305
+		}
1204 1306
 		$additional_query = "spotter_output.spotter_id = :id";
1205 1307
 		$query_values = array(':id' => $id);
1206 1308
 
@@ -1937,7 +2039,9 @@  discard block
 block discarded – undo
1937 2039
 		{
1938 2040
 			$highlight = $row['highlight'];
1939 2041
 		}
1940
-		if (isset($highlight)) return $highlight;
2042
+		if (isset($highlight)) {
2043
+			return $highlight;
2044
+		}
1941 2045
 	}
1942 2046
 
1943 2047
 	
@@ -1965,7 +2069,9 @@  discard block
 block discarded – undo
1965 2069
 		$sth->closeCursor();
1966 2070
 		if (count($row) > 0) {
1967 2071
 			return $row['usage'];
1968
-		} else return '';
2072
+		} else {
2073
+			return '';
2074
+		}
1969 2075
 	}
1970 2076
 
1971 2077
 	/**
@@ -1990,7 +2096,9 @@  discard block
 block discarded – undo
1990 2096
 		$sth->closeCursor();
1991 2097
 		if (count($row) > 0) {
1992 2098
 			return $row['icao'];
1993
-		} else return '';
2099
+		} else {
2100
+			return '';
2101
+		}
1994 2102
 	}
1995 2103
 
1996 2104
 	/**
@@ -2018,7 +2126,9 @@  discard block
 block discarded – undo
2018 2126
 			$airport_longitude = $row['longitude'];
2019 2127
 			$Common = new Common();
2020 2128
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2021
-		} else return '';
2129
+		} else {
2130
+			return '';
2131
+		}
2022 2132
 	}
2023 2133
 	
2024 2134
 	/**
@@ -2130,7 +2240,9 @@  discard block
 block discarded – undo
2130 2240
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2131 2241
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2132 2242
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2133
-		} else return array();
2243
+		} else {
2244
+			return array();
2245
+		}
2134 2246
 		if ($globalDBdriver == 'mysql') {
2135 2247
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2136 2248
 		} else {
@@ -2165,7 +2277,9 @@  discard block
 block discarded – undo
2165 2277
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2166 2278
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2167 2279
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2168
-		} else return array();
2280
+		} else {
2281
+			return array();
2282
+		}
2169 2283
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2170 2284
 		$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.")";
2171 2285
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2200,7 +2314,9 @@  discard block
 block discarded – undo
2200 2314
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2201 2315
 	{
2202 2316
 		global $globalUseRealAirlines;
2203
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2317
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2318
+			$fromsource = NULL;
2319
+		}
2204 2320
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2205 2321
 		if ($airline_icao == 'NA') {
2206 2322
 			$airline_array = array();
@@ -2269,7 +2385,9 @@  discard block
 block discarded – undo
2269 2385
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2270 2386
 	{
2271 2387
 		global $globalUseRealAirlines;
2272
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2388
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2389
+			$fromsource = NULL;
2390
+		}
2273 2391
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2274 2392
 		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2275 2393
 		$sth = $this->db->prepare($query);
@@ -2285,7 +2403,9 @@  discard block
 block discarded – undo
2285 2403
 			$sth->execute(array(':fromsource' => $fromsource));
2286 2404
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2287 2405
 			$sth->closeCursor();
2288
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2406
+			if ($row['nb'] == 0) {
2407
+				$result = $this->getAllAirlineInfoByName($airline_name);
2408
+			}
2289 2409
 		}
2290 2410
 		return $result;
2291 2411
 	}
@@ -2348,15 +2468,20 @@  discard block
 block discarded – undo
2348 2468
 				'A320-211' => 'A320',
2349 2469
 				'747-8i' => 'B748',
2350 2470
 				'A380' => 'A388');
2351
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2471
+		if (isset($all_aircraft[$aircraft_type])) {
2472
+			return $all_aircraft[$aircraft_type];
2473
+		}
2352 2474
 
2353 2475
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2354 2476
 		$aircraft_type = strtoupper($aircraft_type);
2355 2477
 		$sth = $this->db->prepare($query);
2356 2478
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2357 2479
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2358
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2359
-		else return '';
2480
+		if (isset($result[0]['icao'])) {
2481
+			return $result[0]['icao'];
2482
+		} else {
2483
+			return '';
2484
+		}
2360 2485
 	}
2361 2486
 	
2362 2487
 	/**
@@ -2379,9 +2504,13 @@  discard block
 block discarded – undo
2379 2504
 		$sth->closeCursor();
2380 2505
 		if (isset($row['icaotypecode'])) {
2381 2506
 			$icao = $row['icaotypecode'];
2382
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2507
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2508
+				$icao = $this->aircraft_correct_icaotype[$icao];
2509
+			}
2383 2510
 			return $icao;
2384
-		} else return '';
2511
+		} else {
2512
+			return '';
2513
+		}
2385 2514
 	}
2386 2515
 
2387 2516
 	/**
@@ -2404,7 +2533,9 @@  discard block
 block discarded – undo
2404 2533
 		$sth->closeCursor();
2405 2534
 		if (isset($row['icaotypecode'])) {
2406 2535
 			return $row['icaotypecode'];
2407
-		} else return '';
2536
+		} else {
2537
+			return '';
2538
+		}
2408 2539
 	}
2409 2540
 
2410 2541
 	/**
@@ -2450,7 +2581,9 @@  discard block
 block discarded – undo
2450 2581
 		$sth->closeCursor();
2451 2582
 		if (isset($row['operator_correct'])) {
2452 2583
 			return $row['operator_correct'];
2453
-		} else return $operator;
2584
+		} else {
2585
+			return $operator;
2586
+		}
2454 2587
 	}
2455 2588
 
2456 2589
 	/**
@@ -2463,7 +2596,9 @@  discard block
 block discarded – undo
2463 2596
 	public function getRouteInfo($callsign)
2464 2597
 	{
2465 2598
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2466
-                if ($callsign == '') return array();
2599
+                if ($callsign == '') {
2600
+                	return array();
2601
+                }
2467 2602
 		$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";
2468 2603
 		
2469 2604
 		$sth = $this->db->prepare($query);
@@ -2473,7 +2608,9 @@  discard block
 block discarded – undo
2473 2608
 		$sth->closeCursor();
2474 2609
 		if (count($row) > 0) {
2475 2610
 			return $row;
2476
-		} else return array();
2611
+		} else {
2612
+			return array();
2613
+		}
2477 2614
 	}
2478 2615
 	
2479 2616
 	/**
@@ -2526,7 +2663,9 @@  discard block
 block discarded – undo
2526 2663
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2527 2664
 			$sth->closeCursor();
2528 2665
 			return $result;
2529
-		} else return array();
2666
+		} else {
2667
+			return array();
2668
+		}
2530 2669
 	}
2531 2670
 	
2532 2671
   
@@ -2685,8 +2824,11 @@  discard block
 block discarded – undo
2685 2824
 		$query .= " ORDER BY spotter_output.source_name ASC";
2686 2825
 
2687 2826
 		$sth = $this->db->prepare($query);
2688
-		if (!empty($query_values)) $sth->execute($query_values);
2689
-		else $sth->execute();
2827
+		if (!empty($query_values)) {
2828
+			$sth->execute($query_values);
2829
+		} else {
2830
+			$sth->execute();
2831
+		}
2690 2832
 
2691 2833
 		$source_array = array();
2692 2834
 		$temp_array = array();
@@ -2719,9 +2861,13 @@  discard block
 block discarded – undo
2719 2861
 								WHERE spotter_output.airline_icao <> '' 
2720 2862
 								ORDER BY spotter_output.airline_name ASC";
2721 2863
 			*/
2722
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2723
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2724
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2864
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2865
+				$forsource = $globalAirlinesSource;
2866
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2867
+				$forsource = 'vatsim';
2868
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2869
+				$forsource = 'ivao';
2870
+			}
2725 2871
 			if ($forsource === NULL) {
2726 2872
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2727 2873
 				$query_data = array();
@@ -2764,9 +2910,13 @@  discard block
 block discarded – undo
2764 2910
 	{
2765 2911
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2766 2912
 		$filter_query = $this->getFilter($filters,true,true);
2767
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2768
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2769
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2913
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2914
+			$forsource = $globalAirlinesSource;
2915
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2916
+			$forsource = 'vatsim';
2917
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2918
+			$forsource = 'ivao';
2919
+		}
2770 2920
 		if ($forsource === NULL) {
2771 2921
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2772 2922
 			$query_data = array();
@@ -3077,7 +3227,9 @@  discard block
 block discarded – undo
3077 3227
 			date_default_timezone_set($globalTimezone);
3078 3228
 			$datetime = new DateTime();
3079 3229
 			$offset = $datetime->format('P');
3080
-		} else $offset = '+00:00';
3230
+		} else {
3231
+			$offset = '+00:00';
3232
+		}
3081 3233
 		if ($airport_icao == '') {
3082 3234
 			if ($globalDBdriver == 'mysql') {
3083 3235
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3109,7 +3261,9 @@  discard block
 block discarded – undo
3109 3261
 			date_default_timezone_set($globalTimezone);
3110 3262
 			$datetime = new DateTime();
3111 3263
 			$offset = $datetime->format('P');
3112
-		} else $offset = '+00:00';
3264
+		} else {
3265
+			$offset = '+00:00';
3266
+		}
3113 3267
 		if ($airport_icao == '') {
3114 3268
 			if ($globalDBdriver == 'mysql') {
3115 3269
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3142,7 +3296,9 @@  discard block
 block discarded – undo
3142 3296
 			date_default_timezone_set($globalTimezone);
3143 3297
 			$datetime = new DateTime();
3144 3298
 			$offset = $datetime->format('P');
3145
-		} else $offset = '+00:00';
3299
+		} else {
3300
+			$offset = '+00:00';
3301
+		}
3146 3302
 		if ($airport_icao == '') {
3147 3303
 			if ($globalDBdriver == 'mysql') {
3148 3304
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3181,7 +3337,9 @@  discard block
 block discarded – undo
3181 3337
 			date_default_timezone_set($globalTimezone);
3182 3338
 			$datetime = new DateTime();
3183 3339
 			$offset = $datetime->format('P');
3184
-		} else $offset = '+00:00';
3340
+		} else {
3341
+			$offset = '+00:00';
3342
+		}
3185 3343
 		if ($airport_icao == '') {
3186 3344
 			if ($globalDBdriver == 'mysql') {
3187 3345
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3226,7 +3384,9 @@  discard block
 block discarded – undo
3226 3384
 			date_default_timezone_set($globalTimezone);
3227 3385
 			$datetime = new DateTime();
3228 3386
 			$offset = $datetime->format('P');
3229
-		} else $offset = '+00:00';
3387
+		} else {
3388
+			$offset = '+00:00';
3389
+		}
3230 3390
 		if ($airport_icao == '') {
3231 3391
 			if ($globalDBdriver == 'mysql') {
3232 3392
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3261,7 +3421,9 @@  discard block
 block discarded – undo
3261 3421
 			date_default_timezone_set($globalTimezone);
3262 3422
 			$datetime = new DateTime();
3263 3423
 			$offset = $datetime->format('P');
3264
-		} else $offset = '+00:00';
3424
+		} else {
3425
+			$offset = '+00:00';
3426
+		}
3265 3427
 		if ($airport_icao == '') {
3266 3428
 			if ($globalDBdriver == 'mysql') {
3267 3429
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3303,7 +3465,9 @@  discard block
 block discarded – undo
3303 3465
 			date_default_timezone_set($globalTimezone);
3304 3466
 			$datetime = new DateTime();
3305 3467
 			$offset = $datetime->format('P');
3306
-		} else $offset = '+00:00';
3468
+		} else {
3469
+			$offset = '+00:00';
3470
+		}
3307 3471
 		if ($airport_icao == '') {
3308 3472
 			if ($globalDBdriver == 'mysql') {
3309 3473
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3337,7 +3501,9 @@  discard block
 block discarded – undo
3337 3501
 			date_default_timezone_set($globalTimezone);
3338 3502
 			$datetime = new DateTime();
3339 3503
 			$offset = $datetime->format('P');
3340
-		} else $offset = '+00:00';
3504
+		} else {
3505
+			$offset = '+00:00';
3506
+		}
3341 3507
 		if ($airport_icao == '') {
3342 3508
 			if ($globalDBdriver == 'mysql') {
3343 3509
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3385,7 +3551,9 @@  discard block
 block discarded – undo
3385 3551
 			date_default_timezone_set($globalTimezone);
3386 3552
 			$datetime = new DateTime();
3387 3553
 			$offset = $datetime->format('P');
3388
-		} else $offset = '+00:00';
3554
+		} else {
3555
+			$offset = '+00:00';
3556
+		}
3389 3557
 
3390 3558
 		if ($globalDBdriver == 'mysql') {
3391 3559
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3505,7 +3673,9 @@  discard block
 block discarded – undo
3505 3673
 	*/	
3506 3674
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3507 3675
 	{
3508
-		if ($groundspeed == '') $groundspeed = NULL;
3676
+		if ($groundspeed == '') {
3677
+			$groundspeed = NULL;
3678
+		}
3509 3679
 		$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';
3510 3680
                 $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);
3511 3681
 
@@ -3555,10 +3725,18 @@  discard block
 block discarded – undo
3555 3725
 		$Image = new Image($this->db);
3556 3726
 		$Common = new Common();
3557 3727
 		
3558
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3559
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3560
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3561
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3728
+		if (!isset($globalIVAO)) {
3729
+			$globalIVAO = FALSE;
3730
+		}
3731
+		if (!isset($globalVATSIM)) {
3732
+			$globalVATSIM = FALSE;
3733
+		}
3734
+		if (!isset($globalphpVMS)) {
3735
+			$globalphpVMS = FALSE;
3736
+		}
3737
+		if (!isset($globalVAM)) {
3738
+			$globalVAM = FALSE;
3739
+		}
3562 3740
 		date_default_timezone_set('UTC');
3563 3741
 		
3564 3742
 		//getting the registration
@@ -3571,23 +3749,33 @@  discard block
 block discarded – undo
3571 3749
 				if ($ModeS != '') {
3572 3750
 					$timeelapsed = microtime(true);
3573 3751
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3574
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3752
+					if ($globalDebugTimeElapsed) {
3753
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3754
+					}
3575 3755
 				} else {
3576 3756
 					$myhex = explode('-',$flightaware_id);
3577 3757
 					if (count($myhex) > 0) {
3578 3758
 						$timeelapsed = microtime(true);
3579 3759
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3580
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3760
+						if ($globalDebugTimeElapsed) {
3761
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3762
+						}
3581 3763
 					}
3582 3764
 				}
3583 3765
 			}
3584 3766
 		}
3585 3767
 		$fromsource = NULL;
3586
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3587
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3588
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3589
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3590
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3768
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3769
+			$fromsource = $globalAirlinesSource;
3770
+		} elseif ($format_source == 'vatsimtxt') {
3771
+			$fromsource = 'vatsim';
3772
+		} elseif ($format_source == 'whazzup') {
3773
+			$fromsource = 'ivao';
3774
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3775
+			$fromsource = 'vatsim';
3776
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3777
+			$fromsource = 'ivao';
3778
+		}
3591 3779
 		//getting the airline information
3592 3780
 		if ($ident != "")
3593 3781
 		{
@@ -3611,15 +3799,21 @@  discard block
 block discarded – undo
3611 3799
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3612 3800
 						$airline_array = $this->getAllAirlineInfo("NA");
3613 3801
 					}
3614
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3802
+					if ($globalDebugTimeElapsed) {
3803
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3804
+					}
3615 3805
 
3616 3806
 				} else {
3617 3807
 					$timeelapsed = microtime(true);
3618 3808
 					$airline_array = $this->getAllAirlineInfo("NA");
3619
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3809
+					if ($globalDebugTimeElapsed) {
3810
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3811
+					}
3620 3812
 				}
3621 3813
 			}
3622
-		} else $airline_array = array();
3814
+		} else {
3815
+			$airline_array = array();
3816
+		}
3623 3817
 		
3624 3818
 		//getting the aircraft information
3625 3819
 		$aircraft_array = array();
@@ -3633,27 +3827,37 @@  discard block
 block discarded – undo
3633 3827
 				{
3634 3828
 					$timeelapsed = microtime(true);
3635 3829
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3636
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3830
+					if ($globalDebugTimeElapsed) {
3831
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3832
+					}
3637 3833
 				} else {
3638 3834
 					$timeelapsed = microtime(true);
3639 3835
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3640
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3836
+					if ($globalDebugTimeElapsed) {
3837
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3838
+					}
3641 3839
 				}
3642 3840
 			}
3643 3841
 		} else {
3644 3842
 			if ($ModeS != '') {
3645 3843
 				$timeelapsed = microtime(true);
3646 3844
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3647
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3845
+				if ($globalDebugTimeElapsed) {
3846
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3847
+				}
3648 3848
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3649 3849
 				{
3650 3850
 					$timeelapsed = microtime(true);
3651 3851
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3652
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3852
+					if ($globalDebugTimeElapsed) {
3853
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3854
+					}
3653 3855
 				} else {
3654 3856
 					$timeelapsed = microtime(true);
3655 3857
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3656
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3858
+					if ($globalDebugTimeElapsed) {
3859
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3860
+					}
3657 3861
 				}
3658 3862
 			}
3659 3863
 		}
@@ -3669,7 +3873,9 @@  discard block
 block discarded – undo
3669 3873
 			} else {
3670 3874
 				$timeelapsed = microtime(true);
3671 3875
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3672
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3876
+				if ($globalDebugTimeElapsed) {
3877
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3878
+				}
3673 3879
 			}
3674 3880
 		}
3675 3881
 		
@@ -3684,7 +3890,9 @@  discard block
 block discarded – undo
3684 3890
 			} else {
3685 3891
 				$timeelapsed = microtime(true);
3686 3892
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3687
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3893
+				if ($globalDebugTimeElapsed) {
3894
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3895
+				}
3688 3896
 			}
3689 3897
 		}
3690 3898
 
@@ -3718,7 +3926,9 @@  discard block
 block discarded – undo
3718 3926
 			{
3719 3927
 				return false;
3720 3928
 			}
3721
-		} else $altitude = 0;
3929
+		} else {
3930
+			$altitude = 0;
3931
+		}
3722 3932
 		
3723 3933
 		if ($heading != "")
3724 3934
 		{
@@ -3747,7 +3957,9 @@  discard block
 block discarded – undo
3747 3957
 		{
3748 3958
 			$timeelapsed = microtime(true);
3749 3959
 			$image_array = $Image->getSpotterImage($registration);
3750
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3960
+			if ($globalDebugTimeElapsed) {
3961
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3962
+			}
3751 3963
 			if (!isset($image_array[0]['registration']))
3752 3964
 			{
3753 3965
 				//echo "Add image !!!! \n";
@@ -3755,14 +3967,21 @@  discard block
 block discarded – undo
3755 3967
 			}
3756 3968
 			$timeelapsed = microtime(true);
3757 3969
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3758
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3759
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3970
+			if ($globalDebugTimeElapsed) {
3971
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3972
+			}
3973
+			if ($owner_info['owner'] != '') {
3974
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3975
+			}
3760 3976
 		}
3761 3977
     
3762 3978
 		if ($globalIVAO && $aircraft_icao != '')
3763 3979
 		{
3764
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3765
-            		else $airline_icao = '';
3980
+            		if (isset($airline_array[0]['icao'])) {
3981
+            			$airline_icao = $airline_array[0]['icao'];
3982
+            		} else {
3983
+            			$airline_icao = '';
3984
+            		}
3766 3985
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3767 3986
 			if (!isset($image_array[0]['registration']))
3768 3987
 			{
@@ -3807,16 +4026,28 @@  discard block
 block discarded – undo
3807 4026
                 {
3808 4027
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3809 4028
                 }
3810
-                if ($registration == '') $registration = 'NA';
4029
+                if ($registration == '') {
4030
+                	$registration = 'NA';
4031
+                }
3811 4032
                 if ($latitude == '' && $longitude == '') {
3812 4033
             		$latitude = 0;
3813 4034
             		$longitude = 0;
3814 4035
             	}
3815
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3816
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3817
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3818
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3819
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4036
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4037
+                	$squawk = NULL;
4038
+                }
4039
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4040
+                	$verticalrate = NULL;
4041
+                }
4042
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4043
+                	$heading = 0;
4044
+                }
4045
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4046
+                	$groundspeed = 0;
4047
+                }
4048
+                if (!isset($aircraft_owner)) {
4049
+                	$aircraft_owner = NULL;
4050
+                }
3820 4051
                 $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) 
3821 4052
                 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)";
3822 4053
 
@@ -3827,9 +4058,13 @@  discard block
 block discarded – undo
3827 4058
 		if ($airline_type == '') {
3828 4059
 			$timeelapsed = microtime(true);
3829 4060
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3830
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4061
+			if ($globalDebugTimeElapsed) {
4062
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4063
+			}
4064
+		}
4065
+		if ($airline_type == null) {
4066
+			$airline_type = '';
3831 4067
 		}
3832
-		if ($airline_type == null) $airline_type = '';
3833 4068
                 $aircraft_type = $aircraft_array[0]['type'];
3834 4069
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3835 4070
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3993,7 +4228,9 @@  discard block
 block discarded – undo
3993 4228
 			}
3994 4229
 		}
3995 4230
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3996
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4231
+		if ($limit) {
4232
+			$query .= " LIMIT 10 OFFSET 0";
4233
+		}
3997 4234
 
3998 4235
 		$sth = $this->db->prepare($query);
3999 4236
 		$sth->execute($query_values);
@@ -4066,7 +4303,9 @@  discard block
 block discarded – undo
4066 4303
 		}
4067 4304
 		
4068 4305
 		$query .= " GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4069
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4306
+		if ($limit) {
4307
+			$query .= " LIMIT 10 OFFSET 0";
4308
+		}
4070 4309
       
4071 4310
 		
4072 4311
 		$sth = $this->db->prepare($query);
@@ -4110,7 +4349,9 @@  discard block
 block discarded – undo
4110 4349
 			}
4111 4350
 		}
4112 4351
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4113
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4352
+		if ($limit) {
4353
+			$query .= " LIMIT 10 OFFSET 0";
4354
+		}
4114 4355
       
4115 4356
 		
4116 4357
 		$sth = $this->db->prepare($query);
@@ -4186,7 +4427,9 @@  discard block
 block discarded – undo
4186 4427
 			}
4187 4428
 		}
4188 4429
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4189
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4430
+		if ($limit) {
4431
+			$query .= " LIMIT 10 OFFSET 0";
4432
+		}
4190 4433
 		
4191 4434
 		$sth = $this->db->prepare($query);
4192 4435
 		$sth->execute($query_values);
@@ -4228,7 +4471,9 @@  discard block
 block discarded – undo
4228 4471
 			}
4229 4472
 		}
4230 4473
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4231
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4474
+		if ($limit) {
4475
+			$query .= " LIMIT 10 OFFSET 0";
4476
+		}
4232 4477
       
4233 4478
 		
4234 4479
 		$sth = $this->db->prepare($query);
@@ -4471,7 +4716,9 @@  discard block
 block discarded – undo
4471 4716
 			date_default_timezone_set($globalTimezone);
4472 4717
 			$datetime = new DateTime($date);
4473 4718
 			$offset = $datetime->format('P');
4474
-		} else $offset = '+00:00';
4719
+		} else {
4720
+			$offset = '+00:00';
4721
+		}
4475 4722
 
4476 4723
 		if ($globalDBdriver == 'mysql') {
4477 4724
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4519,7 +4766,9 @@  discard block
 block discarded – undo
4519 4766
 			date_default_timezone_set($globalTimezone);
4520 4767
 			$datetime = new DateTime($date);
4521 4768
 			$offset = $datetime->format('P');
4522
-		} else $offset = '+00:00';
4769
+		} else {
4770
+			$offset = '+00:00';
4771
+		}
4523 4772
 		
4524 4773
 		if ($globalDBdriver == 'mysql') {
4525 4774
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4795,7 +5044,9 @@  discard block
 block discarded – undo
4795 5044
 		}
4796 5045
 		$query .= " GROUP BY spotter_output.airline_country
4797 5046
 					ORDER BY airline_country_count DESC";
4798
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5047
+		if ($limit) {
5048
+			$query .= " LIMIT 10 OFFSET 0";
5049
+		}
4799 5050
       
4800 5051
 		$sth = $this->db->prepare($query);
4801 5052
 		$sth->execute($query_values);
@@ -4823,7 +5074,9 @@  discard block
 block discarded – undo
4823 5074
 		global $globalDBdriver;
4824 5075
 		//$filter_query = $this->getFilter($filters,true,true);
4825 5076
 		$Connection= new Connection($this->db);
4826
-		if (!$Connection->tableExists('countries')) return array();
5077
+		if (!$Connection->tableExists('countries')) {
5078
+			return array();
5079
+		}
4827 5080
 		/*
4828 5081
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4829 5082
 					FROM countries c, spotter_output s
@@ -4855,7 +5108,9 @@  discard block
 block discarded – undo
4855 5108
 		}
4856 5109
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country ";
4857 5110
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
4858
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5111
+		if ($limit) {
5112
+			$query .= " LIMIT 10 OFFSET 0";
5113
+		}
4859 5114
       
4860 5115
 		
4861 5116
 		$sth = $this->db->prepare($query);
@@ -4932,7 +5187,9 @@  discard block
 block discarded – undo
4932 5187
 		}
4933 5188
 
4934 5189
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4935
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5190
+		if ($limit) {
5191
+			$query .= " LIMIT 10 OFFSET 0";
5192
+		}
4936 5193
  
4937 5194
 		$sth = $this->db->prepare($query);
4938 5195
 		$sth->execute($query_values);
@@ -5006,7 +5263,9 @@  discard block
 block discarded – undo
5006 5263
 		}
5007 5264
 
5008 5265
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5009
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5266
+		if ($limit) {
5267
+			$query .= " LIMIT 10 OFFSET 0";
5268
+		}
5010 5269
  
5011 5270
 		$sth = $this->db->prepare($query);
5012 5271
 		$sth->execute($query_values);
@@ -5053,7 +5312,9 @@  discard block
 block discarded – undo
5053 5312
 		}
5054 5313
 
5055 5314
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5056
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5315
+		if ($limit) {
5316
+			$query .= " LIMIT 10 OFFSET 0";
5317
+		}
5057 5318
  
5058 5319
 		$sth = $this->db->prepare($query);
5059 5320
 		$sth->execute();
@@ -5106,7 +5367,9 @@  discard block
 block discarded – undo
5106 5367
 			if($row['registration'] != "")
5107 5368
 			{
5108 5369
 				$image_array = $Image->getSpotterImage($row['registration']);
5109
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5370
+				if (isset($image_array[0]['image_thumbnail'])) {
5371
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5372
+				}
5110 5373
 			}
5111 5374
 			$temp_array['registration_count'] = $row['registration_count'];
5112 5375
 
@@ -5181,7 +5444,9 @@  discard block
 block discarded – undo
5181 5444
 			if($row['registration'] != "")
5182 5445
 			{
5183 5446
 				$image_array = $Image->getSpotterImage($row['registration']);
5184
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5447
+				if (isset($image_array[0]['image_thumbnail'])) {
5448
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5449
+				}
5185 5450
 			}
5186 5451
 			$temp_array['registration_count'] = $row['registration_count'];
5187 5452
 
@@ -5288,7 +5553,9 @@  discard block
 block discarded – undo
5288 5553
 			if($row['registration'] != "")
5289 5554
 			{
5290 5555
 				$image_array = $Image->getSpotterImage($row['registration']);
5291
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5556
+				if (isset($image_array[0]['image_thumbnail'])) {
5557
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5558
+				}
5292 5559
 			}
5293 5560
 			$temp_array['registration_count'] = $row['registration_count'];
5294 5561
 			$aircraft_array[] = $temp_array;
@@ -5413,7 +5680,9 @@  discard block
 block discarded – undo
5413 5680
 			date_default_timezone_set($globalTimezone);
5414 5681
 			$datetime = new DateTime($date);
5415 5682
 			$offset = $datetime->format('P');
5416
-		} else $offset = '+00:00';
5683
+		} else {
5684
+			$offset = '+00:00';
5685
+		}
5417 5686
 
5418 5687
 		if ($globalDBdriver == 'mysql') {
5419 5688
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5460,7 +5729,9 @@  discard block
 block discarded – undo
5460 5729
 			date_default_timezone_set($globalTimezone);
5461 5730
 			$datetime = new DateTime($date);
5462 5731
 			$offset = $datetime->format('P');
5463
-		} else $offset = '+00:00';
5732
+		} else {
5733
+			$offset = '+00:00';
5734
+		}
5464 5735
 
5465 5736
 		if ($globalDBdriver == 'mysql') {
5466 5737
 			$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 
@@ -5489,7 +5760,9 @@  discard block
 block discarded – undo
5489 5760
 			if($row['registration'] != "")
5490 5761
 			{
5491 5762
 				$image_array = $Image->getSpotterImage($row['registration']);
5492
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5763
+				if (isset($image_array[0]['image_thumbnail'])) {
5764
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5765
+				}
5493 5766
 			}
5494 5767
 			$temp_array['registration_count'] = $row['registration_count'];
5495 5768
  
@@ -5514,7 +5787,9 @@  discard block
 block discarded – undo
5514 5787
 			date_default_timezone_set($globalTimezone);
5515 5788
 			$datetime = new DateTime($date);
5516 5789
 			$offset = $datetime->format('P');
5517
-		} else $offset = '+00:00';
5790
+		} else {
5791
+			$offset = '+00:00';
5792
+		}
5518 5793
 
5519 5794
 		if ($globalDBdriver == 'mysql') {
5520 5795
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5652,8 +5927,11 @@  discard block
 block discarded – undo
5652 5927
 			if($row['registration'] != "")
5653 5928
 			{
5654 5929
 				$image_array = $Image->getSpotterImage($row['registration']);
5655
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5656
-				else $temp_array['image_thumbnail'] = '';
5930
+				if (isset($image_array[0]['image_thumbnail'])) {
5931
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5932
+				} else {
5933
+					$temp_array['image_thumbnail'] = '';
5934
+				}
5657 5935
 			}
5658 5936
 			$temp_array['registration_count'] = $row['registration_count'];
5659 5937
 			$aircraft_array[] = $temp_array;
@@ -5696,8 +5974,11 @@  discard block
 block discarded – undo
5696 5974
 			if($row['registration'] != "")
5697 5975
 			{
5698 5976
 				$image_array = $Image->getSpotterImage($row['registration']);
5699
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5700
-				else $temp_array['image_thumbnail'] = '';
5977
+				if (isset($image_array[0]['image_thumbnail'])) {
5978
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5979
+				} else {
5980
+					$temp_array['image_thumbnail'] = '';
5981
+				}
5701 5982
 			}
5702 5983
 			$temp_array['registration_count'] = $row['registration_count'];
5703 5984
 			$aircraft_array[] = $temp_array;
@@ -5740,8 +6021,11 @@  discard block
 block discarded – undo
5740 6021
 			if($row['registration'] != "")
5741 6022
 			{
5742 6023
 				$image_array = $Image->getSpotterImage($row['registration']);
5743
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5744
-				else $temp_array['image_thumbnail'] = '';
6024
+				if (isset($image_array[0]['image_thumbnail'])) {
6025
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6026
+				} else {
6027
+					$temp_array['image_thumbnail'] = '';
6028
+				}
5745 6029
 			}
5746 6030
 			$temp_array['registration_count'] = $row['registration_count'];
5747 6031
 			$aircraft_array[] = $temp_array;
@@ -5890,7 +6174,9 @@  discard block
 block discarded – undo
5890 6174
 			if($row['registration'] != "")
5891 6175
 			{
5892 6176
 				$image_array = $Image->getSpotterImage($row['registration']);
5893
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6177
+				if (isset($image_array[0]['image_thumbnail'])) {
6178
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6179
+				}
5894 6180
 			}
5895 6181
 			$temp_array['registration_count'] = $row['registration_count'];
5896 6182
           
@@ -6007,7 +6293,9 @@  discard block
 block discarded – undo
6007 6293
 			if($row['registration'] != "")
6008 6294
 			{
6009 6295
 				$image_array = $Image->getSpotterImage($row['registration']);
6010
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6296
+				if (isset($image_array[0]['image_thumbnail'])) {
6297
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6298
+				}
6011 6299
 			}
6012 6300
 			$temp_array['registration_count'] = $row['registration_count'];
6013 6301
           
@@ -6173,7 +6461,9 @@  discard block
 block discarded – undo
6173 6461
 			}
6174 6462
 		}
6175 6463
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6176
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6464
+		if ($limit) {
6465
+			$query .= " LIMIT 10 OFFSET 0";
6466
+		}
6177 6467
 		
6178 6468
 		$sth = $this->db->prepare($query);
6179 6469
 		$sth->execute($query_values);
@@ -6192,7 +6482,9 @@  discard block
 block discarded – undo
6192 6482
 			if($row['registration'] != "")
6193 6483
 			{
6194 6484
 				$image_array = $Image->getSpotterImage($row['registration']);
6195
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6485
+				if (isset($image_array[0]['image_thumbnail'])) {
6486
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6487
+				}
6196 6488
 			}
6197 6489
           
6198 6490
 			$aircraft_array[] = $temp_array;
@@ -6233,7 +6525,9 @@  discard block
 block discarded – undo
6233 6525
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6234 6526
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6235 6527
                 $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";
6236
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6528
+		if ($limit) {
6529
+			$query .= " LIMIT 10 OFFSET 0";
6530
+		}
6237 6531
 		
6238 6532
 		$sth = $this->db->prepare($query);
6239 6533
 		$sth->execute();
@@ -6253,7 +6547,9 @@  discard block
 block discarded – undo
6253 6547
 			if($row['registration'] != "")
6254 6548
 			{
6255 6549
 				$image_array = $Image->getSpotterImage($row['registration']);
6256
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6550
+				if (isset($image_array[0]['image_thumbnail'])) {
6551
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6552
+				}
6257 6553
 			}
6258 6554
           
6259 6555
 			$aircraft_array[] = $temp_array;
@@ -6319,7 +6615,9 @@  discard block
 block discarded – undo
6319 6615
 		}
6320 6616
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6321 6617
 				ORDER BY airport_departure_icao_count DESC";
6322
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6618
+		if ($limit) {
6619
+			$query .= " LIMIT 10 OFFSET 0";
6620
+		}
6323 6621
 
6324 6622
 		$sth = $this->db->prepare($query);
6325 6623
 		$sth->execute($query_values);
@@ -6370,7 +6668,9 @@  discard block
 block discarded – undo
6370 6668
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6371 6669
                 $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
6372 6670
 				ORDER BY airport_departure_icao_count DESC";
6373
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6671
+		if ($limit) {
6672
+			$query .= " LIMIT 10 OFFSET 0";
6673
+		}
6374 6674
       
6375 6675
 		$sth = $this->db->prepare($query);
6376 6676
 		$sth->execute();
@@ -6448,7 +6748,9 @@  discard block
 block discarded – undo
6448 6748
 		}
6449 6749
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6450 6750
 				ORDER BY airport_departure_icao_count DESC";
6451
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6751
+		if ($limit) {
6752
+			$query .= " LIMIT 10 OFFSET 0";
6753
+		}
6452 6754
     		//echo $query;
6453 6755
 		$sth = $this->db->prepare($query);
6454 6756
 		$sth->execute($query_values);
@@ -6500,7 +6802,9 @@  discard block
 block discarded – undo
6500 6802
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6501 6803
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6502 6804
 				ORDER BY airport_departure_icao_count DESC";
6503
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6805
+		if ($limit) {
6806
+			$query .= " LIMIT 10 OFFSET 0";
6807
+		}
6504 6808
       
6505 6809
 		$sth = $this->db->prepare($query);
6506 6810
 		$sth->execute();
@@ -6895,7 +7199,9 @@  discard block
 block discarded – undo
6895 7199
 			date_default_timezone_set($globalTimezone);
6896 7200
 			$datetime = new DateTime($date);
6897 7201
 			$offset = $datetime->format('P');
6898
-		} else $offset = '+00:00';
7202
+		} else {
7203
+			$offset = '+00:00';
7204
+		}
6899 7205
 
6900 7206
 		if ($globalDBdriver == 'mysql') {
6901 7207
 			$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 
@@ -6945,7 +7251,9 @@  discard block
 block discarded – undo
6945 7251
 			date_default_timezone_set($globalTimezone);
6946 7252
 			$datetime = new DateTime($date);
6947 7253
 			$offset = $datetime->format('P');
6948
-		} else $offset = '+00:00';
7254
+		} else {
7255
+			$offset = '+00:00';
7256
+		}
6949 7257
 
6950 7258
 		if ($globalDBdriver == 'mysql') {
6951 7259
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7294,7 +7602,9 @@  discard block
 block discarded – undo
7294 7602
 		}
7295 7603
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7296 7604
 					ORDER BY airport_arrival_icao_count DESC";
7297
-		if ($limit) $query .= " LIMIT 10";
7605
+		if ($limit) {
7606
+			$query .= " LIMIT 10";
7607
+		}
7298 7608
       
7299 7609
 		
7300 7610
 		$sth = $this->db->prepare($query);
@@ -7314,7 +7624,9 @@  discard block
 block discarded – undo
7314 7624
 			if ($icaoaskey) {
7315 7625
 				$icao = $row['arrival_airport_icao'];
7316 7626
 				$airport_array[$icao] = $temp_array;
7317
-			} else $airport_array[] = $temp_array;
7627
+			} else {
7628
+				$airport_array[] = $temp_array;
7629
+			}
7318 7630
 		}
7319 7631
 
7320 7632
 		return $airport_array;
@@ -7351,7 +7663,9 @@  discard block
 block discarded – undo
7351 7663
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7352 7664
                 $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
7353 7665
 					ORDER BY airport_arrival_icao_count DESC";
7354
-		if ($limit) $query .= " LIMIT 10";
7666
+		if ($limit) {
7667
+			$query .= " LIMIT 10";
7668
+		}
7355 7669
       
7356 7670
 		
7357 7671
 		$sth = $this->db->prepare($query);
@@ -7372,7 +7686,9 @@  discard block
 block discarded – undo
7372 7686
 			if ($icaoaskey) {
7373 7687
 				$icao = $row['arrival_airport_icao'];
7374 7688
 				$airport_array[$icao] = $temp_array;
7375
-			} else $airport_array[] = $temp_array;
7689
+			} else {
7690
+				$airport_array[] = $temp_array;
7691
+			}
7376 7692
 		}
7377 7693
 
7378 7694
 		return $airport_array;
@@ -7435,7 +7751,9 @@  discard block
 block discarded – undo
7435 7751
 		}
7436 7752
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7437 7753
 					ORDER BY airport_arrival_icao_count DESC";
7438
-		if ($limit) $query .= " LIMIT 10";
7754
+		if ($limit) {
7755
+			$query .= " LIMIT 10";
7756
+		}
7439 7757
       
7440 7758
 		
7441 7759
 		$sth = $this->db->prepare($query);
@@ -7454,7 +7772,9 @@  discard block
 block discarded – undo
7454 7772
 			if ($icaoaskey) {
7455 7773
 				$icao = $row['arrival_airport_icao'];
7456 7774
 				$airport_array[$icao] = $temp_array;
7457
-			} else $airport_array[] = $temp_array;
7775
+			} else {
7776
+				$airport_array[] = $temp_array;
7777
+			}
7458 7778
 		}
7459 7779
 
7460 7780
 		return $airport_array;
@@ -7491,7 +7811,9 @@  discard block
 block discarded – undo
7491 7811
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7492 7812
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7493 7813
 					ORDER BY airport_arrival_icao_count DESC";
7494
-		if ($limit) $query .= " LIMIT 10";
7814
+		if ($limit) {
7815
+			$query .= " LIMIT 10";
7816
+		}
7495 7817
       
7496 7818
 		
7497 7819
 		$sth = $this->db->prepare($query);
@@ -7512,7 +7834,9 @@  discard block
 block discarded – undo
7512 7834
 			if ($icaoaskey) {
7513 7835
 				$icao = $row['arrival_airport_icao'];
7514 7836
 				$airport_array[$icao] = $temp_array;
7515
-			} else $airport_array[] = $temp_array;
7837
+			} else {
7838
+				$airport_array[] = $temp_array;
7839
+			}
7516 7840
 		}
7517 7841
 
7518 7842
 		return $airport_array;
@@ -7893,7 +8217,9 @@  discard block
 block discarded – undo
7893 8217
 			date_default_timezone_set($globalTimezone);
7894 8218
 			$datetime = new DateTime($date);
7895 8219
 			$offset = $datetime->format('P');
7896
-		} else $offset = '+00:00';
8220
+		} else {
8221
+			$offset = '+00:00';
8222
+		}
7897 8223
 
7898 8224
 		if ($globalDBdriver == 'mysql') {
7899 8225
 			$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 
@@ -7943,7 +8269,9 @@  discard block
 block discarded – undo
7943 8269
 			date_default_timezone_set($globalTimezone);
7944 8270
 			$datetime = new DateTime($date);
7945 8271
 			$offset = $datetime->format('P');
7946
-		} else $offset = '+00:00';
8272
+		} else {
8273
+			$offset = '+00:00';
8274
+		}
7947 8275
 
7948 8276
 		if ($globalDBdriver == 'mysql') {
7949 8277
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8334,7 +8662,9 @@  discard block
 block discarded – undo
8334 8662
 		}
8335 8663
 		$query .= " GROUP BY spotter_output.arrival_airport_country
8336 8664
 					ORDER BY airport_arrival_country_count DESC";
8337
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8665
+		if ($limit) {
8666
+			$query .= " LIMIT 10 OFFSET 0";
8667
+		}
8338 8668
       
8339 8669
 		
8340 8670
 		$sth = $this->db->prepare($query);
@@ -8621,7 +8951,9 @@  discard block
 block discarded – undo
8621 8951
 			date_default_timezone_set($globalTimezone);
8622 8952
 			$datetime = new DateTime($date);
8623 8953
 			$offset = $datetime->format('P');
8624
-		} else $offset = '+00:00';
8954
+		} else {
8955
+			$offset = '+00:00';
8956
+		}
8625 8957
 		
8626 8958
 		if ($globalDBdriver == 'mysql') {
8627 8959
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -8877,12 +9209,18 @@  discard block
 block discarded – undo
8877 9209
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8878 9210
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
8879 9211
 		 if ($olderthanmonths > 0) {
8880
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8881
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9212
+			if ($globalDBdriver == 'mysql') {
9213
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9214
+			} else {
9215
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9216
+			}
8882 9217
 		}
8883 9218
 		if ($sincedate != '') {
8884
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
8885
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9219
+			if ($globalDBdriver == 'mysql') {
9220
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9221
+			} else {
9222
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9223
+			}
8886 9224
 		}
8887 9225
 		$query_values = array();
8888 9226
 		if ($year != '') {
@@ -8913,7 +9251,9 @@  discard block
 block discarded – undo
8913 9251
 			}
8914 9252
 		}
8915 9253
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
8916
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9254
+		if ($limit) {
9255
+			$query .= " LIMIT 10 OFFSET 0";
9256
+		}
8917 9257
       		
8918 9258
 		$sth = $this->db->prepare($query);
8919 9259
 		$sth->execute($query_values);
@@ -8947,15 +9287,23 @@  discard block
 block discarded – undo
8947 9287
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8948 9288
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
8949 9289
 		 if ($olderthanmonths > 0) {
8950
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8951
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9290
+			if ($globalDBdriver == 'mysql') {
9291
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9292
+			} else {
9293
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9294
+			}
8952 9295
 		}
8953 9296
 		if ($sincedate != '') {
8954
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
8955
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9297
+			if ($globalDBdriver == 'mysql') {
9298
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9299
+			} else {
9300
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9301
+			}
8956 9302
 		}
8957 9303
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
8958
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9304
+		if ($limit) {
9305
+			$query .= " LIMIT 10 OFFSET 0";
9306
+		}
8959 9307
       		
8960 9308
 		$sth = $this->db->prepare($query);
8961 9309
 		$sth->execute();
@@ -8992,7 +9340,9 @@  discard block
 block discarded – undo
8992 9340
 			date_default_timezone_set($globalTimezone);
8993 9341
 			$datetime = new DateTime();
8994 9342
 			$offset = $datetime->format('P');
8995
-		} else $offset = '+00:00';
9343
+		} else {
9344
+			$offset = '+00:00';
9345
+		}
8996 9346
 
8997 9347
 		if ($globalDBdriver == 'mysql') {
8998 9348
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9041,7 +9391,9 @@  discard block
 block discarded – undo
9041 9391
 			date_default_timezone_set($globalTimezone);
9042 9392
 			$datetime = new DateTime();
9043 9393
 			$offset = $datetime->format('P');
9044
-		} else $offset = '+00:00';
9394
+		} else {
9395
+			$offset = '+00:00';
9396
+		}
9045 9397
 		$filter_query = $this->getFilter($filters,true,true);
9046 9398
 		if ($globalDBdriver == 'mysql') {
9047 9399
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9090,7 +9442,9 @@  discard block
 block discarded – undo
9090 9442
 			date_default_timezone_set($globalTimezone);
9091 9443
 			$datetime = new DateTime();
9092 9444
 			$offset = $datetime->format('P');
9093
-		} else $offset = '+00:00';
9445
+		} else {
9446
+			$offset = '+00:00';
9447
+		}
9094 9448
 		$filter_query = $this->getFilter($filters,true,true);
9095 9449
 		if ($globalDBdriver == 'mysql') {
9096 9450
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9136,7 +9490,9 @@  discard block
 block discarded – undo
9136 9490
 			date_default_timezone_set($globalTimezone);
9137 9491
 			$datetime = new DateTime();
9138 9492
 			$offset = $datetime->format('P');
9139
-		} else $offset = '+00:00';
9493
+		} else {
9494
+			$offset = '+00:00';
9495
+		}
9140 9496
 		$filter_query = $this->getFilter($filters,true,true);
9141 9497
 		if ($globalDBdriver == 'mysql') {
9142 9498
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9184,7 +9540,9 @@  discard block
 block discarded – undo
9184 9540
 			date_default_timezone_set($globalTimezone);
9185 9541
 			$datetime = new DateTime();
9186 9542
 			$offset = $datetime->format('P');
9187
-		} else $offset = '+00:00';
9543
+		} else {
9544
+			$offset = '+00:00';
9545
+		}
9188 9546
 		
9189 9547
 		if ($globalDBdriver == 'mysql') {
9190 9548
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9232,7 +9590,9 @@  discard block
 block discarded – undo
9232 9590
 			date_default_timezone_set($globalTimezone);
9233 9591
 			$datetime = new DateTime();
9234 9592
 			$offset = $datetime->format('P');
9235
-		} else $offset = '+00:00';
9593
+		} else {
9594
+			$offset = '+00:00';
9595
+		}
9236 9596
 
9237 9597
 		if ($globalDBdriver == 'mysql') {
9238 9598
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9279,7 +9639,9 @@  discard block
 block discarded – undo
9279 9639
 			date_default_timezone_set($globalTimezone);
9280 9640
 			$datetime = new DateTime();
9281 9641
 			$offset = $datetime->format('P');
9282
-		} else $offset = '+00:00';
9642
+		} else {
9643
+			$offset = '+00:00';
9644
+		}
9283 9645
 
9284 9646
 		if ($globalDBdriver == 'mysql') {
9285 9647
 			$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
@@ -9327,7 +9689,9 @@  discard block
 block discarded – undo
9327 9689
 			date_default_timezone_set($globalTimezone);
9328 9690
 			$datetime = new DateTime();
9329 9691
 			$offset = $datetime->format('P');
9330
-		} else $offset = '+00:00';
9692
+		} else {
9693
+			$offset = '+00:00';
9694
+		}
9331 9695
 		$filter_query = $this->getFilter($filters,true,true);
9332 9696
 		if ($globalDBdriver == 'mysql') {
9333 9697
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9372,7 +9736,9 @@  discard block
 block discarded – undo
9372 9736
 			date_default_timezone_set($globalTimezone);
9373 9737
 			$datetime = new DateTime();
9374 9738
 			$offset = $datetime->format('P');
9375
-		} else $offset = '+00:00';
9739
+		} else {
9740
+			$offset = '+00:00';
9741
+		}
9376 9742
 		$filter_query = $this->getFilter($filters,true,true);
9377 9743
 
9378 9744
 		if ($globalDBdriver == 'mysql') {
@@ -9419,7 +9785,9 @@  discard block
 block discarded – undo
9419 9785
 			date_default_timezone_set($globalTimezone);
9420 9786
 			$datetime = new DateTime();
9421 9787
 			$offset = $datetime->format('P');
9422
-		} else $offset = '+00:00';
9788
+		} else {
9789
+			$offset = '+00:00';
9790
+		}
9423 9791
 
9424 9792
 		if ($globalDBdriver == 'mysql') {
9425 9793
 			$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
@@ -9465,7 +9833,9 @@  discard block
 block discarded – undo
9465 9833
 			date_default_timezone_set($globalTimezone);
9466 9834
 			$datetime = new DateTime();
9467 9835
 			$offset = $datetime->format('P');
9468
-		} else $offset = '+00:00';
9836
+		} else {
9837
+			$offset = '+00:00';
9838
+		}
9469 9839
 		$filter_query = $this->getFilter($filters,true,true);
9470 9840
 
9471 9841
 		if ($globalDBdriver == 'mysql') {
@@ -9512,7 +9882,9 @@  discard block
 block discarded – undo
9512 9882
 			date_default_timezone_set($globalTimezone);
9513 9883
 			$datetime = new DateTime();
9514 9884
 			$offset = $datetime->format('P');
9515
-		} else $offset = '+00:00';
9885
+		} else {
9886
+			$offset = '+00:00';
9887
+		}
9516 9888
 
9517 9889
 		if ($globalDBdriver == 'mysql') {
9518 9890
 			$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
@@ -9559,7 +9931,9 @@  discard block
 block discarded – undo
9559 9931
 			date_default_timezone_set($globalTimezone);
9560 9932
 			$datetime = new DateTime();
9561 9933
 			$offset = $datetime->format('P');
9562
-		} else $offset = '+00:00';
9934
+		} else {
9935
+			$offset = '+00:00';
9936
+		}
9563 9937
 
9564 9938
 		if ($globalDBdriver == 'mysql') {
9565 9939
 			$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
@@ -9604,7 +9978,9 @@  discard block
 block discarded – undo
9604 9978
 			date_default_timezone_set($globalTimezone);
9605 9979
 			$datetime = new DateTime();
9606 9980
 			$offset = $datetime->format('P');
9607
-		} else $offset = '+00:00';
9981
+		} else {
9982
+			$offset = '+00:00';
9983
+		}
9608 9984
 		$filter_query = $this->getFilter($filters,true,true);
9609 9985
 
9610 9986
 		if ($globalDBdriver == 'mysql') {
@@ -9652,7 +10028,9 @@  discard block
 block discarded – undo
9652 10028
 			date_default_timezone_set($globalTimezone);
9653 10029
 			$datetime = new DateTime();
9654 10030
 			$offset = $datetime->format('P');
9655
-		} else $offset = '+00:00';
10031
+		} else {
10032
+			$offset = '+00:00';
10033
+		}
9656 10034
 
9657 10035
 		if ($globalDBdriver == 'mysql') {
9658 10036
 			$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
@@ -9698,7 +10076,9 @@  discard block
 block discarded – undo
9698 10076
 			date_default_timezone_set($globalTimezone);
9699 10077
 			$datetime = new DateTime();
9700 10078
 			$offset = $datetime->format('P');
9701
-		} else $offset = '+00:00';
10079
+		} else {
10080
+			$offset = '+00:00';
10081
+		}
9702 10082
 		$filter_query = $this->getFilter($filters,true,true);
9703 10083
 
9704 10084
 		if ($globalDBdriver == 'mysql') {
@@ -9746,7 +10126,9 @@  discard block
 block discarded – undo
9746 10126
 			date_default_timezone_set($globalTimezone);
9747 10127
 			$datetime = new DateTime();
9748 10128
 			$offset = $datetime->format('P');
9749
-		} else $offset = '+00:00';
10129
+		} else {
10130
+			$offset = '+00:00';
10131
+		}
9750 10132
 
9751 10133
 		if ($globalDBdriver == 'mysql') {
9752 10134
 			$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
@@ -9793,7 +10175,9 @@  discard block
 block discarded – undo
9793 10175
 			date_default_timezone_set($globalTimezone);
9794 10176
 			$datetime = new DateTime();
9795 10177
 			$offset = $datetime->format('P');
9796
-		} else $offset = '+00:00';
10178
+		} else {
10179
+			$offset = '+00:00';
10180
+		}
9797 10181
 		$filter_query = $this->getFilter($filters,true,true);
9798 10182
 		if ($globalDBdriver == 'mysql') {
9799 10183
 			$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
@@ -9842,7 +10226,9 @@  discard block
 block discarded – undo
9842 10226
 			date_default_timezone_set($globalTimezone);
9843 10227
 			$datetime = new DateTime();
9844 10228
 			$offset = $datetime->format('P');
9845
-		} else $offset = '+00:00';
10229
+		} else {
10230
+			$offset = '+00:00';
10231
+		}
9846 10232
 
9847 10233
 		$orderby_sql = '';
9848 10234
 		if ($orderby == "hour")
@@ -9908,7 +10294,9 @@  discard block
 block discarded – undo
9908 10294
 			date_default_timezone_set($globalTimezone);
9909 10295
 			$datetime = new DateTime();
9910 10296
 			$offset = $datetime->format('P');
9911
-		} else $offset = '+00:00';
10297
+		} else {
10298
+			$offset = '+00:00';
10299
+		}
9912 10300
 
9913 10301
 		$orderby_sql = '';
9914 10302
 		if ($orderby == "hour")
@@ -9975,7 +10363,9 @@  discard block
 block discarded – undo
9975 10363
 			date_default_timezone_set($globalTimezone);
9976 10364
 			$datetime = new DateTime();
9977 10365
 			$offset = $datetime->format('P');
9978
-		} else $offset = '+00:00';
10366
+		} else {
10367
+			$offset = '+00:00';
10368
+		}
9979 10369
 
9980 10370
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
9981 10371
 
@@ -10026,7 +10416,9 @@  discard block
 block discarded – undo
10026 10416
 			date_default_timezone_set($globalTimezone);
10027 10417
 			$datetime = new DateTime();
10028 10418
 			$offset = $datetime->format('P');
10029
-		} else $offset = '+00:00';
10419
+		} else {
10420
+			$offset = '+00:00';
10421
+		}
10030 10422
 
10031 10423
 		if ($globalDBdriver == 'mysql') {
10032 10424
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10073,7 +10465,9 @@  discard block
 block discarded – undo
10073 10465
 			date_default_timezone_set($globalTimezone);
10074 10466
 			$datetime = new DateTime();
10075 10467
 			$offset = $datetime->format('P');
10076
-		} else $offset = '+00:00';
10468
+		} else {
10469
+			$offset = '+00:00';
10470
+		}
10077 10471
 
10078 10472
 		if ($globalDBdriver == 'mysql') {
10079 10473
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10120,7 +10514,9 @@  discard block
 block discarded – undo
10120 10514
 			date_default_timezone_set($globalTimezone);
10121 10515
 			$datetime = new DateTime();
10122 10516
 			$offset = $datetime->format('P');
10123
-		} else $offset = '+00:00';
10517
+		} else {
10518
+			$offset = '+00:00';
10519
+		}
10124 10520
 
10125 10521
 		if ($globalDBdriver == 'mysql') {
10126 10522
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10168,7 +10564,9 @@  discard block
 block discarded – undo
10168 10564
 			date_default_timezone_set($globalTimezone);
10169 10565
 			$datetime = new DateTime();
10170 10566
 			$offset = $datetime->format('P');
10171
-		} else $offset = '+00:00';
10567
+		} else {
10568
+			$offset = '+00:00';
10569
+		}
10172 10570
 
10173 10571
 		if ($globalDBdriver == 'mysql') {
10174 10572
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10216,7 +10614,9 @@  discard block
 block discarded – undo
10216 10614
 			date_default_timezone_set($globalTimezone);
10217 10615
 			$datetime = new DateTime($date);
10218 10616
 			$offset = $datetime->format('P');
10219
-		} else $offset = '+00:00';
10617
+		} else {
10618
+			$offset = '+00:00';
10619
+		}
10220 10620
 
10221 10621
 		if ($globalDBdriver == 'mysql') {
10222 10622
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10264,7 +10664,9 @@  discard block
 block discarded – undo
10264 10664
 			date_default_timezone_set($globalTimezone);
10265 10665
 			$datetime = new DateTime();
10266 10666
 			$offset = $datetime->format('P');
10267
-		} else $offset = '+00:00';
10667
+		} else {
10668
+			$offset = '+00:00';
10669
+		}
10268 10670
 
10269 10671
 		if ($globalDBdriver == 'mysql') {
10270 10672
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10311,7 +10713,9 @@  discard block
 block discarded – undo
10311 10713
 			date_default_timezone_set($globalTimezone);
10312 10714
 			$datetime = new DateTime();
10313 10715
 			$offset = $datetime->format('P');
10314
-		} else $offset = '+00:00';
10716
+		} else {
10717
+			$offset = '+00:00';
10718
+		}
10315 10719
 
10316 10720
 		if ($globalDBdriver == 'mysql') {
10317 10721
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10358,7 +10762,9 @@  discard block
 block discarded – undo
10358 10762
 			date_default_timezone_set($globalTimezone);
10359 10763
 			$datetime = new DateTime();
10360 10764
 			$offset = $datetime->format('P');
10361
-		} else $offset = '+00:00';
10765
+		} else {
10766
+			$offset = '+00:00';
10767
+		}
10362 10768
 
10363 10769
 		if ($globalDBdriver == 'mysql') {
10364 10770
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10408,7 +10814,9 @@  discard block
 block discarded – undo
10408 10814
 			date_default_timezone_set($globalTimezone);
10409 10815
 			$datetime = new DateTime();
10410 10816
 			$offset = $datetime->format('P');
10411
-		} else $offset = '+00:00';
10817
+		} else {
10818
+			$offset = '+00:00';
10819
+		}
10412 10820
 
10413 10821
 		if ($globalDBdriver == 'mysql') {
10414 10822
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10455,7 +10863,9 @@  discard block
 block discarded – undo
10455 10863
 			date_default_timezone_set($globalTimezone);
10456 10864
 			$datetime = new DateTime();
10457 10865
 			$offset = $datetime->format('P');
10458
-		} else $offset = '+00:00';
10866
+		} else {
10867
+			$offset = '+00:00';
10868
+		}
10459 10869
 
10460 10870
 		if ($globalDBdriver == 'mysql') {
10461 10871
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10666,8 +11076,11 @@  discard block
 block discarded – undo
10666 11076
 				$query_values = array_merge($query_values,array(':month' => $month));
10667 11077
 			}
10668 11078
 		}
10669
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
10670
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11079
+		if (empty($query_values)) {
11080
+			$queryi .= $this->getFilter($filters);
11081
+		} else {
11082
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11083
+		}
10671 11084
 		
10672 11085
 		//echo $query;
10673 11086
 		$sth = $this->db->prepare($queryi);
@@ -10746,8 +11159,11 @@  discard block
 block discarded – undo
10746 11159
 				$query_values = array_merge($query_values,array(':month' => $month));
10747 11160
 			}
10748 11161
 		}
10749
-                if ($query == '') $queryi .= $this->getFilter($filters);
10750
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11162
+                if ($query == '') {
11163
+                	$queryi .= $this->getFilter($filters);
11164
+                } else {
11165
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11166
+                }
10751 11167
 
10752 11168
 
10753 11169
 		$sth = $this->db->prepare($queryi);
@@ -10770,7 +11186,9 @@  discard block
 block discarded – undo
10770 11186
 			date_default_timezone_set($globalTimezone);
10771 11187
 			$datetime = new DateTime();
10772 11188
 			$offset = $datetime->format('P');
10773
-		} else $offset = '+00:00';
11189
+		} else {
11190
+			$offset = '+00:00';
11191
+		}
10774 11192
 
10775 11193
 		if ($globalDBdriver == 'mysql') {
10776 11194
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10956,7 +11374,9 @@  discard block
 block discarded – undo
10956 11374
 	*/
10957 11375
 	public function parseDirection($direction = 0)
10958 11376
 	{
10959
-		if ($direction == '') $direction = 0;
11377
+		if ($direction == '') {
11378
+			$direction = 0;
11379
+		}
10960 11380
 		$direction_array = array();
10961 11381
 		$temp_array = array();
10962 11382
 
@@ -11057,7 +11477,9 @@  discard block
 block discarded – undo
11057 11477
 		if (isset($result->AirlineFlightInfoResult))
11058 11478
 		{
11059 11479
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11060
-		} else return '';
11480
+		} else {
11481
+			return '';
11482
+		}
11061 11483
 		
11062 11484
 		$registration = $this->convertAircraftRegistration($registration);
11063 11485
 		
@@ -11086,7 +11508,9 @@  discard block
 block discarded – undo
11086 11508
 		if (count($row) > 0) {
11087 11509
 		    //return $row['Registration'];
11088 11510
 		    return $row['registration'];
11089
-		} else return '';
11511
+		} else {
11512
+			return '';
11513
+		}
11090 11514
 	
11091 11515
 	}
11092 11516
 
@@ -11109,9 +11533,14 @@  discard block
 block discarded – undo
11109 11533
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11110 11534
 		$sth->closeCursor();
11111 11535
 		if (count($row) > 0) {
11112
-		    if ($row['type_flight'] == null) return '';
11113
-		    else return $row['type_flight'];
11114
-		} else return '';
11536
+		    if ($row['type_flight'] == null) {
11537
+		    	return '';
11538
+		    } else {
11539
+		    	return $row['type_flight'];
11540
+		    }
11541
+		} else {
11542
+			return '';
11543
+		}
11115 11544
 	
11116 11545
 	}
11117 11546
 
@@ -11129,7 +11558,9 @@  discard block
 block discarded – undo
11129 11558
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11130 11559
 	
11131 11560
 		$Connection = new Connection($this->db);
11132
-		if (!$Connection->tableExists('countries')) return '';
11561
+		if (!$Connection->tableExists('countries')) {
11562
+			return '';
11563
+		}
11133 11564
 	
11134 11565
 		try {
11135 11566
 			/*
@@ -11149,9 +11580,13 @@  discard block
 block discarded – undo
11149 11580
 			$sth->closeCursor();
11150 11581
 			if (count($row) > 0) {
11151 11582
 				return $row;
11152
-			} else return '';
11583
+			} else {
11584
+				return '';
11585
+			}
11153 11586
 		} catch (PDOException $e) {
11154
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11587
+			if (isset($globalDebug) && $globalDebug) {
11588
+				echo 'Error : '.$e->getMessage()."\n";
11589
+			}
11155 11590
 			return '';
11156 11591
 		}
11157 11592
 	
@@ -11169,7 +11604,9 @@  discard block
 block discarded – undo
11169 11604
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11170 11605
 	
11171 11606
 		$Connection = new Connection($this->db);
11172
-		if (!$Connection->tableExists('countries')) return '';
11607
+		if (!$Connection->tableExists('countries')) {
11608
+			return '';
11609
+		}
11173 11610
 	
11174 11611
 		try {
11175 11612
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11181,9 +11618,13 @@  discard block
 block discarded – undo
11181 11618
 			$sth->closeCursor();
11182 11619
 			if (count($row) > 0) {
11183 11620
 				return $row;
11184
-			} else return '';
11621
+			} else {
11622
+				return '';
11623
+			}
11185 11624
 		} catch (PDOException $e) {
11186
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11625
+			if (isset($globalDebug) && $globalDebug) {
11626
+				echo 'Error : '.$e->getMessage()."\n";
11627
+			}
11187 11628
 			return '';
11188 11629
 		}
11189 11630
 	
@@ -11433,7 +11874,9 @@  discard block
 block discarded – undo
11433 11874
 	{
11434 11875
 		global $globalBitlyAccessToken;
11435 11876
 		
11436
-		if ($globalBitlyAccessToken == '') return $url;
11877
+		if ($globalBitlyAccessToken == '') {
11878
+			return $url;
11879
+		}
11437 11880
         
11438 11881
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11439 11882
 		
@@ -11582,7 +12025,9 @@  discard block
 block discarded – undo
11582 12025
 		
11583 12026
 
11584 12027
 		// routes
11585
-		if ($globalDebug) print "Routes...\n";
12028
+		if ($globalDebug) {
12029
+			print "Routes...\n";
12030
+		}
11586 12031
 		if ($globalDBdriver == 'mysql') {
11587 12032
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
11588 12033
 		} else {
@@ -11601,7 +12046,9 @@  discard block
 block discarded – undo
11601 12046
 			}
11602 12047
 		}
11603 12048
 		
11604
-		if ($globalDebug) print "Airlines...\n";
12049
+		if ($globalDebug) {
12050
+			print "Airlines...\n";
12051
+		}
11605 12052
 		//airlines
11606 12053
 		if ($globalDBdriver == 'mysql') {
11607 12054
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -11615,10 +12062,15 @@  discard block
 block discarded – undo
11615 12062
 			if (is_numeric(substr($row['ident'], -1, 1)))
11616 12063
 			{
11617 12064
 				$fromsource = NULL;
11618
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
11619
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11620
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11621
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12065
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12066
+					$fromsource = 'vatsim';
12067
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12068
+					$fromsource = 'ivao';
12069
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12070
+					$fromsource = 'vatsim';
12071
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12072
+					$fromsource = 'ivao';
12073
+				}
11622 12074
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11623 12075
 				if (isset($airline_array[0]['name'])) {
11624 12076
 					$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";
@@ -11628,13 +12080,17 @@  discard block
 block discarded – undo
11628 12080
 			}
11629 12081
 		}
11630 12082
 
11631
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12083
+		if ($globalDebug) {
12084
+			print "Remove Duplicate in aircraft_modes...\n";
12085
+		}
11632 12086
 		//duplicate modes
11633 12087
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
11634 12088
 		$sth = $this->db->prepare($query);
11635 12089
 		$sth->execute();
11636 12090
 		
11637
-		if ($globalDebug) print "Aircraft...\n";
12091
+		if ($globalDebug) {
12092
+			print "Aircraft...\n";
12093
+		}
11638 12094
 		//aircraft
11639 12095
 		if ($globalDBdriver == 'mysql') {
11640 12096
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -11677,26 +12133,38 @@  discard block
 block discarded – undo
11677 12133
 				 if (isset($closestAirports[0])) {
11678 12134
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
11679 12135
 						$airport_icao = $closestAirports[0]['icao'];
11680
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12136
+						if ($globalDebug) {
12137
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12138
+						}
11681 12139
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
11682 12140
 						foreach ($closestAirports as $airport) {
11683 12141
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
11684 12142
 								$airport_icao = $airport['icao'];
11685
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12143
+								if ($globalDebug) {
12144
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12145
+								}
11686 12146
 								break;
11687 12147
 							}
11688 12148
 						}
11689 12149
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
11690 12150
 						$airport_icao = $closestAirports[0]['icao'];
11691
-						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";
12151
+						if ($globalDebug) {
12152
+							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";
12153
+						}
11692 12154
 					} else {
11693
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12155
+						if ($globalDebug) {
12156
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12157
+						}
11694 12158
 					}
11695 12159
 				} else {
11696
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12160
+					if ($globalDebug) {
12161
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12162
+					}
11697 12163
 				}
11698 12164
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
11699
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12165
+					if ($globalDebug) {
12166
+						echo "Updating airport to ".$airport_icao."...\n";
12167
+					}
11700 12168
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11701 12169
 					$sthu = $this->db->prepare($update_query);
11702 12170
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.