Completed
Push — master ( 150320...f1741a )
by Yannick
10:41
created
require/class.Spotter.php 1 patch
Indentation   +1454 added lines, -1454 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 	}
167 167
 
168 168
 	/**
169
-	* Executes the SQL statements to get the spotter information
170
-	*
171
-	* @param String $query the SQL query
172
-	* @param Array $params parameter of the query
173
-	* @param String $limitQuery the limit query
174
-	* @return Array the spotter information
175
-	*
176
-	*/
169
+	 * Executes the SQL statements to get the spotter information
170
+	 *
171
+	 * @param String $query the SQL query
172
+	 * @param Array $params parameter of the query
173
+	 * @param String $limitQuery the limit query
174
+	 * @return Array the spotter information
175
+	 *
176
+	 */
177 177
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
178 178
 	{
179 179
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
343 343
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
344 344
 					} else $temp_array['aircraft_shadow'] = 'default.png';
345
-                                } else {
346
-                            		$temp_array['aircraft_shadow'] = 'default.png';
345
+								} else {
346
+									$temp_array['aircraft_shadow'] = 'default.png';
347 347
 					$temp_array['aircraft_name'] = 'N/A';
348 348
 					$temp_array['aircraft_manufacturer'] = 'N/A';
349
-                            	}
349
+								}
350 350
 			}
351 351
 			$fromsource = NULL;
352 352
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -542,11 +542,11 @@  discard block
 block discarded – undo
542 542
 	
543 543
 	
544 544
 	/**
545
-	* Gets all the spotter information
546
-	*
547
-	* @return Array the spotter information
548
-	*
549
-	*/
545
+	 * Gets all the spotter information
546
+	 *
547
+	 * @return Array the spotter information
548
+	 *
549
+	 */
550 550
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
551 551
 	{
552 552
 		global $globalTimezone, $globalDBdriver;
@@ -893,11 +893,11 @@  discard block
 block discarded – undo
893 893
 	
894 894
 	
895 895
 	/**
896
-	* Gets all the spotter information based on the latest data entry
897
-	*
898
-	* @return Array the spotter information
899
-	*
900
-	*/
896
+	 * Gets all the spotter information based on the latest data entry
897
+	 *
898
+	 * @return Array the spotter information
899
+	 *
900
+	 */
901 901
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
902 902
 	{
903 903
 		global $global_query;
@@ -936,12 +936,12 @@  discard block
 block discarded – undo
936 936
 	}
937 937
     
938 938
     
939
-    /**
940
-	* Gets all the spotter information based on a user's latitude and longitude
941
-	*
942
-	* @return Array the spotter information
943
-	*
944
-	*/
939
+	/**
940
+	 * Gets all the spotter information based on a user's latitude and longitude
941
+	 *
942
+	 * @return Array the spotter information
943
+	 *
944
+	 */
945 945
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
946 946
 	{
947 947
 		date_default_timezone_set('UTC');
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 				return false;
970 970
 			}
971 971
 		}
972
-    		$additional_query = '';
972
+			$additional_query = '';
973 973
 		if ($interval != "")
974 974
 		{
975 975
 			if (!is_string($interval))
@@ -1009,12 +1009,12 @@  discard block
 block discarded – undo
1009 1009
 	}
1010 1010
     
1011 1011
     
1012
-    /**
1013
-	* Gets all the spotter information sorted by the newest aircraft type
1014
-	*
1015
-	* @return Array the spotter information
1016
-	*
1017
-	*/
1012
+	/**
1013
+	 * Gets all the spotter information sorted by the newest aircraft type
1014
+	 *
1015
+	 * @return Array the spotter information
1016
+	 *
1017
+	 */
1018 1018
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1019 1019
 	{
1020 1020
 		global $global_query;
@@ -1055,11 +1055,11 @@  discard block
 block discarded – undo
1055 1055
     
1056 1056
     
1057 1057
 	/**
1058
-	* Gets all the spotter information sorted by the newest aircraft registration
1059
-	*
1060
-	* @return Array the spotter information
1061
-	*
1062
-	*/
1058
+	 * Gets all the spotter information sorted by the newest aircraft registration
1059
+	 *
1060
+	 * @return Array the spotter information
1061
+	 *
1062
+	 */
1063 1063
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1064 1064
 	{
1065 1065
 		global $global_query;
@@ -1099,11 +1099,11 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 
1101 1101
 	/**
1102
-	* Gets all the spotter information sorted by the newest airline
1103
-	*
1104
-	* @return Array the spotter information
1105
-	*
1106
-	*/
1102
+	 * Gets all the spotter information sorted by the newest airline
1103
+	 *
1104
+	 * @return Array the spotter information
1105
+	 *
1106
+	 */
1107 1107
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1108 1108
 	{
1109 1109
 		global $global_query;
@@ -1142,12 +1142,12 @@  discard block
 block discarded – undo
1142 1142
 	}
1143 1143
     
1144 1144
     
1145
-    /**
1146
-	* Gets all the spotter information sorted by the newest departure airport
1147
-	*
1148
-	* @return Array the spotter information
1149
-	*
1150
-	*/
1145
+	/**
1146
+	 * Gets all the spotter information sorted by the newest departure airport
1147
+	 *
1148
+	 * @return Array the spotter information
1149
+	 *
1150
+	 */
1151 1151
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1152 1152
 	{
1153 1153
 		global $global_query;
@@ -1189,11 +1189,11 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
 
1191 1191
 	/**
1192
-	* Gets all the spotter information sorted by the newest arrival airport
1193
-	*
1194
-	* @return Array the spotter information
1195
-	*
1196
-	*/
1192
+	 * Gets all the spotter information sorted by the newest arrival airport
1193
+	 *
1194
+	 * @return Array the spotter information
1195
+	 *
1196
+	 */
1197 1197
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1198 1198
 	{
1199 1199
 		global $global_query;
@@ -1232,11 +1232,11 @@  discard block
 block discarded – undo
1232 1232
 	
1233 1233
 
1234 1234
 	/**
1235
-	* Gets all the spotter information based on the spotter id
1236
-	*
1237
-	* @return Array the spotter information
1238
-	*
1239
-	*/
1235
+	 * Gets all the spotter information based on the spotter id
1236
+	 *
1237
+	 * @return Array the spotter information
1238
+	 *
1239
+	 */
1240 1240
 	public function getSpotterDataByID($id = '')
1241 1241
 	{
1242 1242
 		global $global_query;
@@ -1258,11 +1258,11 @@  discard block
 block discarded – undo
1258 1258
 	
1259 1259
 	
1260 1260
 	/**
1261
-	* Gets all the spotter information based on the callsign
1262
-	*
1263
-	* @return Array the spotter information
1264
-	*
1265
-	*/
1261
+	 * Gets all the spotter information based on the callsign
1262
+	 *
1263
+	 * @return Array the spotter information
1264
+	 *
1265
+	 */
1266 1266
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
1267 1267
 	{
1268 1268
 		global $global_query;
@@ -1314,11 +1314,11 @@  discard block
 block discarded – undo
1314 1314
 	}
1315 1315
 	
1316 1316
 	/**
1317
-	* Gets all the spotter information based on the owner
1318
-	*
1319
-	* @return Array the spotter information
1320
-	*
1321
-	*/
1317
+	 * Gets all the spotter information based on the owner
1318
+	 *
1319
+	 * @return Array the spotter information
1320
+	 *
1321
+	 */
1322 1322
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1323 1323
 	{
1324 1324
 		global $global_query;
@@ -1371,11 +1371,11 @@  discard block
 block discarded – undo
1371 1371
 	}
1372 1372
 	
1373 1373
 	/**
1374
-	* Gets all the spotter information based on the pilot
1375
-	*
1376
-	* @return Array the spotter information
1377
-	*
1378
-	*/
1374
+	 * Gets all the spotter information based on the pilot
1375
+	 *
1376
+	 * @return Array the spotter information
1377
+	 *
1378
+	 */
1379 1379
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1380 1380
 	{
1381 1381
 		global $global_query;
@@ -1424,11 +1424,11 @@  discard block
 block discarded – undo
1424 1424
 	
1425 1425
 	
1426 1426
 	/**
1427
-	* Gets all the spotter information based on the aircraft type
1428
-	*
1429
-	* @return Array the spotter information
1430
-	*
1431
-	*/
1427
+	 * Gets all the spotter information based on the aircraft type
1428
+	 *
1429
+	 * @return Array the spotter information
1430
+	 *
1431
+	 */
1432 1432
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1433 1433
 	{
1434 1434
 		global $global_query;
@@ -1482,11 +1482,11 @@  discard block
 block discarded – undo
1482 1482
 	
1483 1483
 	
1484 1484
 	/**
1485
-	* Gets all the spotter information based on the aircraft registration
1486
-	*
1487
-	* @return Array the spotter information
1488
-	*
1489
-	*/
1485
+	 * Gets all the spotter information based on the aircraft registration
1486
+	 *
1487
+	 * @return Array the spotter information
1488
+	 *
1489
+	 */
1490 1490
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1491 1491
 	{
1492 1492
 		global $global_query;
@@ -1543,11 +1543,11 @@  discard block
 block discarded – undo
1543 1543
 	
1544 1544
 	
1545 1545
 	/**
1546
-	* Gets all the spotter information based on the airline
1547
-	*
1548
-	* @return Array the spotter information
1549
-	*
1550
-	*/
1546
+	 * Gets all the spotter information based on the airline
1547
+	 *
1548
+	 * @return Array the spotter information
1549
+	 *
1550
+	 */
1551 1551
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1552 1552
 	{
1553 1553
 		global $global_query;
@@ -1600,11 +1600,11 @@  discard block
 block discarded – undo
1600 1600
 	
1601 1601
 	
1602 1602
 	/**
1603
-	* Gets all the spotter information based on the airport
1604
-	*
1605
-	* @return Array the spotter information
1606
-	*
1607
-	*/
1603
+	 * Gets all the spotter information based on the airport
1604
+	 *
1605
+	 * @return Array the spotter information
1606
+	 *
1607
+	 */
1608 1608
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1609 1609
 	{
1610 1610
 		global $global_query;
@@ -1658,11 +1658,11 @@  discard block
 block discarded – undo
1658 1658
 
1659 1659
 
1660 1660
 	/**
1661
-	* Gets all the spotter information based on the date
1662
-	*
1663
-	* @return Array the spotter information
1664
-	*
1665
-	*/
1661
+	 * Gets all the spotter information based on the date
1662
+	 *
1663
+	 * @return Array the spotter information
1664
+	 *
1665
+	 */
1666 1666
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1667 1667
 	{
1668 1668
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1726,11 +1726,11 @@  discard block
 block discarded – undo
1726 1726
 
1727 1727
 
1728 1728
 	/**
1729
-	* Gets all the spotter information based on the country name
1730
-	*
1731
-	* @return Array the spotter information
1732
-	*
1733
-	*/
1729
+	 * Gets all the spotter information based on the country name
1730
+	 *
1731
+	 * @return Array the spotter information
1732
+	 *
1733
+	 */
1734 1734
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1735 1735
 	{
1736 1736
 		global $global_query;
@@ -1784,11 +1784,11 @@  discard block
 block discarded – undo
1784 1784
 	
1785 1785
 	
1786 1786
 	/**
1787
-	* Gets all the spotter information based on the manufacturer name
1788
-	*
1789
-	* @return Array the spotter information
1790
-	*
1791
-	*/
1787
+	 * Gets all the spotter information based on the manufacturer name
1788
+	 *
1789
+	 * @return Array the spotter information
1790
+	 *
1791
+	 */
1792 1792
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1793 1793
 	{
1794 1794
 		global $global_query;
@@ -1844,13 +1844,13 @@  discard block
 block discarded – undo
1844 1844
   
1845 1845
   
1846 1846
 	/**
1847
-	* Gets a list of all aircraft that take a route
1848
-	*
1849
-	* @param String $departure_airport_icao ICAO code of departure airport
1850
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1851
-	* @return Array the spotter information
1852
-	*
1853
-	*/
1847
+	 * Gets a list of all aircraft that take a route
1848
+	 *
1849
+	 * @param String $departure_airport_icao ICAO code of departure airport
1850
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1851
+	 * @return Array the spotter information
1852
+	 *
1853
+	 */
1854 1854
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1855 1855
 	{
1856 1856
 		global $global_query;
@@ -1919,11 +1919,11 @@  discard block
 block discarded – undo
1919 1919
 	
1920 1920
 	
1921 1921
 	/**
1922
-	* Gets all the spotter information based on the special column in the table
1923
-	*
1924
-	* @return Array the spotter information
1925
-	*
1926
-	*/
1922
+	 * Gets all the spotter information based on the special column in the table
1923
+	 *
1924
+	 * @return Array the spotter information
1925
+	 *
1926
+	 */
1927 1927
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1928 1928
 	{
1929 1929
 		global $global_query;
@@ -1962,11 +1962,11 @@  discard block
 block discarded – undo
1962 1962
 	}
1963 1963
 
1964 1964
 	/**
1965
-	* Gets all the highlight based on a aircraft registration
1966
-	*
1967
-	* @return String the highlight text
1968
-	*
1969
-	*/
1965
+	 * Gets all the highlight based on a aircraft registration
1966
+	 *
1967
+	 * @return String the highlight text
1968
+	 *
1969
+	 */
1970 1970
 	public function getHighlightByRegistration($registration,$filter = array())
1971 1971
 	{
1972 1972
 		global $global_query;
@@ -1988,13 +1988,13 @@  discard block
 block discarded – undo
1988 1988
 
1989 1989
 	
1990 1990
 	/**
1991
-	* Gets the squawk usage from squawk code
1992
-	*
1993
-	* @param String $squawk squawk code
1994
-	* @param String $country country
1995
-	* @return String usage
1996
-	*
1997
-	*/
1991
+	 * Gets the squawk usage from squawk code
1992
+	 *
1993
+	 * @param String $squawk squawk code
1994
+	 * @param String $country country
1995
+	 * @return String usage
1996
+	 *
1997
+	 */
1998 1998
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1999 1999
 	{
2000 2000
 		
@@ -2015,12 +2015,12 @@  discard block
 block discarded – undo
2015 2015
 	}
2016 2016
 
2017 2017
 	/**
2018
-	* Gets the airport icao from the iata
2019
-	*
2020
-	* @param String $airport_iata the iata code of the airport
2021
-	* @return String airport iata
2022
-	*
2023
-	*/
2018
+	 * Gets the airport icao from the iata
2019
+	 *
2020
+	 * @param String $airport_iata the iata code of the airport
2021
+	 * @return String airport iata
2022
+	 *
2023
+	 */
2024 2024
 	public function getAirportIcao($airport_iata = '')
2025 2025
 	{
2026 2026
 		
@@ -2040,14 +2040,14 @@  discard block
 block discarded – undo
2040 2040
 	}
2041 2041
 
2042 2042
 	/**
2043
-	* Gets the airport distance
2044
-	*
2045
-	* @param String $airport_icao the icao code of the airport
2046
-	* @param Float $latitude the latitude
2047
-	* @param Float $longitude the longitude
2048
-	* @return Float distance to the airport
2049
-	*
2050
-	*/
2043
+	 * Gets the airport distance
2044
+	 *
2045
+	 * @param String $airport_icao the icao code of the airport
2046
+	 * @param Float $latitude the latitude
2047
+	 * @param Float $longitude the longitude
2048
+	 * @return Float distance to the airport
2049
+	 *
2050
+	 */
2051 2051
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2052 2052
 	{
2053 2053
 		
@@ -2068,12 +2068,12 @@  discard block
 block discarded – undo
2068 2068
 	}
2069 2069
 	
2070 2070
 	/**
2071
-	* Gets the airport info based on the icao
2072
-	*
2073
-	* @param String $airport the icao code of the airport
2074
-	* @return Array airport information
2075
-	*
2076
-	*/
2071
+	 * Gets the airport info based on the icao
2072
+	 *
2073
+	 * @param String $airport the icao code of the airport
2074
+	 * @return Array airport information
2075
+	 *
2076
+	 */
2077 2077
 	public function getAllAirportInfo($airport = '')
2078 2078
 	{
2079 2079
 		
@@ -2119,12 +2119,12 @@  discard block
 block discarded – undo
2119 2119
 	}
2120 2120
 	
2121 2121
 	/**
2122
-	* Gets the airport info based on the country
2123
-	*
2124
-	* @param Array $countries Airports countries
2125
-	* @return Array airport information
2126
-	*
2127
-	*/
2122
+	 * Gets the airport info based on the country
2123
+	 *
2124
+	 * @param Array $countries Airports countries
2125
+	 * @return Array airport information
2126
+	 *
2127
+	 */
2128 2128
 	public function getAllAirportInfobyCountry($countries)
2129 2129
 	{
2130 2130
 		$lst_countries = '';
@@ -2162,12 +2162,12 @@  discard block
 block discarded – undo
2162 2162
 	}
2163 2163
 	
2164 2164
 	/**
2165
-	* Gets airports info based on the coord
2166
-	*
2167
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2168
-	* @return Array airport information
2169
-	*
2170
-	*/
2165
+	 * Gets airports info based on the coord
2166
+	 *
2167
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2168
+	 * @return Array airport information
2169
+	 *
2170
+	 */
2171 2171
 	public function getAllAirportInfobyCoord($coord)
2172 2172
 	{
2173 2173
 		global $globalDBdriver;
@@ -2198,12 +2198,12 @@  discard block
 block discarded – undo
2198 2198
 	}
2199 2199
 
2200 2200
 	/**
2201
-	* Gets waypoints info based on the coord
2202
-	*
2203
-	* @param Array $coord waypoints coord
2204
-	* @return Array airport information
2205
-	*
2206
-	*/
2201
+	 * Gets waypoints info based on the coord
2202
+	 *
2203
+	 * @param Array $coord waypoints coord
2204
+	 * @return Array airport information
2205
+	 *
2206
+	 */
2207 2207
 	public function getAllWaypointsInfobyCoord($coord)
2208 2208
 	{
2209 2209
 		if (is_array($coord)) {
@@ -2237,12 +2237,12 @@  discard block
 block discarded – undo
2237 2237
 	
2238 2238
 	
2239 2239
 	/**
2240
-	* Gets the airline info based on the icao code or iata code
2241
-	*
2242
-	* @param String $airline_icao the iata code of the airport
2243
-	* @return Array airport information
2244
-	*
2245
-	*/
2240
+	 * Gets the airline info based on the icao code or iata code
2241
+	 *
2242
+	 * @param String $airline_icao the iata code of the airport
2243
+	 * @return Array airport information
2244
+	 *
2245
+	 */
2246 2246
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2247 2247
 	{
2248 2248
 		global $globalUseRealAirlines;
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
 			} else {
2274 2274
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2275 2275
 			}
2276
-                        /*
2276
+						/*
2277 2277
 			$airline_array = array();
2278 2278
 			$temp_array = array();
2279 2279
 		
@@ -2306,12 +2306,12 @@  discard block
 block discarded – undo
2306 2306
 	}
2307 2307
 	
2308 2308
 	/**
2309
-	* Gets the airline info based on the airline name
2310
-	*
2311
-	* @param String $airline_name the name of the airline
2312
-	* @return Array airline information
2313
-	*
2314
-	*/
2309
+	 * Gets the airline info based on the airline name
2310
+	 *
2311
+	 * @param String $airline_name the name of the airline
2312
+	 * @return Array airline information
2313
+	 *
2314
+	 */
2315 2315
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2316 2316
 	{
2317 2317
 		global $globalUseRealAirlines;
@@ -2339,12 +2339,12 @@  discard block
 block discarded – undo
2339 2339
 	
2340 2340
 	
2341 2341
 	/**
2342
-	* Gets the aircraft info based on the aircraft type
2343
-	*
2344
-	* @param String $aircraft_type the aircraft type
2345
-	* @return Array aircraft information
2346
-	*
2347
-	*/
2342
+	 * Gets the aircraft info based on the aircraft type
2343
+	 *
2344
+	 * @param String $aircraft_type the aircraft type
2345
+	 * @return Array aircraft information
2346
+	 *
2347
+	 */
2348 2348
 	public function getAllAircraftInfo($aircraft_type)
2349 2349
 	{
2350 2350
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2376,12 +2376,12 @@  discard block
 block discarded – undo
2376 2376
 	}
2377 2377
 
2378 2378
 	/**
2379
-	* Gets the aircraft icao based on the aircraft name/type
2380
-	*
2381
-	* @param String $aircraft_type the aircraft type
2382
-	* @return String aircraft information
2383
-	*
2384
-	*/
2379
+	 * Gets the aircraft icao based on the aircraft name/type
2380
+	 *
2381
+	 * @param String $aircraft_type the aircraft type
2382
+	 * @return String aircraft information
2383
+	 *
2384
+	 */
2385 2385
 	public function getAircraftIcao($aircraft_type)
2386 2386
 	{
2387 2387
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2406,12 +2406,12 @@  discard block
 block discarded – undo
2406 2406
 	}
2407 2407
 	
2408 2408
 	/**
2409
-	* Gets the aircraft info based on the aircraft modes
2410
-	*
2411
-	* @param String $aircraft_modes the aircraft ident (hex)
2412
-	* @return String aircraft type
2413
-	*
2414
-	*/
2409
+	 * Gets the aircraft info based on the aircraft modes
2410
+	 *
2411
+	 * @param String $aircraft_modes the aircraft ident (hex)
2412
+	 * @return String aircraft type
2413
+	 *
2414
+	 */
2415 2415
 	public function getAllAircraftType($aircraft_modes,$source_type = '')
2416 2416
 	{
2417 2417
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2438,12 +2438,12 @@  discard block
 block discarded – undo
2438 2438
 	}
2439 2439
 
2440 2440
 	/**
2441
-	* Gets the aircraft info based on the aircraft registration
2442
-	*
2443
-	* @param String $registration the aircraft registration
2444
-	* @return String aircraft type
2445
-	*
2446
-	*/
2441
+	 * Gets the aircraft info based on the aircraft registration
2442
+	 *
2443
+	 * @param String $registration the aircraft registration
2444
+	 * @return String aircraft type
2445
+	 *
2446
+	 */
2447 2447
 	public function getAllAircraftTypeByRegistration($registration)
2448 2448
 	{
2449 2449
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2461,12 +2461,12 @@  discard block
 block discarded – undo
2461 2461
 	}
2462 2462
 
2463 2463
 	/**
2464
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2465
-	*
2466
-	* @param String $registration the aircraft registration
2467
-	* @return Array spotter_id and flightaware_id
2468
-	*
2469
-	*/
2464
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2465
+	 *
2466
+	 * @param String $registration the aircraft registration
2467
+	 * @return Array spotter_id and flightaware_id
2468
+	 *
2469
+	 */
2470 2470
 	public function getAllIDByRegistration($registration)
2471 2471
 	{
2472 2472
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2485,12 +2485,12 @@  discard block
 block discarded – undo
2485 2485
 	}
2486 2486
 
2487 2487
 	/**
2488
-	* Gets correct aircraft operator code
2489
-	*
2490
-	* @param String $operator the aircraft operator code (callsign)
2491
-	* @return String aircraft operator code
2492
-	*
2493
-	*/
2488
+	 * Gets correct aircraft operator code
2489
+	 *
2490
+	 * @param String $operator the aircraft operator code (callsign)
2491
+	 * @return String aircraft operator code
2492
+	 *
2493
+	 */
2494 2494
 	public function getOperator($operator)
2495 2495
 	{
2496 2496
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2507,16 +2507,16 @@  discard block
 block discarded – undo
2507 2507
 	}
2508 2508
 
2509 2509
 	/**
2510
-	* Gets the aircraft route based on the aircraft callsign
2511
-	*
2512
-	* @param String $callsign the aircraft callsign
2513
-	* @return Array aircraft type
2514
-	*
2515
-	*/
2510
+	 * Gets the aircraft route based on the aircraft callsign
2511
+	 *
2512
+	 * @param String $callsign the aircraft callsign
2513
+	 * @return Array aircraft type
2514
+	 *
2515
+	 */
2516 2516
 	public function getRouteInfo($callsign)
2517 2517
 	{
2518 2518
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2519
-                if ($callsign == '') return array();
2519
+				if ($callsign == '') return array();
2520 2520
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2521 2521
 		
2522 2522
 		$sth = $this->db->prepare($query);
@@ -2530,12 +2530,12 @@  discard block
 block discarded – undo
2530 2530
 	}
2531 2531
 	
2532 2532
 	/**
2533
-	* Gets the aircraft info based on the aircraft registration
2534
-	*
2535
-	* @param String $registration the aircraft registration
2536
-	* @return Array aircraft information
2537
-	*
2538
-	*/
2533
+	 * Gets the aircraft info based on the aircraft registration
2534
+	 *
2535
+	 * @param String $registration the aircraft registration
2536
+	 * @return Array aircraft information
2537
+	 *
2538
+	 */
2539 2539
 	public function getAircraftInfoByRegistration($registration)
2540 2540
 	{
2541 2541
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2562,12 +2562,12 @@  discard block
 block discarded – undo
2562 2562
 	}
2563 2563
 	
2564 2564
 	/**
2565
-	* Gets the aircraft owner & base based on the aircraft registration
2566
-	*
2567
-	* @param String $registration the aircraft registration
2568
-	* @return Array aircraft information
2569
-	*
2570
-	*/
2565
+	 * Gets the aircraft owner & base based on the aircraft registration
2566
+	 *
2567
+	 * @param String $registration the aircraft registration
2568
+	 * @return Array aircraft information
2569
+	 *
2570
+	 */
2571 2571
 	public function getAircraftOwnerByRegistration($registration)
2572 2572
 	{
2573 2573
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2584,11 +2584,11 @@  discard block
 block discarded – undo
2584 2584
 	
2585 2585
   
2586 2586
   /**
2587
-	* Gets all flights (but with only little info)
2588
-	*
2589
-	* @return Array basic flight information
2590
-	*
2591
-	*/
2587
+   * Gets all flights (but with only little info)
2588
+   *
2589
+   * @return Array basic flight information
2590
+   *
2591
+   */
2592 2592
 	public function getAllFlightsforSitemap()
2593 2593
 	{
2594 2594
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
 		
2597 2597
 		$sth = $this->db->prepare($query);
2598 2598
 		$sth->execute();
2599
-                  /*
2599
+				  /*
2600 2600
 		$flight_array = array();
2601 2601
 		$temp_array = array();
2602 2602
 		
@@ -2618,11 +2618,11 @@  discard block
 block discarded – undo
2618 2618
 	}
2619 2619
   
2620 2620
 	/**
2621
-	* Gets a list of all aircraft manufacturers
2622
-	*
2623
-	* @return Array list of aircraft types
2624
-	*
2625
-	*/
2621
+	 * Gets a list of all aircraft manufacturers
2622
+	 *
2623
+	 * @return Array list of aircraft types
2624
+	 *
2625
+	 */
2626 2626
 	public function getAllManufacturers()
2627 2627
 	{
2628 2628
 		/*
@@ -2651,11 +2651,11 @@  discard block
 block discarded – undo
2651 2651
   
2652 2652
   
2653 2653
   /**
2654
-	* Gets a list of all aircraft types
2655
-	*
2656
-	* @return Array list of aircraft types
2657
-	*
2658
-	*/
2654
+   * Gets a list of all aircraft types
2655
+   *
2656
+   * @return Array list of aircraft types
2657
+   *
2658
+   */
2659 2659
 	public function getAllAircraftTypes($filters = array())
2660 2660
 	{
2661 2661
 		/*
@@ -2690,11 +2690,11 @@  discard block
 block discarded – undo
2690 2690
 	
2691 2691
 	
2692 2692
 	/**
2693
-	* Gets a list of all aircraft registrations
2694
-	*
2695
-	* @return Array list of aircraft registrations
2696
-	*
2697
-	*/
2693
+	 * Gets a list of all aircraft registrations
2694
+	 *
2695
+	 * @return Array list of aircraft registrations
2696
+	 *
2697
+	 */
2698 2698
 	public function getAllAircraftRegistrations($filters = array())
2699 2699
 	{
2700 2700
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2719,12 +2719,12 @@  discard block
 block discarded – undo
2719 2719
 	}
2720 2720
 
2721 2721
 	/**
2722
-	* Gets all source name
2723
-	*
2724
-	* @param String type format of source
2725
-	* @return Array list of source name
2726
-	*
2727
-	*/
2722
+	 * Gets all source name
2723
+	 *
2724
+	 * @param String type format of source
2725
+	 * @return Array list of source name
2726
+	 *
2727
+	 */
2728 2728
 	public function getAllSourceName($type = '',$filters = array())
2729 2729
 	{
2730 2730
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2755,11 +2755,11 @@  discard block
 block discarded – undo
2755 2755
 
2756 2756
 
2757 2757
 	/**
2758
-	* Gets a list of all airline names
2759
-	*
2760
-	* @return Array list of airline names
2761
-	*
2762
-	*/
2758
+	 * Gets a list of all airline names
2759
+	 *
2760
+	 * @return Array list of airline names
2761
+	 *
2762
+	 */
2763 2763
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2764 2764
 	{
2765 2765
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2808,11 +2808,11 @@  discard block
 block discarded – undo
2808 2808
 	}
2809 2809
 	
2810 2810
 	/**
2811
-	* Gets a list of all alliance names
2812
-	*
2813
-	* @return Array list of alliance names
2814
-	*
2815
-	*/
2811
+	 * Gets a list of all alliance names
2812
+	 *
2813
+	 * @return Array list of alliance names
2814
+	 *
2815
+	 */
2816 2816
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2817 2817
 	{
2818 2818
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2837,11 +2837,11 @@  discard block
 block discarded – undo
2837 2837
 	}
2838 2838
 	
2839 2839
 	/**
2840
-	* Gets a list of all airline countries
2841
-	*
2842
-	* @return Array list of airline countries
2843
-	*
2844
-	*/
2840
+	 * Gets a list of all airline countries
2841
+	 *
2842
+	 * @return Array list of airline countries
2843
+	 *
2844
+	 */
2845 2845
 	public function getAllAirlineCountries($filters = array())
2846 2846
 	{
2847 2847
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2869,11 +2869,11 @@  discard block
 block discarded – undo
2869 2869
 	
2870 2870
 	
2871 2871
 	/**
2872
-	* Gets a list of all departure & arrival names
2873
-	*
2874
-	* @return Array list of airport names
2875
-	*
2876
-	*/
2872
+	 * Gets a list of all departure & arrival names
2873
+	 *
2874
+	 * @return Array list of airport names
2875
+	 *
2876
+	 */
2877 2877
 	public function getAllAirportNames($filters = array())
2878 2878
 	{
2879 2879
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2921,11 +2921,11 @@  discard block
 block discarded – undo
2921 2921
 	} 
2922 2922
 
2923 2923
 	/**
2924
-	* Gets a list of all owner names
2925
-	*
2926
-	* @return Array list of owner names
2927
-	*
2928
-	*/
2924
+	 * Gets a list of all owner names
2925
+	 *
2926
+	 * @return Array list of owner names
2927
+	 *
2928
+	 */
2929 2929
 	public function getAllOwnerNames($filters = array())
2930 2930
 	{
2931 2931
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2939,11 +2939,11 @@  discard block
 block discarded – undo
2939 2939
 	} 
2940 2940
 
2941 2941
 	/**
2942
-	* Gets a list of all pilot names and pilot ids
2943
-	*
2944
-	* @return Array list of pilot names and pilot ids
2945
-	*
2946
-	*/
2942
+	 * Gets a list of all pilot names and pilot ids
2943
+	 *
2944
+	 * @return Array list of pilot names and pilot ids
2945
+	 *
2946
+	 */
2947 2947
 	public function getAllPilotNames($filters = array())
2948 2948
 	{
2949 2949
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2958,11 +2958,11 @@  discard block
 block discarded – undo
2958 2958
 	
2959 2959
 	
2960 2960
 	/**
2961
-	* Gets a list of all departure & arrival airport countries
2962
-	*
2963
-	* @return Array list of airport countries
2964
-	*
2965
-	*/
2961
+	 * Gets a list of all departure & arrival airport countries
2962
+	 *
2963
+	 * @return Array list of airport countries
2964
+	 *
2965
+	 */
2966 2966
 	public function getAllAirportCountries($filters = array())
2967 2967
 	{
2968 2968
 		$airport_array = array();
@@ -3010,11 +3010,11 @@  discard block
 block discarded – undo
3010 3010
 	
3011 3011
 	
3012 3012
 	/**
3013
-	* Gets a list of all countries (airline, departure airport & arrival airport)
3014
-	*
3015
-	* @return Array list of countries
3016
-	*
3017
-	*/
3013
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
3014
+	 *
3015
+	 * @return Array list of countries
3016
+	 *
3017
+	 */
3018 3018
 	public function getAllCountries($filters = array())
3019 3019
 	{
3020 3020
 		$Connection= new Connection($this->db);
@@ -3091,11 +3091,11 @@  discard block
 block discarded – undo
3091 3091
 	
3092 3092
 	
3093 3093
 	/**
3094
-	* Gets a list of all idents/callsigns
3095
-	*
3096
-	* @return Array list of ident/callsign names
3097
-	*
3098
-	*/
3094
+	 * Gets a list of all idents/callsigns
3095
+	 *
3096
+	 * @return Array list of ident/callsign names
3097
+	 *
3098
+	 */
3099 3099
 	public function getAllIdents($filters = array())
3100 3100
 	{
3101 3101
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3119,9 +3119,9 @@  discard block
 block discarded – undo
3119 3119
 	}
3120 3120
 
3121 3121
 	/**
3122
-	* Get a list of flights from airport since 7 days
3123
-	* @return Array number, icao, name and city of airports
3124
-	*/
3122
+	 * Get a list of flights from airport since 7 days
3123
+	 * @return Array number, icao, name and city of airports
3124
+	 */
3125 3125
 
3126 3126
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3127 3127
 		global $globalTimezone, $globalDBdriver;
@@ -3152,9 +3152,9 @@  discard block
 block discarded – undo
3152 3152
 	}
3153 3153
 
3154 3154
 	/**
3155
-	* Get a list of flights from airport since 7 days
3156
-	* @return Array number, icao, name and city of airports
3157
-	*/
3155
+	 * Get a list of flights from airport since 7 days
3156
+	 * @return Array number, icao, name and city of airports
3157
+	 */
3158 3158
 
3159 3159
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3160 3160
 		global $globalTimezone, $globalDBdriver;
@@ -3184,9 +3184,9 @@  discard block
 block discarded – undo
3184 3184
 	}
3185 3185
 
3186 3186
 	/**
3187
-	* Get a list of flights from detected airport since 7 days
3188
-	* @return Array number, icao, name and city of airports
3189
-	*/
3187
+	 * Get a list of flights from detected airport since 7 days
3188
+	 * @return Array number, icao, name and city of airports
3189
+	 */
3190 3190
 
3191 3191
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3192 3192
 		global $globalTimezone, $globalDBdriver;
@@ -3224,9 +3224,9 @@  discard block
 block discarded – undo
3224 3224
 	}
3225 3225
 
3226 3226
 	/**
3227
-	* Get a list of flights from detected airport since 7 days
3228
-	* @return Array number, icao, name and city of airports
3229
-	*/
3227
+	 * Get a list of flights from detected airport since 7 days
3228
+	 * @return Array number, icao, name and city of airports
3229
+	 */
3230 3230
 
3231 3231
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3232 3232
 		global $globalTimezone, $globalDBdriver;
@@ -3268,9 +3268,9 @@  discard block
 block discarded – undo
3268 3268
 
3269 3269
 
3270 3270
 	/**
3271
-	* Get a list of flights to airport since 7 days
3272
-	* @return Array number, icao, name and city of airports
3273
-	*/
3271
+	 * Get a list of flights to airport since 7 days
3272
+	 * @return Array number, icao, name and city of airports
3273
+	 */
3274 3274
 
3275 3275
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3276 3276
 		global $globalTimezone, $globalDBdriver;
@@ -3303,9 +3303,9 @@  discard block
 block discarded – undo
3303 3303
 
3304 3304
 
3305 3305
 	/**
3306
-	* Get a list of flights detected to airport since 7 days
3307
-	* @return Array number, icao, name and city of airports
3308
-	*/
3306
+	 * Get a list of flights detected to airport since 7 days
3307
+	 * @return Array number, icao, name and city of airports
3308
+	 */
3309 3309
 
3310 3310
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3311 3311
 		global $globalTimezone, $globalDBdriver;
@@ -3346,9 +3346,9 @@  discard block
 block discarded – undo
3346 3346
 
3347 3347
 
3348 3348
 	/**
3349
-	* Get a list of flights to airport since 7 days
3350
-	* @return Array number, icao, name and city of airports
3351
-	*/
3349
+	 * Get a list of flights to airport since 7 days
3350
+	 * @return Array number, icao, name and city of airports
3351
+	 */
3352 3352
 
3353 3353
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3354 3354
 		global $globalTimezone, $globalDBdriver;
@@ -3380,9 +3380,9 @@  discard block
 block discarded – undo
3380 3380
 
3381 3381
 
3382 3382
 	/**
3383
-	* Get a list of flights detected to airport since 7 days
3384
-	* @return Array number, icao, name and city of airports
3385
-	*/
3383
+	 * Get a list of flights detected to airport since 7 days
3384
+	 * @return Array number, icao, name and city of airports
3385
+	 */
3386 3386
 
3387 3387
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3388 3388
 		global $globalTimezone, $globalDBdriver;
@@ -3426,11 +3426,11 @@  discard block
 block discarded – undo
3426 3426
 
3427 3427
 
3428 3428
 	/**
3429
-	* Gets a list of all dates
3430
-	*
3431
-	* @return Array list of date names
3432
-	*
3433
-	*/
3429
+	 * Gets a list of all dates
3430
+	 *
3431
+	 * @return Array list of date names
3432
+	 *
3433
+	 */
3434 3434
 	public function getAllDates()
3435 3435
 	{
3436 3436
 		global $globalTimezone, $globalDBdriver;
@@ -3471,11 +3471,11 @@  discard block
 block discarded – undo
3471 3471
 	
3472 3472
 	
3473 3473
 	/**
3474
-	* Gets all route combinations
3475
-	*
3476
-	* @return Array the route list
3477
-	*
3478
-	*/
3474
+	 * Gets all route combinations
3475
+	 *
3476
+	 * @return Array the route list
3477
+	 *
3478
+	 */
3479 3479
 	public function getAllRoutes()
3480 3480
 	{
3481 3481
 		$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 
@@ -3501,13 +3501,13 @@  discard block
 block discarded – undo
3501 3501
 	}
3502 3502
 
3503 3503
 	/**
3504
-	* Update ident spotter data
3505
-	*
3506
-	* @param String $flightaware_id the ID from flightaware
3507
-	* @param String $ident the flight ident
3508
-	* @return String success or false
3509
-	*
3510
-	*/	
3504
+	 * Update ident spotter data
3505
+	 *
3506
+	 * @param String $flightaware_id the ID from flightaware
3507
+	 * @param String $ident the flight ident
3508
+	 * @return String success or false
3509
+	 *
3510
+	 */	
3511 3511
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3512 3512
 	{
3513 3513
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3528,14 +3528,14 @@  discard block
 block discarded – undo
3528 3528
 		} else {
3529 3529
 			$airline_array = $this->getAllAirlineInfo("NA");
3530 3530
 		}
3531
-                $airline_name = $airline_array[0]['name'];
3532
-                $airline_icao = $airline_array[0]['icao'];
3533
-                $airline_country = $airline_array[0]['country'];
3534
-                $airline_type = $airline_array[0]['type'];
3531
+				$airline_name = $airline_array[0]['name'];
3532
+				$airline_icao = $airline_array[0]['icao'];
3533
+				$airline_country = $airline_array[0]['country'];
3534
+				$airline_type = $airline_array[0]['type'];
3535 3535
 
3536 3536
 
3537 3537
 		$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';
3538
-                $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);
3538
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3539 3539
 
3540 3540
 		try {
3541 3541
 			$sth = $this->db->prepare($query);
@@ -3548,19 +3548,19 @@  discard block
 block discarded – undo
3548 3548
 
3549 3549
 	}
3550 3550
 	/**
3551
-	* Update latest spotter data
3552
-	*
3553
-	* @param String $flightaware_id the ID from flightaware
3554
-	* @param String $ident the flight ident
3555
-	* @param String $arrival_airport_icao the arrival airport
3556
-	* @return String success or false
3557
-	*
3558
-	*/	
3551
+	 * Update latest spotter data
3552
+	 *
3553
+	 * @param String $flightaware_id the ID from flightaware
3554
+	 * @param String $ident the flight ident
3555
+	 * @param String $arrival_airport_icao the arrival airport
3556
+	 * @return String success or false
3557
+	 *
3558
+	 */	
3559 3559
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3560 3560
 	{
3561 3561
 		if ($groundspeed == '') $groundspeed = NULL;
3562 3562
 		$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';
3563
-                $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);
3563
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3564 3564
 
3565 3565
 		try {
3566 3566
 			$sth = $this->db->prepare($query);
@@ -3574,32 +3574,32 @@  discard block
 block discarded – undo
3574 3574
 	}
3575 3575
 
3576 3576
 	/**
3577
-	* Adds a new spotter data
3578
-	*
3579
-	* @param String $flightaware_id the ID from flightaware
3580
-	* @param String $ident the flight ident
3581
-	* @param String $aircraft_icao the aircraft type
3582
-	* @param String $departure_airport_icao the departure airport
3583
-	* @param String $arrival_airport_icao the arrival airport
3584
-	* @param String $latitude latitude of flight
3585
-	* @param String $longitude latitude of flight
3586
-	* @param String $waypoints waypoints of flight
3587
-	* @param String $altitude altitude of flight
3588
-	* @param String $heading heading of flight
3589
-	* @param String $groundspeed speed of flight
3590
-	* @param String $date date of flight
3591
-	* @param String $departure_airport_time departure time of flight
3592
-	* @param String $arrival_airport_time arrival time of flight
3593
-	* @param String $squawk squawk code of flight
3594
-	* @param String $route_stop route stop of flight
3595
-	* @param String $highlight highlight or not
3596
-	* @param String $ModeS ModesS code of flight
3597
-	* @param String $registration registration code of flight
3598
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3599
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3600
-	* @param String $verticalrate vertival rate of flight
3601
-	* @return String success or false
3602
-	*/
3577
+	 * Adds a new spotter data
3578
+	 *
3579
+	 * @param String $flightaware_id the ID from flightaware
3580
+	 * @param String $ident the flight ident
3581
+	 * @param String $aircraft_icao the aircraft type
3582
+	 * @param String $departure_airport_icao the departure airport
3583
+	 * @param String $arrival_airport_icao the arrival airport
3584
+	 * @param String $latitude latitude of flight
3585
+	 * @param String $longitude latitude of flight
3586
+	 * @param String $waypoints waypoints of flight
3587
+	 * @param String $altitude altitude of flight
3588
+	 * @param String $heading heading of flight
3589
+	 * @param String $groundspeed speed of flight
3590
+	 * @param String $date date of flight
3591
+	 * @param String $departure_airport_time departure time of flight
3592
+	 * @param String $arrival_airport_time arrival time of flight
3593
+	 * @param String $squawk squawk code of flight
3594
+	 * @param String $route_stop route stop of flight
3595
+	 * @param String $highlight highlight or not
3596
+	 * @param String $ModeS ModesS code of flight
3597
+	 * @param String $registration registration code of flight
3598
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3599
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3600
+	 * @param String $verticalrate vertival rate of flight
3601
+	 * @return String success or false
3602
+	 */
3603 3603
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '',$source_type = '')
3604 3604
 	{
3605 3605
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3814,8 +3814,8 @@  discard block
 block discarded – undo
3814 3814
     
3815 3815
 		if ($globalIVAO && $aircraft_icao != '')
3816 3816
 		{
3817
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
-            		else $airline_icao = '';
3817
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
+					else $airline_icao = '';
3819 3819
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3820 3820
 			if (!isset($image_array[0]['registration']))
3821 3821
 			{
@@ -3846,53 +3846,53 @@  discard block
 block discarded – undo
3846 3846
 	
3847 3847
 		if (count($airline_array) == 0) 
3848 3848
 		{
3849
-                        $airline_array = $this->getAllAirlineInfo('NA');
3850
-                }
3851
-                if (count($aircraft_array) == 0) 
3852
-                {
3853
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3854
-                }
3855
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3856
-                {
3857
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3858
-                }
3859
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3860
-                {
3861
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3862
-                }
3863
-                if ($registration == '') $registration = 'NA';
3864
-                if ($latitude == '' && $longitude == '') {
3865
-            		$latitude = 0;
3866
-            		$longitude = 0;
3867
-            	}
3868
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
-                $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) 
3849
+						$airline_array = $this->getAllAirlineInfo('NA');
3850
+				}
3851
+				if (count($aircraft_array) == 0) 
3852
+				{
3853
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3854
+				}
3855
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3856
+				{
3857
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3858
+				}
3859
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3860
+				{
3861
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3862
+				}
3863
+				if ($registration == '') $registration = 'NA';
3864
+				if ($latitude == '' && $longitude == '') {
3865
+					$latitude = 0;
3866
+					$longitude = 0;
3867
+				}
3868
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3874 3874
                 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)";
3875 3875
 
3876
-                $airline_name = $airline_array[0]['name'];
3877
-                $airline_icao = $airline_array[0]['icao'];
3878
-                $airline_country = $airline_array[0]['country'];
3879
-                $airline_type = $airline_array[0]['type'];
3876
+				$airline_name = $airline_array[0]['name'];
3877
+				$airline_icao = $airline_array[0]['icao'];
3878
+				$airline_country = $airline_array[0]['country'];
3879
+				$airline_type = $airline_array[0]['type'];
3880 3880
 		if ($airline_type == '') {
3881 3881
 			$timeelapsed = microtime(true);
3882 3882
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3883 3883
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3884 3884
 		}
3885 3885
 		if ($airline_type == null) $airline_type = '';
3886
-                $aircraft_type = $aircraft_array[0]['type'];
3887
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888
-                $departure_airport_name = $departure_airport_array[0]['name'];
3889
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3890
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3886
+				$aircraft_type = $aircraft_array[0]['type'];
3887
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888
+				$departure_airport_name = $departure_airport_array[0]['name'];
3889
+			$departure_airport_city = $departure_airport_array[0]['city'];
3890
+				$departure_airport_country = $departure_airport_array[0]['country'];
3891 3891
                 
3892
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3893
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3894
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3895
-                $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);
3892
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3893
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3894
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3895
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3896 3896
 
3897 3897
 		try {
3898 3898
 		        
@@ -3900,7 +3900,7 @@  discard block
 block discarded – undo
3900 3900
 			$sth->execute($query_values);
3901 3901
 			$this->db = null;
3902 3902
 		} catch (PDOException $e) {
3903
-		    return "error : ".$e->getMessage();
3903
+			return "error : ".$e->getMessage();
3904 3904
 		}
3905 3905
 		
3906 3906
 		return "success";
@@ -3909,11 +3909,11 @@  discard block
 block discarded – undo
3909 3909
 	
3910 3910
   
3911 3911
 	/**
3912
-	* Gets the aircraft ident within the last hour
3913
-	*
3914
-	* @return String the ident
3915
-	*
3916
-	*/
3912
+	 * Gets the aircraft ident within the last hour
3913
+	 *
3914
+	 * @return String the ident
3915
+	 *
3916
+	 */
3917 3917
 	public function getIdentFromLastHour($ident)
3918 3918
 	{
3919 3919
 		global $globalDBdriver, $globalTimezone;
@@ -3929,11 +3929,11 @@  discard block
 block discarded – undo
3929 3929
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3930 3930
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3931 3931
 			$query_data = array(':ident' => $ident);
3932
-    		}
3932
+			}
3933 3933
 		
3934 3934
 		$sth = $this->db->prepare($query);
3935 3935
 		$sth->execute($query_data);
3936
-    		$ident_result='';
3936
+			$ident_result='';
3937 3937
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3938 3938
 		{
3939 3939
 			$ident_result = $row['ident'];
@@ -3944,11 +3944,11 @@  discard block
 block discarded – undo
3944 3944
 	
3945 3945
 	
3946 3946
 	/**
3947
-	* Gets the aircraft data from the last 20 seconds
3948
-	*
3949
-	* @return Array the spotter data
3950
-	*
3951
-	*/
3947
+	 * Gets the aircraft data from the last 20 seconds
3948
+	 *
3949
+	 * @return Array the spotter data
3950
+	 *
3951
+	 */
3952 3952
 	public function getRealTimeData($q = '')
3953 3953
 	{
3954 3954
 		global $globalDBdriver;
@@ -3992,11 +3992,11 @@  discard block
 block discarded – undo
3992 3992
 	
3993 3993
 	
3994 3994
 	 /**
3995
-	* Gets all airlines that have flown over
3996
-	*
3997
-	* @return Array the airline list
3998
-	*
3999
-	*/
3995
+	  * Gets all airlines that have flown over
3996
+	  *
3997
+	  * @return Array the airline list
3998
+	  *
3999
+	  */
4000 4000
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
4001 4001
 	{
4002 4002
 		global $globalDBdriver;
@@ -4010,7 +4010,7 @@  discard block
 block discarded – undo
4010 4010
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4011 4011
 			}
4012 4012
 		}
4013
-                if ($sincedate != '') {
4013
+				if ($sincedate != '') {
4014 4014
 			if ($globalDBdriver == 'mysql') {
4015 4015
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4016 4016
 			} else {
@@ -4064,26 +4064,26 @@  discard block
 block discarded – undo
4064 4064
 	}
4065 4065
 
4066 4066
 	 /**
4067
-	* Gets all pilots that have flown over
4068
-	*
4069
-	* @return Array the pilots list
4070
-	*
4071
-	*/
4067
+	  * Gets all pilots that have flown over
4068
+	  *
4069
+	  * @return Array the pilots list
4070
+	  *
4071
+	  */
4072 4072
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4073 4073
 	{
4074 4074
 		global $globalDBdriver;
4075 4075
 		$filter_query = $this->getFilter($filters,true,true);
4076 4076
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4077 4077
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4078
-                if ($olderthanmonths > 0) {
4079
-            		if ($globalDBdriver == 'mysql') {
4078
+				if ($olderthanmonths > 0) {
4079
+					if ($globalDBdriver == 'mysql') {
4080 4080
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4081 4081
 			} else {
4082 4082
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4083 4083
 			}
4084 4084
 		}
4085
-                if ($sincedate != '') {
4086
-            		if ($globalDBdriver == 'mysql') {
4085
+				if ($sincedate != '') {
4086
+					if ($globalDBdriver == 'mysql') {
4087 4087
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4088 4088
 			} else {
4089 4089
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4138,25 +4138,25 @@  discard block
 block discarded – undo
4138 4138
 	}
4139 4139
 	
4140 4140
 	/**
4141
-	* Gets all pilots that have flown over
4142
-	*
4143
-	* @return Array the pilots list
4144
-	*
4145
-	*/
4141
+	 * Gets all pilots that have flown over
4142
+	 *
4143
+	 * @return Array the pilots list
4144
+	 *
4145
+	 */
4146 4146
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4147 4147
 	{
4148 4148
 		global $globalDBdriver;
4149 4149
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4150 4150
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4151
-                if ($olderthanmonths > 0) {
4152
-            		if ($globalDBdriver == 'mysql') {
4151
+				if ($olderthanmonths > 0) {
4152
+					if ($globalDBdriver == 'mysql') {
4153 4153
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4154 4154
 			} else {
4155 4155
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4156 4156
 			}
4157 4157
 		}
4158
-                if ($sincedate != '') {
4159
-            		if ($globalDBdriver == 'mysql') {
4158
+				if ($sincedate != '') {
4159
+					if ($globalDBdriver == 'mysql') {
4160 4160
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4161 4161
 			} else {
4162 4162
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4185,26 +4185,26 @@  discard block
 block discarded – undo
4185 4185
 	}
4186 4186
 	
4187 4187
 	 /**
4188
-	* Gets all owner that have flown over
4189
-	*
4190
-	* @return Array the pilots list
4191
-	*
4192
-	*/
4188
+	  * Gets all owner that have flown over
4189
+	  *
4190
+	  * @return Array the pilots list
4191
+	  *
4192
+	  */
4193 4193
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4194 4194
 	{
4195 4195
 		global $globalDBdriver;
4196 4196
 		$filter_query = $this->getFilter($filters,true,true);
4197 4197
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4198 4198
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4199
-                if ($olderthanmonths > 0) {
4200
-            		if ($globalDBdriver == 'mysql') {
4199
+				if ($olderthanmonths > 0) {
4200
+					if ($globalDBdriver == 'mysql') {
4201 4201
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4202 4202
 			} else {
4203 4203
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4204 4204
 			}
4205 4205
 		}
4206
-                if ($sincedate != '') {
4207
-            		if ($globalDBdriver == 'mysql') {
4206
+				if ($sincedate != '') {
4207
+					if ($globalDBdriver == 'mysql') {
4208 4208
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4209 4209
 			} else {
4210 4210
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4255,26 +4255,26 @@  discard block
 block discarded – undo
4255 4255
 	}
4256 4256
 	
4257 4257
 	 /**
4258
-	* Gets all owner that have flown over
4259
-	*
4260
-	* @return Array the pilots list
4261
-	*
4262
-	*/
4258
+	  * Gets all owner that have flown over
4259
+	  *
4260
+	  * @return Array the pilots list
4261
+	  *
4262
+	  */
4263 4263
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4264 4264
 	{
4265 4265
 		global $globalDBdriver;
4266 4266
 		$filter_query = $this->getFilter($filters,true,true);
4267 4267
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4268 4268
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4269
-                if ($olderthanmonths > 0) {
4270
-            		if ($globalDBdriver == 'mysql') {
4269
+				if ($olderthanmonths > 0) {
4270
+					if ($globalDBdriver == 'mysql') {
4271 4271
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4272 4272
 			} else {
4273 4273
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4274 4274
 			}
4275 4275
 		}
4276
-                if ($sincedate != '') {
4277
-            		if ($globalDBdriver == 'mysql') {
4276
+				if ($sincedate != '') {
4277
+					if ($globalDBdriver == 'mysql') {
4278 4278
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4279 4279
 			} else {
4280 4280
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4301,11 +4301,11 @@  discard block
 block discarded – undo
4301 4301
 	}
4302 4302
 
4303 4303
 	/**
4304
-	* Gets all airlines that have flown over by aircraft
4305
-	*
4306
-	* @return Array the airline list
4307
-	*
4308
-	*/
4304
+	 * Gets all airlines that have flown over by aircraft
4305
+	 *
4306
+	 * @return Array the airline list
4307
+	 *
4308
+	 */
4309 4309
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4310 4310
 	{
4311 4311
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4337,11 +4337,11 @@  discard block
 block discarded – undo
4337 4337
 
4338 4338
 
4339 4339
 	/**
4340
-	* Gets all airline countries that have flown over by aircraft
4341
-	*
4342
-	* @return Array the airline country list
4343
-	*
4344
-	*/
4340
+	 * Gets all airline countries that have flown over by aircraft
4341
+	 *
4342
+	 * @return Array the airline country list
4343
+	 *
4344
+	 */
4345 4345
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4346 4346
 	{
4347 4347
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4374,11 +4374,11 @@  discard block
 block discarded – undo
4374 4374
 	
4375 4375
 	
4376 4376
 	/**
4377
-	* Gets all airlines that have flown over by airport
4378
-	*
4379
-	* @return Array the airline list
4380
-	*
4381
-	*/
4377
+	 * Gets all airlines that have flown over by airport
4378
+	 *
4379
+	 * @return Array the airline list
4380
+	 *
4381
+	 */
4382 4382
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4383 4383
 	{
4384 4384
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4409,11 +4409,11 @@  discard block
 block discarded – undo
4409 4409
 
4410 4410
 
4411 4411
 	/**
4412
-	* Gets all airline countries that have flown over by airport icao
4413
-	*
4414
-	* @return Array the airline country list
4415
-	*
4416
-	*/
4412
+	 * Gets all airline countries that have flown over by airport icao
4413
+	 *
4414
+	 * @return Array the airline country list
4415
+	 *
4416
+	 */
4417 4417
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4418 4418
 	{
4419 4419
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4443,11 +4443,11 @@  discard block
 block discarded – undo
4443 4443
 
4444 4444
 
4445 4445
 	/**
4446
-	* Gets all airlines that have flown over by aircraft manufacturer
4447
-	*
4448
-	* @return Array the airline list
4449
-	*
4450
-	*/
4446
+	 * Gets all airlines that have flown over by aircraft manufacturer
4447
+	 *
4448
+	 * @return Array the airline list
4449
+	 *
4450
+	 */
4451 4451
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4452 4452
 	{
4453 4453
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4478,11 +4478,11 @@  discard block
 block discarded – undo
4478 4478
 
4479 4479
 
4480 4480
 	/**
4481
-	* Gets all airline countries that have flown over by aircraft manufacturer
4482
-	*
4483
-	* @return Array the airline country list
4484
-	*
4485
-	*/
4481
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4482
+	 *
4483
+	 * @return Array the airline country list
4484
+	 *
4485
+	 */
4486 4486
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4487 4487
 	{
4488 4488
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4511,11 +4511,11 @@  discard block
 block discarded – undo
4511 4511
 
4512 4512
 
4513 4513
 	/**
4514
-	* Gets all airlines that have flown over by date
4515
-	*
4516
-	* @return Array the airline list
4517
-	*
4518
-	*/
4514
+	 * Gets all airlines that have flown over by date
4515
+	 *
4516
+	 * @return Array the airline list
4517
+	 *
4518
+	 */
4519 4519
 	public function countAllAirlinesByDate($date,$filters = array())
4520 4520
 	{
4521 4521
 		global $globalTimezone, $globalDBdriver;
@@ -4559,11 +4559,11 @@  discard block
 block discarded – undo
4559 4559
 	
4560 4560
 	
4561 4561
 	/**
4562
-	* Gets all airline countries that have flown over by date
4563
-	*
4564
-	* @return Array the airline country list
4565
-	*
4566
-	*/
4562
+	 * Gets all airline countries that have flown over by date
4563
+	 *
4564
+	 * @return Array the airline country list
4565
+	 *
4566
+	 */
4567 4567
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4568 4568
 	{
4569 4569
 		global $globalTimezone, $globalDBdriver;
@@ -4606,11 +4606,11 @@  discard block
 block discarded – undo
4606 4606
 
4607 4607
 
4608 4608
 	/**
4609
-	* Gets all airlines that have flown over by ident/callsign
4610
-	*
4611
-	* @return Array the airline list
4612
-	*
4613
-	*/
4609
+	 * Gets all airlines that have flown over by ident/callsign
4610
+	 *
4611
+	 * @return Array the airline list
4612
+	 *
4613
+	 */
4614 4614
 	public function countAllAirlinesByIdent($ident,$filters = array())
4615 4615
 	{
4616 4616
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4627,11 +4627,11 @@  discard block
 block discarded – undo
4627 4627
 	}
4628 4628
 
4629 4629
 	/**
4630
-	* Gets all airlines by owner
4631
-	*
4632
-	* @return Array the airline list
4633
-	*
4634
-	*/
4630
+	 * Gets all airlines by owner
4631
+	 *
4632
+	 * @return Array the airline list
4633
+	 *
4634
+	 */
4635 4635
 	public function countAllAirlinesByOwner($owner,$filters = array())
4636 4636
 	{
4637 4637
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4648,11 +4648,11 @@  discard block
 block discarded – undo
4648 4648
 	}
4649 4649
 
4650 4650
 	/**
4651
-	* Gets flight duration by owner
4652
-	*
4653
-	* @return String Duration of all flights
4654
-	*
4655
-	*/
4651
+	 * Gets flight duration by owner
4652
+	 *
4653
+	 * @return String Duration of all flights
4654
+	 *
4655
+	 */
4656 4656
 	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4657 4657
 	{
4658 4658
 		global $globalDBdriver;
@@ -4699,11 +4699,11 @@  discard block
 block discarded – undo
4699 4699
 	}
4700 4700
 
4701 4701
 	/**
4702
-	* Count flights by owner
4703
-	*
4704
-	* @return String Duration of all flights
4705
-	*
4706
-	*/
4702
+	 * Count flights by owner
4703
+	 *
4704
+	 * @return String Duration of all flights
4705
+	 *
4706
+	 */
4707 4707
 	public function countFlightsByOwner($owner,$filters = array())
4708 4708
 	{
4709 4709
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4719,11 +4719,11 @@  discard block
 block discarded – undo
4719 4719
 	}
4720 4720
 
4721 4721
 	/**
4722
-	* Count flights by pilot
4723
-	*
4724
-	* @return String Duration of all flights
4725
-	*
4726
-	*/
4722
+	 * Count flights by pilot
4723
+	 *
4724
+	 * @return String Duration of all flights
4725
+	 *
4726
+	 */
4727 4727
 	public function countFlightsByPilot($pilot,$filters = array())
4728 4728
 	{
4729 4729
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4739,11 +4739,11 @@  discard block
 block discarded – undo
4739 4739
 	}
4740 4740
 
4741 4741
 	/**
4742
-	* Gets flight duration by pilot
4743
-	*
4744
-	* @return String Duration of all flights
4745
-	*
4746
-	*/
4742
+	 * Gets flight duration by pilot
4743
+	 *
4744
+	 * @return String Duration of all flights
4745
+	 *
4746
+	 */
4747 4747
 	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4748 4748
 	{
4749 4749
 		global $globalDBdriver;
@@ -4789,11 +4789,11 @@  discard block
 block discarded – undo
4789 4789
 	}
4790 4790
 
4791 4791
 	/**
4792
-	* Gets all airlines used by pilot
4793
-	*
4794
-	* @return Array the airline list
4795
-	*
4796
-	*/
4792
+	 * Gets all airlines used by pilot
4793
+	 *
4794
+	 * @return Array the airline list
4795
+	 *
4796
+	 */
4797 4797
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4798 4798
 	{
4799 4799
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4810,11 +4810,11 @@  discard block
 block discarded – undo
4810 4810
 	}
4811 4811
 
4812 4812
 	/**
4813
-	* Gets all airlines that have flown over by route
4814
-	*
4815
-	* @return Array the airline list
4816
-	*
4817
-	*/
4813
+	 * Gets all airlines that have flown over by route
4814
+	 *
4815
+	 * @return Array the airline list
4816
+	 *
4817
+	 */
4818 4818
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4819 4819
 	{
4820 4820
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4846,11 +4846,11 @@  discard block
 block discarded – undo
4846 4846
 	}
4847 4847
 
4848 4848
 	/**
4849
-	* Gets all airline countries that have flown over by route
4850
-	*
4851
-	* @return Array the airline country list
4852
-	*
4853
-	*/
4849
+	 * Gets all airline countries that have flown over by route
4850
+	 *
4851
+	 * @return Array the airline country list
4852
+	 *
4853
+	 */
4854 4854
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4855 4855
 	{
4856 4856
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4882,11 +4882,11 @@  discard block
 block discarded – undo
4882 4882
 
4883 4883
 
4884 4884
 	/**
4885
-	* Gets all airlines that have flown over by country
4886
-	*
4887
-	* @return Array the airline list
4888
-	*
4889
-	*/
4885
+	 * Gets all airlines that have flown over by country
4886
+	 *
4887
+	 * @return Array the airline list
4888
+	 *
4889
+	 */
4890 4890
 	public function countAllAirlinesByCountry($country,$filters = array())
4891 4891
 	{
4892 4892
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4916,11 +4916,11 @@  discard block
 block discarded – undo
4916 4916
 
4917 4917
 
4918 4918
 	/**
4919
-	* Gets all airline countries that have flown over by country
4920
-	*
4921
-	* @return Array the airline country list
4922
-	*
4923
-	*/
4919
+	 * Gets all airline countries that have flown over by country
4920
+	 *
4921
+	 * @return Array the airline country list
4922
+	 *
4923
+	 */
4924 4924
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4925 4925
 	{
4926 4926
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4949,11 +4949,11 @@  discard block
 block discarded – undo
4949 4949
 
4950 4950
 
4951 4951
 	/**
4952
-	* Gets all airlines countries
4953
-	*
4954
-	* @return Array the airline country list
4955
-	*
4956
-	*/
4952
+	 * Gets all airlines countries
4953
+	 *
4954
+	 * @return Array the airline country list
4955
+	 *
4956
+	 */
4957 4957
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4958 4958
 	{
4959 4959
 		global $globalDBdriver;
@@ -5009,11 +5009,11 @@  discard block
 block discarded – undo
5009 5009
 	}
5010 5010
 
5011 5011
 	/**
5012
-	* Gets all number of flight over countries
5013
-	*
5014
-	* @return Array the airline country list
5015
-	*
5016
-	*/
5012
+	 * Gets all number of flight over countries
5013
+	 *
5014
+	 * @return Array the airline country list
5015
+	 *
5016
+	 */
5017 5017
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5018 5018
 	{
5019 5019
 		global $globalDBdriver;
@@ -5035,15 +5035,15 @@  discard block
 block discarded – undo
5035 5035
 		$SpotterLive = new SpotterLive();
5036 5036
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5037 5037
 		$filter_query .= ' over_country IS NOT NULL';
5038
-                if ($olderthanmonths > 0) {
5038
+				if ($olderthanmonths > 0) {
5039 5039
 			if ($globalDBdriver == 'mysql') {
5040 5040
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5041 5041
 			} else {
5042 5042
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5043 5043
 			}
5044 5044
 		}
5045
-                if ($sincedate != '') {
5046
-            		if ($globalDBdriver == 'mysql') {
5045
+				if ($sincedate != '') {
5046
+					if ($globalDBdriver == 'mysql') {
5047 5047
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5048 5048
 			} else {
5049 5049
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5073,11 +5073,11 @@  discard block
 block discarded – undo
5073 5073
 	
5074 5074
 	
5075 5075
 	/**
5076
-	* Gets all aircraft types that have flown over
5077
-	*
5078
-	* @return Array the aircraft list
5079
-	*
5080
-	*/
5076
+	 * Gets all aircraft types that have flown over
5077
+	 *
5078
+	 * @return Array the aircraft list
5079
+	 *
5080
+	 */
5081 5081
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5082 5082
 	{
5083 5083
 		global $globalDBdriver;
@@ -5147,11 +5147,11 @@  discard block
 block discarded – undo
5147 5147
 	}
5148 5148
 
5149 5149
 	/**
5150
-	* Gets all aircraft types that have flown over by airline
5151
-	*
5152
-	* @return Array the aircraft list
5153
-	*
5154
-	*/
5150
+	 * Gets all aircraft types that have flown over by airline
5151
+	 *
5152
+	 * @return Array the aircraft list
5153
+	 *
5154
+	 */
5155 5155
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5156 5156
 	{
5157 5157
 		global $globalDBdriver;
@@ -5222,11 +5222,11 @@  discard block
 block discarded – undo
5222 5222
 	}
5223 5223
 
5224 5224
 	/**
5225
-	* Gets all aircraft types that have flown over by months
5226
-	*
5227
-	* @return Array the aircraft list
5228
-	*
5229
-	*/
5225
+	 * Gets all aircraft types that have flown over by months
5226
+	 *
5227
+	 * @return Array the aircraft list
5228
+	 *
5229
+	 */
5230 5230
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5231 5231
 	{
5232 5232
 		global $globalDBdriver;
@@ -5270,11 +5270,11 @@  discard block
 block discarded – undo
5270 5270
 
5271 5271
 
5272 5272
 	/**
5273
-	* Gets all aircraft registration that have flown over by aircaft icao
5274
-	*
5275
-	* @return Array the aircraft list
5276
-	*
5277
-	*/
5273
+	 * Gets all aircraft registration that have flown over by aircaft icao
5274
+	 *
5275
+	 * @return Array the aircraft list
5276
+	 *
5277
+	 */
5278 5278
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5279 5279
 	{
5280 5280
 		$Image = new Image($this->db);
@@ -5313,11 +5313,11 @@  discard block
 block discarded – undo
5313 5313
 
5314 5314
 
5315 5315
 	/**
5316
-	* Gets all aircraft types that have flown over by airline icao
5317
-	*
5318
-	* @return Array the aircraft list
5319
-	*
5320
-	*/
5316
+	 * Gets all aircraft types that have flown over by airline icao
5317
+	 *
5318
+	 * @return Array the aircraft list
5319
+	 *
5320
+	 */
5321 5321
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5322 5322
 	{
5323 5323
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5346,11 +5346,11 @@  discard block
 block discarded – undo
5346 5346
 
5347 5347
 
5348 5348
 	/**
5349
-	* Gets all aircraft registration that have flown over by airline icao
5350
-	*
5351
-	* @return Array the aircraft list
5352
-	*
5353
-	*/
5349
+	 * Gets all aircraft registration that have flown over by airline icao
5350
+	 *
5351
+	 * @return Array the aircraft list
5352
+	 *
5353
+	 */
5354 5354
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5355 5355
 	{
5356 5356
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5388,11 +5388,11 @@  discard block
 block discarded – undo
5388 5388
 
5389 5389
 
5390 5390
 	/**
5391
-	* Gets all aircraft manufacturer that have flown over by airline icao
5392
-	*
5393
-	* @return Array the aircraft list
5394
-	*
5395
-	*/
5391
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5392
+	 *
5393
+	 * @return Array the aircraft list
5394
+	 *
5395
+	 */
5396 5396
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5397 5397
 	{
5398 5398
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5420,11 +5420,11 @@  discard block
 block discarded – undo
5420 5420
 
5421 5421
 
5422 5422
 	/**
5423
-	* Gets all aircraft types that have flown over by airline icao
5424
-	*
5425
-	* @return Array the aircraft list
5426
-	*
5427
-	*/
5423
+	 * Gets all aircraft types that have flown over by airline icao
5424
+	 *
5425
+	 * @return Array the aircraft list
5426
+	 *
5427
+	 */
5428 5428
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5429 5429
 	{
5430 5430
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5453,11 +5453,11 @@  discard block
 block discarded – undo
5453 5453
 
5454 5454
 
5455 5455
 	/**
5456
-	* Gets all aircraft registration that have flown over by airport icao
5457
-	*
5458
-	* @return Array the aircraft list
5459
-	*
5460
-	*/
5456
+	 * Gets all aircraft registration that have flown over by airport icao
5457
+	 *
5458
+	 * @return Array the aircraft list
5459
+	 *
5460
+	 */
5461 5461
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5462 5462
 	{
5463 5463
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5494,11 +5494,11 @@  discard block
 block discarded – undo
5494 5494
 	
5495 5495
 	
5496 5496
 	/**
5497
-	* Gets all aircraft manufacturer that have flown over by airport icao
5498
-	*
5499
-	* @return Array the aircraft list
5500
-	*
5501
-	*/
5497
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5498
+	 *
5499
+	 * @return Array the aircraft list
5500
+	 *
5501
+	 */
5502 5502
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5503 5503
 	{
5504 5504
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5524,11 +5524,11 @@  discard block
 block discarded – undo
5524 5524
 	}
5525 5525
 
5526 5526
 	/**
5527
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5528
-	*
5529
-	* @return Array the aircraft list
5530
-	*
5531
-	*/
5527
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5528
+	 *
5529
+	 * @return Array the aircraft list
5530
+	 *
5531
+	 */
5532 5532
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5533 5533
 	{
5534 5534
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5555,11 +5555,11 @@  discard block
 block discarded – undo
5555 5555
 
5556 5556
 
5557 5557
 	/**
5558
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5559
-	*
5560
-	* @return Array the aircraft list
5561
-	*
5562
-	*/
5558
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5559
+	 *
5560
+	 * @return Array the aircraft list
5561
+	 *
5562
+	 */
5563 5563
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5564 5564
 	{
5565 5565
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5595,11 +5595,11 @@  discard block
 block discarded – undo
5595 5595
 	}
5596 5596
 
5597 5597
 	/**
5598
-	* Gets all aircraft types that have flown over by date
5599
-	*
5600
-	* @return Array the aircraft list
5601
-	*
5602
-	*/
5598
+	 * Gets all aircraft types that have flown over by date
5599
+	 *
5600
+	 * @return Array the aircraft list
5601
+	 *
5602
+	 */
5603 5603
 	public function countAllAircraftTypesByDate($date,$filters = array())
5604 5604
 	{
5605 5605
 		global $globalTimezone, $globalDBdriver;
@@ -5641,11 +5641,11 @@  discard block
 block discarded – undo
5641 5641
 
5642 5642
 
5643 5643
 	/**
5644
-	* Gets all aircraft registration that have flown over by date
5645
-	*
5646
-	* @return Array the aircraft list
5647
-	*
5648
-	*/
5644
+	 * Gets all aircraft registration that have flown over by date
5645
+	 *
5646
+	 * @return Array the aircraft list
5647
+	 *
5648
+	 */
5649 5649
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5650 5650
 	{
5651 5651
 		global $globalTimezone, $globalDBdriver;
@@ -5696,11 +5696,11 @@  discard block
 block discarded – undo
5696 5696
 
5697 5697
 
5698 5698
 	/**
5699
-	* Gets all aircraft manufacturer that have flown over by date
5700
-	*
5701
-	* @return Array the aircraft manufacturer list
5702
-	*
5703
-	*/
5699
+	 * Gets all aircraft manufacturer that have flown over by date
5700
+	 *
5701
+	 * @return Array the aircraft manufacturer list
5702
+	 *
5703
+	 */
5704 5704
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5705 5705
 	{
5706 5706
 		global $globalTimezone, $globalDBdriver;
@@ -5742,11 +5742,11 @@  discard block
 block discarded – undo
5742 5742
 
5743 5743
 
5744 5744
 	/**
5745
-	* Gets all aircraft types that have flown over by ident/callsign
5746
-	*
5747
-	* @return Array the aircraft list
5748
-	*
5749
-	*/
5745
+	 * Gets all aircraft types that have flown over by ident/callsign
5746
+	 *
5747
+	 * @return Array the aircraft list
5748
+	 *
5749
+	 */
5750 5750
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5751 5751
 	{
5752 5752
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5774,11 +5774,11 @@  discard block
 block discarded – undo
5774 5774
 	}
5775 5775
 
5776 5776
 	/**
5777
-	* Gets all aircraft types that have flown over by pilot
5778
-	*
5779
-	* @return Array the aircraft list
5780
-	*
5781
-	*/
5777
+	 * Gets all aircraft types that have flown over by pilot
5778
+	 *
5779
+	 * @return Array the aircraft list
5780
+	 *
5781
+	 */
5782 5782
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5783 5783
 	{
5784 5784
 		global $globalDBdriver;
@@ -5824,11 +5824,11 @@  discard block
 block discarded – undo
5824 5824
 	}
5825 5825
 
5826 5826
 	/**
5827
-	* Gets all aircraft types that have flown over by owner
5828
-	*
5829
-	* @return Array the aircraft list
5830
-	*
5831
-	*/
5827
+	 * Gets all aircraft types that have flown over by owner
5828
+	 *
5829
+	 * @return Array the aircraft list
5830
+	 *
5831
+	 */
5832 5832
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5833 5833
 	{
5834 5834
 		global $globalDBdriver;
@@ -5873,11 +5873,11 @@  discard block
 block discarded – undo
5873 5873
 	}
5874 5874
 
5875 5875
 	/**
5876
-	* Gets all aircraft registration that have flown over by ident/callsign
5877
-	*
5878
-	* @return Array the aircraft list
5879
-	*
5880
-	*/
5876
+	 * Gets all aircraft registration that have flown over by ident/callsign
5877
+	 *
5878
+	 * @return Array the aircraft list
5879
+	 *
5880
+	 */
5881 5881
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5882 5882
 	{
5883 5883
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5916,11 +5916,11 @@  discard block
 block discarded – undo
5916 5916
 	}
5917 5917
 
5918 5918
 	/**
5919
-	* Gets all aircraft registration that have flown over by owner
5920
-	*
5921
-	* @return Array the aircraft list
5922
-	*
5923
-	*/
5919
+	 * Gets all aircraft registration that have flown over by owner
5920
+	 *
5921
+	 * @return Array the aircraft list
5922
+	 *
5923
+	 */
5924 5924
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5925 5925
 	{
5926 5926
 		global $globalDBdriver;
@@ -5991,11 +5991,11 @@  discard block
 block discarded – undo
5991 5991
 	}
5992 5992
 
5993 5993
 	/**
5994
-	* Gets all aircraft registration that have flown over by pilot
5995
-	*
5996
-	* @return Array the aircraft list
5997
-	*
5998
-	*/
5994
+	 * Gets all aircraft registration that have flown over by pilot
5995
+	 *
5996
+	 * @return Array the aircraft list
5997
+	 *
5998
+	 */
5999 5999
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6000 6000
 	{
6001 6001
 		global $globalDBdriver;
@@ -6067,11 +6067,11 @@  discard block
 block discarded – undo
6067 6067
 
6068 6068
 
6069 6069
 	/**
6070
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6071
-	*
6072
-	* @return Array the aircraft manufacturer list
6073
-	*
6074
-	*/
6070
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6071
+	 *
6072
+	 * @return Array the aircraft manufacturer list
6073
+	 *
6074
+	 */
6075 6075
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6076 6076
 	{
6077 6077
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6096,11 +6096,11 @@  discard block
 block discarded – undo
6096 6096
 	}
6097 6097
 
6098 6098
 	/**
6099
-	* Gets all aircraft manufacturer that have flown over by owner
6100
-	*
6101
-	* @return Array the aircraft manufacturer list
6102
-	*
6103
-	*/
6099
+	 * Gets all aircraft manufacturer that have flown over by owner
6100
+	 *
6101
+	 * @return Array the aircraft manufacturer list
6102
+	 *
6103
+	 */
6104 6104
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6105 6105
 	{
6106 6106
 		global $globalDBdriver;
@@ -6148,11 +6148,11 @@  discard block
 block discarded – undo
6148 6148
 	}
6149 6149
 
6150 6150
 	/**
6151
-	* Gets all aircraft manufacturer that have flown over by pilot
6152
-	*
6153
-	* @return Array the aircraft manufacturer list
6154
-	*
6155
-	*/
6151
+	 * Gets all aircraft manufacturer that have flown over by pilot
6152
+	 *
6153
+	 * @return Array the aircraft manufacturer list
6154
+	 *
6155
+	 */
6156 6156
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6157 6157
 	{
6158 6158
 		global $globalDBdriver;
@@ -6201,11 +6201,11 @@  discard block
 block discarded – undo
6201 6201
 
6202 6202
 
6203 6203
 	/**
6204
-	* Gets all aircraft types that have flown over by route
6205
-	*
6206
-	* @return Array the aircraft list
6207
-	*
6208
-	*/
6204
+	 * Gets all aircraft types that have flown over by route
6205
+	 *
6206
+	 * @return Array the aircraft list
6207
+	 *
6208
+	 */
6209 6209
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6210 6210
 	{
6211 6211
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6234,11 +6234,11 @@  discard block
 block discarded – undo
6234 6234
 	}
6235 6235
 
6236 6236
 	/**
6237
-	* Gets all aircraft registration that have flown over by route
6238
-	*
6239
-	* @return Array the aircraft list
6240
-	*
6241
-	*/
6237
+	 * Gets all aircraft registration that have flown over by route
6238
+	 *
6239
+	 * @return Array the aircraft list
6240
+	 *
6241
+	 */
6242 6242
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6243 6243
 	{
6244 6244
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6280,11 +6280,11 @@  discard block
 block discarded – undo
6280 6280
 	
6281 6281
 	
6282 6282
 	/**
6283
-	* Gets all aircraft manufacturer that have flown over by route
6284
-	*
6285
-	* @return Array the aircraft manufacturer list
6286
-	*
6287
-	*/
6283
+	 * Gets all aircraft manufacturer that have flown over by route
6284
+	 *
6285
+	 * @return Array the aircraft manufacturer list
6286
+	 *
6287
+	 */
6288 6288
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6289 6289
 	{
6290 6290
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6318,11 +6318,11 @@  discard block
 block discarded – undo
6318 6318
 	
6319 6319
 	
6320 6320
 	/**
6321
-	* Gets all aircraft types that have flown over by country
6322
-	*
6323
-	* @return Array the aircraft list
6324
-	*
6325
-	*/
6321
+	 * Gets all aircraft types that have flown over by country
6322
+	 *
6323
+	 * @return Array the aircraft list
6324
+	 *
6325
+	 */
6326 6326
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6327 6327
 	{
6328 6328
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6353,11 +6353,11 @@  discard block
 block discarded – undo
6353 6353
 
6354 6354
 
6355 6355
 	/**
6356
-	* Gets all aircraft registration that have flown over by country
6357
-	*
6358
-	* @return Array the aircraft list
6359
-	*
6360
-	*/
6356
+	 * Gets all aircraft registration that have flown over by country
6357
+	 *
6358
+	 * @return Array the aircraft list
6359
+	 *
6360
+	 */
6361 6361
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6362 6362
 	{
6363 6363
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6397,11 +6397,11 @@  discard block
 block discarded – undo
6397 6397
 	
6398 6398
 	
6399 6399
 	/**
6400
-	* Gets all aircraft manufacturer that have flown over by country
6401
-	*
6402
-	* @return Array the aircraft manufacturer list
6403
-	*
6404
-	*/
6400
+	 * Gets all aircraft manufacturer that have flown over by country
6401
+	 *
6402
+	 * @return Array the aircraft manufacturer list
6403
+	 *
6404
+	 */
6405 6405
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6406 6406
 	{
6407 6407
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6432,18 +6432,18 @@  discard block
 block discarded – undo
6432 6432
 	
6433 6433
 	
6434 6434
 	/**
6435
-	* Gets all aircraft manufacturers that have flown over
6436
-	*
6437
-	* @return Array the aircraft list
6438
-	*
6439
-	*/
6435
+	 * Gets all aircraft manufacturers that have flown over
6436
+	 *
6437
+	 * @return Array the aircraft list
6438
+	 *
6439
+	 */
6440 6440
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6441 6441
 	{
6442 6442
 		global $globalDBdriver;
6443 6443
 		$filter_query = $this->getFilter($filters,true,true);
6444 6444
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6445 6445
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6446
-                $query_values = array();
6446
+				$query_values = array();
6447 6447
 		if ($year != '') {
6448 6448
 			if ($globalDBdriver == 'mysql') {
6449 6449
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6496,11 +6496,11 @@  discard block
 block discarded – undo
6496 6496
 	
6497 6497
 	
6498 6498
 	/**
6499
-	* Gets all aircraft registrations that have flown over
6500
-	*
6501
-	* @return Array the aircraft list
6502
-	*
6503
-	*/
6499
+	 * Gets all aircraft registrations that have flown over
6500
+	 *
6501
+	 * @return Array the aircraft list
6502
+	 *
6503
+	 */
6504 6504
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6505 6505
 	{
6506 6506
 		global $globalDBdriver;
@@ -6508,15 +6508,15 @@  discard block
 block discarded – undo
6508 6508
 		$filter_query = $this->getFilter($filters,true,true);
6509 6509
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6510 6510
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6511
-                if ($olderthanmonths > 0) {
6512
-            		if ($globalDBdriver == 'mysql') {
6511
+				if ($olderthanmonths > 0) {
6512
+					if ($globalDBdriver == 'mysql') {
6513 6513
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6514 6514
 			} else {
6515 6515
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6516 6516
 			}
6517 6517
 		}
6518
-                if ($sincedate != '') {
6519
-            		if ($globalDBdriver == 'mysql') {
6518
+				if ($sincedate != '') {
6519
+					if ($globalDBdriver == 'mysql') {
6520 6520
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6521 6521
 			} else {
6522 6522
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6581,11 +6581,11 @@  discard block
 block discarded – undo
6581 6581
 
6582 6582
 
6583 6583
 	/**
6584
-	* Gets all aircraft registrations that have flown over
6585
-	*
6586
-	* @return Array the aircraft list
6587
-	*
6588
-	*/
6584
+	 * Gets all aircraft registrations that have flown over
6585
+	 *
6586
+	 * @return Array the aircraft list
6587
+	 *
6588
+	 */
6589 6589
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6590 6590
 	{
6591 6591
 		global $globalDBdriver;
@@ -6593,15 +6593,15 @@  discard block
 block discarded – undo
6593 6593
 		$Image = new Image($this->db);
6594 6594
 		$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    
6595 6595
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6596
-                if ($olderthanmonths > 0) {
6597
-            		if ($globalDBdriver == 'mysql') {
6596
+				if ($olderthanmonths > 0) {
6597
+					if ($globalDBdriver == 'mysql') {
6598 6598
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6599 6599
 			} else {
6600 6600
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6601 6601
 			}
6602 6602
 		}
6603
-                if ($sincedate != '') {
6604
-            		if ($globalDBdriver == 'mysql') {
6603
+				if ($sincedate != '') {
6604
+					if ($globalDBdriver == 'mysql') {
6605 6605
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6606 6606
 			} else {
6607 6607
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6610,7 +6610,7 @@  discard block
 block discarded – undo
6610 6610
 
6611 6611
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6612 6612
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6613
-                $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";
6613
+				$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";
6614 6614
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6615 6615
 		
6616 6616
 		$sth = $this->db->prepare($query);
@@ -6642,26 +6642,26 @@  discard block
 block discarded – undo
6642 6642
 	
6643 6643
 	
6644 6644
 	/**
6645
-	* Gets all departure airports of the airplanes that have flown over
6646
-	*
6647
-	* @return Array the airport list
6648
-	*
6649
-	*/
6645
+	 * Gets all departure airports of the airplanes that have flown over
6646
+	 *
6647
+	 * @return Array the airport list
6648
+	 *
6649
+	 */
6650 6650
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6651 6651
 	{
6652 6652
 		global $globalDBdriver;
6653 6653
 		$filter_query = $this->getFilter($filters,true,true);
6654 6654
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
6655 6655
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.departure_airport_icao AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6656
-                if ($olderthanmonths > 0) {
6657
-            		if ($globalDBdriver == 'mysql') {
6656
+				if ($olderthanmonths > 0) {
6657
+					if ($globalDBdriver == 'mysql') {
6658 6658
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6659 6659
 			} else {
6660 6660
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6661 6661
 			}
6662
-                }
6663
-                if ($sincedate != '') {
6664
-            		if ($globalDBdriver == 'mysql') {
6662
+				}
6663
+				if ($sincedate != '') {
6664
+					if ($globalDBdriver == 'mysql') {
6665 6665
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6666 6666
 			} else {
6667 6667
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6695,7 +6695,7 @@  discard block
 block discarded – undo
6695 6695
 				$query_values = array_merge($query_values,array(':day' => $day));
6696 6696
 			}
6697 6697
 		}
6698
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
6698
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
6699 6699
 				ORDER BY airport_departure_icao_count DESC";
6700 6700
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6701 6701
 
@@ -6719,35 +6719,35 @@  discard block
 block discarded – undo
6719 6719
 	}
6720 6720
 
6721 6721
 	/**
6722
-	* Gets all departure airports of the airplanes that have flown over
6723
-	*
6724
-	* @return Array the airport list
6725
-	*
6726
-	*/
6722
+	 * Gets all departure airports of the airplanes that have flown over
6723
+	 *
6724
+	 * @return Array the airport list
6725
+	 *
6726
+	 */
6727 6727
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6728 6728
 	{
6729 6729
 		global $globalDBdriver;
6730 6730
 		$filter_query = $this->getFilter($filters,true,true);
6731 6731
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6732 6732
 			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 <> '' ";
6733
-                if ($olderthanmonths > 0) {
6734
-            		if ($globalDBdriver == 'mysql') {
6733
+				if ($olderthanmonths > 0) {
6734
+					if ($globalDBdriver == 'mysql') {
6735 6735
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6736 6736
 			} else {
6737 6737
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6738 6738
 			}
6739
-                }
6740
-                if ($sincedate != '') {
6741
-            		if ($globalDBdriver == 'mysql') {
6739
+				}
6740
+				if ($sincedate != '') {
6741
+					if ($globalDBdriver == 'mysql') {
6742 6742
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6743 6743
 			} else {
6744 6744
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6745 6745
 			}
6746 6746
 		}
6747 6747
 
6748
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6749
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6750
-                $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
6748
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6749
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6750
+				$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
6751 6751
 				ORDER BY airport_departure_icao_count DESC";
6752 6752
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6753 6753
       
@@ -6772,26 +6772,26 @@  discard block
 block discarded – undo
6772 6772
 	}
6773 6773
 
6774 6774
 	/**
6775
-	* Gets all detected departure airports of the airplanes that have flown over
6776
-	*
6777
-	* @return Array the airport list
6778
-	*
6779
-	*/
6775
+	 * Gets all detected departure airports of the airplanes that have flown over
6776
+	 *
6777
+	 * @return Array the airport list
6778
+	 *
6779
+	 */
6780 6780
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6781 6781
 	{
6782 6782
 		global $globalDBdriver;
6783 6783
 		$filter_query = $this->getFilter($filters,true,true);
6784 6784
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport.longitude
6785 6785
 				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";
6786
-                if ($olderthanmonths > 0) {
6787
-            		if ($globalDBdriver == 'mysql') {
6786
+				if ($olderthanmonths > 0) {
6787
+					if ($globalDBdriver == 'mysql') {
6788 6788
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6789 6789
 			} else {
6790 6790
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6791 6791
 			}
6792
-                }
6793
-                if ($sincedate != '') {
6794
-            		if ($globalDBdriver == 'mysql') {
6792
+				}
6793
+				if ($sincedate != '') {
6794
+					if ($globalDBdriver == 'mysql') {
6795 6795
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6796 6796
 			} else {
6797 6797
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6825,10 +6825,10 @@  discard block
 block discarded – undo
6825 6825
 				$query_values = array_merge($query_values,array(':day' => $day));
6826 6826
 			}
6827 6827
 		}
6828
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6828
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6829 6829
 				ORDER BY airport_departure_icao_count DESC";
6830 6830
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6831
-    		//echo $query;
6831
+			//echo $query;
6832 6832
 		$sth = $this->db->prepare($query);
6833 6833
 		$sth->execute($query_values);
6834 6834
       
@@ -6851,35 +6851,35 @@  discard block
 block discarded – undo
6851 6851
 	}
6852 6852
 	
6853 6853
 	/**
6854
-	* Gets all detected departure airports of the airplanes that have flown over
6855
-	*
6856
-	* @return Array the airport list
6857
-	*
6858
-	*/
6854
+	 * Gets all detected departure airports of the airplanes that have flown over
6855
+	 *
6856
+	 * @return Array the airport list
6857
+	 *
6858
+	 */
6859 6859
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6860 6860
 	{
6861 6861
 		global $globalDBdriver;
6862 6862
 		$filter_query = $this->getFilter($filters,true,true);
6863 6863
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6864 6864
 				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 ";
6865
-                if ($olderthanmonths > 0) {
6866
-            		if ($globalDBdriver == 'mysql') {
6865
+				if ($olderthanmonths > 0) {
6866
+					if ($globalDBdriver == 'mysql') {
6867 6867
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6868 6868
 			} else {
6869 6869
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6870 6870
 			}
6871
-                }
6872
-                if ($sincedate != '') {
6873
-            		if ($globalDBdriver == 'mysql') {
6871
+				}
6872
+				if ($sincedate != '') {
6873
+					if ($globalDBdriver == 'mysql') {
6874 6874
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6875 6875
 			} else {
6876 6876
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6877 6877
 			}
6878 6878
 		}
6879 6879
 
6880
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6881
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6882
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6880
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6881
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6882
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6883 6883
 				ORDER BY airport_departure_icao_count DESC";
6884 6884
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6885 6885
       
@@ -6904,11 +6904,11 @@  discard block
 block discarded – undo
6904 6904
 	}	
6905 6905
 	
6906 6906
 	/**
6907
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6908
-	*
6909
-	* @return Array the airport list
6910
-	*
6911
-	*/
6907
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6908
+	 *
6909
+	 * @return Array the airport list
6910
+	 *
6911
+	 */
6912 6912
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6913 6913
 	{
6914 6914
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6942,11 +6942,11 @@  discard block
 block discarded – undo
6942 6942
 	
6943 6943
 	
6944 6944
 	/**
6945
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6946
-	*
6947
-	* @return Array the airport list
6948
-	*
6949
-	*/
6945
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6946
+	 *
6947
+	 * @return Array the airport list
6948
+	 *
6949
+	 */
6950 6950
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6951 6951
 	{
6952 6952
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6975,11 +6975,11 @@  discard block
 block discarded – undo
6975 6975
 	
6976 6976
 	
6977 6977
 	/**
6978
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6979
-	*
6980
-	* @return Array the airport list
6981
-	*
6982
-	*/
6978
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6979
+	 *
6980
+	 * @return Array the airport list
6981
+	 *
6982
+	 */
6983 6983
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6984 6984
 	{
6985 6985
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7012,11 +7012,11 @@  discard block
 block discarded – undo
7012 7012
 	
7013 7013
 	
7014 7014
 	/**
7015
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7016
-	*
7017
-	* @return Array the airport list
7018
-	*
7019
-	*/
7015
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7016
+	 *
7017
+	 * @return Array the airport list
7018
+	 *
7019
+	 */
7020 7020
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7021 7021
 	{
7022 7022
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7046,11 +7046,11 @@  discard block
 block discarded – undo
7046 7046
 	
7047 7047
 	
7048 7048
 	/**
7049
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7050
-	*
7051
-	* @return Array the airport list
7052
-	*
7053
-	*/
7049
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7050
+	 *
7051
+	 * @return Array the airport list
7052
+	 *
7053
+	 */
7054 7054
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7055 7055
 	{
7056 7056
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7083,11 +7083,11 @@  discard block
 block discarded – undo
7083 7083
 	
7084 7084
 	
7085 7085
 	/**
7086
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7087
-	*
7088
-	* @return Array the airport list
7089
-	*
7090
-	*/
7086
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7087
+	 *
7088
+	 * @return Array the airport list
7089
+	 *
7090
+	 */
7091 7091
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7092 7092
 	{
7093 7093
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7117,11 +7117,11 @@  discard block
 block discarded – undo
7117 7117
 	
7118 7118
 	
7119 7119
 	/**
7120
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7121
-	*
7122
-	* @return Array the airport list
7123
-	*
7124
-	*/
7120
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7121
+	 *
7122
+	 * @return Array the airport list
7123
+	 *
7124
+	 */
7125 7125
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7126 7126
 	{
7127 7127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7154,11 +7154,11 @@  discard block
 block discarded – undo
7154 7154
 	
7155 7155
 	
7156 7156
 	/**
7157
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7158
-	*
7159
-	* @return Array the airport list
7160
-	*
7161
-	*/
7157
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7158
+	 *
7159
+	 * @return Array the airport list
7160
+	 *
7161
+	 */
7162 7162
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7163 7163
 	{
7164 7164
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7189,11 +7189,11 @@  discard block
 block discarded – undo
7189 7189
 	
7190 7190
 	
7191 7191
 	/**
7192
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7193
-	*
7194
-	* @return Array the airport list
7195
-	*
7196
-	*/
7192
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7193
+	 *
7194
+	 * @return Array the airport list
7195
+	 *
7196
+	 */
7197 7197
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7198 7198
 	{
7199 7199
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7226,11 +7226,11 @@  discard block
 block discarded – undo
7226 7226
 	
7227 7227
 	
7228 7228
 	/**
7229
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7230
-	*
7231
-	* @return Array the airport list
7232
-	*
7233
-	*/
7229
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7230
+	 *
7231
+	 * @return Array the airport list
7232
+	 *
7233
+	 */
7234 7234
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7235 7235
 	{
7236 7236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7260,11 +7260,11 @@  discard block
 block discarded – undo
7260 7260
 	
7261 7261
 	
7262 7262
 	/**
7263
-	* Gets all departure airports of the airplanes that have flown over based on a date
7264
-	*
7265
-	* @return Array the airport list
7266
-	*
7267
-	*/
7263
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7264
+	 *
7265
+	 * @return Array the airport list
7266
+	 *
7267
+	 */
7268 7268
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7269 7269
 	{
7270 7270
 		global $globalTimezone, $globalDBdriver;
@@ -7310,11 +7310,11 @@  discard block
 block discarded – undo
7310 7310
 	
7311 7311
 	
7312 7312
 	/**
7313
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7314
-	*
7315
-	* @return Array the airport list
7316
-	*
7317
-	*/
7313
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7314
+	 *
7315
+	 * @return Array the airport list
7316
+	 *
7317
+	 */
7318 7318
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7319 7319
 	{
7320 7320
 		global $globalTimezone, $globalDBdriver;
@@ -7357,11 +7357,11 @@  discard block
 block discarded – undo
7357 7357
 	
7358 7358
 	
7359 7359
 	/**
7360
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7361
-	*
7362
-	* @return Array the airport list
7363
-	*
7364
-	*/
7360
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7361
+	 *
7362
+	 * @return Array the airport list
7363
+	 *
7364
+	 */
7365 7365
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7366 7366
 	{
7367 7367
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7393,11 +7393,11 @@  discard block
 block discarded – undo
7393 7393
 	}
7394 7394
 	
7395 7395
 	/**
7396
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7397
-	*
7398
-	* @return Array the airport list
7399
-	*
7400
-	*/
7396
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7397
+	 *
7398
+	 * @return Array the airport list
7399
+	 *
7400
+	 */
7401 7401
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7402 7402
 	{
7403 7403
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7429,11 +7429,11 @@  discard block
 block discarded – undo
7429 7429
 	}
7430 7430
 	
7431 7431
 	/**
7432
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7433
-	*
7434
-	* @return Array the airport list
7435
-	*
7436
-	*/
7432
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7433
+	 *
7434
+	 * @return Array the airport list
7435
+	 *
7436
+	 */
7437 7437
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7438 7438
 	{
7439 7439
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7466,11 +7466,11 @@  discard block
 block discarded – undo
7466 7466
 	
7467 7467
 	
7468 7468
 	/**
7469
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7470
-	*
7471
-	* @return Array the airport list
7472
-	*
7473
-	*/
7469
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7470
+	 *
7471
+	 * @return Array the airport list
7472
+	 *
7473
+	 */
7474 7474
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7475 7475
 	{
7476 7476
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7499,11 +7499,11 @@  discard block
 block discarded – undo
7499 7499
 	}
7500 7500
 	
7501 7501
 	/**
7502
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7503
-	*
7504
-	* @return Array the airport list
7505
-	*
7506
-	*/
7502
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7503
+	 *
7504
+	 * @return Array the airport list
7505
+	 *
7506
+	 */
7507 7507
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7508 7508
 	{
7509 7509
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7519,11 +7519,11 @@  discard block
 block discarded – undo
7519 7519
 	}
7520 7520
 	
7521 7521
 	/**
7522
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7523
-	*
7524
-	* @return Array the airport list
7525
-	*
7526
-	*/
7522
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7523
+	 *
7524
+	 * @return Array the airport list
7525
+	 *
7526
+	 */
7527 7527
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7528 7528
 	{
7529 7529
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7541,11 +7541,11 @@  discard block
 block discarded – undo
7541 7541
 	
7542 7542
 	
7543 7543
 	/**
7544
-	* Gets all departure airports of the airplanes that have flown over based on a country
7545
-	*
7546
-	* @return Array the airport list
7547
-	*
7548
-	*/
7544
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7545
+	 *
7546
+	 * @return Array the airport list
7547
+	 *
7548
+	 */
7549 7549
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7550 7550
 	{
7551 7551
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7579,11 +7579,11 @@  discard block
 block discarded – undo
7579 7579
 
7580 7580
 
7581 7581
 	/**
7582
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7583
-	*
7584
-	* @return Array the airport list
7585
-	*
7586
-	*/
7582
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7583
+	 *
7584
+	 * @return Array the airport list
7585
+	 *
7586
+	 */
7587 7587
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7588 7588
 	{
7589 7589
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7613,31 +7613,31 @@  discard block
 block discarded – undo
7613 7613
 	
7614 7614
 
7615 7615
 	/**
7616
-	* Gets all arrival airports of the airplanes that have flown over
7617
-	*
7618
-	* @param Boolean $limit Limit result to 10 or not
7619
-	* @param Integer $olderthanmonths Only show result older than x months
7620
-	* @param String $sincedate Only show result since x date
7621
-	* @param Boolean $icaoaskey Show result by ICAO
7622
-	* @param Array $filters Filter used here
7623
-	* @return Array the airport list
7624
-	*
7625
-	*/
7616
+	 * Gets all arrival airports of the airplanes that have flown over
7617
+	 *
7618
+	 * @param Boolean $limit Limit result to 10 or not
7619
+	 * @param Integer $olderthanmonths Only show result older than x months
7620
+	 * @param String $sincedate Only show result since x date
7621
+	 * @param Boolean $icaoaskey Show result by ICAO
7622
+	 * @param Array $filters Filter used here
7623
+	 * @return Array the airport list
7624
+	 *
7625
+	 */
7626 7626
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7627 7627
 	{
7628 7628
 		global $globalDBdriver;
7629 7629
 		$filter_query = $this->getFilter($filters,true,true);
7630 7630
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude 
7631 7631
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.arrival_airport_icao AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7632
-                if ($olderthanmonths > 0) {
7633
-            		if ($globalDBdriver == 'mysql') {
7632
+				if ($olderthanmonths > 0) {
7633
+					if ($globalDBdriver == 'mysql') {
7634 7634
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7635 7635
 			} else {
7636 7636
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7637 7637
 			}
7638 7638
 		}
7639
-                if ($sincedate != '') {
7640
-            		if ($globalDBdriver == 'mysql') {
7639
+				if ($sincedate != '') {
7640
+					if ($globalDBdriver == 'mysql') {
7641 7641
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7642 7642
 			} else {
7643 7643
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7671,7 +7671,7 @@  discard block
 block discarded – undo
7671 7671
 				$query_values = array_merge($query_values,array(':day' => $day));
7672 7672
 			}
7673 7673
 		}
7674
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
7674
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
7675 7675
 					ORDER BY airport_arrival_icao_count DESC";
7676 7676
 		if ($limit) $query .= " LIMIT 10";
7677 7677
       
@@ -7702,35 +7702,35 @@  discard block
 block discarded – undo
7702 7702
 	}
7703 7703
 
7704 7704
 	/**
7705
-	* Gets all arrival airports of the airplanes that have flown over
7706
-	*
7707
-	* @return Array the airport list
7708
-	*
7709
-	*/
7705
+	 * Gets all arrival airports of the airplanes that have flown over
7706
+	 *
7707
+	 * @return Array the airport list
7708
+	 *
7709
+	 */
7710 7710
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7711 7711
 	{
7712 7712
 		global $globalDBdriver;
7713 7713
 		$filter_query = $this->getFilter($filters,true,true);
7714 7714
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, country.iso3 AS arrival_airport_country_iso3 
7715 7715
 			FROM countries,spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7716
-                if ($olderthanmonths > 0) {
7717
-            		if ($globalDBdriver == 'mysql') {
7716
+				if ($olderthanmonths > 0) {
7717
+					if ($globalDBdriver == 'mysql') {
7718 7718
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7719 7719
 			} else {
7720 7720
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7721 7721
 			}
7722 7722
 		}
7723
-                if ($sincedate != '') {
7724
-            		if ($globalDBdriver == 'mysql') {
7723
+				if ($sincedate != '') {
7724
+					if ($globalDBdriver == 'mysql') {
7725 7725
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7726 7726
 			} else {
7727 7727
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7728 7728
 			}
7729 7729
 		}
7730 7730
 
7731
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7732
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7733
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, countries.iso3
7731
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7732
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7733
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, countries.iso3
7734 7734
 					ORDER BY airport_arrival_icao_count DESC";
7735 7735
 		if ($limit) $query .= " LIMIT 10";
7736 7736
       
@@ -7762,26 +7762,26 @@  discard block
 block discarded – undo
7762 7762
 
7763 7763
 
7764 7764
 	/**
7765
-	* Gets all detected arrival airports of the airplanes that have flown over
7766
-	*
7767
-	* @return Array the airport list
7768
-	*
7769
-	*/
7765
+	 * Gets all detected arrival airports of the airplanes that have flown over
7766
+	 *
7767
+	 * @return Array the airport list
7768
+	 *
7769
+	 */
7770 7770
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7771 7771
 	{
7772 7772
 		global $globalDBdriver;
7773 7773
 		$filter_query = $this->getFilter($filters,true,true);
7774 7774
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude 
7775 7775
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
7776
-                if ($olderthanmonths > 0) {
7777
-            		if ($globalDBdriver == 'mysql') {
7776
+				if ($olderthanmonths > 0) {
7777
+					if ($globalDBdriver == 'mysql') {
7778 7778
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7779 7779
 			} else {
7780 7780
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7781 7781
 			}
7782 7782
 		}
7783
-                if ($sincedate != '') {
7784
-            		if ($globalDBdriver == 'mysql') {
7783
+				if ($sincedate != '') {
7784
+					if ($globalDBdriver == 'mysql') {
7785 7785
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7786 7786
 			} else {
7787 7787
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7843,35 +7843,35 @@  discard block
 block discarded – undo
7843 7843
 	}
7844 7844
 	
7845 7845
 	/**
7846
-	* Gets all detected arrival airports of the airplanes that have flown over
7847
-	*
7848
-	* @return Array the airport list
7849
-	*
7850
-	*/
7846
+	 * Gets all detected arrival airports of the airplanes that have flown over
7847
+	 *
7848
+	 * @return Array the airport list
7849
+	 *
7850
+	 */
7851 7851
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7852 7852
 	{
7853 7853
 		global $globalDBdriver;
7854 7854
 		$filter_query = $this->getFilter($filters,true,true);
7855 7855
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7856 7856
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
7857
-                if ($olderthanmonths > 0) {
7858
-            		if ($globalDBdriver == 'mysql') {
7857
+				if ($olderthanmonths > 0) {
7858
+					if ($globalDBdriver == 'mysql') {
7859 7859
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7860 7860
 			} else {
7861 7861
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7862 7862
 			}
7863 7863
 		}
7864
-                if ($sincedate != '') {
7865
-            		if ($globalDBdriver == 'mysql') {
7864
+				if ($sincedate != '') {
7865
+					if ($globalDBdriver == 'mysql') {
7866 7866
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7867 7867
 			} else {
7868 7868
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7869 7869
 			}
7870 7870
 		}
7871 7871
 
7872
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7873
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7874
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7872
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7873
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7874
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7875 7875
 					ORDER BY airport_arrival_icao_count DESC";
7876 7876
 		if ($limit) $query .= " LIMIT 10";
7877 7877
       
@@ -7901,11 +7901,11 @@  discard block
 block discarded – undo
7901 7901
 	}	
7902 7902
 	
7903 7903
 	/**
7904
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7905
-	*
7906
-	* @return Array the airport list
7907
-	*
7908
-	*/
7904
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7905
+	 *
7906
+	 * @return Array the airport list
7907
+	 *
7908
+	 */
7909 7909
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7910 7910
 	{
7911 7911
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7937,11 +7937,11 @@  discard block
 block discarded – undo
7937 7937
 	
7938 7938
 	
7939 7939
 	/**
7940
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7941
-	*
7942
-	* @return Array the airport list
7943
-	*
7944
-	*/
7940
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7941
+	 *
7942
+	 * @return Array the airport list
7943
+	 *
7944
+	 */
7945 7945
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7946 7946
 	{
7947 7947
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7971,11 +7971,11 @@  discard block
 block discarded – undo
7971 7971
 	
7972 7972
 	
7973 7973
 	/**
7974
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7975
-	*
7976
-	* @return Array the airport list
7977
-	*
7978
-	*/
7974
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7975
+	 *
7976
+	 * @return Array the airport list
7977
+	 *
7978
+	 */
7979 7979
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7980 7980
 	{
7981 7981
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8009,11 +8009,11 @@  discard block
 block discarded – undo
8009 8009
 	
8010 8010
 	
8011 8011
 	/**
8012
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8013
-	*
8014
-	* @return Array the airport list
8015
-	*
8016
-	*/
8012
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8013
+	 *
8014
+	 * @return Array the airport list
8015
+	 *
8016
+	 */
8017 8017
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8018 8018
 	{
8019 8019
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8043,11 +8043,11 @@  discard block
 block discarded – undo
8043 8043
 	
8044 8044
 	
8045 8045
 	/**
8046
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8047
-	*
8048
-	* @return Array the airport list
8049
-	*
8050
-	*/
8046
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8047
+	 *
8048
+	 * @return Array the airport list
8049
+	 *
8050
+	 */
8051 8051
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8052 8052
 	{
8053 8053
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8081,11 +8081,11 @@  discard block
 block discarded – undo
8081 8081
 	
8082 8082
 	
8083 8083
 	/**
8084
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8085
-	*
8086
-	* @return Array the airport list
8087
-	*
8088
-	*/
8084
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8085
+	 *
8086
+	 * @return Array the airport list
8087
+	 *
8088
+	 */
8089 8089
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8090 8090
 	{
8091 8091
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8116,11 +8116,11 @@  discard block
 block discarded – undo
8116 8116
 	
8117 8117
 	
8118 8118
 	/**
8119
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8120
-	*
8121
-	* @return Array the airport list
8122
-	*
8123
-	*/
8119
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8120
+	 *
8121
+	 * @return Array the airport list
8122
+	 *
8123
+	 */
8124 8124
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8125 8125
 	{
8126 8126
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8153,11 +8153,11 @@  discard block
 block discarded – undo
8153 8153
 	
8154 8154
 	
8155 8155
 	/**
8156
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8157
-	*
8158
-	* @return Array the airport list
8159
-	*
8160
-	*/
8156
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8157
+	 *
8158
+	 * @return Array the airport list
8159
+	 *
8160
+	 */
8161 8161
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8162 8162
 	{
8163 8163
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8187,11 +8187,11 @@  discard block
 block discarded – undo
8187 8187
 	
8188 8188
 	
8189 8189
 	/**
8190
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8191
-	*
8192
-	* @return Array the airport list
8193
-	*
8194
-	*/
8190
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8191
+	 *
8192
+	 * @return Array the airport list
8193
+	 *
8194
+	 */
8195 8195
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8196 8196
 	{
8197 8197
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8225,11 +8225,11 @@  discard block
 block discarded – undo
8225 8225
 	
8226 8226
 	
8227 8227
 	/**
8228
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8229
-	*
8230
-	* @return Array the airport list
8231
-	*
8232
-	*/
8228
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8229
+	 *
8230
+	 * @return Array the airport list
8231
+	 *
8232
+	 */
8233 8233
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8234 8234
 	{
8235 8235
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8260,11 +8260,11 @@  discard block
 block discarded – undo
8260 8260
 	
8261 8261
 	
8262 8262
 	/**
8263
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8264
-	*
8265
-	* @return Array the airport list
8266
-	*
8267
-	*/
8263
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8264
+	 *
8265
+	 * @return Array the airport list
8266
+	 *
8267
+	 */
8268 8268
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8269 8269
 	{
8270 8270
 		global $globalTimezone, $globalDBdriver;
@@ -8310,11 +8310,11 @@  discard block
 block discarded – undo
8310 8310
 	
8311 8311
 	
8312 8312
 	/**
8313
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8314
-	*
8315
-	* @return Array the airport list
8316
-	*
8317
-	*/
8313
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8314
+	 *
8315
+	 * @return Array the airport list
8316
+	 *
8317
+	 */
8318 8318
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8319 8319
 	{
8320 8320
 		global $globalTimezone, $globalDBdriver;
@@ -8357,11 +8357,11 @@  discard block
 block discarded – undo
8357 8357
 	
8358 8358
 	
8359 8359
 	/**
8360
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8361
-	*
8362
-	* @return Array the airport list
8363
-	*
8364
-	*/
8360
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8361
+	 *
8362
+	 * @return Array the airport list
8363
+	 *
8364
+	 */
8365 8365
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8366 8366
 	{
8367 8367
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8393,11 +8393,11 @@  discard block
 block discarded – undo
8393 8393
 	}
8394 8394
 	
8395 8395
 	/**
8396
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8397
-	*
8398
-	* @return Array the airport list
8399
-	*
8400
-	*/
8396
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8397
+	 *
8398
+	 * @return Array the airport list
8399
+	 *
8400
+	 */
8401 8401
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8402 8402
 	{
8403 8403
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8428,11 +8428,11 @@  discard block
 block discarded – undo
8428 8428
 	}
8429 8429
 
8430 8430
 	/**
8431
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8432
-	*
8433
-	* @return Array the airport list
8434
-	*
8435
-	*/
8431
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8432
+	 *
8433
+	 * @return Array the airport list
8434
+	 *
8435
+	 */
8436 8436
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8437 8437
 	{
8438 8438
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8463,11 +8463,11 @@  discard block
 block discarded – undo
8463 8463
 	}
8464 8464
 	
8465 8465
 	/**
8466
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8467
-	*
8468
-	* @return Array the airport list
8469
-	*
8470
-	*/
8466
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8467
+	 *
8468
+	 * @return Array the airport list
8469
+	 *
8470
+	 */
8471 8471
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8472 8472
 	{
8473 8473
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8496,11 +8496,11 @@  discard block
 block discarded – undo
8496 8496
 	}
8497 8497
 	
8498 8498
 	/**
8499
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8500
-	*
8501
-	* @return Array the airport list
8502
-	*
8503
-	*/
8499
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8500
+	 *
8501
+	 * @return Array the airport list
8502
+	 *
8503
+	 */
8504 8504
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8505 8505
 	{
8506 8506
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8516,11 +8516,11 @@  discard block
 block discarded – undo
8516 8516
 	}
8517 8517
 	
8518 8518
 	/**
8519
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8520
-	*
8521
-	* @return Array the airport list
8522
-	*
8523
-	*/
8519
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8520
+	 *
8521
+	 * @return Array the airport list
8522
+	 *
8523
+	 */
8524 8524
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8525 8525
 	{
8526 8526
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8538,11 +8538,11 @@  discard block
 block discarded – undo
8538 8538
 	
8539 8539
 	
8540 8540
 	/**
8541
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8542
-	*
8543
-	* @return Array the airport list
8544
-	*
8545
-	*/
8541
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8542
+	 *
8543
+	 * @return Array the airport list
8544
+	 *
8545
+	 */
8546 8546
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8547 8547
 	{
8548 8548
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8575,11 +8575,11 @@  discard block
 block discarded – undo
8575 8575
 	
8576 8576
 	
8577 8577
 	/**
8578
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8579
-	*
8580
-	* @return Array the airport list
8581
-	*
8582
-	*/
8578
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8579
+	 *
8580
+	 * @return Array the airport list
8581
+	 *
8582
+	 */
8583 8583
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8584 8584
 	{
8585 8585
 		global $globalDBdriver;
@@ -8611,11 +8611,11 @@  discard block
 block discarded – undo
8611 8611
 
8612 8612
 
8613 8613
 	/**
8614
-	* Counts all airport departure countries
8615
-	*
8616
-	* @return Array the airport departure list
8617
-	*
8618
-	*/
8614
+	 * Counts all airport departure countries
8615
+	 *
8616
+	 * @return Array the airport departure list
8617
+	 *
8618
+	 */
8619 8619
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8620 8620
 	{
8621 8621
 		global $globalDBdriver;
@@ -8674,11 +8674,11 @@  discard block
 block discarded – undo
8674 8674
 	
8675 8675
 	
8676 8676
 	/**
8677
-	* Counts all airport arrival countries
8678
-	*
8679
-	* @return Array the airport arrival list
8680
-	*
8681
-	*/
8677
+	 * Counts all airport arrival countries
8678
+	 *
8679
+	 * @return Array the airport arrival list
8680
+	 *
8681
+	 */
8682 8682
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8683 8683
 	{
8684 8684
 		global $globalDBdriver;
@@ -8741,11 +8741,11 @@  discard block
 block discarded – undo
8741 8741
 
8742 8742
 
8743 8743
 	/**
8744
-	* Gets all route combinations
8745
-	*
8746
-	* @return Array the route list
8747
-	*
8748
-	*/
8744
+	 * Gets all route combinations
8745
+	 *
8746
+	 * @return Array the route list
8747
+	 *
8748
+	 */
8749 8749
 	public function countAllRoutes($filters = array())
8750 8750
 	{
8751 8751
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8784,11 +8784,11 @@  discard block
 block discarded – undo
8784 8784
 	
8785 8785
 	
8786 8786
 	/**
8787
-	* Gets all route combinations based on an aircraft
8788
-	*
8789
-	* @return Array the route list
8790
-	*
8791
-	*/
8787
+	 * Gets all route combinations based on an aircraft
8788
+	 *
8789
+	 * @return Array the route list
8790
+	 *
8791
+	 */
8792 8792
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8793 8793
 	{
8794 8794
 		$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 based on an aircraft registration
8828
-	*
8829
-	* @return Array the route list
8830
-	*
8831
-	*/
8827
+	 * Gets all route combinations based on an aircraft registration
8828
+	 *
8829
+	 * @return Array the route list
8830
+	 *
8831
+	 */
8832 8832
 	public function countAllRoutesByRegistration($registration, $filters = array())
8833 8833
 	{
8834 8834
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8866,11 +8866,11 @@  discard block
 block discarded – undo
8866 8866
 	
8867 8867
 	
8868 8868
 	/**
8869
-	* Gets all route combinations based on an airline
8870
-	*
8871
-	* @return Array the route list
8872
-	*
8873
-	*/
8869
+	 * Gets all route combinations based on an airline
8870
+	 *
8871
+	 * @return Array the route list
8872
+	 *
8873
+	 */
8874 8874
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8875 8875
 	{
8876 8876
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8908,11 +8908,11 @@  discard block
 block discarded – undo
8908 8908
 	
8909 8909
 	
8910 8910
 	/**
8911
-	* Gets all route combinations based on an airport
8912
-	*
8913
-	* @return Array the route list
8914
-	*
8915
-	*/
8911
+	 * Gets all route combinations based on an airport
8912
+	 *
8913
+	 * @return Array the route list
8914
+	 *
8915
+	 */
8916 8916
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8917 8917
 	{
8918 8918
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8949,11 +8949,11 @@  discard block
 block discarded – undo
8949 8949
 	
8950 8950
 	
8951 8951
 	/**
8952
-	* Gets all route combinations based on an country
8953
-	*
8954
-	* @return Array the route list
8955
-	*
8956
-	*/
8952
+	 * Gets all route combinations based on an country
8953
+	 *
8954
+	 * @return Array the route list
8955
+	 *
8956
+	 */
8957 8957
 	public function countAllRoutesByCountry($country, $filters = array())
8958 8958
 	{
8959 8959
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8989,11 +8989,11 @@  discard block
 block discarded – undo
8989 8989
 
8990 8990
 
8991 8991
 	/**
8992
-	* Gets all route combinations based on an date
8993
-	*
8994
-	* @return Array the route list
8995
-	*
8996
-	*/
8992
+	 * Gets all route combinations based on an date
8993
+	 *
8994
+	 * @return Array the route list
8995
+	 *
8996
+	 */
8997 8997
 	public function countAllRoutesByDate($date, $filters = array())
8998 8998
 	{
8999 8999
 		global $globalTimezone, $globalDBdriver;
@@ -9043,11 +9043,11 @@  discard block
 block discarded – undo
9043 9043
 	
9044 9044
 	
9045 9045
 	/**
9046
-	* Gets all route combinations based on an ident/callsign
9047
-	*
9048
-	* @return Array the route list
9049
-	*
9050
-	*/
9046
+	 * Gets all route combinations based on an ident/callsign
9047
+	 *
9048
+	 * @return Array the route list
9049
+	 *
9050
+	 */
9051 9051
 	public function countAllRoutesByIdent($ident, $filters = array())
9052 9052
 	{
9053 9053
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9083,11 +9083,11 @@  discard block
 block discarded – undo
9083 9083
 	}
9084 9084
 	
9085 9085
 	/**
9086
-	* Gets all route combinations based on an owner
9087
-	*
9088
-	* @return Array the route list
9089
-	*
9090
-	*/
9086
+	 * Gets all route combinations based on an owner
9087
+	 *
9088
+	 * @return Array the route list
9089
+	 *
9090
+	 */
9091 9091
 	public function countAllRoutesByOwner($owner,$filters = array())
9092 9092
 	{
9093 9093
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9123,11 +9123,11 @@  discard block
 block discarded – undo
9123 9123
 	}
9124 9124
 	
9125 9125
 	/**
9126
-	* Gets all route combinations based on a pilot
9127
-	*
9128
-	* @return Array the route list
9129
-	*
9130
-	*/
9126
+	 * Gets all route combinations based on a pilot
9127
+	 *
9128
+	 * @return Array the route list
9129
+	 *
9130
+	 */
9131 9131
 	public function countAllRoutesByPilot($pilot,$filters = array())
9132 9132
 	{
9133 9133
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9164,11 +9164,11 @@  discard block
 block discarded – undo
9164 9164
 	
9165 9165
 	
9166 9166
 	/**
9167
-	* Gets all route combinations based on an manufacturer
9168
-	*
9169
-	* @return Array the route list
9170
-	*
9171
-	*/
9167
+	 * Gets all route combinations based on an manufacturer
9168
+	 *
9169
+	 * @return Array the route list
9170
+	 *
9171
+	 */
9172 9172
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9173 9173
 	{
9174 9174
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9206,11 +9206,11 @@  discard block
 block discarded – undo
9206 9206
 	
9207 9207
 	
9208 9208
 	/**
9209
-	* Gets all route combinations with waypoints
9210
-	*
9211
-	* @return Array the route list
9212
-	*
9213
-	*/
9209
+	 * Gets all route combinations with waypoints
9210
+	 *
9211
+	 * @return Array the route list
9212
+	 *
9213
+	 */
9214 9214
 	public function countAllRoutesWithWaypoints($filters = array())
9215 9215
 	{
9216 9216
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9247,11 +9247,11 @@  discard block
 block discarded – undo
9247 9247
 	}
9248 9248
 	
9249 9249
 	/**
9250
-	* Gets all callsigns that have flown over
9251
-	*
9252
-	* @return Array the callsign list
9253
-	*
9254
-	*/
9250
+	 * Gets all callsigns that have flown over
9251
+	 *
9252
+	 * @return Array the callsign list
9253
+	 *
9254
+	 */
9255 9255
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9256 9256
 	{
9257 9257
 		global $globalDBdriver;
@@ -9317,11 +9317,11 @@  discard block
 block discarded – undo
9317 9317
 	}
9318 9318
 
9319 9319
 	/**
9320
-	* Gets all callsigns that have flown over
9321
-	*
9322
-	* @return Array the callsign list
9323
-	*
9324
-	*/
9320
+	 * Gets all callsigns that have flown over
9321
+	 *
9322
+	 * @return Array the callsign list
9323
+	 *
9324
+	 */
9325 9325
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9326 9326
 	{
9327 9327
 		global $globalDBdriver;
@@ -9362,11 +9362,11 @@  discard block
 block discarded – undo
9362 9362
 
9363 9363
 
9364 9364
 	/**
9365
-	* Counts all dates
9366
-	*
9367
-	* @return Array the date list
9368
-	*
9369
-	*/
9365
+	 * Counts all dates
9366
+	 *
9367
+	 * @return Array the date list
9368
+	 *
9369
+	 */
9370 9370
 	public function countAllDates($filters = array())
9371 9371
 	{
9372 9372
 		global $globalTimezone, $globalDBdriver;
@@ -9411,11 +9411,11 @@  discard block
 block discarded – undo
9411 9411
 	}
9412 9412
 	
9413 9413
 	/**
9414
-	* Counts all dates
9415
-	*
9416
-	* @return Array the date list
9417
-	*
9418
-	*/
9414
+	 * Counts all dates
9415
+	 *
9416
+	 * @return Array the date list
9417
+	 *
9418
+	 */
9419 9419
 	public function countAllDatesByAirlines($filters = array())
9420 9420
 	{
9421 9421
 		global $globalTimezone, $globalDBdriver;
@@ -9460,11 +9460,11 @@  discard block
 block discarded – undo
9460 9460
 	}	
9461 9461
 	
9462 9462
 	/**
9463
-	* Counts all dates during the last 7 days
9464
-	*
9465
-	* @return Array the date list
9466
-	*
9467
-	*/
9463
+	 * Counts all dates during the last 7 days
9464
+	 *
9465
+	 * @return Array the date list
9466
+	 *
9467
+	 */
9468 9468
 	public function countAllDatesLast7Days($filters = array())
9469 9469
 	{
9470 9470
 		global $globalTimezone, $globalDBdriver;
@@ -9486,7 +9486,7 @@  discard block
 block discarded – undo
9486 9486
 			$query .= " GROUP BY date_name 
9487 9487
 								ORDER BY date_name ASC";
9488 9488
 			$query_data = array(':offset' => $offset);
9489
-    		}
9489
+			}
9490 9490
 		
9491 9491
 		$sth = $this->db->prepare($query);
9492 9492
 		$sth->execute($query_data);
@@ -9506,11 +9506,11 @@  discard block
 block discarded – undo
9506 9506
 	}
9507 9507
 
9508 9508
 	/**
9509
-	* Counts all dates during the last month
9510
-	*
9511
-	* @return Array the date list
9512
-	*
9513
-	*/
9509
+	 * Counts all dates during the last month
9510
+	 *
9511
+	 * @return Array the date list
9512
+	 *
9513
+	 */
9514 9514
 	public function countAllDatesLastMonth($filters = array())
9515 9515
 	{
9516 9516
 		global $globalTimezone, $globalDBdriver;
@@ -9532,7 +9532,7 @@  discard block
 block discarded – undo
9532 9532
 			$query .= " GROUP BY date_name 
9533 9533
 								ORDER BY date_name ASC";
9534 9534
 			$query_data = array(':offset' => $offset);
9535
-    		}
9535
+			}
9536 9536
 		
9537 9537
 		$sth = $this->db->prepare($query);
9538 9538
 		$sth->execute($query_data);
@@ -9553,11 +9553,11 @@  discard block
 block discarded – undo
9553 9553
 
9554 9554
 
9555 9555
 	/**
9556
-	* Counts all dates during the last month
9557
-	*
9558
-	* @return Array the date list
9559
-	*
9560
-	*/
9556
+	 * Counts all dates during the last month
9557
+	 *
9558
+	 * @return Array the date list
9559
+	 *
9560
+	 */
9561 9561
 	public function countAllDatesLastMonthByAirlines($filters = array())
9562 9562
 	{
9563 9563
 		global $globalTimezone, $globalDBdriver;
@@ -9580,7 +9580,7 @@  discard block
 block discarded – undo
9580 9580
 								GROUP BY spotter_output.airline_icao, date_name 
9581 9581
 								ORDER BY date_name ASC";
9582 9582
 			$query_data = array(':offset' => $offset);
9583
-    		}
9583
+			}
9584 9584
 		
9585 9585
 		$sth = $this->db->prepare($query);
9586 9586
 		$sth->execute($query_data);
@@ -9602,11 +9602,11 @@  discard block
 block discarded – undo
9602 9602
 	
9603 9603
 
9604 9604
 	/**
9605
-	* Counts all month
9606
-	*
9607
-	* @return Array the month list
9608
-	*
9609
-	*/
9605
+	 * Counts all month
9606
+	 *
9607
+	 * @return Array the month list
9608
+	 *
9609
+	 */
9610 9610
 	public function countAllMonths($filters = array())
9611 9611
 	{
9612 9612
 		global $globalTimezone, $globalDBdriver;
@@ -9648,11 +9648,11 @@  discard block
 block discarded – undo
9648 9648
 	}
9649 9649
 
9650 9650
 	/**
9651
-	* Counts all month
9652
-	*
9653
-	* @return Array the month list
9654
-	*
9655
-	*/
9651
+	 * Counts all month
9652
+	 *
9653
+	 * @return Array the month list
9654
+	 *
9655
+	 */
9656 9656
 	public function countAllMonthsByAirlines($filters = array())
9657 9657
 	{
9658 9658
 		global $globalTimezone, $globalDBdriver;
@@ -9697,11 +9697,11 @@  discard block
 block discarded – undo
9697 9697
 	}
9698 9698
 
9699 9699
 	/**
9700
-	* Counts all military month
9701
-	*
9702
-	* @return Array the month list
9703
-	*
9704
-	*/
9700
+	 * Counts all military month
9701
+	 *
9702
+	 * @return Array the month list
9703
+	 *
9704
+	 */
9705 9705
 	public function countAllMilitaryMonths($filters = array())
9706 9706
 	{
9707 9707
 		global $globalTimezone, $globalDBdriver;
@@ -9742,11 +9742,11 @@  discard block
 block discarded – undo
9742 9742
 	}
9743 9743
 	
9744 9744
 	/**
9745
-	* Counts all month owners
9746
-	*
9747
-	* @return Array the month list
9748
-	*
9749
-	*/
9745
+	 * Counts all month owners
9746
+	 *
9747
+	 * @return Array the month list
9748
+	 *
9749
+	 */
9750 9750
 	public function countAllMonthsOwners($filters = array())
9751 9751
 	{
9752 9752
 		global $globalTimezone, $globalDBdriver;
@@ -9788,11 +9788,11 @@  discard block
 block discarded – undo
9788 9788
 	}
9789 9789
 	
9790 9790
 	/**
9791
-	* Counts all month owners
9792
-	*
9793
-	* @return Array the month list
9794
-	*
9795
-	*/
9791
+	 * Counts all month owners
9792
+	 *
9793
+	 * @return Array the month list
9794
+	 *
9795
+	 */
9796 9796
 	public function countAllMonthsOwnersByAirlines($filters = array())
9797 9797
 	{
9798 9798
 		global $globalTimezone, $globalDBdriver;
@@ -9835,11 +9835,11 @@  discard block
 block discarded – undo
9835 9835
 	}
9836 9836
 
9837 9837
 	/**
9838
-	* Counts all month pilot
9839
-	*
9840
-	* @return Array the month list
9841
-	*
9842
-	*/
9838
+	 * Counts all month pilot
9839
+	 *
9840
+	 * @return Array the month list
9841
+	 *
9842
+	 */
9843 9843
 	public function countAllMonthsPilots($filters = array())
9844 9844
 	{
9845 9845
 		global $globalTimezone, $globalDBdriver;
@@ -9881,11 +9881,11 @@  discard block
 block discarded – undo
9881 9881
 	}
9882 9882
 	
9883 9883
 	/**
9884
-	* Counts all month pilot
9885
-	*
9886
-	* @return Array the month list
9887
-	*
9888
-	*/
9884
+	 * Counts all month pilot
9885
+	 *
9886
+	 * @return Array the month list
9887
+	 *
9888
+	 */
9889 9889
 	public function countAllMonthsPilotsByAirlines($filters = array())
9890 9890
 	{
9891 9891
 		global $globalTimezone, $globalDBdriver;
@@ -9928,11 +9928,11 @@  discard block
 block discarded – undo
9928 9928
 	}
9929 9929
 
9930 9930
 	/**
9931
-	* Counts all month airline
9932
-	*
9933
-	* @return Array the month list
9934
-	*
9935
-	*/
9931
+	 * Counts all month airline
9932
+	 *
9933
+	 * @return Array the month list
9934
+	 *
9935
+	 */
9936 9936
 	public function countAllMonthsAirlines($filters = array())
9937 9937
 	{
9938 9938
 		global $globalTimezone, $globalDBdriver;
@@ -9974,11 +9974,11 @@  discard block
 block discarded – undo
9974 9974
 	}
9975 9975
 	
9976 9976
 	/**
9977
-	* Counts all month aircraft
9978
-	*
9979
-	* @return Array the month list
9980
-	*
9981
-	*/
9977
+	 * Counts all month aircraft
9978
+	 *
9979
+	 * @return Array the month list
9980
+	 *
9981
+	 */
9982 9982
 	public function countAllMonthsAircrafts($filters = array())
9983 9983
 	{
9984 9984
 		global $globalTimezone, $globalDBdriver;
@@ -10021,11 +10021,11 @@  discard block
 block discarded – undo
10021 10021
 	
10022 10022
 
10023 10023
 	/**
10024
-	* Counts all month aircraft
10025
-	*
10026
-	* @return Array the month list
10027
-	*
10028
-	*/
10024
+	 * Counts all month aircraft
10025
+	 *
10026
+	 * @return Array the month list
10027
+	 *
10028
+	 */
10029 10029
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10030 10030
 	{
10031 10031
 		global $globalTimezone, $globalDBdriver;
@@ -10068,11 +10068,11 @@  discard block
 block discarded – undo
10068 10068
 	}
10069 10069
 
10070 10070
 	/**
10071
-	* Counts all month real arrival
10072
-	*
10073
-	* @return Array the month list
10074
-	*
10075
-	*/
10071
+	 * Counts all month real arrival
10072
+	 *
10073
+	 * @return Array the month list
10074
+	 *
10075
+	 */
10076 10076
 	public function countAllMonthsRealArrivals($filters = array())
10077 10077
 	{
10078 10078
 		global $globalTimezone, $globalDBdriver;
@@ -10115,11 +10115,11 @@  discard block
 block discarded – undo
10115 10115
 	
10116 10116
 
10117 10117
 	/**
10118
-	* Counts all month real arrival
10119
-	*
10120
-	* @return Array the month list
10121
-	*
10122
-	*/
10118
+	 * Counts all month real arrival
10119
+	 *
10120
+	 * @return Array the month list
10121
+	 *
10122
+	 */
10123 10123
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10124 10124
 	{
10125 10125
 		global $globalTimezone, $globalDBdriver;
@@ -10163,11 +10163,11 @@  discard block
 block discarded – undo
10163 10163
 	
10164 10164
 
10165 10165
 	/**
10166
-	* Counts all dates during the last year
10167
-	*
10168
-	* @return Array the date list
10169
-	*
10170
-	*/
10166
+	 * Counts all dates during the last year
10167
+	 *
10168
+	 * @return Array the date list
10169
+	 *
10170
+	 */
10171 10171
 	public function countAllMonthsLastYear($filters)
10172 10172
 	{
10173 10173
 		global $globalTimezone, $globalDBdriver;
@@ -10189,7 +10189,7 @@  discard block
 block discarded – undo
10189 10189
 			$query .= " GROUP BY year_name, month_name
10190 10190
 								ORDER BY year_name, month_name ASC";
10191 10191
 			$query_data = array(':offset' => $offset);
10192
-    		}
10192
+			}
10193 10193
 		
10194 10194
 		$sth = $this->db->prepare($query);
10195 10195
 		$sth->execute($query_data);
@@ -10212,11 +10212,11 @@  discard block
 block discarded – undo
10212 10212
 	
10213 10213
 	
10214 10214
 	/**
10215
-	* Counts all hours
10216
-	*
10217
-	* @return Array the hour list
10218
-	*
10219
-	*/
10215
+	 * Counts all hours
10216
+	 *
10217
+	 * @return Array the hour list
10218
+	 *
10219
+	 */
10220 10220
 	public function countAllHours($orderby,$filters = array())
10221 10221
 	{
10222 10222
 		global $globalTimezone, $globalDBdriver;
@@ -10277,11 +10277,11 @@  discard block
 block discarded – undo
10277 10277
 	}
10278 10278
 	
10279 10279
 	/**
10280
-	* Counts all hours
10281
-	*
10282
-	* @return Array the hour list
10283
-	*
10284
-	*/
10280
+	 * Counts all hours
10281
+	 *
10282
+	 * @return Array the hour list
10283
+	 *
10284
+	 */
10285 10285
 	public function countAllHoursByAirlines($orderby, $filters = array())
10286 10286
 	{
10287 10287
 		global $globalTimezone, $globalDBdriver;
@@ -10344,11 +10344,11 @@  discard block
 block discarded – undo
10344 10344
 
10345 10345
 
10346 10346
 	/**
10347
-	* Counts all hours by airline
10348
-	*
10349
-	* @return Array the hour list
10350
-	*
10351
-	*/
10347
+	 * Counts all hours by airline
10348
+	 *
10349
+	 * @return Array the hour list
10350
+	 *
10351
+	 */
10352 10352
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10353 10353
 	{
10354 10354
 		global $globalTimezone, $globalDBdriver;
@@ -10394,11 +10394,11 @@  discard block
 block discarded – undo
10394 10394
 	
10395 10395
 	
10396 10396
 	/**
10397
-	* Counts all hours by aircraft
10398
-	*
10399
-	* @return Array the hour list
10400
-	*
10401
-	*/
10397
+	 * Counts all hours by aircraft
10398
+	 *
10399
+	 * @return Array the hour list
10400
+	 *
10401
+	 */
10402 10402
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10403 10403
 	{
10404 10404
 		global $globalTimezone, $globalDBdriver;
@@ -10441,11 +10441,11 @@  discard block
 block discarded – undo
10441 10441
 	
10442 10442
 	
10443 10443
 	/**
10444
-	* Counts all hours by aircraft registration
10445
-	*
10446
-	* @return Array the hour list
10447
-	*
10448
-	*/
10444
+	 * Counts all hours by aircraft registration
10445
+	 *
10446
+	 * @return Array the hour list
10447
+	 *
10448
+	 */
10449 10449
 	public function countAllHoursByRegistration($registration, $filters = array())
10450 10450
 	{
10451 10451
 		global $globalTimezone, $globalDBdriver;
@@ -10488,11 +10488,11 @@  discard block
 block discarded – undo
10488 10488
 	
10489 10489
 	
10490 10490
 	/**
10491
-	* Counts all hours by airport
10492
-	*
10493
-	* @return Array the hour list
10494
-	*
10495
-	*/
10491
+	 * Counts all hours by airport
10492
+	 *
10493
+	 * @return Array the hour list
10494
+	 *
10495
+	 */
10496 10496
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10497 10497
 	{
10498 10498
 		global $globalTimezone, $globalDBdriver;
@@ -10536,11 +10536,11 @@  discard block
 block discarded – undo
10536 10536
 	
10537 10537
 	
10538 10538
 	/**
10539
-	* Counts all hours by manufacturer
10540
-	*
10541
-	* @return Array the hour list
10542
-	*
10543
-	*/
10539
+	 * Counts all hours by manufacturer
10540
+	 *
10541
+	 * @return Array the hour list
10542
+	 *
10543
+	 */
10544 10544
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10545 10545
 	{
10546 10546
 		global $globalTimezone, $globalDBdriver;
@@ -10584,11 +10584,11 @@  discard block
 block discarded – undo
10584 10584
 	
10585 10585
 	
10586 10586
 	/**
10587
-	* Counts all hours by date
10588
-	*
10589
-	* @return Array the hour list
10590
-	*
10591
-	*/
10587
+	 * Counts all hours by date
10588
+	 *
10589
+	 * @return Array the hour list
10590
+	 *
10591
+	 */
10592 10592
 	public function countAllHoursByDate($date, $filters = array())
10593 10593
 	{
10594 10594
 		global $globalTimezone, $globalDBdriver;
@@ -10632,11 +10632,11 @@  discard block
 block discarded – undo
10632 10632
 	
10633 10633
 	
10634 10634
 	/**
10635
-	* Counts all hours by a ident/callsign
10636
-	*
10637
-	* @return Array the hour list
10638
-	*
10639
-	*/
10635
+	 * Counts all hours by a ident/callsign
10636
+	 *
10637
+	 * @return Array the hour list
10638
+	 *
10639
+	 */
10640 10640
 	public function countAllHoursByIdent($ident, $filters = array())
10641 10641
 	{
10642 10642
 		global $globalTimezone, $globalDBdriver;
@@ -10679,11 +10679,11 @@  discard block
 block discarded – undo
10679 10679
 	}
10680 10680
 	
10681 10681
 	/**
10682
-	* Counts all hours by a owner
10683
-	*
10684
-	* @return Array the hour list
10685
-	*
10686
-	*/
10682
+	 * Counts all hours by a owner
10683
+	 *
10684
+	 * @return Array the hour list
10685
+	 *
10686
+	 */
10687 10687
 	public function countAllHoursByOwner($owner, $filters = array())
10688 10688
 	{
10689 10689
 		global $globalTimezone, $globalDBdriver;
@@ -10726,11 +10726,11 @@  discard block
 block discarded – undo
10726 10726
 	}
10727 10727
 	
10728 10728
 	/**
10729
-	* Counts all hours by a pilot
10730
-	*
10731
-	* @return Array the hour list
10732
-	*
10733
-	*/
10729
+	 * Counts all hours by a pilot
10730
+	 *
10731
+	 * @return Array the hour list
10732
+	 *
10733
+	 */
10734 10734
 	public function countAllHoursByPilot($pilot, $filters = array())
10735 10735
 	{
10736 10736
 		global $globalTimezone, $globalDBdriver;
@@ -10775,11 +10775,11 @@  discard block
 block discarded – undo
10775 10775
 	
10776 10776
 	
10777 10777
 	/**
10778
-	* Counts all hours by route
10779
-	*
10780
-	* @return Array the hour list
10781
-	*
10782
-	*/
10778
+	 * Counts all hours by route
10779
+	 *
10780
+	 * @return Array the hour list
10781
+	 *
10782
+	 */
10783 10783
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10784 10784
 	{
10785 10785
 		global $globalTimezone, $globalDBdriver;
@@ -10823,11 +10823,11 @@  discard block
 block discarded – undo
10823 10823
 	
10824 10824
 	
10825 10825
 	/**
10826
-	* Counts all hours by country
10827
-	*
10828
-	* @return Array the hour list
10829
-	*
10830
-	*/
10826
+	 * Counts all hours by country
10827
+	 *
10828
+	 * @return Array the hour list
10829
+	 *
10830
+	 */
10831 10831
 	public function countAllHoursByCountry($country, $filters = array())
10832 10832
 	{
10833 10833
 		global $globalTimezone, $globalDBdriver;
@@ -10872,11 +10872,11 @@  discard block
 block discarded – undo
10872 10872
 
10873 10873
 
10874 10874
 	/**
10875
-	* Counts all aircraft that have flown over
10876
-	*
10877
-	* @return Integer the number of aircrafts
10878
-	*
10879
-	*/
10875
+	 * Counts all aircraft that have flown over
10876
+	 *
10877
+	 * @return Integer the number of aircrafts
10878
+	 *
10879
+	 */
10880 10880
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10881 10881
 	{
10882 10882
 		global $globalDBdriver;
@@ -10909,11 +10909,11 @@  discard block
 block discarded – undo
10909 10909
 	}
10910 10910
 
10911 10911
 	/**
10912
-	* Counts all flight that really arrival
10913
-	*
10914
-	* @return Integer the number of aircrafts
10915
-	*
10916
-	*/
10912
+	 * Counts all flight that really arrival
10913
+	 *
10914
+	 * @return Integer the number of aircrafts
10915
+	 *
10916
+	 */
10917 10917
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10918 10918
 	{
10919 10919
 		global $globalDBdriver;
@@ -10946,11 +10946,11 @@  discard block
 block discarded – undo
10946 10946
 	}
10947 10947
 
10948 10948
 	/**
10949
-	* Counts all pilots that have flown over
10950
-	*
10951
-	* @return Integer the number of pilots
10952
-	*
10953
-	*/
10949
+	 * Counts all pilots that have flown over
10950
+	 *
10951
+	 * @return Integer the number of pilots
10952
+	 *
10953
+	 */
10954 10954
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10955 10955
 	{
10956 10956
 		global $globalDBdriver;
@@ -10982,11 +10982,11 @@  discard block
 block discarded – undo
10982 10982
 	}
10983 10983
 
10984 10984
 	/**
10985
-	* Counts all owners that have flown over
10986
-	*
10987
-	* @return Integer the number of owners
10988
-	*
10989
-	*/
10985
+	 * Counts all owners that have flown over
10986
+	 *
10987
+	 * @return Integer the number of owners
10988
+	 *
10989
+	 */
10990 10990
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10991 10991
 	{
10992 10992
 		global $globalDBdriver;
@@ -11019,11 +11019,11 @@  discard block
 block discarded – undo
11019 11019
 	
11020 11020
 	
11021 11021
 	/**
11022
-	* Counts all flights that have flown over
11023
-	*
11024
-	* @return Integer the number of flights
11025
-	*
11026
-	*/
11022
+	 * Counts all flights that have flown over
11023
+	 *
11024
+	 * @return Integer the number of flights
11025
+	 *
11026
+	 */
11027 11027
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
11028 11028
 	{
11029 11029
 		global $globalDBdriver;
@@ -11057,11 +11057,11 @@  discard block
 block discarded – undo
11057 11057
 	}
11058 11058
 	
11059 11059
 	/**
11060
-	* Counts all military flights that have flown over
11061
-	*
11062
-	* @return Integer the number of flights
11063
-	*
11064
-	*/
11060
+	 * Counts all military flights that have flown over
11061
+	 *
11062
+	 * @return Integer the number of flights
11063
+	 *
11064
+	 */
11065 11065
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11066 11066
 	{
11067 11067
 		global $globalDBdriver;
@@ -11096,11 +11096,11 @@  discard block
 block discarded – undo
11096 11096
 	
11097 11097
 	
11098 11098
 	/**
11099
-	* Counts all airlines that have flown over
11100
-	*
11101
-	* @return Integer the number of airlines
11102
-	*
11103
-	*/
11099
+	 * Counts all airlines that have flown over
11100
+	 *
11101
+	 * @return Integer the number of airlines
11102
+	 *
11103
+	 */
11104 11104
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11105 11105
 	{
11106 11106
 		global $globalDBdriver;
@@ -11127,8 +11127,8 @@  discard block
 block discarded – undo
11127 11127
 				$query_values = array_merge($query_values,array(':month' => $month));
11128 11128
 			}
11129 11129
 		}
11130
-                if ($query == '') $queryi .= $this->getFilter($filters);
11131
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11130
+				if ($query == '') $queryi .= $this->getFilter($filters);
11131
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11132 11132
 
11133 11133
 
11134 11134
 		$sth = $this->db->prepare($queryi);
@@ -11138,11 +11138,11 @@  discard block
 block discarded – undo
11138 11138
 
11139 11139
   
11140 11140
 	/**
11141
-	* Counts all hours of today
11142
-	*
11143
-	* @return Array the hour list
11144
-	*
11145
-	*/
11141
+	 * Counts all hours of today
11142
+	 *
11143
+	 * @return Array the hour list
11144
+	 *
11145
+	 */
11146 11146
 	public function countAllHoursFromToday($filters = array())
11147 11147
 	{
11148 11148
 		global $globalTimezone, $globalDBdriver;
@@ -11182,11 +11182,11 @@  discard block
 block discarded – undo
11182 11182
 	}
11183 11183
     
11184 11184
 	/**
11185
-	* Gets all the spotter information based on calculated upcoming flights
11186
-	*
11187
-	* @return Array the spotter information
11188
-	*
11189
-	*/
11185
+	 * Gets all the spotter information based on calculated upcoming flights
11186
+	 *
11187
+	 * @return Array the spotter information
11188
+	 *
11189
+	 */
11190 11190
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11191 11191
 	{
11192 11192
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11261,12 +11261,12 @@  discard block
 block discarded – undo
11261 11261
 	}
11262 11262
     
11263 11263
     
11264
-     /**
11265
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11266
-	*
11267
-	* @return Integer the Barrie Spotter ID
11264
+	 /**
11265
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11266
+	  *
11267
+	  * @return Integer the Barrie Spotter ID
11268 11268
 q	*
11269
-	*/
11269
+	  */
11270 11270
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11271 11271
 	{
11272 11272
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11287,13 +11287,13 @@  discard block
 block discarded – undo
11287 11287
   
11288 11288
  
11289 11289
 	/**
11290
-	* Parses a date string
11291
-	*
11292
-	* @param String $dateString the date string
11293
-	* @param String $timezone the timezone of a user
11294
-	* @return Array the time information
11295
-	*
11296
-	*/
11290
+	 * Parses a date string
11291
+	 *
11292
+	 * @param String $dateString the date string
11293
+	 * @param String $timezone the timezone of a user
11294
+	 * @return Array the time information
11295
+	 *
11296
+	 */
11297 11297
 	public function parseDateString($dateString, $timezone = '')
11298 11298
 	{
11299 11299
 		$time_array = array();
@@ -11329,12 +11329,12 @@  discard block
 block discarded – undo
11329 11329
 	
11330 11330
 	
11331 11331
 	/**
11332
-	* Parses the direction degrees to working
11333
-	*
11334
-	* @param Float $direction the direction in degrees
11335
-	* @return Array the direction information
11336
-	*
11337
-	*/
11332
+	 * Parses the direction degrees to working
11333
+	 *
11334
+	 * @param Float $direction the direction in degrees
11335
+	 * @return Array the direction information
11336
+	 *
11337
+	 */
11338 11338
 	public function parseDirection($direction = 0)
11339 11339
 	{
11340 11340
 		if ($direction == '') $direction = 0;
@@ -11413,12 +11413,12 @@  discard block
 block discarded – undo
11413 11413
 	
11414 11414
 	
11415 11415
 	/**
11416
-	* Gets the aircraft registration
11417
-	*
11418
-	* @param String $flightaware_id the flight aware id
11419
-	* @return String the aircraft registration
11420
-	*
11421
-	*/
11416
+	 * Gets the aircraft registration
11417
+	 *
11418
+	 * @param String $flightaware_id the flight aware id
11419
+	 * @return String the aircraft registration
11420
+	 *
11421
+	 */
11422 11422
 	
11423 11423
 	public function getAircraftRegistration($flightaware_id)
11424 11424
 	{
@@ -11447,12 +11447,12 @@  discard block
 block discarded – undo
11447 11447
 
11448 11448
 
11449 11449
 	/**
11450
-	* Gets the aircraft registration from ModeS
11451
-	*
11452
-	* @param String $aircraft_modes the flight ModeS in hex
11453
-	* @return String the aircraft registration
11454
-	*
11455
-	*/
11450
+	 * Gets the aircraft registration from ModeS
11451
+	 *
11452
+	 * @param String $aircraft_modes the flight ModeS in hex
11453
+	 * @return String the aircraft registration
11454
+	 *
11455
+	 */
11456 11456
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11457 11457
 	{
11458 11458
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11468,8 +11468,8 @@  discard block
 block discarded – undo
11468 11468
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11469 11469
 		$sth->closeCursor();
11470 11470
 		if (count($row) > 0) {
11471
-		    //return $row['Registration'];
11472
-		    return $row['registration'];
11471
+			//return $row['Registration'];
11472
+			return $row['registration'];
11473 11473
 		} elseif ($source_type == 'flarm') {
11474 11474
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11475 11475
 		} else return '';
@@ -11477,12 +11477,12 @@  discard block
 block discarded – undo
11477 11477
 	}
11478 11478
 
11479 11479
 	/**
11480
-	* Gets the aircraft type from ModeS
11481
-	*
11482
-	* @param String $aircraft_modes the flight ModeS in hex
11483
-	* @return String the aircraft type
11484
-	*
11485
-	*/
11480
+	 * Gets the aircraft type from ModeS
11481
+	 *
11482
+	 * @param String $aircraft_modes the flight ModeS in hex
11483
+	 * @return String the aircraft type
11484
+	 *
11485
+	 */
11486 11486
 	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11487 11487
 	{
11488 11488
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11508,12 +11508,12 @@  discard block
 block discarded – undo
11508 11508
 	}
11509 11509
 
11510 11510
 	/**
11511
-	* Gets Country from latitude/longitude
11512
-	*
11513
-	* @param Float $latitude latitute of the flight
11514
-	* @param Float $longitude longitute of the flight
11515
-	* @return String the countrie
11516
-	*/
11511
+	 * Gets Country from latitude/longitude
11512
+	 *
11513
+	 * @param Float $latitude latitute of the flight
11514
+	 * @param Float $longitude longitute of the flight
11515
+	 * @return String the countrie
11516
+	 */
11517 11517
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11518 11518
 	{
11519 11519
 		global $globalDBdriver, $globalDebug;
@@ -11550,11 +11550,11 @@  discard block
 block discarded – undo
11550 11550
 	}
11551 11551
 
11552 11552
 	/**
11553
-	* Gets Country from iso2
11554
-	*
11555
-	* @param String $iso2 ISO2 country code
11556
-	* @return String the countrie
11557
-	*/
11553
+	 * Gets Country from iso2
11554
+	 *
11555
+	 * @param String $iso2 ISO2 country code
11556
+	 * @return String the countrie
11557
+	 */
11558 11558
 	public function getCountryFromISO2($iso2)
11559 11559
 	{
11560 11560
 		global $globalDBdriver, $globalDebug;
@@ -11582,12 +11582,12 @@  discard block
 block discarded – undo
11582 11582
 	}
11583 11583
 
11584 11584
 	/**
11585
-	* converts the registration code using the country prefix
11586
-	*
11587
-	* @param String $registration the aircraft registration
11588
-	* @return String the aircraft registration
11589
-	*
11590
-	*/
11585
+	 * converts the registration code using the country prefix
11586
+	 *
11587
+	 * @param String $registration the aircraft registration
11588
+	 * @return String the aircraft registration
11589
+	 *
11590
+	 */
11591 11591
 	public function convertAircraftRegistration($registration)
11592 11592
 	{
11593 11593
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11639,12 +11639,12 @@  discard block
 block discarded – undo
11639 11639
 	}
11640 11640
 
11641 11641
 	/**
11642
-	* Country from the registration code
11643
-	*
11644
-	* @param String $registration the aircraft registration
11645
-	* @return String the country
11646
-	*
11647
-	*/
11642
+	 * Country from the registration code
11643
+	 *
11644
+	 * @param String $registration the aircraft registration
11645
+	 * @return String the country
11646
+	 *
11647
+	 */
11648 11648
 	public function countryFromAircraftRegistration($registration)
11649 11649
 	{
11650 11650
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11663,8 +11663,8 @@  discard block
 block discarded – undo
11663 11663
 				$country = $row['country'];
11664 11664
 			}
11665 11665
 		} else {
11666
-    			$registration_1 = substr($registration, 0, 1);
11667
-		        $registration_2 = substr($registration, 0, 2);
11666
+				$registration_1 = substr($registration, 0, 1);
11667
+				$registration_2 = substr($registration, 0, 2);
11668 11668
 
11669 11669
 			$country = '';
11670 11670
 			//first get the prefix based on two characters
@@ -11700,12 +11700,12 @@  discard block
 block discarded – undo
11700 11700
 	}
11701 11701
 
11702 11702
 	/**
11703
-	* Registration prefix from the registration code
11704
-	*
11705
-	* @param String $registration the aircraft registration
11706
-	* @return String the registration prefix
11707
-	*
11708
-	*/
11703
+	 * Registration prefix from the registration code
11704
+	 *
11705
+	 * @param String $registration the aircraft registration
11706
+	 * @return String the registration prefix
11707
+	 *
11708
+	 */
11709 11709
 	public function registrationPrefixFromAircraftRegistration($registration)
11710 11710
 	{
11711 11711
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11724,8 +11724,8 @@  discard block
 block discarded – undo
11724 11724
 				//$country = $row['country'];
11725 11725
 			}
11726 11726
 		} else {
11727
-    			$registration_1 = substr($registration, 0, 1);
11728
-		        $registration_2 = substr($registration, 0, 2);
11727
+				$registration_1 = substr($registration, 0, 1);
11728
+				$registration_2 = substr($registration, 0, 2);
11729 11729
 
11730 11730
 			//first get the prefix based on two characters
11731 11731
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11761,12 +11761,12 @@  discard block
 block discarded – undo
11761 11761
 
11762 11762
 
11763 11763
 	/**
11764
-	* Country from the registration code
11765
-	*
11766
-	* @param String $registration the aircraft registration
11767
-	* @return String the country
11768
-	*
11769
-	*/
11764
+	 * Country from the registration code
11765
+	 *
11766
+	 * @param String $registration the aircraft registration
11767
+	 * @return String the country
11768
+	 *
11769
+	 */
11770 11770
 	public function countryFromAircraftRegistrationCode($registration)
11771 11771
 	{
11772 11772
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11783,11 +11783,11 @@  discard block
 block discarded – undo
11783 11783
 	}
11784 11784
 	
11785 11785
 	/**
11786
-	* Set a new highlight value for a flight
11787
-	*
11788
-	* @param String $flightaware_id flightaware_id from spotter_output table
11789
-	* @param String $highlight New highlight value
11790
-	*/
11786
+	 * Set a new highlight value for a flight
11787
+	 *
11788
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11789
+	 * @param String $highlight New highlight value
11790
+	 */
11791 11791
 	public function setHighlightFlight($flightaware_id,$highlight) {
11792 11792
 		
11793 11793
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11796,12 +11796,12 @@  discard block
 block discarded – undo
11796 11796
 	}
11797 11797
 
11798 11798
 	/**
11799
-	* Set a new highlight value for a flight by Registration
11800
-	*
11801
-	* @param String $registration Registration of the aircraft
11802
-	* @param String $date Date of spotted aircraft
11803
-	* @param String $highlight New highlight value
11804
-	*/
11799
+	 * Set a new highlight value for a flight by Registration
11800
+	 *
11801
+	 * @param String $registration Registration of the aircraft
11802
+	 * @param String $date Date of spotted aircraft
11803
+	 * @param String $highlight New highlight value
11804
+	 */
11805 11805
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11806 11806
 		if ($date == '') {
11807 11807
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11815,12 +11815,12 @@  discard block
 block discarded – undo
11815 11815
 	}
11816 11816
 	
11817 11817
 	/**
11818
-	* Gets the short url from bit.ly
11819
-	*
11820
-	* @param String $url the full url
11821
-	* @return String the bit.ly url
11822
-	*
11823
-	*/
11818
+	 * Gets the short url from bit.ly
11819
+	 *
11820
+	 * @param String $url the full url
11821
+	 * @return String the bit.ly url
11822
+	 *
11823
+	 */
11824 11824
 	public function getBitlyURL($url)
11825 11825
 	{
11826 11826
 		global $globalBitlyAccessToken;
@@ -12109,11 +12109,11 @@  discard block
 block discarded – undo
12109 12109
 			$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 
12110 12110
 	                      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)) 
12111 12111
 	                      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;";
12112
-                } else {
12112
+				} else {
12113 12113
 			$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 
12114 12114
 	                      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)) 
12115 12115
 	                      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;";
12116
-    		}
12116
+			}
12117 12117
 		$sth = $this->db->prepare($query);
12118 12118
 		$sth->execute();
12119 12119
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Indentation   +402 added lines, -402 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@  discard block
 block discarded – undo
8 8
 require_once(dirname(__FILE__).'/class.Stats.php');
9 9
 require_once(dirname(__FILE__).'/class.Source.php');
10 10
 if (isset($globalServerAPRS) && $globalServerAPRS) {
11
-    require_once(dirname(__FILE__).'/class.APRS.php');
11
+	require_once(dirname(__FILE__).'/class.APRS.php');
12 12
 }
13 13
 
14 14
 class SpotterImport {
15
-    private $all_flights = array();
16
-    private $last_delete_hourly = 0;
17
-    private $last_delete = 0;
18
-    private $stats = array();
19
-    private $tmd = 0;
20
-    private $source_location = array();
21
-    public $db = null;
22
-    public $nb = 0;
23
-
24
-    public function __construct($dbc = null) {
15
+	private $all_flights = array();
16
+	private $last_delete_hourly = 0;
17
+	private $last_delete = 0;
18
+	private $stats = array();
19
+	private $tmd = 0;
20
+	private $source_location = array();
21
+	public $db = null;
22
+	public $nb = 0;
23
+
24
+	public function __construct($dbc = null) {
25 25
 	global $globalBeta, $globalServerAPRS, $APRSSpotter, $globalNoDB;
26 26
 	if (!(isset($globalNoDB) && $globalNoDB)) {
27 27
 		$Connection = new Connection($dbc);
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 		$currentdate = date('Y-m-d');
34 34
 		$sourcestat = $Stats->getStatsSource($currentdate);
35 35
 		if (!empty($sourcestat)) {
36
-		    foreach($sourcestat as $srcst) {
37
-		    	$type = $srcst['stats_type'];
36
+			foreach($sourcestat as $srcst) {
37
+				$type = $srcst['stats_type'];
38 38
 			if ($type == 'polar' || $type == 'hist') {
39
-			    $source = $srcst['source_name'];
40
-			    $data = $srcst['source_data'];
41
-			    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
42
-	    		}
43
-		    }
39
+				$source = $srcst['source_name'];
40
+				$data = $srcst['source_data'];
41
+				$this->stats[$currentdate][$source][$type] = json_decode($data,true);
42
+				}
43
+			}
44 44
 		}
45 45
 	}
46 46
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 		//$APRSSpotter->connect();
49 49
 	}
50 50
 
51
-    }
51
+	}
52 52
 
53
-    public function get_Schedule($id,$ident) {
53
+	public function get_Schedule($id,$ident) {
54 54
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
55 55
 	// Get schedule here, so it's done only one time
56 56
 	
@@ -70,42 +70,42 @@  discard block
 block discarded – undo
70 70
 	$operator = $Spotter->getOperator($ident);
71 71
 	$scheduleexist = false;
72 72
 	if ($Schedule->checkSchedule($operator) == 0) {
73
-	    $operator = $Translation->checkTranslation($ident);
74
-	    if ($Schedule->checkSchedule($operator) == 0) {
73
+		$operator = $Translation->checkTranslation($ident);
74
+		if ($Schedule->checkSchedule($operator) == 0) {
75 75
 		$schedule = $Schedule->fetchSchedule($operator);
76 76
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
77
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
78
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
79
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
80
-		    // Should also check if route schedule = route from DB
81
-		    if ($schedule['DepartureAirportIATA'] != '') {
77
+			if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
78
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
79
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
80
+			// Should also check if route schedule = route from DB
81
+			if ($schedule['DepartureAirportIATA'] != '') {
82 82
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
83
-			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
84
-			    if (trim($airport_icao) != '') {
83
+				$airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
84
+				if (trim($airport_icao) != '') {
85 85
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
86 86
 				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
87
-			    }
87
+				}
88
+			}
88 89
 			}
89
-		    }
90
-		    if ($schedule['ArrivalAirportIATA'] != '') {
90
+			if ($schedule['ArrivalAirportIATA'] != '') {
91 91
 			if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
92
-			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
93
-			    if (trim($airport_icao) != '') {
92
+				$airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
93
+				if (trim($airport_icao) != '') {
94 94
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
95 95
 				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
96
-			    }
96
+				}
97 97
 			}
98
-		    }
99
-		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
98
+			}
99
+			$Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
100 100
 		}
101
-	    } else $scheduleexist = true;
101
+		} else $scheduleexist = true;
102 102
 	} else $scheduleexist = true;
103 103
 	// close connection, at least one way will work ?
104
-       if ($scheduleexist) {
104
+	   if ($scheduleexist) {
105 105
 		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
106
-    		$sch = $Schedule->getSchedule($operator);
106
+			$sch = $Schedule->getSchedule($operator);
107 107
 		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time']));
108
-       }
108
+	   }
109 109
 	$Spotter->db = null;
110 110
 	$Schedule->db = null;
111 111
 	$Translation->db = null;
@@ -120,96 +120,96 @@  discard block
 block discarded – undo
120 120
 	}
121 121
 	  */
122 122
 	}
123
-    }
123
+	}
124 124
 
125
-    public function checkAll() {
125
+	public function checkAll() {
126 126
 	global $globalDebug, $globalNoImport;
127 127
 	if ($globalDebug) echo "Update last seen flights data...\n";
128 128
 	if (!isset($globalNoImport) || $globalNoImport === FALSE) {
129
-	    foreach ($this->all_flights as $key => $flight) {
129
+		foreach ($this->all_flights as $key => $flight) {
130 130
 		if (isset($this->all_flights[$key]['id'])) {
131
-		    //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
132
-    		    $Spotter = new Spotter($this->db);
133
-        	    $real_arrival = $this->arrival($key);
134
-        	    if (isset($this->all_flights[$key]['altitude'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
135
-        	}
136
-	    }
131
+			//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
132
+				$Spotter = new Spotter($this->db);
133
+				$real_arrival = $this->arrival($key);
134
+				if (isset($this->all_flights[$key]['altitude'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
135
+			}
136
+		}
137
+	}
137 138
 	}
138
-    }
139 139
 
140
-    public function arrival($key) {
140
+	public function arrival($key) {
141 141
 	global $globalClosestMinDist, $globalDebug;
142 142
 	if ($globalDebug) echo 'Update arrival...'."\n";
143 143
 	$Spotter = new Spotter($this->db);
144
-        $airport_icao = '';
145
-        $airport_time = '';
146
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
144
+		$airport_icao = '';
145
+		$airport_time = '';
146
+		if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
147 147
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
148
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
149
-    	    if (isset($closestAirports[0])) {
150
-        	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
151
-        	    $airport_icao = $closestAirports[0]['icao'];
152
-        	    $airport_time = $this->all_flights[$key]['datetime'];
153
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
154
-        	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
155
-        	    foreach ($closestAirports as $airport) {
156
-        		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
157
-        		    $airport_icao = $airport['icao'];
158
-        		    $airport_time = $this->all_flights[$key]['datetime'];
159
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
160
-        		    break;
161
-        		}
162
-        	    }
163
-        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
164
-        		$airport_icao = $closestAirports[0]['icao'];
165
-        		$airport_time = $this->all_flights[$key]['datetime'];
166
-        	} else {
167
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
168
-        	}
169
-    	    } else {
170
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
171
-    	    }
172
-
173
-        } else {
174
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
175
-        }
176
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
177
-    }
178
-
179
-
180
-
181
-    public function del() {
148
+		$closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
149
+			if (isset($closestAirports[0])) {
150
+			if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
151
+				$airport_icao = $closestAirports[0]['icao'];
152
+				$airport_time = $this->all_flights[$key]['datetime'];
153
+				if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
154
+			} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
155
+				foreach ($closestAirports as $airport) {
156
+				if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
157
+					$airport_icao = $airport['icao'];
158
+					$airport_time = $this->all_flights[$key]['datetime'];
159
+					if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
160
+					break;
161
+				}
162
+				}
163
+			} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
164
+				$airport_icao = $closestAirports[0]['icao'];
165
+				$airport_time = $this->all_flights[$key]['datetime'];
166
+			} else {
167
+				if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
168
+			}
169
+			} else {
170
+				if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
171
+			}
172
+
173
+		} else {
174
+			if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
175
+		}
176
+		return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
177
+	}
178
+
179
+
180
+
181
+	public function del() {
182 182
 	global $globalDebug, $globalNoImport, $globalNoDB;
183 183
 	// Delete old infos
184 184
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
185 185
 	foreach ($this->all_flights as $key => $flight) {
186
-    	    if (isset($flight['lastupdate'])) {
187
-        	if ($flight['lastupdate'] < (time()-3000)) {
188
-            	    if (isset($this->all_flights[$key]['id'])) {
189
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
186
+			if (isset($flight['lastupdate'])) {
187
+			if ($flight['lastupdate'] < (time()-3000)) {
188
+					if (isset($this->all_flights[$key]['id'])) {
189
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
190 190
 			/*
191 191
 			$SpotterLive = new SpotterLive();
192 192
             		$SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']);
193 193
 			$SpotterLive->db = null;
194 194
 			*/
195 195
 			if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
196
-            		    $real_arrival = $this->arrival($key);
197
-            		    $Spotter = new Spotter($this->db);
198
-            	    	    if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
196
+						$real_arrival = $this->arrival($key);
197
+						$Spotter = new Spotter($this->db);
198
+							if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
199 199
 				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
200 200
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
201
-			    }
201
+				}
202 202
 			// Put in archive
203 203
 //				$Spotter->db = null;
204 204
 			}
205
-            	    }
206
-            	    unset($this->all_flights[$key]);
207
-    	        }
208
-	    }
209
-        }
210
-    }
205
+					}
206
+					unset($this->all_flights[$key]);
207
+				}
208
+		}
209
+		}
210
+	}
211 211
 
212
-    public function add($line) {
212
+	public function add($line) {
213 213
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB;
214 214
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
215 215
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
@@ -234,18 +234,18 @@  discard block
 block discarded – undo
234 234
 	
235 235
 	// SBS format is CSV format
236 236
 	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
237
-	    //print_r($line);
238
-  	    if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
237
+		//print_r($line);
238
+  		if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
239 239
 
240 240
 		// Increment message number
241 241
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
242
-		    $current_date = date('Y-m-d');
243
-		    $source = $line['source_name'];
244
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
245
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
246
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
247
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
248
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
242
+			$current_date = date('Y-m-d');
243
+			$source = $line['source_name'];
244
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
245
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
246
+				$this->stats[$current_date][$source]['msg']['date'] = time();
247
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
248
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
249 249
 		}
250 250
 		
251 251
 		/*
@@ -261,49 +261,49 @@  discard block
 block discarded – undo
261 261
 		//$this->db = $dbc;
262 262
 
263 263
 		//$hex = trim($line['hex']);
264
-	        if (!isset($line['id'])) $id = trim($line['hex']);
265
-	        else $id = trim($line['id']);
264
+			if (!isset($line['id'])) $id = trim($line['hex']);
265
+			else $id = trim($line['id']);
266 266
 		
267 267
 		if (!isset($this->all_flights[$id])) {
268
-		    $this->all_flights[$id] = array();
269
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
270
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => ''));
271
-		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
272
-		    if (!isset($line['id'])) {
268
+			$this->all_flights[$id] = array();
269
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
270
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => ''));
271
+			if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
272
+			if (!isset($line['id'])) {
273 273
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
274 274
 //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
275 275
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
276 276
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
277
-		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
278
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
279
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
277
+				//else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
278
+			 } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
279
+			if ($globalAllFlights !== FALSE) $dataFound = true;
280 280
 		}
281 281
 		if (isset($line['source_type']) && $line['source_type'] != '') {
282
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
282
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
283 283
 		}
284 284
 		
285 285
 		//print_r($this->all_flights);
286 286
 		if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) {
287
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
288
-		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
287
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
288
+			//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
289 289
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
290
-		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
291
-		    if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') {
290
+			//} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
291
+			if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') {
292 292
 			$timeelapsed = microtime(true);
293 293
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
294
-			    $Spotter = new Spotter($this->db);
295
-			    if (isset($this->all_flights[$id]['source_type'])) {
294
+				$Spotter = new Spotter($this->db);
295
+				if (isset($this->all_flights[$id]['source_type'])) {
296 296
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']);
297
-			    } else {
297
+				} else {
298 298
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']));
299
-			    }
300
-			    $Spotter->db = null;
301
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
302
-			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
299
+				}
300
+				$Spotter->db = null;
301
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
302
+				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
303 303
 			}
304
-		    }
305
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
306
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
304
+			}
305
+			if ($globalAllFlights !== FALSE) $dataFound = true;
306
+			if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
307 307
 		}
308 308
 		if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') {
309 309
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 		}
330 330
 		//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
331 331
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) {
332
-		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
332
+			if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
333 333
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
334
-		    } else {
334
+			} else {
335 335
 				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
336 336
 				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
337 337
 				/*
@@ -340,43 +340,43 @@  discard block
 block discarded – undo
340 340
 				print_r($line);
341 341
 				*/
342 342
 				return '';
343
-		    }
343
+			}
344 344
 		} else {
345 345
 			date_default_timezone_set('UTC');
346 346
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
347 347
 		}
348 348
 
349 349
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
350
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
350
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
351 351
 		}
352 352
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
353
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
353
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
354 354
 		}
355 355
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
356
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
356
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
357 357
 		}
358 358
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
359
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
359
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
360 360
 		}
361 361
  
362 362
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
363
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
364
-		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
363
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
364
+			if ($this->all_flights[$id]['addedSpotter'] == 1) {
365 365
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
366
-			    $timeelapsed = microtime(true);
367
-            		    $Spotter = new Spotter($this->db);
368
-            		    $fromsource = NULL;
369
-            		    if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
370
-            		    elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
371
-			    elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
372
-			    elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
373
-			    elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
374
-            		    $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
375
-			    if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
376
-			    $Spotter->db = null;
377
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
378
-			}
379
-		    }
366
+				$timeelapsed = microtime(true);
367
+						$Spotter = new Spotter($this->db);
368
+						$fromsource = NULL;
369
+						if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
370
+						elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
371
+				elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
372
+				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
373
+				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
374
+						$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
375
+				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
376
+				$Spotter->db = null;
377
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
378
+			}
379
+			}
380 380
 
381 381
 /*
382 382
 		    if (!isset($line['id'])) {
@@ -386,104 +386,104 @@  discard block
 block discarded – undo
386 386
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
387 387
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
388 388
   */
389
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
389
+			if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
390 390
 
391
-		    //$putinarchive = true;
392
-		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
391
+			//$putinarchive = true;
392
+			if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
393 393
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
394
-		    }
395
-		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
394
+			}
395
+			if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
396 396
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
397
-		    }
398
-		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
399
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
400
-		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
397
+			}
398
+			if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
399
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
400
+			} elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
401 401
 			$timeelapsed = microtime(true);
402 402
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
403 403
 				$Spotter = new Spotter($this->db);
404 404
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
405 405
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
406
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
406
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
407 407
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
408
-                        }
409
-		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
408
+						}
409
+			} elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
410 410
 			$timeelapsed = microtime(true);
411 411
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
412
-			    $Spotter = new Spotter($this->db);
413
-			    $route = $Spotter->getRouteInfo(trim($line['ident']));
414
-			    if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) {
412
+				$Spotter = new Spotter($this->db);
413
+				$route = $Spotter->getRouteInfo(trim($line['ident']));
414
+				if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) {
415 415
 				$Translation = new Translation($this->db);
416 416
 				$ident = $Translation->checkTranslation(trim($line['ident']));
417 417
 				$route = $Spotter->getRouteInfo($ident);
418 418
 				$Translation->db = null;
419
-			    }
420
-			    $Spotter->db = null;
421
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
422
-                    	}
419
+				}
420
+				$Spotter->db = null;
421
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
422
+						}
423 423
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
424
-			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
425
-			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
424
+				//if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
425
+				if ($route['fromairport_icao'] != $route['toairport_icao']) {
426 426
 				//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
427
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
428
-		    	    }
427
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
428
+					}
429 429
 			}
430 430
 			if (!isset($globalFork)) $globalFork = TRUE;
431 431
 			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
432 432
 				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
433 433
 			}
434
-		    }
434
+			}
435 435
 		}
436 436
 
437 437
 		if (isset($line['speed']) && $line['speed'] != '') {
438 438
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
439
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
440
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
441
-		    //$dataFound = true;
439
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
440
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
441
+			//$dataFound = true;
442 442
 		} else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
443
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
444
-		    if ($distance > 1000 && $distance < 10000) {
445
-		    // use datetime
443
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
444
+			if ($distance > 1000 && $distance < 10000) {
445
+			// use datetime
446 446
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
447 447
 			$speed = $speed*3.6;
448 448
 			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
449 449
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
450
-		    }
450
+			}
451 451
 		}
452 452
 
453 453
 
454 454
 
455
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
456
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
457
-	    	    else unset($timediff);
458
-	    	    if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
455
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
456
+				if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
457
+				else unset($timediff);
458
+				if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
459 459
 			if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) {
460
-			    if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
460
+				if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
461 461
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
462 462
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
463 463
 				$this->all_flights[$id]['putinarchive'] = true;
464 464
 				$this->tmd = 0;
465 465
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
466
-				    if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
467
-				    $timeelapsed = microtime(true);
468
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
466
+					if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
467
+					$timeelapsed = microtime(true);
468
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
469 469
 					$Spotter = new Spotter($this->db);
470 470
 					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
471 471
 					if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
472 472
 					$Spotter->db = null;
473 473
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
474 474
 					if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
475
-				    }
475
+					}
476
+				}
476 477
 				}
477
-			    }
478 478
 			}
479 479
 
480 480
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
481
-			    //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
481
+				//if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
482 482
 				if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
483 483
 				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
484
-				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
485
-				    $dataFound = true;
486
-				    $this->all_flights[$id]['time_last_coord'] = time();
484
+					$this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
485
+					$dataFound = true;
486
+					$this->all_flights[$id]['time_last_coord'] = time();
487 487
 				}
488 488
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
489 489
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
@@ -494,20 +494,20 @@  discard block
 block discarded – undo
494 494
 				    //$putinarchive = true;
495 495
 				}
496 496
 				*/
497
-			    /*
497
+				/*
498 498
 			    } elseif (isset($this->all_flights[$id]['latitude'])) {
499 499
 				if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n";
500 500
 			    }
501 501
 			    */
502 502
 			}
503 503
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
504
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
505
-			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
504
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
505
+				//if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
506 506
 				if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
507 507
 				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
508
-				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
509
-				    $dataFound = true;
510
-				    $this->all_flights[$id]['time_last_coord'] = time();
508
+					$this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
509
+					$dataFound = true;
510
+					$this->all_flights[$id]['time_last_coord'] = time();
511 511
 				}
512 512
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
513 513
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
@@ -525,95 +525,95 @@  discard block
 block discarded – undo
525 525
 			    */
526 526
 			}
527 527
 
528
-		    } else if ($globalDebug && $timediff > 30) {
528
+			} else if ($globalDebug && $timediff > 30) {
529 529
 			$this->tmd = $this->tmd + 1;
530 530
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
531 531
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
532 532
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
533 533
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
534
-		    }
534
+			}
535 535
 		}
536 536
 		if (isset($line['last_update']) && $line['last_update'] != '') {
537
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
538
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
537
+			if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
538
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
539 539
 		}
540 540
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
541
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
542
-		    //$dataFound = true;
541
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
542
+			//$dataFound = true;
543 543
 		}
544 544
 		if (isset($line['format_source']) && $line['format_source'] != '') {
545
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
545
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
546 546
 		}
547 547
 		if (isset($line['source_name']) && $line['source_name'] != '') {
548
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
548
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
549 549
 		}
550 550
 		if (isset($line['emergency']) && $line['emergency'] != '') {
551
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
552
-		    //$dataFound = true;
551
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
552
+			//$dataFound = true;
553 553
 		}
554 554
 		if (isset($line['ground']) && $line['ground'] != '') {
555
-		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
555
+			if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
556 556
 			// Here we force archive of flight because after ground it's a new one (or should be)
557 557
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
558 558
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
559 559
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi')));
560
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
560
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
561 561
 			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
562
-		    }
563
-		    if ($line['ground'] != 1) $line['ground'] = 0;
564
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
565
-		    //$dataFound = true;
562
+			}
563
+			if ($line['ground'] != 1) $line['ground'] = 0;
564
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
565
+			//$dataFound = true;
566 566
 		}
567 567
 		if (isset($line['squawk']) && $line['squawk'] != '') {
568
-		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
569
-			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
570
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
571
-			    $highlight = '';
572
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
573
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
574
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
575
-			    if ($highlight != '') {
568
+			if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
569
+				if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
570
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
571
+				$highlight = '';
572
+				if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
573
+				if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
574
+				if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
575
+				if ($highlight != '') {
576 576
 				$timeelapsed = microtime(true);
577 577
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
578
-				    $Spotter = new Spotter($this->db);
579
-				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
580
-				    $Spotter->db = null;
581
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
578
+					$Spotter = new Spotter($this->db);
579
+					$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
580
+					$Spotter->db = null;
581
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
582 582
 				}
583 583
 				//$putinarchive = true;
584 584
 				//$highlight = '';
585
-			    }
585
+				}
586 586
 			    
587
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
588
-		    //$dataFound = true;
587
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
588
+			//$dataFound = true;
589 589
 		}
590 590
 
591 591
 		if (isset($line['altitude']) && $line['altitude'] != '') {
592
-		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
592
+			//if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
593 593
 			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true;
594 594
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
595 595
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
596 596
 			//$dataFound = true;
597
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
597
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
598 598
   		}
599 599
 
600 600
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
601
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
601
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
602 602
 		}
603 603
 		
604 604
 		if (isset($line['heading']) && $line['heading'] != '') {
605
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
606
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
607
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
608
-		    //$dataFound = true;
605
+			if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
606
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
607
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
608
+			//$dataFound = true;
609 609
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
610
-  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
611
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
612
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
613
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
610
+  			$heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
611
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
612
+			if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
613
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
614 614
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
615
-  		    // If not enough messages and ACARS set heading to 0
616
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
615
+  			// If not enough messages and ACARS set heading to 0
616
+  			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
617 617
   		}
618 618
 		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
619 619
 		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
@@ -624,125 +624,125 @@  discard block
 block discarded – undo
624 624
 		//if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
625 625
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
626 626
 		if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
627
-		    $this->all_flights[$id]['lastupdate'] = time();
628
-		    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
629
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
630
-			    //print_r($this->all_flights);
631
-			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
632
-			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
633
-			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
627
+			$this->all_flights[$id]['lastupdate'] = time();
628
+			if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
629
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
630
+				//print_r($this->all_flights);
631
+				//echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
632
+				//$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
633
+				if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
634 634
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
635
-				    if ($globalDebug) echo "Check if aircraft is already in DB...";
636
-				    $timeelapsed = microtime(true);
637
-				    $SpotterLive = new SpotterLive($this->db);
638
-				    if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) {
635
+					if ($globalDebug) echo "Check if aircraft is already in DB...";
636
+					$timeelapsed = microtime(true);
637
+					$SpotterLive = new SpotterLive($this->db);
638
+					if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) {
639 639
 					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
640 640
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
641
-				    } elseif (isset($line['id'])) {
641
+					} elseif (isset($line['id'])) {
642 642
 					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
643 643
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
644
-				    } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
644
+					} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
645 645
 					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
646 646
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
647
-				    } else $recent_ident = '';
648
-				    $SpotterLive->db=null;
649
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
650
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
647
+					} else $recent_ident = '';
648
+					$SpotterLive->db=null;
649
+					if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
650
+					elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
651 651
 				} else $recent_ident = '';
652
-			    } else {
652
+				} else {
653 653
 				$recent_ident = '';
654 654
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
655
-			    }
656
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
657
-			    if($recent_ident == "")
658
-			    {
655
+				}
656
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
657
+				if($recent_ident == "")
658
+				{
659 659
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
660 660
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
661 661
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
662 662
 				//adds the spotter data for the archive
663 663
 				$ignoreImport = false;
664 664
 				foreach($globalAirportIgnore as $airportIgnore) {
665
-				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
665
+					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
666 666
 					$ignoreImport = true;
667
-				    }
667
+					}
668 668
 				}
669 669
 				if (count($globalAirportAccept) > 0) {
670
-				    $ignoreImport = true;
671
-				    foreach($globalAirportIgnore as $airportIgnore) {
670
+					$ignoreImport = true;
671
+					foreach($globalAirportIgnore as $airportIgnore) {
672 672
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
673
-					    $ignoreImport = false;
673
+						$ignoreImport = false;
674
+					}
674 675
 					}
675
-				    }
676 676
 				}
677 677
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
678
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
678
+					foreach($globalAirlineIgnore as $airlineIgnore) {
679 679
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
680
-					    $ignoreImport = true;
680
+						$ignoreImport = true;
681
+					}
681 682
 					}
682
-				    }
683 683
 				}
684 684
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
685
-				    $ignoreImport = true;
686
-				    foreach($globalAirlineAccept as $airlineAccept) {
685
+					$ignoreImport = true;
686
+					foreach($globalAirlineAccept as $airlineAccept) {
687 687
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
688
-					    $ignoreImport = false;
688
+						$ignoreImport = false;
689
+					}
689 690
 					}
690
-				    }
691 691
 				}
692 692
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
693
-				    $ignoreImport = true;
694
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
693
+					$ignoreImport = true;
694
+					foreach($globalPilotIdAccept as $pilotIdAccept) {
695 695
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
696
-					    $ignoreImport = false;
696
+						$ignoreImport = false;
697
+					}
697 698
 					}
698
-				    }
699 699
 				}
700 700
 				
701 701
 				if (!$ignoreImport) {
702
-				    $highlight = '';
703
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
704
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
705
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
706
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
707
-				    $timeelapsed = microtime(true);
708
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
702
+					$highlight = '';
703
+					if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
704
+					if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
705
+					if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
706
+					if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
707
+					$timeelapsed = microtime(true);
708
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
709 709
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
710
-					    $Spotter = new Spotter($this->db);
711
-					    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
712
-					    $Spotter->db = null;
713
-					    if ($globalDebug && isset($result)) echo $result."\n";
710
+						$Spotter = new Spotter($this->db);
711
+						$result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
712
+						$Spotter->db = null;
713
+						if ($globalDebug && isset($result)) echo $result."\n";
714
+					}
714 715
 					}
715
-				    }
716
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
717
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
716
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
717
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
718 718
 
719
-				    // Add source stat in DB
720
-				    $Stats = new Stats($this->db);
721
-				    if (!empty($this->stats)) {
719
+					// Add source stat in DB
720
+					$Stats = new Stats($this->db);
721
+					if (!empty($this->stats)) {
722 722
 					if ($globalDebug) echo 'Add source stats : ';
723
-				        foreach($this->stats as $date => $data) {
724
-					    foreach($data as $source => $sourced) {
725
-					        //print_r($sourced);
726
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
727
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
728
-				    		if (isset($sourced['msg'])) {
729
-				    		    if (time() - $sourced['msg']['date'] > 10) {
730
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
731
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
732
-			    			        unset($this->stats[$date][$source]['msg']);
733
-			    			    }
734
-			    			}
735
-			    		    }
736
-			    		    if ($date != date('Y-m-d')) {
737
-			    			unset($this->stats[$date]);
738
-			    		    }
739
-				    	}
740
-				    	if ($globalDebug) echo 'Done'."\n";
741
-
742
-				    }
743
-				    $Stats->db = null;
744
-				    }
745
-				    $this->del();
723
+						foreach($this->stats as $date => $data) {
724
+						foreach($data as $source => $sourced) {
725
+							//print_r($sourced);
726
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
727
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
728
+							if (isset($sourced['msg'])) {
729
+								if (time() - $sourced['msg']['date'] > 10) {
730
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
731
+									echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
732
+									unset($this->stats[$date][$source]['msg']);
733
+								}
734
+							}
735
+							}
736
+							if ($date != date('Y-m-d')) {
737
+							unset($this->stats[$date]);
738
+							}
739
+						}
740
+						if ($globalDebug) echo 'Done'."\n";
741
+
742
+					}
743
+					$Stats->db = null;
744
+					}
745
+					$this->del();
746 746
 				} elseif ($globalDebug) echo 'Ignore data'."\n";
747 747
 				//$ignoreImport = false;
748 748
 				$this->all_flights[$id]['addedSpotter'] = 1;
@@ -760,41 +760,41 @@  discard block
 block discarded – undo
760 760
 			*/
761 761
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
762 762
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
763
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
764
-				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
765
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
763
+					if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
764
+					//SpotterLive->deleteLiveSpotterDataNotUpdated();
765
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
766 766
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
767
-					    $SpotterLive = new SpotterLive($this->db);
768
-					    $SpotterLive->deleteLiveSpotterData();
769
-					    $SpotterLive->db=null;
767
+						$SpotterLive = new SpotterLive($this->db);
768
+						$SpotterLive->deleteLiveSpotterData();
769
+						$SpotterLive->db=null;
770
+					}
770 771
 					}
771
-				    }
772
-				    if ($globalDebug) echo " Done\n";
773
-				    $this->last_delete = time();
772
+					if ($globalDebug) echo " Done\n";
773
+					$this->last_delete = time();
774 774
 				}
775
-			    } else {
775
+				} else {
776 776
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa'  || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) {
777
-				    $this->all_flights[$id]['id'] = $recent_ident;
778
-				    $this->all_flights[$id]['addedSpotter'] = 1;
777
+					$this->all_flights[$id]['id'] = $recent_ident;
778
+					$this->all_flights[$id]['addedSpotter'] = 1;
779 779
 				}
780 780
 				if (isset($globalDaemon) && !$globalDaemon) {
781
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
781
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
782 782
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
783
-					    $Spotter = new Spotter($this->db);
784
-					    $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']);
785
-					    $Spotter->db = null;
783
+						$Spotter = new Spotter($this->db);
784
+						$Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']);
785
+						$Spotter->db = null;
786
+					}
786 787
 					}
787
-				    }
788 788
 				}
789 789
 				
790
-			    }
790
+				}
791
+			}
791 792
 			}
792
-		    }
793
-		    //adds the spotter LIVE data
794
-		    //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
795
-		    //echo "\nAdd in Live !! \n";
796
-		    //echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
797
-		    if ($globalDebug) {
793
+			//adds the spotter LIVE data
794
+			//SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
795
+			//echo "\nAdd in Live !! \n";
796
+			//echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
797
+			if ($globalDebug) {
798 798
 			if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
799 799
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
800 800
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
@@ -802,60 +802,60 @@  discard block
 block discarded – undo
802 802
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
803 803
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
804 804
 			}
805
-		    }
806
-		    $ignoreImport = false;
807
-		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
808
-		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
805
+			}
806
+			$ignoreImport = false;
807
+			if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
808
+			if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
809 809
 
810
-		    foreach($globalAirportIgnore as $airportIgnore) {
811
-		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
812
-			    $ignoreImport = true;
810
+			foreach($globalAirportIgnore as $airportIgnore) {
811
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
812
+				$ignoreImport = true;
813 813
 			}
814
-		    }
815
-		    if (count($globalAirportAccept) > 0) {
816
-		        $ignoreImport = true;
817
-		        foreach($globalAirportIgnore as $airportIgnore) {
818
-			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
814
+			}
815
+			if (count($globalAirportAccept) > 0) {
816
+				$ignoreImport = true;
817
+				foreach($globalAirportIgnore as $airportIgnore) {
818
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
819 819
 				$ignoreImport = false;
820
-			    }
820
+				}
821
+			}
821 822
 			}
822
-		    }
823
-		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
823
+			if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
824 824
 			foreach($globalAirlineIgnore as $airlineIgnore) {
825
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
825
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
826 826
 				$ignoreImport = true;
827
-			    }
827
+				}
828 828
 			}
829
-		    }
830
-		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
829
+			}
830
+			if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
831 831
 			$ignoreImport = true;
832 832
 			foreach($globalAirlineAccept as $airlineAccept) {
833
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
833
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
834 834
 				$ignoreImport = false;
835
-			    }
835
+				}
836
+			}
836 837
 			}
837
-		    }
838
-		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
838
+			if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
839 839
 			$ignoreImport = true;
840 840
 			foreach($globalPilotIdAccept as $pilotIdAccept) {
841
-			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
842
-			        $ignoreImport = false;
843
-			    }
841
+				if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
842
+					$ignoreImport = false;
843
+				}
844
+			}
844 845
 			}
845
-		    }
846 846
 
847
-		    if (!$ignoreImport) {
847
+			if (!$ignoreImport) {
848 848
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
849 849
 				if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
850 850
 				$timeelapsed = microtime(true);
851 851
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
852
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
852
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
853 853
 					if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
854 854
 					$SpotterLive = new SpotterLive($this->db);
855 855
 					$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
856 856
 					$SpotterLive->db = null;
857 857
 					if ($globalDebug) echo $result."\n";
858
-				    }
858
+					}
859 859
 				}
860 860
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) {
861 861
 					$APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 				//if ($line['format_source'] != 'aprs') {
868 868
 				//if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) {
869 869
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
870
-				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
870
+					if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
871 871
 					$source = $this->all_flights[$id]['source_name'];
872 872
 					if ($source == '') $source = $this->all_flights[$id]['format_source'];
873 873
 					if (!isset($this->source_location[$source])) {
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 					if ($stats_heading == 16) $stats_heading = 0;
894 894
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
895 895
 						for ($i=0;$i<=15;$i++) {
896
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
896
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
897 897
 						}
898 898
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
899 899
 					} else {
@@ -906,17 +906,17 @@  discard block
 block discarded – undo
906 906
 					//var_dump($this->stats);
907 907
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
908 908
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
909
-						    end($this->stats[$current_date][$source]['hist']);
910
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
909
+							end($this->stats[$current_date][$source]['hist']);
910
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
911 911
 						} else $mini = 0;
912 912
 						for ($i=$mini;$i<=$distance;$i+=10) {
913
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
913
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
914 914
 						}
915 915
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
916 916
 					} else {
917 917
 						$this->stats[$current_date][$source]['hist'][$distance] += 1;
918 918
 					}
919
-				    }
919
+					}
920 920
 				}
921 921
 
922 922
 				$this->all_flights[$id]['lastupdate'] = time();
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 			//$this->del();
927 927
 			
928 928
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
929
-			    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
929
+				if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
930 930
 				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
931 931
 				$SpotterLive = new SpotterLive($this->db);
932 932
 				$SpotterLive->deleteLiveSpotterDataNotUpdated();
@@ -934,19 +934,19 @@  discard block
 block discarded – undo
934 934
 				//SpotterLive->deleteLiveSpotterData();
935 935
 				if ($globalDebug) echo " Done\n";
936 936
 				$this->last_delete_hourly = time();
937
-			    } else {
937
+				} else {
938 938
 				$this->del();
939 939
 				$this->last_delete_hourly = time();
940
-			    }
940
+				}
941 941
 			}
942 942
 			
943
-		    }
944
-		    //$ignoreImport = false;
943
+			}
944
+			//$ignoreImport = false;
945 945
 		}
946 946
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
947 947
 		if ($send) return $this->all_flights[$id];
948
-	    }
948
+		}
949
+	}
949 950
 	}
950
-    }
951 951
 }
952 952
 ?>
Please login to merge, or discard this patch.
airline-statistics-departure-airport-country.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airline'])) {
7
-        header('Location: '.$globalURL.'/airline');
8
-        die();
7
+		header('Location: '.$globalURL.'/airline');
8
+		die();
9 9
 }
10 10
 $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 	}
77 77
 	$country_data = substr($country_data, 0, -1);
78 78
 	print $country_data;
79
-        print '];';
80
-        print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
81
-        print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
82
-        print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
83
-        print 'new Datamap({
79
+		print '];';
80
+		print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
81
+		print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
82
+		print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
83
+		print 'new Datamap({
84 84
 	    element: document.getElementById("chartCountry"),
85 85
 	    projection: "mercator", // big world map
86 86
 	    fills: { defaultFill: "#F5F5F5" },
Please login to merge, or discard this patch.
airline-statistics-arrival-airport-country.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airline'])) {
7
-        header('Location: '.$globalURL.'/airline');
8
-        die();
7
+		header('Location: '.$globalURL.'/airline');
8
+		die();
9 9
 }
10 10
 $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.