Completed
Push — master ( d3c7d3...904e04 )
by Yannick
09:04 queued 42s
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);
@@ -4373,11 +4373,11 @@  discard block
 block discarded – undo
4373 4373
 	
4374 4374
 	
4375 4375
 	/**
4376
-	* Gets all airlines that have flown over by airport
4377
-	*
4378
-	* @return Array the airline list
4379
-	*
4380
-	*/
4376
+	 * Gets all airlines that have flown over by airport
4377
+	 *
4378
+	 * @return Array the airline list
4379
+	 *
4380
+	 */
4381 4381
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4382 4382
 	{
4383 4383
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4408,11 +4408,11 @@  discard block
 block discarded – undo
4408 4408
 
4409 4409
 
4410 4410
 	/**
4411
-	* Gets all airline countries that have flown over by airport icao
4412
-	*
4413
-	* @return Array the airline country list
4414
-	*
4415
-	*/
4411
+	 * Gets all airline countries that have flown over by airport icao
4412
+	 *
4413
+	 * @return Array the airline country list
4414
+	 *
4415
+	 */
4416 4416
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4417 4417
 	{
4418 4418
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4442,11 +4442,11 @@  discard block
 block discarded – undo
4442 4442
 
4443 4443
 
4444 4444
 	/**
4445
-	* Gets all airlines that have flown over by aircraft manufacturer
4446
-	*
4447
-	* @return Array the airline list
4448
-	*
4449
-	*/
4445
+	 * Gets all airlines that have flown over by aircraft manufacturer
4446
+	 *
4447
+	 * @return Array the airline list
4448
+	 *
4449
+	 */
4450 4450
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4451 4451
 	{
4452 4452
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4477,11 +4477,11 @@  discard block
 block discarded – undo
4477 4477
 
4478 4478
 
4479 4479
 	/**
4480
-	* Gets all airline countries that have flown over by aircraft manufacturer
4481
-	*
4482
-	* @return Array the airline country list
4483
-	*
4484
-	*/
4480
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4481
+	 *
4482
+	 * @return Array the airline country list
4483
+	 *
4484
+	 */
4485 4485
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4486 4486
 	{
4487 4487
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4510,11 +4510,11 @@  discard block
 block discarded – undo
4510 4510
 
4511 4511
 
4512 4512
 	/**
4513
-	* Gets all airlines that have flown over by date
4514
-	*
4515
-	* @return Array the airline list
4516
-	*
4517
-	*/
4513
+	 * Gets all airlines that have flown over by date
4514
+	 *
4515
+	 * @return Array the airline list
4516
+	 *
4517
+	 */
4518 4518
 	public function countAllAirlinesByDate($date,$filters = array())
4519 4519
 	{
4520 4520
 		global $globalTimezone, $globalDBdriver;
@@ -4558,11 +4558,11 @@  discard block
 block discarded – undo
4558 4558
 	
4559 4559
 	
4560 4560
 	/**
4561
-	* Gets all airline countries that have flown over by date
4562
-	*
4563
-	* @return Array the airline country list
4564
-	*
4565
-	*/
4561
+	 * Gets all airline countries that have flown over by date
4562
+	 *
4563
+	 * @return Array the airline country list
4564
+	 *
4565
+	 */
4566 4566
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4567 4567
 	{
4568 4568
 		global $globalTimezone, $globalDBdriver;
@@ -4605,11 +4605,11 @@  discard block
 block discarded – undo
4605 4605
 
4606 4606
 
4607 4607
 	/**
4608
-	* Gets all airlines that have flown over by ident/callsign
4609
-	*
4610
-	* @return Array the airline list
4611
-	*
4612
-	*/
4608
+	 * Gets all airlines that have flown over by ident/callsign
4609
+	 *
4610
+	 * @return Array the airline list
4611
+	 *
4612
+	 */
4613 4613
 	public function countAllAirlinesByIdent($ident,$filters = array())
4614 4614
 	{
4615 4615
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4626,11 +4626,11 @@  discard block
 block discarded – undo
4626 4626
 	}
4627 4627
 
4628 4628
 	/**
4629
-	* Gets all airlines by owner
4630
-	*
4631
-	* @return Array the airline list
4632
-	*
4633
-	*/
4629
+	 * Gets all airlines by owner
4630
+	 *
4631
+	 * @return Array the airline list
4632
+	 *
4633
+	 */
4634 4634
 	public function countAllAirlinesByOwner($owner,$filters = array())
4635 4635
 	{
4636 4636
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4647,11 +4647,11 @@  discard block
 block discarded – undo
4647 4647
 	}
4648 4648
 
4649 4649
 	/**
4650
-	* Gets flight duration by owner
4651
-	*
4652
-	* @return String Duration of all flights
4653
-	*
4654
-	*/
4650
+	 * Gets flight duration by owner
4651
+	 *
4652
+	 * @return String Duration of all flights
4653
+	 *
4654
+	 */
4655 4655
 	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4656 4656
 	{
4657 4657
 		global $globalDBdriver;
@@ -4698,11 +4698,11 @@  discard block
 block discarded – undo
4698 4698
 	}
4699 4699
 
4700 4700
 	/**
4701
-	* Count flights by owner
4702
-	*
4703
-	* @return String Duration of all flights
4704
-	*
4705
-	*/
4701
+	 * Count flights by owner
4702
+	 *
4703
+	 * @return String Duration of all flights
4704
+	 *
4705
+	 */
4706 4706
 	public function countFlightsByOwner($owner,$filters = array())
4707 4707
 	{
4708 4708
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4718,11 +4718,11 @@  discard block
 block discarded – undo
4718 4718
 	}
4719 4719
 
4720 4720
 	/**
4721
-	* Count flights by pilot
4722
-	*
4723
-	* @return String Duration of all flights
4724
-	*
4725
-	*/
4721
+	 * Count flights by pilot
4722
+	 *
4723
+	 * @return String Duration of all flights
4724
+	 *
4725
+	 */
4726 4726
 	public function countFlightsByPilot($pilot,$filters = array())
4727 4727
 	{
4728 4728
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4738,11 +4738,11 @@  discard block
 block discarded – undo
4738 4738
 	}
4739 4739
 
4740 4740
 	/**
4741
-	* Gets flight duration by pilot
4742
-	*
4743
-	* @return String Duration of all flights
4744
-	*
4745
-	*/
4741
+	 * Gets flight duration by pilot
4742
+	 *
4743
+	 * @return String Duration of all flights
4744
+	 *
4745
+	 */
4746 4746
 	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4747 4747
 	{
4748 4748
 		global $globalDBdriver;
@@ -4788,11 +4788,11 @@  discard block
 block discarded – undo
4788 4788
 	}
4789 4789
 
4790 4790
 	/**
4791
-	* Gets all airlines used by pilot
4792
-	*
4793
-	* @return Array the airline list
4794
-	*
4795
-	*/
4791
+	 * Gets all airlines used by pilot
4792
+	 *
4793
+	 * @return Array the airline list
4794
+	 *
4795
+	 */
4796 4796
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4797 4797
 	{
4798 4798
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4809,11 +4809,11 @@  discard block
 block discarded – undo
4809 4809
 	}
4810 4810
 
4811 4811
 	/**
4812
-	* Gets all airlines that have flown over by route
4813
-	*
4814
-	* @return Array the airline list
4815
-	*
4816
-	*/
4812
+	 * Gets all airlines that have flown over by route
4813
+	 *
4814
+	 * @return Array the airline list
4815
+	 *
4816
+	 */
4817 4817
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4818 4818
 	{
4819 4819
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4845,11 +4845,11 @@  discard block
 block discarded – undo
4845 4845
 	}
4846 4846
 
4847 4847
 	/**
4848
-	* Gets all airline countries that have flown over by route
4849
-	*
4850
-	* @return Array the airline country list
4851
-	*
4852
-	*/
4848
+	 * Gets all airline countries that have flown over by route
4849
+	 *
4850
+	 * @return Array the airline country list
4851
+	 *
4852
+	 */
4853 4853
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4854 4854
 	{
4855 4855
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4881,11 +4881,11 @@  discard block
 block discarded – undo
4881 4881
 
4882 4882
 
4883 4883
 	/**
4884
-	* Gets all airlines that have flown over by country
4885
-	*
4886
-	* @return Array the airline list
4887
-	*
4888
-	*/
4884
+	 * Gets all airlines that have flown over by country
4885
+	 *
4886
+	 * @return Array the airline list
4887
+	 *
4888
+	 */
4889 4889
 	public function countAllAirlinesByCountry($country,$filters = array())
4890 4890
 	{
4891 4891
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4915,11 +4915,11 @@  discard block
 block discarded – undo
4915 4915
 
4916 4916
 
4917 4917
 	/**
4918
-	* Gets all airline countries that have flown over by country
4919
-	*
4920
-	* @return Array the airline country list
4921
-	*
4922
-	*/
4918
+	 * Gets all airline countries that have flown over by country
4919
+	 *
4920
+	 * @return Array the airline country list
4921
+	 *
4922
+	 */
4923 4923
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4924 4924
 	{
4925 4925
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4948,11 +4948,11 @@  discard block
 block discarded – undo
4948 4948
 
4949 4949
 
4950 4950
 	/**
4951
-	* Gets all airlines countries
4952
-	*
4953
-	* @return Array the airline country list
4954
-	*
4955
-	*/
4951
+	 * Gets all airlines countries
4952
+	 *
4953
+	 * @return Array the airline country list
4954
+	 *
4955
+	 */
4956 4956
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4957 4957
 	{
4958 4958
 		global $globalDBdriver;
@@ -5008,11 +5008,11 @@  discard block
 block discarded – undo
5008 5008
 	}
5009 5009
 
5010 5010
 	/**
5011
-	* Gets all number of flight over countries
5012
-	*
5013
-	* @return Array the airline country list
5014
-	*
5015
-	*/
5011
+	 * Gets all number of flight over countries
5012
+	 *
5013
+	 * @return Array the airline country list
5014
+	 *
5015
+	 */
5016 5016
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5017 5017
 	{
5018 5018
 		global $globalDBdriver;
@@ -5034,15 +5034,15 @@  discard block
 block discarded – undo
5034 5034
 		$SpotterLive = new SpotterLive();
5035 5035
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5036 5036
 		$filter_query .= ' over_country IS NOT NULL';
5037
-                if ($olderthanmonths > 0) {
5037
+				if ($olderthanmonths > 0) {
5038 5038
 			if ($globalDBdriver == 'mysql') {
5039 5039
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5040 5040
 			} else {
5041 5041
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5042 5042
 			}
5043 5043
 		}
5044
-                if ($sincedate != '') {
5045
-            		if ($globalDBdriver == 'mysql') {
5044
+				if ($sincedate != '') {
5045
+					if ($globalDBdriver == 'mysql') {
5046 5046
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5047 5047
 			} else {
5048 5048
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5072,11 +5072,11 @@  discard block
 block discarded – undo
5072 5072
 	
5073 5073
 	
5074 5074
 	/**
5075
-	* Gets all aircraft types that have flown over
5076
-	*
5077
-	* @return Array the aircraft list
5078
-	*
5079
-	*/
5075
+	 * Gets all aircraft types that have flown over
5076
+	 *
5077
+	 * @return Array the aircraft list
5078
+	 *
5079
+	 */
5080 5080
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5081 5081
 	{
5082 5082
 		global $globalDBdriver;
@@ -5146,11 +5146,11 @@  discard block
 block discarded – undo
5146 5146
 	}
5147 5147
 
5148 5148
 	/**
5149
-	* Gets all aircraft types that have flown over by airline
5150
-	*
5151
-	* @return Array the aircraft list
5152
-	*
5153
-	*/
5149
+	 * Gets all aircraft types that have flown over by airline
5150
+	 *
5151
+	 * @return Array the aircraft list
5152
+	 *
5153
+	 */
5154 5154
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5155 5155
 	{
5156 5156
 		global $globalDBdriver;
@@ -5221,11 +5221,11 @@  discard block
 block discarded – undo
5221 5221
 	}
5222 5222
 
5223 5223
 	/**
5224
-	* Gets all aircraft types that have flown over by months
5225
-	*
5226
-	* @return Array the aircraft list
5227
-	*
5228
-	*/
5224
+	 * Gets all aircraft types that have flown over by months
5225
+	 *
5226
+	 * @return Array the aircraft list
5227
+	 *
5228
+	 */
5229 5229
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5230 5230
 	{
5231 5231
 		global $globalDBdriver;
@@ -5269,11 +5269,11 @@  discard block
 block discarded – undo
5269 5269
 
5270 5270
 
5271 5271
 	/**
5272
-	* Gets all aircraft registration that have flown over by aircaft icao
5273
-	*
5274
-	* @return Array the aircraft list
5275
-	*
5276
-	*/
5272
+	 * Gets all aircraft registration that have flown over by aircaft icao
5273
+	 *
5274
+	 * @return Array the aircraft list
5275
+	 *
5276
+	 */
5277 5277
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5278 5278
 	{
5279 5279
 		$Image = new Image($this->db);
@@ -5312,11 +5312,11 @@  discard block
 block discarded – undo
5312 5312
 
5313 5313
 
5314 5314
 	/**
5315
-	* Gets all aircraft types that have flown over by airline icao
5316
-	*
5317
-	* @return Array the aircraft list
5318
-	*
5319
-	*/
5315
+	 * Gets all aircraft types that have flown over by airline icao
5316
+	 *
5317
+	 * @return Array the aircraft list
5318
+	 *
5319
+	 */
5320 5320
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5321 5321
 	{
5322 5322
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5345,11 +5345,11 @@  discard block
 block discarded – undo
5345 5345
 
5346 5346
 
5347 5347
 	/**
5348
-	* Gets all aircraft registration that have flown over by airline icao
5349
-	*
5350
-	* @return Array the aircraft list
5351
-	*
5352
-	*/
5348
+	 * Gets all aircraft registration that have flown over by airline icao
5349
+	 *
5350
+	 * @return Array the aircraft list
5351
+	 *
5352
+	 */
5353 5353
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5354 5354
 	{
5355 5355
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5387,11 +5387,11 @@  discard block
 block discarded – undo
5387 5387
 
5388 5388
 
5389 5389
 	/**
5390
-	* Gets all aircraft manufacturer that have flown over by airline icao
5391
-	*
5392
-	* @return Array the aircraft list
5393
-	*
5394
-	*/
5390
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5391
+	 *
5392
+	 * @return Array the aircraft list
5393
+	 *
5394
+	 */
5395 5395
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5396 5396
 	{
5397 5397
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5419,11 +5419,11 @@  discard block
 block discarded – undo
5419 5419
 
5420 5420
 
5421 5421
 	/**
5422
-	* Gets all aircraft types that have flown over by airline icao
5423
-	*
5424
-	* @return Array the aircraft list
5425
-	*
5426
-	*/
5422
+	 * Gets all aircraft types that have flown over by airline icao
5423
+	 *
5424
+	 * @return Array the aircraft list
5425
+	 *
5426
+	 */
5427 5427
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5428 5428
 	{
5429 5429
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5452,11 +5452,11 @@  discard block
 block discarded – undo
5452 5452
 
5453 5453
 
5454 5454
 	/**
5455
-	* Gets all aircraft registration that have flown over by airport icao
5456
-	*
5457
-	* @return Array the aircraft list
5458
-	*
5459
-	*/
5455
+	 * Gets all aircraft registration that have flown over by airport icao
5456
+	 *
5457
+	 * @return Array the aircraft list
5458
+	 *
5459
+	 */
5460 5460
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5461 5461
 	{
5462 5462
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5493,11 +5493,11 @@  discard block
 block discarded – undo
5493 5493
 	
5494 5494
 	
5495 5495
 	/**
5496
-	* Gets all aircraft manufacturer that have flown over by airport icao
5497
-	*
5498
-	* @return Array the aircraft list
5499
-	*
5500
-	*/
5496
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5497
+	 *
5498
+	 * @return Array the aircraft list
5499
+	 *
5500
+	 */
5501 5501
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5502 5502
 	{
5503 5503
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5523,11 +5523,11 @@  discard block
 block discarded – undo
5523 5523
 	}
5524 5524
 
5525 5525
 	/**
5526
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5527
-	*
5528
-	* @return Array the aircraft list
5529
-	*
5530
-	*/
5526
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5527
+	 *
5528
+	 * @return Array the aircraft list
5529
+	 *
5530
+	 */
5531 5531
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5532 5532
 	{
5533 5533
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5554,11 +5554,11 @@  discard block
 block discarded – undo
5554 5554
 
5555 5555
 
5556 5556
 	/**
5557
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5558
-	*
5559
-	* @return Array the aircraft list
5560
-	*
5561
-	*/
5557
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5558
+	 *
5559
+	 * @return Array the aircraft list
5560
+	 *
5561
+	 */
5562 5562
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5563 5563
 	{
5564 5564
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5594,11 +5594,11 @@  discard block
 block discarded – undo
5594 5594
 	}
5595 5595
 
5596 5596
 	/**
5597
-	* Gets all aircraft types that have flown over by date
5598
-	*
5599
-	* @return Array the aircraft list
5600
-	*
5601
-	*/
5597
+	 * Gets all aircraft types that have flown over by date
5598
+	 *
5599
+	 * @return Array the aircraft list
5600
+	 *
5601
+	 */
5602 5602
 	public function countAllAircraftTypesByDate($date,$filters = array())
5603 5603
 	{
5604 5604
 		global $globalTimezone, $globalDBdriver;
@@ -5640,11 +5640,11 @@  discard block
 block discarded – undo
5640 5640
 
5641 5641
 
5642 5642
 	/**
5643
-	* Gets all aircraft registration that have flown over by date
5644
-	*
5645
-	* @return Array the aircraft list
5646
-	*
5647
-	*/
5643
+	 * Gets all aircraft registration that have flown over by date
5644
+	 *
5645
+	 * @return Array the aircraft list
5646
+	 *
5647
+	 */
5648 5648
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5649 5649
 	{
5650 5650
 		global $globalTimezone, $globalDBdriver;
@@ -5695,11 +5695,11 @@  discard block
 block discarded – undo
5695 5695
 
5696 5696
 
5697 5697
 	/**
5698
-	* Gets all aircraft manufacturer that have flown over by date
5699
-	*
5700
-	* @return Array the aircraft manufacturer list
5701
-	*
5702
-	*/
5698
+	 * Gets all aircraft manufacturer that have flown over by date
5699
+	 *
5700
+	 * @return Array the aircraft manufacturer list
5701
+	 *
5702
+	 */
5703 5703
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5704 5704
 	{
5705 5705
 		global $globalTimezone, $globalDBdriver;
@@ -5741,11 +5741,11 @@  discard block
 block discarded – undo
5741 5741
 
5742 5742
 
5743 5743
 	/**
5744
-	* Gets all aircraft types that have flown over by ident/callsign
5745
-	*
5746
-	* @return Array the aircraft list
5747
-	*
5748
-	*/
5744
+	 * Gets all aircraft types that have flown over by ident/callsign
5745
+	 *
5746
+	 * @return Array the aircraft list
5747
+	 *
5748
+	 */
5749 5749
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5750 5750
 	{
5751 5751
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5773,11 +5773,11 @@  discard block
 block discarded – undo
5773 5773
 	}
5774 5774
 
5775 5775
 	/**
5776
-	* Gets all aircraft types that have flown over by pilot
5777
-	*
5778
-	* @return Array the aircraft list
5779
-	*
5780
-	*/
5776
+	 * Gets all aircraft types that have flown over by pilot
5777
+	 *
5778
+	 * @return Array the aircraft list
5779
+	 *
5780
+	 */
5781 5781
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5782 5782
 	{
5783 5783
 		global $globalDBdriver;
@@ -5823,11 +5823,11 @@  discard block
 block discarded – undo
5823 5823
 	}
5824 5824
 
5825 5825
 	/**
5826
-	* Gets all aircraft types that have flown over by owner
5827
-	*
5828
-	* @return Array the aircraft list
5829
-	*
5830
-	*/
5826
+	 * Gets all aircraft types that have flown over by owner
5827
+	 *
5828
+	 * @return Array the aircraft list
5829
+	 *
5830
+	 */
5831 5831
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5832 5832
 	{
5833 5833
 		global $globalDBdriver;
@@ -5872,11 +5872,11 @@  discard block
 block discarded – undo
5872 5872
 	}
5873 5873
 
5874 5874
 	/**
5875
-	* Gets all aircraft registration that have flown over by ident/callsign
5876
-	*
5877
-	* @return Array the aircraft list
5878
-	*
5879
-	*/
5875
+	 * Gets all aircraft registration that have flown over by ident/callsign
5876
+	 *
5877
+	 * @return Array the aircraft list
5878
+	 *
5879
+	 */
5880 5880
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5881 5881
 	{
5882 5882
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5915,11 +5915,11 @@  discard block
 block discarded – undo
5915 5915
 	}
5916 5916
 
5917 5917
 	/**
5918
-	* Gets all aircraft registration that have flown over by owner
5919
-	*
5920
-	* @return Array the aircraft list
5921
-	*
5922
-	*/
5918
+	 * Gets all aircraft registration that have flown over by owner
5919
+	 *
5920
+	 * @return Array the aircraft list
5921
+	 *
5922
+	 */
5923 5923
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5924 5924
 	{
5925 5925
 		global $globalDBdriver;
@@ -5990,11 +5990,11 @@  discard block
 block discarded – undo
5990 5990
 	}
5991 5991
 
5992 5992
 	/**
5993
-	* Gets all aircraft registration that have flown over by pilot
5994
-	*
5995
-	* @return Array the aircraft list
5996
-	*
5997
-	*/
5993
+	 * Gets all aircraft registration that have flown over by pilot
5994
+	 *
5995
+	 * @return Array the aircraft list
5996
+	 *
5997
+	 */
5998 5998
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5999 5999
 	{
6000 6000
 		global $globalDBdriver;
@@ -6066,11 +6066,11 @@  discard block
 block discarded – undo
6066 6066
 
6067 6067
 
6068 6068
 	/**
6069
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6070
-	*
6071
-	* @return Array the aircraft manufacturer list
6072
-	*
6073
-	*/
6069
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6070
+	 *
6071
+	 * @return Array the aircraft manufacturer list
6072
+	 *
6073
+	 */
6074 6074
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6075 6075
 	{
6076 6076
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6095,11 +6095,11 @@  discard block
 block discarded – undo
6095 6095
 	}
6096 6096
 
6097 6097
 	/**
6098
-	* Gets all aircraft manufacturer that have flown over by owner
6099
-	*
6100
-	* @return Array the aircraft manufacturer list
6101
-	*
6102
-	*/
6098
+	 * Gets all aircraft manufacturer that have flown over by owner
6099
+	 *
6100
+	 * @return Array the aircraft manufacturer list
6101
+	 *
6102
+	 */
6103 6103
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6104 6104
 	{
6105 6105
 		global $globalDBdriver;
@@ -6147,11 +6147,11 @@  discard block
 block discarded – undo
6147 6147
 	}
6148 6148
 
6149 6149
 	/**
6150
-	* Gets all aircraft manufacturer that have flown over by pilot
6151
-	*
6152
-	* @return Array the aircraft manufacturer list
6153
-	*
6154
-	*/
6150
+	 * Gets all aircraft manufacturer that have flown over by pilot
6151
+	 *
6152
+	 * @return Array the aircraft manufacturer list
6153
+	 *
6154
+	 */
6155 6155
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6156 6156
 	{
6157 6157
 		global $globalDBdriver;
@@ -6200,11 +6200,11 @@  discard block
 block discarded – undo
6200 6200
 
6201 6201
 
6202 6202
 	/**
6203
-	* Gets all aircraft types that have flown over by route
6204
-	*
6205
-	* @return Array the aircraft list
6206
-	*
6207
-	*/
6203
+	 * Gets all aircraft types that have flown over by route
6204
+	 *
6205
+	 * @return Array the aircraft list
6206
+	 *
6207
+	 */
6208 6208
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6209 6209
 	{
6210 6210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6233,11 +6233,11 @@  discard block
 block discarded – undo
6233 6233
 	}
6234 6234
 
6235 6235
 	/**
6236
-	* Gets all aircraft registration that have flown over by route
6237
-	*
6238
-	* @return Array the aircraft list
6239
-	*
6240
-	*/
6236
+	 * Gets all aircraft registration that have flown over by route
6237
+	 *
6238
+	 * @return Array the aircraft list
6239
+	 *
6240
+	 */
6241 6241
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6242 6242
 	{
6243 6243
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6279,11 +6279,11 @@  discard block
 block discarded – undo
6279 6279
 	
6280 6280
 	
6281 6281
 	/**
6282
-	* Gets all aircraft manufacturer that have flown over by route
6283
-	*
6284
-	* @return Array the aircraft manufacturer list
6285
-	*
6286
-	*/
6282
+	 * Gets all aircraft manufacturer that have flown over by route
6283
+	 *
6284
+	 * @return Array the aircraft manufacturer list
6285
+	 *
6286
+	 */
6287 6287
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6288 6288
 	{
6289 6289
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6317,11 +6317,11 @@  discard block
 block discarded – undo
6317 6317
 	
6318 6318
 	
6319 6319
 	/**
6320
-	* Gets all aircraft types that have flown over by country
6321
-	*
6322
-	* @return Array the aircraft list
6323
-	*
6324
-	*/
6320
+	 * Gets all aircraft types that have flown over by country
6321
+	 *
6322
+	 * @return Array the aircraft list
6323
+	 *
6324
+	 */
6325 6325
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6326 6326
 	{
6327 6327
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6352,11 +6352,11 @@  discard block
 block discarded – undo
6352 6352
 
6353 6353
 
6354 6354
 	/**
6355
-	* Gets all aircraft registration that have flown over by country
6356
-	*
6357
-	* @return Array the aircraft list
6358
-	*
6359
-	*/
6355
+	 * Gets all aircraft registration that have flown over by country
6356
+	 *
6357
+	 * @return Array the aircraft list
6358
+	 *
6359
+	 */
6360 6360
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6361 6361
 	{
6362 6362
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6396,11 +6396,11 @@  discard block
 block discarded – undo
6396 6396
 	
6397 6397
 	
6398 6398
 	/**
6399
-	* Gets all aircraft manufacturer that have flown over by country
6400
-	*
6401
-	* @return Array the aircraft manufacturer list
6402
-	*
6403
-	*/
6399
+	 * Gets all aircraft manufacturer that have flown over by country
6400
+	 *
6401
+	 * @return Array the aircraft manufacturer list
6402
+	 *
6403
+	 */
6404 6404
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6405 6405
 	{
6406 6406
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6431,18 +6431,18 @@  discard block
 block discarded – undo
6431 6431
 	
6432 6432
 	
6433 6433
 	/**
6434
-	* Gets all aircraft manufacturers that have flown over
6435
-	*
6436
-	* @return Array the aircraft list
6437
-	*
6438
-	*/
6434
+	 * Gets all aircraft manufacturers that have flown over
6435
+	 *
6436
+	 * @return Array the aircraft list
6437
+	 *
6438
+	 */
6439 6439
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6440 6440
 	{
6441 6441
 		global $globalDBdriver;
6442 6442
 		$filter_query = $this->getFilter($filters,true,true);
6443 6443
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6444 6444
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6445
-                $query_values = array();
6445
+				$query_values = array();
6446 6446
 		if ($year != '') {
6447 6447
 			if ($globalDBdriver == 'mysql') {
6448 6448
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6495,11 +6495,11 @@  discard block
 block discarded – undo
6495 6495
 	
6496 6496
 	
6497 6497
 	/**
6498
-	* Gets all aircraft registrations that have flown over
6499
-	*
6500
-	* @return Array the aircraft list
6501
-	*
6502
-	*/
6498
+	 * Gets all aircraft registrations that have flown over
6499
+	 *
6500
+	 * @return Array the aircraft list
6501
+	 *
6502
+	 */
6503 6503
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6504 6504
 	{
6505 6505
 		global $globalDBdriver;
@@ -6507,15 +6507,15 @@  discard block
 block discarded – undo
6507 6507
 		$filter_query = $this->getFilter($filters,true,true);
6508 6508
 		$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    
6509 6509
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6510
-                if ($olderthanmonths > 0) {
6511
-            		if ($globalDBdriver == 'mysql') {
6510
+				if ($olderthanmonths > 0) {
6511
+					if ($globalDBdriver == 'mysql') {
6512 6512
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6513 6513
 			} else {
6514 6514
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6515 6515
 			}
6516 6516
 		}
6517
-                if ($sincedate != '') {
6518
-            		if ($globalDBdriver == 'mysql') {
6517
+				if ($sincedate != '') {
6518
+					if ($globalDBdriver == 'mysql') {
6519 6519
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6520 6520
 			} else {
6521 6521
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6580,11 +6580,11 @@  discard block
 block discarded – undo
6580 6580
 
6581 6581
 
6582 6582
 	/**
6583
-	* Gets all aircraft registrations that have flown over
6584
-	*
6585
-	* @return Array the aircraft list
6586
-	*
6587
-	*/
6583
+	 * Gets all aircraft registrations that have flown over
6584
+	 *
6585
+	 * @return Array the aircraft list
6586
+	 *
6587
+	 */
6588 6588
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6589 6589
 	{
6590 6590
 		global $globalDBdriver;
@@ -6592,15 +6592,15 @@  discard block
 block discarded – undo
6592 6592
 		$Image = new Image($this->db);
6593 6593
 		$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    
6594 6594
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6595
-                if ($olderthanmonths > 0) {
6596
-            		if ($globalDBdriver == 'mysql') {
6595
+				if ($olderthanmonths > 0) {
6596
+					if ($globalDBdriver == 'mysql') {
6597 6597
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6598 6598
 			} else {
6599 6599
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6600 6600
 			}
6601 6601
 		}
6602
-                if ($sincedate != '') {
6603
-            		if ($globalDBdriver == 'mysql') {
6602
+				if ($sincedate != '') {
6603
+					if ($globalDBdriver == 'mysql') {
6604 6604
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6605 6605
 			} else {
6606 6606
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6609,7 +6609,7 @@  discard block
 block discarded – undo
6609 6609
 
6610 6610
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6611 6611
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6612
-                $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";
6612
+				$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 6613
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6614 6614
 		
6615 6615
 		$sth = $this->db->prepare($query);
@@ -6641,26 +6641,26 @@  discard block
 block discarded – undo
6641 6641
 	
6642 6642
 	
6643 6643
 	/**
6644
-	* Gets all departure airports of the airplanes that have flown over
6645
-	*
6646
-	* @return Array the airport list
6647
-	*
6648
-	*/
6644
+	 * Gets all departure airports of the airplanes that have flown over
6645
+	 *
6646
+	 * @return Array the airport list
6647
+	 *
6648
+	 */
6649 6649
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6650 6650
 	{
6651 6651
 		global $globalDBdriver;
6652 6652
 		$filter_query = $this->getFilter($filters,true,true);
6653 6653
 		$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
6654 6654
 				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 <> ''";
6655
-                if ($olderthanmonths > 0) {
6656
-            		if ($globalDBdriver == 'mysql') {
6655
+				if ($olderthanmonths > 0) {
6656
+					if ($globalDBdriver == 'mysql') {
6657 6657
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6658 6658
 			} else {
6659 6659
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6660 6660
 			}
6661
-                }
6662
-                if ($sincedate != '') {
6663
-            		if ($globalDBdriver == 'mysql') {
6661
+				}
6662
+				if ($sincedate != '') {
6663
+					if ($globalDBdriver == 'mysql') {
6664 6664
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6665 6665
 			} else {
6666 6666
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6694,7 +6694,7 @@  discard block
 block discarded – undo
6694 6694
 				$query_values = array_merge($query_values,array(':day' => $day));
6695 6695
 			}
6696 6696
 		}
6697
-                $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
6697
+				$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 6698
 				ORDER BY airport_departure_icao_count DESC";
6699 6699
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6700 6700
 
@@ -6718,35 +6718,35 @@  discard block
 block discarded – undo
6718 6718
 	}
6719 6719
 
6720 6720
 	/**
6721
-	* Gets all departure airports of the airplanes that have flown over
6722
-	*
6723
-	* @return Array the airport list
6724
-	*
6725
-	*/
6721
+	 * Gets all departure airports of the airplanes that have flown over
6722
+	 *
6723
+	 * @return Array the airport list
6724
+	 *
6725
+	 */
6726 6726
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6727 6727
 	{
6728 6728
 		global $globalDBdriver;
6729 6729
 		$filter_query = $this->getFilter($filters,true,true);
6730 6730
 		$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 
6731 6731
 			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 <> '' ";
6732
-                if ($olderthanmonths > 0) {
6733
-            		if ($globalDBdriver == 'mysql') {
6732
+				if ($olderthanmonths > 0) {
6733
+					if ($globalDBdriver == 'mysql') {
6734 6734
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6735 6735
 			} else {
6736 6736
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6737 6737
 			}
6738
-                }
6739
-                if ($sincedate != '') {
6740
-            		if ($globalDBdriver == 'mysql') {
6738
+				}
6739
+				if ($sincedate != '') {
6740
+					if ($globalDBdriver == 'mysql') {
6741 6741
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6742 6742
 			} else {
6743 6743
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6744 6744
 			}
6745 6745
 		}
6746 6746
 
6747
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6748
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6749
-                $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
6747
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6748
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6749
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6750 6750
 				ORDER BY airport_departure_icao_count DESC";
6751 6751
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6752 6752
       
@@ -6771,26 +6771,26 @@  discard block
 block discarded – undo
6771 6771
 	}
6772 6772
 
6773 6773
 	/**
6774
-	* Gets all detected departure airports of the airplanes that have flown over
6775
-	*
6776
-	* @return Array the airport list
6777
-	*
6778
-	*/
6774
+	 * Gets all detected departure airports of the airplanes that have flown over
6775
+	 *
6776
+	 * @return Array the airport list
6777
+	 *
6778
+	 */
6779 6779
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6780 6780
 	{
6781 6781
 		global $globalDBdriver;
6782 6782
 		$filter_query = $this->getFilter($filters,true,true);
6783 6783
 		$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
6784 6784
 				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";
6785
-                if ($olderthanmonths > 0) {
6786
-            		if ($globalDBdriver == 'mysql') {
6785
+				if ($olderthanmonths > 0) {
6786
+					if ($globalDBdriver == 'mysql') {
6787 6787
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6788 6788
 			} else {
6789 6789
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6790 6790
 			}
6791
-                }
6792
-                if ($sincedate != '') {
6793
-            		if ($globalDBdriver == 'mysql') {
6791
+				}
6792
+				if ($sincedate != '') {
6793
+					if ($globalDBdriver == 'mysql') {
6794 6794
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6795 6795
 			} else {
6796 6796
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6824,10 +6824,10 @@  discard block
 block discarded – undo
6824 6824
 				$query_values = array_merge($query_values,array(':day' => $day));
6825 6825
 			}
6826 6826
 		}
6827
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6827
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6828 6828
 				ORDER BY airport_departure_icao_count DESC";
6829 6829
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6830
-    		//echo $query;
6830
+			//echo $query;
6831 6831
 		$sth = $this->db->prepare($query);
6832 6832
 		$sth->execute($query_values);
6833 6833
       
@@ -6850,35 +6850,35 @@  discard block
 block discarded – undo
6850 6850
 	}
6851 6851
 	
6852 6852
 	/**
6853
-	* Gets all detected departure airports of the airplanes that have flown over
6854
-	*
6855
-	* @return Array the airport list
6856
-	*
6857
-	*/
6853
+	 * Gets all detected departure airports of the airplanes that have flown over
6854
+	 *
6855
+	 * @return Array the airport list
6856
+	 *
6857
+	 */
6858 6858
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6859 6859
 	{
6860 6860
 		global $globalDBdriver;
6861 6861
 		$filter_query = $this->getFilter($filters,true,true);
6862 6862
 		$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
6863 6863
 				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 ";
6864
-                if ($olderthanmonths > 0) {
6865
-            		if ($globalDBdriver == 'mysql') {
6864
+				if ($olderthanmonths > 0) {
6865
+					if ($globalDBdriver == 'mysql') {
6866 6866
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6867 6867
 			} else {
6868 6868
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6869 6869
 			}
6870
-                }
6871
-                if ($sincedate != '') {
6872
-            		if ($globalDBdriver == 'mysql') {
6870
+				}
6871
+				if ($sincedate != '') {
6872
+					if ($globalDBdriver == 'mysql') {
6873 6873
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6874 6874
 			} else {
6875 6875
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6876 6876
 			}
6877 6877
 		}
6878 6878
 
6879
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6880
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6881
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6879
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6880
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6881
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6882 6882
 				ORDER BY airport_departure_icao_count DESC";
6883 6883
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6884 6884
       
@@ -6903,11 +6903,11 @@  discard block
 block discarded – undo
6903 6903
 	}	
6904 6904
 	
6905 6905
 	/**
6906
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6907
-	*
6908
-	* @return Array the airport list
6909
-	*
6910
-	*/
6906
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6907
+	 *
6908
+	 * @return Array the airport list
6909
+	 *
6910
+	 */
6911 6911
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6912 6912
 	{
6913 6913
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6941,11 +6941,11 @@  discard block
 block discarded – undo
6941 6941
 	
6942 6942
 	
6943 6943
 	/**
6944
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6945
-	*
6946
-	* @return Array the airport list
6947
-	*
6948
-	*/
6944
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6945
+	 *
6946
+	 * @return Array the airport list
6947
+	 *
6948
+	 */
6949 6949
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6950 6950
 	{
6951 6951
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6976,11 +6976,11 @@  discard block
 block discarded – undo
6976 6976
 	
6977 6977
 	
6978 6978
 	/**
6979
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6980
-	*
6981
-	* @return Array the airport list
6982
-	*
6983
-	*/
6979
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6980
+	 *
6981
+	 * @return Array the airport list
6982
+	 *
6983
+	 */
6984 6984
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6985 6985
 	{
6986 6986
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7013,11 +7013,11 @@  discard block
 block discarded – undo
7013 7013
 	
7014 7014
 	
7015 7015
 	/**
7016
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7017
-	*
7018
-	* @return Array the airport list
7019
-	*
7020
-	*/
7016
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7017
+	 *
7018
+	 * @return Array the airport list
7019
+	 *
7020
+	 */
7021 7021
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7022 7022
 	{
7023 7023
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7047,11 +7047,11 @@  discard block
 block discarded – undo
7047 7047
 	
7048 7048
 	
7049 7049
 	/**
7050
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7051
-	*
7052
-	* @return Array the airport list
7053
-	*
7054
-	*/
7050
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7051
+	 *
7052
+	 * @return Array the airport list
7053
+	 *
7054
+	 */
7055 7055
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7056 7056
 	{
7057 7057
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7084,11 +7084,11 @@  discard block
 block discarded – undo
7084 7084
 	
7085 7085
 	
7086 7086
 	/**
7087
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7088
-	*
7089
-	* @return Array the airport list
7090
-	*
7091
-	*/
7087
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7088
+	 *
7089
+	 * @return Array the airport list
7090
+	 *
7091
+	 */
7092 7092
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7093 7093
 	{
7094 7094
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7118,11 +7118,11 @@  discard block
 block discarded – undo
7118 7118
 	
7119 7119
 	
7120 7120
 	/**
7121
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7122
-	*
7123
-	* @return Array the airport list
7124
-	*
7125
-	*/
7121
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7122
+	 *
7123
+	 * @return Array the airport list
7124
+	 *
7125
+	 */
7126 7126
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7127 7127
 	{
7128 7128
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7155,11 +7155,11 @@  discard block
 block discarded – undo
7155 7155
 	
7156 7156
 	
7157 7157
 	/**
7158
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7159
-	*
7160
-	* @return Array the airport list
7161
-	*
7162
-	*/
7158
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7159
+	 *
7160
+	 * @return Array the airport list
7161
+	 *
7162
+	 */
7163 7163
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7164 7164
 	{
7165 7165
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7190,11 +7190,11 @@  discard block
 block discarded – undo
7190 7190
 	
7191 7191
 	
7192 7192
 	/**
7193
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7194
-	*
7195
-	* @return Array the airport list
7196
-	*
7197
-	*/
7193
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7194
+	 *
7195
+	 * @return Array the airport list
7196
+	 *
7197
+	 */
7198 7198
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7199 7199
 	{
7200 7200
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7227,11 +7227,11 @@  discard block
 block discarded – undo
7227 7227
 	
7228 7228
 	
7229 7229
 	/**
7230
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7231
-	*
7232
-	* @return Array the airport list
7233
-	*
7234
-	*/
7230
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7231
+	 *
7232
+	 * @return Array the airport list
7233
+	 *
7234
+	 */
7235 7235
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7236 7236
 	{
7237 7237
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7261,11 +7261,11 @@  discard block
 block discarded – undo
7261 7261
 	
7262 7262
 	
7263 7263
 	/**
7264
-	* Gets all departure airports of the airplanes that have flown over based on a date
7265
-	*
7266
-	* @return Array the airport list
7267
-	*
7268
-	*/
7264
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7265
+	 *
7266
+	 * @return Array the airport list
7267
+	 *
7268
+	 */
7269 7269
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7270 7270
 	{
7271 7271
 		global $globalTimezone, $globalDBdriver;
@@ -7311,11 +7311,11 @@  discard block
 block discarded – undo
7311 7311
 	
7312 7312
 	
7313 7313
 	/**
7314
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7315
-	*
7316
-	* @return Array the airport list
7317
-	*
7318
-	*/
7314
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7315
+	 *
7316
+	 * @return Array the airport list
7317
+	 *
7318
+	 */
7319 7319
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7320 7320
 	{
7321 7321
 		global $globalTimezone, $globalDBdriver;
@@ -7358,11 +7358,11 @@  discard block
 block discarded – undo
7358 7358
 	
7359 7359
 	
7360 7360
 	/**
7361
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7362
-	*
7363
-	* @return Array the airport list
7364
-	*
7365
-	*/
7361
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7362
+	 *
7363
+	 * @return Array the airport list
7364
+	 *
7365
+	 */
7366 7366
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7367 7367
 	{
7368 7368
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7394,11 +7394,11 @@  discard block
 block discarded – undo
7394 7394
 	}
7395 7395
 	
7396 7396
 	/**
7397
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7398
-	*
7399
-	* @return Array the airport list
7400
-	*
7401
-	*/
7397
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7398
+	 *
7399
+	 * @return Array the airport list
7400
+	 *
7401
+	 */
7402 7402
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7403 7403
 	{
7404 7404
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7430,11 +7430,11 @@  discard block
 block discarded – undo
7430 7430
 	}
7431 7431
 	
7432 7432
 	/**
7433
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7434
-	*
7435
-	* @return Array the airport list
7436
-	*
7437
-	*/
7433
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7434
+	 *
7435
+	 * @return Array the airport list
7436
+	 *
7437
+	 */
7438 7438
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7439 7439
 	{
7440 7440
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7467,11 +7467,11 @@  discard block
 block discarded – undo
7467 7467
 	
7468 7468
 	
7469 7469
 	/**
7470
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7471
-	*
7472
-	* @return Array the airport list
7473
-	*
7474
-	*/
7470
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7471
+	 *
7472
+	 * @return Array the airport list
7473
+	 *
7474
+	 */
7475 7475
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7476 7476
 	{
7477 7477
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7500,11 +7500,11 @@  discard block
 block discarded – undo
7500 7500
 	}
7501 7501
 	
7502 7502
 	/**
7503
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7504
-	*
7505
-	* @return Array the airport list
7506
-	*
7507
-	*/
7503
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7504
+	 *
7505
+	 * @return Array the airport list
7506
+	 *
7507
+	 */
7508 7508
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7509 7509
 	{
7510 7510
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7520,11 +7520,11 @@  discard block
 block discarded – undo
7520 7520
 	}
7521 7521
 	
7522 7522
 	/**
7523
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7524
-	*
7525
-	* @return Array the airport list
7526
-	*
7527
-	*/
7523
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7524
+	 *
7525
+	 * @return Array the airport list
7526
+	 *
7527
+	 */
7528 7528
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7529 7529
 	{
7530 7530
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7542,11 +7542,11 @@  discard block
 block discarded – undo
7542 7542
 	
7543 7543
 	
7544 7544
 	/**
7545
-	* Gets all departure airports of the airplanes that have flown over based on a country
7546
-	*
7547
-	* @return Array the airport list
7548
-	*
7549
-	*/
7545
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7546
+	 *
7547
+	 * @return Array the airport list
7548
+	 *
7549
+	 */
7550 7550
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7551 7551
 	{
7552 7552
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7580,11 +7580,11 @@  discard block
 block discarded – undo
7580 7580
 
7581 7581
 
7582 7582
 	/**
7583
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7584
-	*
7585
-	* @return Array the airport list
7586
-	*
7587
-	*/
7583
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7584
+	 *
7585
+	 * @return Array the airport list
7586
+	 *
7587
+	 */
7588 7588
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7589 7589
 	{
7590 7590
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7614,31 +7614,31 @@  discard block
 block discarded – undo
7614 7614
 	
7615 7615
 
7616 7616
 	/**
7617
-	* Gets all arrival airports of the airplanes that have flown over
7618
-	*
7619
-	* @param Boolean $limit Limit result to 10 or not
7620
-	* @param Integer $olderthanmonths Only show result older than x months
7621
-	* @param String $sincedate Only show result since x date
7622
-	* @param Boolean $icaoaskey Show result by ICAO
7623
-	* @param Array $filters Filter used here
7624
-	* @return Array the airport list
7625
-	*
7626
-	*/
7617
+	 * Gets all arrival airports of the airplanes that have flown over
7618
+	 *
7619
+	 * @param Boolean $limit Limit result to 10 or not
7620
+	 * @param Integer $olderthanmonths Only show result older than x months
7621
+	 * @param String $sincedate Only show result since x date
7622
+	 * @param Boolean $icaoaskey Show result by ICAO
7623
+	 * @param Array $filters Filter used here
7624
+	 * @return Array the airport list
7625
+	 *
7626
+	 */
7627 7627
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7628 7628
 	{
7629 7629
 		global $globalDBdriver;
7630 7630
 		$filter_query = $this->getFilter($filters,true,true);
7631 7631
 		$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 
7632 7632
 				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 <> ''";
7633
-                if ($olderthanmonths > 0) {
7634
-            		if ($globalDBdriver == 'mysql') {
7633
+				if ($olderthanmonths > 0) {
7634
+					if ($globalDBdriver == 'mysql') {
7635 7635
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7636 7636
 			} else {
7637 7637
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7638 7638
 			}
7639 7639
 		}
7640
-                if ($sincedate != '') {
7641
-            		if ($globalDBdriver == 'mysql') {
7640
+				if ($sincedate != '') {
7641
+					if ($globalDBdriver == 'mysql') {
7642 7642
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7643 7643
 			} else {
7644 7644
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7672,7 +7672,7 @@  discard block
 block discarded – undo
7672 7672
 				$query_values = array_merge($query_values,array(':day' => $day));
7673 7673
 			}
7674 7674
 		}
7675
-                $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
+				$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
7676 7676
 					ORDER BY airport_arrival_icao_count DESC";
7677 7677
 		if ($limit) $query .= " LIMIT 10";
7678 7678
       
@@ -7703,35 +7703,35 @@  discard block
 block discarded – undo
7703 7703
 	}
7704 7704
 
7705 7705
 	/**
7706
-	* Gets all arrival airports of the airplanes that have flown over
7707
-	*
7708
-	* @return Array the airport list
7709
-	*
7710
-	*/
7706
+	 * Gets all arrival airports of the airplanes that have flown over
7707
+	 *
7708
+	 * @return Array the airport list
7709
+	 *
7710
+	 */
7711 7711
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7712 7712
 	{
7713 7713
 		global $globalDBdriver;
7714 7714
 		$filter_query = $this->getFilter($filters,true,true);
7715 7715
 		$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 
7716 7716
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7717
-                if ($olderthanmonths > 0) {
7718
-            		if ($globalDBdriver == 'mysql') {
7717
+				if ($olderthanmonths > 0) {
7718
+					if ($globalDBdriver == 'mysql') {
7719 7719
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7720 7720
 			} else {
7721 7721
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7722 7722
 			}
7723 7723
 		}
7724
-                if ($sincedate != '') {
7725
-            		if ($globalDBdriver == 'mysql') {
7724
+				if ($sincedate != '') {
7725
+					if ($globalDBdriver == 'mysql') {
7726 7726
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7727 7727
 			} else {
7728 7728
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7729 7729
 			}
7730 7730
 		}
7731 7731
 
7732
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7733
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7734
-                $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
7732
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7733
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7734
+				$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
7735 7735
 					ORDER BY airport_arrival_icao_count DESC";
7736 7736
 		if ($limit) $query .= " LIMIT 10";
7737 7737
       
@@ -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);
@@ -7972,11 +7972,11 @@  discard block
 block discarded – undo
7972 7972
 	
7973 7973
 	
7974 7974
 	/**
7975
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7976
-	*
7977
-	* @return Array the airport list
7978
-	*
7979
-	*/
7975
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7976
+	 *
7977
+	 * @return Array the airport list
7978
+	 *
7979
+	 */
7980 7980
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7981 7981
 	{
7982 7982
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8010,11 +8010,11 @@  discard block
 block discarded – undo
8010 8010
 	
8011 8011
 	
8012 8012
 	/**
8013
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8014
-	*
8015
-	* @return Array the airport list
8016
-	*
8017
-	*/
8013
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8014
+	 *
8015
+	 * @return Array the airport list
8016
+	 *
8017
+	 */
8018 8018
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8019 8019
 	{
8020 8020
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8044,11 +8044,11 @@  discard block
 block discarded – undo
8044 8044
 	
8045 8045
 	
8046 8046
 	/**
8047
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8048
-	*
8049
-	* @return Array the airport list
8050
-	*
8051
-	*/
8047
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8048
+	 *
8049
+	 * @return Array the airport list
8050
+	 *
8051
+	 */
8052 8052
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8053 8053
 	{
8054 8054
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8082,11 +8082,11 @@  discard block
 block discarded – undo
8082 8082
 	
8083 8083
 	
8084 8084
 	/**
8085
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8086
-	*
8087
-	* @return Array the airport list
8088
-	*
8089
-	*/
8085
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8086
+	 *
8087
+	 * @return Array the airport list
8088
+	 *
8089
+	 */
8090 8090
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8091 8091
 	{
8092 8092
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8117,11 +8117,11 @@  discard block
 block discarded – undo
8117 8117
 	
8118 8118
 	
8119 8119
 	/**
8120
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8121
-	*
8122
-	* @return Array the airport list
8123
-	*
8124
-	*/
8120
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8121
+	 *
8122
+	 * @return Array the airport list
8123
+	 *
8124
+	 */
8125 8125
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8126 8126
 	{
8127 8127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8154,11 +8154,11 @@  discard block
 block discarded – undo
8154 8154
 	
8155 8155
 	
8156 8156
 	/**
8157
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8158
-	*
8159
-	* @return Array the airport list
8160
-	*
8161
-	*/
8157
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8158
+	 *
8159
+	 * @return Array the airport list
8160
+	 *
8161
+	 */
8162 8162
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8163 8163
 	{
8164 8164
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8188,11 +8188,11 @@  discard block
 block discarded – undo
8188 8188
 	
8189 8189
 	
8190 8190
 	/**
8191
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8192
-	*
8193
-	* @return Array the airport list
8194
-	*
8195
-	*/
8191
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8192
+	 *
8193
+	 * @return Array the airport list
8194
+	 *
8195
+	 */
8196 8196
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8197 8197
 	{
8198 8198
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8226,11 +8226,11 @@  discard block
 block discarded – undo
8226 8226
 	
8227 8227
 	
8228 8228
 	/**
8229
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8230
-	*
8231
-	* @return Array the airport list
8232
-	*
8233
-	*/
8229
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8230
+	 *
8231
+	 * @return Array the airport list
8232
+	 *
8233
+	 */
8234 8234
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8235 8235
 	{
8236 8236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8261,11 +8261,11 @@  discard block
 block discarded – undo
8261 8261
 	
8262 8262
 	
8263 8263
 	/**
8264
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8265
-	*
8266
-	* @return Array the airport list
8267
-	*
8268
-	*/
8264
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8265
+	 *
8266
+	 * @return Array the airport list
8267
+	 *
8268
+	 */
8269 8269
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8270 8270
 	{
8271 8271
 		global $globalTimezone, $globalDBdriver;
@@ -8311,11 +8311,11 @@  discard block
 block discarded – undo
8311 8311
 	
8312 8312
 	
8313 8313
 	/**
8314
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8315
-	*
8316
-	* @return Array the airport list
8317
-	*
8318
-	*/
8314
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8315
+	 *
8316
+	 * @return Array the airport list
8317
+	 *
8318
+	 */
8319 8319
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8320 8320
 	{
8321 8321
 		global $globalTimezone, $globalDBdriver;
@@ -8358,11 +8358,11 @@  discard block
 block discarded – undo
8358 8358
 	
8359 8359
 	
8360 8360
 	/**
8361
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8362
-	*
8363
-	* @return Array the airport list
8364
-	*
8365
-	*/
8361
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8362
+	 *
8363
+	 * @return Array the airport list
8364
+	 *
8365
+	 */
8366 8366
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8367 8367
 	{
8368 8368
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8394,11 +8394,11 @@  discard block
 block discarded – undo
8394 8394
 	}
8395 8395
 	
8396 8396
 	/**
8397
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8398
-	*
8399
-	* @return Array the airport list
8400
-	*
8401
-	*/
8397
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8398
+	 *
8399
+	 * @return Array the airport list
8400
+	 *
8401
+	 */
8402 8402
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8403 8403
 	{
8404 8404
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8429,11 +8429,11 @@  discard block
 block discarded – undo
8429 8429
 	}
8430 8430
 
8431 8431
 	/**
8432
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8433
-	*
8434
-	* @return Array the airport list
8435
-	*
8436
-	*/
8432
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8433
+	 *
8434
+	 * @return Array the airport list
8435
+	 *
8436
+	 */
8437 8437
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8438 8438
 	{
8439 8439
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8464,11 +8464,11 @@  discard block
 block discarded – undo
8464 8464
 	}
8465 8465
 	
8466 8466
 	/**
8467
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8468
-	*
8469
-	* @return Array the airport list
8470
-	*
8471
-	*/
8467
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8468
+	 *
8469
+	 * @return Array the airport list
8470
+	 *
8471
+	 */
8472 8472
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8473 8473
 	{
8474 8474
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8497,11 +8497,11 @@  discard block
 block discarded – undo
8497 8497
 	}
8498 8498
 	
8499 8499
 	/**
8500
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8501
-	*
8502
-	* @return Array the airport list
8503
-	*
8504
-	*/
8500
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8501
+	 *
8502
+	 * @return Array the airport list
8503
+	 *
8504
+	 */
8505 8505
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8506 8506
 	{
8507 8507
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8517,11 +8517,11 @@  discard block
 block discarded – undo
8517 8517
 	}
8518 8518
 	
8519 8519
 	/**
8520
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8521
-	*
8522
-	* @return Array the airport list
8523
-	*
8524
-	*/
8520
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8521
+	 *
8522
+	 * @return Array the airport list
8523
+	 *
8524
+	 */
8525 8525
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8526 8526
 	{
8527 8527
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8539,11 +8539,11 @@  discard block
 block discarded – undo
8539 8539
 	
8540 8540
 	
8541 8541
 	/**
8542
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8543
-	*
8544
-	* @return Array the airport list
8545
-	*
8546
-	*/
8542
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8543
+	 *
8544
+	 * @return Array the airport list
8545
+	 *
8546
+	 */
8547 8547
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8548 8548
 	{
8549 8549
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8576,11 +8576,11 @@  discard block
 block discarded – undo
8576 8576
 	
8577 8577
 	
8578 8578
 	/**
8579
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8580
-	*
8581
-	* @return Array the airport list
8582
-	*
8583
-	*/
8579
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8580
+	 *
8581
+	 * @return Array the airport list
8582
+	 *
8583
+	 */
8584 8584
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8585 8585
 	{
8586 8586
 		global $globalDBdriver;
@@ -8612,11 +8612,11 @@  discard block
 block discarded – undo
8612 8612
 
8613 8613
 
8614 8614
 	/**
8615
-	* Counts all airport departure countries
8616
-	*
8617
-	* @return Array the airport departure list
8618
-	*
8619
-	*/
8615
+	 * Counts all airport departure countries
8616
+	 *
8617
+	 * @return Array the airport departure list
8618
+	 *
8619
+	 */
8620 8620
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8621 8621
 	{
8622 8622
 		global $globalDBdriver;
@@ -8675,11 +8675,11 @@  discard block
 block discarded – undo
8675 8675
 	
8676 8676
 	
8677 8677
 	/**
8678
-	* Counts all airport arrival countries
8679
-	*
8680
-	* @return Array the airport arrival list
8681
-	*
8682
-	*/
8678
+	 * Counts all airport arrival countries
8679
+	 *
8680
+	 * @return Array the airport arrival list
8681
+	 *
8682
+	 */
8683 8683
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8684 8684
 	{
8685 8685
 		global $globalDBdriver;
@@ -8742,11 +8742,11 @@  discard block
 block discarded – undo
8742 8742
 
8743 8743
 
8744 8744
 	/**
8745
-	* Gets all route combinations
8746
-	*
8747
-	* @return Array the route list
8748
-	*
8749
-	*/
8745
+	 * Gets all route combinations
8746
+	 *
8747
+	 * @return Array the route list
8748
+	 *
8749
+	 */
8750 8750
 	public function countAllRoutes($filters = array())
8751 8751
 	{
8752 8752
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8785,11 +8785,11 @@  discard block
 block discarded – undo
8785 8785
 	
8786 8786
 	
8787 8787
 	/**
8788
-	* Gets all route combinations based on an aircraft
8789
-	*
8790
-	* @return Array the route list
8791
-	*
8792
-	*/
8788
+	 * Gets all route combinations based on an aircraft
8789
+	 *
8790
+	 * @return Array the route list
8791
+	 *
8792
+	 */
8793 8793
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8794 8794
 	{
8795 8795
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8825,11 +8825,11 @@  discard block
 block discarded – undo
8825 8825
 	
8826 8826
 	
8827 8827
 	/**
8828
-	* Gets all route combinations based on an aircraft registration
8829
-	*
8830
-	* @return Array the route list
8831
-	*
8832
-	*/
8828
+	 * Gets all route combinations based on an aircraft registration
8829
+	 *
8830
+	 * @return Array the route list
8831
+	 *
8832
+	 */
8833 8833
 	public function countAllRoutesByRegistration($registration, $filters = array())
8834 8834
 	{
8835 8835
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8867,11 +8867,11 @@  discard block
 block discarded – undo
8867 8867
 	
8868 8868
 	
8869 8869
 	/**
8870
-	* Gets all route combinations based on an airline
8871
-	*
8872
-	* @return Array the route list
8873
-	*
8874
-	*/
8870
+	 * Gets all route combinations based on an airline
8871
+	 *
8872
+	 * @return Array the route list
8873
+	 *
8874
+	 */
8875 8875
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8876 8876
 	{
8877 8877
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8909,11 +8909,11 @@  discard block
 block discarded – undo
8909 8909
 	
8910 8910
 	
8911 8911
 	/**
8912
-	* Gets all route combinations based on an airport
8913
-	*
8914
-	* @return Array the route list
8915
-	*
8916
-	*/
8912
+	 * Gets all route combinations based on an airport
8913
+	 *
8914
+	 * @return Array the route list
8915
+	 *
8916
+	 */
8917 8917
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8918 8918
 	{
8919 8919
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8950,11 +8950,11 @@  discard block
 block discarded – undo
8950 8950
 	
8951 8951
 	
8952 8952
 	/**
8953
-	* Gets all route combinations based on an country
8954
-	*
8955
-	* @return Array the route list
8956
-	*
8957
-	*/
8953
+	 * Gets all route combinations based on an country
8954
+	 *
8955
+	 * @return Array the route list
8956
+	 *
8957
+	 */
8958 8958
 	public function countAllRoutesByCountry($country, $filters = array())
8959 8959
 	{
8960 8960
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8990,11 +8990,11 @@  discard block
 block discarded – undo
8990 8990
 
8991 8991
 
8992 8992
 	/**
8993
-	* Gets all route combinations based on an date
8994
-	*
8995
-	* @return Array the route list
8996
-	*
8997
-	*/
8993
+	 * Gets all route combinations based on an date
8994
+	 *
8995
+	 * @return Array the route list
8996
+	 *
8997
+	 */
8998 8998
 	public function countAllRoutesByDate($date, $filters = array())
8999 8999
 	{
9000 9000
 		global $globalTimezone, $globalDBdriver;
@@ -9044,11 +9044,11 @@  discard block
 block discarded – undo
9044 9044
 	
9045 9045
 	
9046 9046
 	/**
9047
-	* Gets all route combinations based on an ident/callsign
9048
-	*
9049
-	* @return Array the route list
9050
-	*
9051
-	*/
9047
+	 * Gets all route combinations based on an ident/callsign
9048
+	 *
9049
+	 * @return Array the route list
9050
+	 *
9051
+	 */
9052 9052
 	public function countAllRoutesByIdent($ident, $filters = array())
9053 9053
 	{
9054 9054
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9084,11 +9084,11 @@  discard block
 block discarded – undo
9084 9084
 	}
9085 9085
 	
9086 9086
 	/**
9087
-	* Gets all route combinations based on an owner
9088
-	*
9089
-	* @return Array the route list
9090
-	*
9091
-	*/
9087
+	 * Gets all route combinations based on an owner
9088
+	 *
9089
+	 * @return Array the route list
9090
+	 *
9091
+	 */
9092 9092
 	public function countAllRoutesByOwner($owner,$filters = array())
9093 9093
 	{
9094 9094
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9124,11 +9124,11 @@  discard block
 block discarded – undo
9124 9124
 	}
9125 9125
 	
9126 9126
 	/**
9127
-	* Gets all route combinations based on a pilot
9128
-	*
9129
-	* @return Array the route list
9130
-	*
9131
-	*/
9127
+	 * Gets all route combinations based on a pilot
9128
+	 *
9129
+	 * @return Array the route list
9130
+	 *
9131
+	 */
9132 9132
 	public function countAllRoutesByPilot($pilot,$filters = array())
9133 9133
 	{
9134 9134
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9165,11 +9165,11 @@  discard block
 block discarded – undo
9165 9165
 	
9166 9166
 	
9167 9167
 	/**
9168
-	* Gets all route combinations based on an manufacturer
9169
-	*
9170
-	* @return Array the route list
9171
-	*
9172
-	*/
9168
+	 * Gets all route combinations based on an manufacturer
9169
+	 *
9170
+	 * @return Array the route list
9171
+	 *
9172
+	 */
9173 9173
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9174 9174
 	{
9175 9175
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9207,11 +9207,11 @@  discard block
 block discarded – undo
9207 9207
 	
9208 9208
 	
9209 9209
 	/**
9210
-	* Gets all route combinations with waypoints
9211
-	*
9212
-	* @return Array the route list
9213
-	*
9214
-	*/
9210
+	 * Gets all route combinations with waypoints
9211
+	 *
9212
+	 * @return Array the route list
9213
+	 *
9214
+	 */
9215 9215
 	public function countAllRoutesWithWaypoints($filters = array())
9216 9216
 	{
9217 9217
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9248,11 +9248,11 @@  discard block
 block discarded – undo
9248 9248
 	}
9249 9249
 	
9250 9250
 	/**
9251
-	* Gets all callsigns that have flown over
9252
-	*
9253
-	* @return Array the callsign list
9254
-	*
9255
-	*/
9251
+	 * Gets all callsigns that have flown over
9252
+	 *
9253
+	 * @return Array the callsign list
9254
+	 *
9255
+	 */
9256 9256
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9257 9257
 	{
9258 9258
 		global $globalDBdriver;
@@ -9318,11 +9318,11 @@  discard block
 block discarded – undo
9318 9318
 	}
9319 9319
 
9320 9320
 	/**
9321
-	* Gets all callsigns that have flown over
9322
-	*
9323
-	* @return Array the callsign list
9324
-	*
9325
-	*/
9321
+	 * Gets all callsigns that have flown over
9322
+	 *
9323
+	 * @return Array the callsign list
9324
+	 *
9325
+	 */
9326 9326
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9327 9327
 	{
9328 9328
 		global $globalDBdriver;
@@ -9363,11 +9363,11 @@  discard block
 block discarded – undo
9363 9363
 
9364 9364
 
9365 9365
 	/**
9366
-	* Counts all dates
9367
-	*
9368
-	* @return Array the date list
9369
-	*
9370
-	*/
9366
+	 * Counts all dates
9367
+	 *
9368
+	 * @return Array the date list
9369
+	 *
9370
+	 */
9371 9371
 	public function countAllDates($filters = array())
9372 9372
 	{
9373 9373
 		global $globalTimezone, $globalDBdriver;
@@ -9412,11 +9412,11 @@  discard block
 block discarded – undo
9412 9412
 	}
9413 9413
 	
9414 9414
 	/**
9415
-	* Counts all dates
9416
-	*
9417
-	* @return Array the date list
9418
-	*
9419
-	*/
9415
+	 * Counts all dates
9416
+	 *
9417
+	 * @return Array the date list
9418
+	 *
9419
+	 */
9420 9420
 	public function countAllDatesByAirlines($filters = array())
9421 9421
 	{
9422 9422
 		global $globalTimezone, $globalDBdriver;
@@ -9461,11 +9461,11 @@  discard block
 block discarded – undo
9461 9461
 	}	
9462 9462
 	
9463 9463
 	/**
9464
-	* Counts all dates during the last 7 days
9465
-	*
9466
-	* @return Array the date list
9467
-	*
9468
-	*/
9464
+	 * Counts all dates during the last 7 days
9465
+	 *
9466
+	 * @return Array the date list
9467
+	 *
9468
+	 */
9469 9469
 	public function countAllDatesLast7Days($filters = array())
9470 9470
 	{
9471 9471
 		global $globalTimezone, $globalDBdriver;
@@ -9487,7 +9487,7 @@  discard block
 block discarded – undo
9487 9487
 			$query .= " GROUP BY date_name 
9488 9488
 								ORDER BY date_name ASC";
9489 9489
 			$query_data = array(':offset' => $offset);
9490
-    		}
9490
+			}
9491 9491
 		
9492 9492
 		$sth = $this->db->prepare($query);
9493 9493
 		$sth->execute($query_data);
@@ -9507,11 +9507,11 @@  discard block
 block discarded – undo
9507 9507
 	}
9508 9508
 
9509 9509
 	/**
9510
-	* Counts all dates during the last month
9511
-	*
9512
-	* @return Array the date list
9513
-	*
9514
-	*/
9510
+	 * Counts all dates during the last month
9511
+	 *
9512
+	 * @return Array the date list
9513
+	 *
9514
+	 */
9515 9515
 	public function countAllDatesLastMonth($filters = array())
9516 9516
 	{
9517 9517
 		global $globalTimezone, $globalDBdriver;
@@ -9533,7 +9533,7 @@  discard block
 block discarded – undo
9533 9533
 			$query .= " GROUP BY date_name 
9534 9534
 								ORDER BY date_name ASC";
9535 9535
 			$query_data = array(':offset' => $offset);
9536
-    		}
9536
+			}
9537 9537
 		
9538 9538
 		$sth = $this->db->prepare($query);
9539 9539
 		$sth->execute($query_data);
@@ -9554,11 +9554,11 @@  discard block
 block discarded – undo
9554 9554
 
9555 9555
 
9556 9556
 	/**
9557
-	* Counts all dates during the last month
9558
-	*
9559
-	* @return Array the date list
9560
-	*
9561
-	*/
9557
+	 * Counts all dates during the last month
9558
+	 *
9559
+	 * @return Array the date list
9560
+	 *
9561
+	 */
9562 9562
 	public function countAllDatesLastMonthByAirlines($filters = array())
9563 9563
 	{
9564 9564
 		global $globalTimezone, $globalDBdriver;
@@ -9581,7 +9581,7 @@  discard block
 block discarded – undo
9581 9581
 								GROUP BY spotter_output.airline_icao, date_name 
9582 9582
 								ORDER BY date_name ASC";
9583 9583
 			$query_data = array(':offset' => $offset);
9584
-    		}
9584
+			}
9585 9585
 		
9586 9586
 		$sth = $this->db->prepare($query);
9587 9587
 		$sth->execute($query_data);
@@ -9603,11 +9603,11 @@  discard block
 block discarded – undo
9603 9603
 	
9604 9604
 
9605 9605
 	/**
9606
-	* Counts all month
9607
-	*
9608
-	* @return Array the month list
9609
-	*
9610
-	*/
9606
+	 * Counts all month
9607
+	 *
9608
+	 * @return Array the month list
9609
+	 *
9610
+	 */
9611 9611
 	public function countAllMonths($filters = array())
9612 9612
 	{
9613 9613
 		global $globalTimezone, $globalDBdriver;
@@ -9649,11 +9649,11 @@  discard block
 block discarded – undo
9649 9649
 	}
9650 9650
 
9651 9651
 	/**
9652
-	* Counts all month
9653
-	*
9654
-	* @return Array the month list
9655
-	*
9656
-	*/
9652
+	 * Counts all month
9653
+	 *
9654
+	 * @return Array the month list
9655
+	 *
9656
+	 */
9657 9657
 	public function countAllMonthsByAirlines($filters = array())
9658 9658
 	{
9659 9659
 		global $globalTimezone, $globalDBdriver;
@@ -9698,11 +9698,11 @@  discard block
 block discarded – undo
9698 9698
 	}
9699 9699
 
9700 9700
 	/**
9701
-	* Counts all military month
9702
-	*
9703
-	* @return Array the month list
9704
-	*
9705
-	*/
9701
+	 * Counts all military month
9702
+	 *
9703
+	 * @return Array the month list
9704
+	 *
9705
+	 */
9706 9706
 	public function countAllMilitaryMonths($filters = array())
9707 9707
 	{
9708 9708
 		global $globalTimezone, $globalDBdriver;
@@ -9743,11 +9743,11 @@  discard block
 block discarded – undo
9743 9743
 	}
9744 9744
 	
9745 9745
 	/**
9746
-	* Counts all month owners
9747
-	*
9748
-	* @return Array the month list
9749
-	*
9750
-	*/
9746
+	 * Counts all month owners
9747
+	 *
9748
+	 * @return Array the month list
9749
+	 *
9750
+	 */
9751 9751
 	public function countAllMonthsOwners($filters = array())
9752 9752
 	{
9753 9753
 		global $globalTimezone, $globalDBdriver;
@@ -9789,11 +9789,11 @@  discard block
 block discarded – undo
9789 9789
 	}
9790 9790
 	
9791 9791
 	/**
9792
-	* Counts all month owners
9793
-	*
9794
-	* @return Array the month list
9795
-	*
9796
-	*/
9792
+	 * Counts all month owners
9793
+	 *
9794
+	 * @return Array the month list
9795
+	 *
9796
+	 */
9797 9797
 	public function countAllMonthsOwnersByAirlines($filters = array())
9798 9798
 	{
9799 9799
 		global $globalTimezone, $globalDBdriver;
@@ -9836,11 +9836,11 @@  discard block
 block discarded – undo
9836 9836
 	}
9837 9837
 
9838 9838
 	/**
9839
-	* Counts all month pilot
9840
-	*
9841
-	* @return Array the month list
9842
-	*
9843
-	*/
9839
+	 * Counts all month pilot
9840
+	 *
9841
+	 * @return Array the month list
9842
+	 *
9843
+	 */
9844 9844
 	public function countAllMonthsPilots($filters = array())
9845 9845
 	{
9846 9846
 		global $globalTimezone, $globalDBdriver;
@@ -9882,11 +9882,11 @@  discard block
 block discarded – undo
9882 9882
 	}
9883 9883
 	
9884 9884
 	/**
9885
-	* Counts all month pilot
9886
-	*
9887
-	* @return Array the month list
9888
-	*
9889
-	*/
9885
+	 * Counts all month pilot
9886
+	 *
9887
+	 * @return Array the month list
9888
+	 *
9889
+	 */
9890 9890
 	public function countAllMonthsPilotsByAirlines($filters = array())
9891 9891
 	{
9892 9892
 		global $globalTimezone, $globalDBdriver;
@@ -9929,11 +9929,11 @@  discard block
 block discarded – undo
9929 9929
 	}
9930 9930
 
9931 9931
 	/**
9932
-	* Counts all month airline
9933
-	*
9934
-	* @return Array the month list
9935
-	*
9936
-	*/
9932
+	 * Counts all month airline
9933
+	 *
9934
+	 * @return Array the month list
9935
+	 *
9936
+	 */
9937 9937
 	public function countAllMonthsAirlines($filters = array())
9938 9938
 	{
9939 9939
 		global $globalTimezone, $globalDBdriver;
@@ -9975,11 +9975,11 @@  discard block
 block discarded – undo
9975 9975
 	}
9976 9976
 	
9977 9977
 	/**
9978
-	* Counts all month aircraft
9979
-	*
9980
-	* @return Array the month list
9981
-	*
9982
-	*/
9978
+	 * Counts all month aircraft
9979
+	 *
9980
+	 * @return Array the month list
9981
+	 *
9982
+	 */
9983 9983
 	public function countAllMonthsAircrafts($filters = array())
9984 9984
 	{
9985 9985
 		global $globalTimezone, $globalDBdriver;
@@ -10022,11 +10022,11 @@  discard block
 block discarded – undo
10022 10022
 	
10023 10023
 
10024 10024
 	/**
10025
-	* Counts all month aircraft
10026
-	*
10027
-	* @return Array the month list
10028
-	*
10029
-	*/
10025
+	 * Counts all month aircraft
10026
+	 *
10027
+	 * @return Array the month list
10028
+	 *
10029
+	 */
10030 10030
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10031 10031
 	{
10032 10032
 		global $globalTimezone, $globalDBdriver;
@@ -10069,11 +10069,11 @@  discard block
 block discarded – undo
10069 10069
 	}
10070 10070
 
10071 10071
 	/**
10072
-	* Counts all month real arrival
10073
-	*
10074
-	* @return Array the month list
10075
-	*
10076
-	*/
10072
+	 * Counts all month real arrival
10073
+	 *
10074
+	 * @return Array the month list
10075
+	 *
10076
+	 */
10077 10077
 	public function countAllMonthsRealArrivals($filters = array())
10078 10078
 	{
10079 10079
 		global $globalTimezone, $globalDBdriver;
@@ -10116,11 +10116,11 @@  discard block
 block discarded – undo
10116 10116
 	
10117 10117
 
10118 10118
 	/**
10119
-	* Counts all month real arrival
10120
-	*
10121
-	* @return Array the month list
10122
-	*
10123
-	*/
10119
+	 * Counts all month real arrival
10120
+	 *
10121
+	 * @return Array the month list
10122
+	 *
10123
+	 */
10124 10124
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10125 10125
 	{
10126 10126
 		global $globalTimezone, $globalDBdriver;
@@ -10164,11 +10164,11 @@  discard block
 block discarded – undo
10164 10164
 	
10165 10165
 
10166 10166
 	/**
10167
-	* Counts all dates during the last year
10168
-	*
10169
-	* @return Array the date list
10170
-	*
10171
-	*/
10167
+	 * Counts all dates during the last year
10168
+	 *
10169
+	 * @return Array the date list
10170
+	 *
10171
+	 */
10172 10172
 	public function countAllMonthsLastYear($filters)
10173 10173
 	{
10174 10174
 		global $globalTimezone, $globalDBdriver;
@@ -10190,7 +10190,7 @@  discard block
 block discarded – undo
10190 10190
 			$query .= " GROUP BY year_name, month_name
10191 10191
 								ORDER BY year_name, month_name ASC";
10192 10192
 			$query_data = array(':offset' => $offset);
10193
-    		}
10193
+			}
10194 10194
 		
10195 10195
 		$sth = $this->db->prepare($query);
10196 10196
 		$sth->execute($query_data);
@@ -10213,11 +10213,11 @@  discard block
 block discarded – undo
10213 10213
 	
10214 10214
 	
10215 10215
 	/**
10216
-	* Counts all hours
10217
-	*
10218
-	* @return Array the hour list
10219
-	*
10220
-	*/
10216
+	 * Counts all hours
10217
+	 *
10218
+	 * @return Array the hour list
10219
+	 *
10220
+	 */
10221 10221
 	public function countAllHours($orderby,$filters = array())
10222 10222
 	{
10223 10223
 		global $globalTimezone, $globalDBdriver;
@@ -10278,11 +10278,11 @@  discard block
 block discarded – undo
10278 10278
 	}
10279 10279
 	
10280 10280
 	/**
10281
-	* Counts all hours
10282
-	*
10283
-	* @return Array the hour list
10284
-	*
10285
-	*/
10281
+	 * Counts all hours
10282
+	 *
10283
+	 * @return Array the hour list
10284
+	 *
10285
+	 */
10286 10286
 	public function countAllHoursByAirlines($orderby, $filters = array())
10287 10287
 	{
10288 10288
 		global $globalTimezone, $globalDBdriver;
@@ -10345,11 +10345,11 @@  discard block
 block discarded – undo
10345 10345
 
10346 10346
 
10347 10347
 	/**
10348
-	* Counts all hours by airline
10349
-	*
10350
-	* @return Array the hour list
10351
-	*
10352
-	*/
10348
+	 * Counts all hours by airline
10349
+	 *
10350
+	 * @return Array the hour list
10351
+	 *
10352
+	 */
10353 10353
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10354 10354
 	{
10355 10355
 		global $globalTimezone, $globalDBdriver;
@@ -10395,11 +10395,11 @@  discard block
 block discarded – undo
10395 10395
 	
10396 10396
 	
10397 10397
 	/**
10398
-	* Counts all hours by aircraft
10399
-	*
10400
-	* @return Array the hour list
10401
-	*
10402
-	*/
10398
+	 * Counts all hours by aircraft
10399
+	 *
10400
+	 * @return Array the hour list
10401
+	 *
10402
+	 */
10403 10403
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10404 10404
 	{
10405 10405
 		global $globalTimezone, $globalDBdriver;
@@ -10442,11 +10442,11 @@  discard block
 block discarded – undo
10442 10442
 	
10443 10443
 	
10444 10444
 	/**
10445
-	* Counts all hours by aircraft registration
10446
-	*
10447
-	* @return Array the hour list
10448
-	*
10449
-	*/
10445
+	 * Counts all hours by aircraft registration
10446
+	 *
10447
+	 * @return Array the hour list
10448
+	 *
10449
+	 */
10450 10450
 	public function countAllHoursByRegistration($registration, $filters = array())
10451 10451
 	{
10452 10452
 		global $globalTimezone, $globalDBdriver;
@@ -10489,11 +10489,11 @@  discard block
 block discarded – undo
10489 10489
 	
10490 10490
 	
10491 10491
 	/**
10492
-	* Counts all hours by airport
10493
-	*
10494
-	* @return Array the hour list
10495
-	*
10496
-	*/
10492
+	 * Counts all hours by airport
10493
+	 *
10494
+	 * @return Array the hour list
10495
+	 *
10496
+	 */
10497 10497
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10498 10498
 	{
10499 10499
 		global $globalTimezone, $globalDBdriver;
@@ -10537,11 +10537,11 @@  discard block
 block discarded – undo
10537 10537
 	
10538 10538
 	
10539 10539
 	/**
10540
-	* Counts all hours by manufacturer
10541
-	*
10542
-	* @return Array the hour list
10543
-	*
10544
-	*/
10540
+	 * Counts all hours by manufacturer
10541
+	 *
10542
+	 * @return Array the hour list
10543
+	 *
10544
+	 */
10545 10545
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10546 10546
 	{
10547 10547
 		global $globalTimezone, $globalDBdriver;
@@ -10585,11 +10585,11 @@  discard block
 block discarded – undo
10585 10585
 	
10586 10586
 	
10587 10587
 	/**
10588
-	* Counts all hours by date
10589
-	*
10590
-	* @return Array the hour list
10591
-	*
10592
-	*/
10588
+	 * Counts all hours by date
10589
+	 *
10590
+	 * @return Array the hour list
10591
+	 *
10592
+	 */
10593 10593
 	public function countAllHoursByDate($date, $filters = array())
10594 10594
 	{
10595 10595
 		global $globalTimezone, $globalDBdriver;
@@ -10633,11 +10633,11 @@  discard block
 block discarded – undo
10633 10633
 	
10634 10634
 	
10635 10635
 	/**
10636
-	* Counts all hours by a ident/callsign
10637
-	*
10638
-	* @return Array the hour list
10639
-	*
10640
-	*/
10636
+	 * Counts all hours by a ident/callsign
10637
+	 *
10638
+	 * @return Array the hour list
10639
+	 *
10640
+	 */
10641 10641
 	public function countAllHoursByIdent($ident, $filters = array())
10642 10642
 	{
10643 10643
 		global $globalTimezone, $globalDBdriver;
@@ -10680,11 +10680,11 @@  discard block
 block discarded – undo
10680 10680
 	}
10681 10681
 	
10682 10682
 	/**
10683
-	* Counts all hours by a owner
10684
-	*
10685
-	* @return Array the hour list
10686
-	*
10687
-	*/
10683
+	 * Counts all hours by a owner
10684
+	 *
10685
+	 * @return Array the hour list
10686
+	 *
10687
+	 */
10688 10688
 	public function countAllHoursByOwner($owner, $filters = array())
10689 10689
 	{
10690 10690
 		global $globalTimezone, $globalDBdriver;
@@ -10727,11 +10727,11 @@  discard block
 block discarded – undo
10727 10727
 	}
10728 10728
 	
10729 10729
 	/**
10730
-	* Counts all hours by a pilot
10731
-	*
10732
-	* @return Array the hour list
10733
-	*
10734
-	*/
10730
+	 * Counts all hours by a pilot
10731
+	 *
10732
+	 * @return Array the hour list
10733
+	 *
10734
+	 */
10735 10735
 	public function countAllHoursByPilot($pilot, $filters = array())
10736 10736
 	{
10737 10737
 		global $globalTimezone, $globalDBdriver;
@@ -10776,11 +10776,11 @@  discard block
 block discarded – undo
10776 10776
 	
10777 10777
 	
10778 10778
 	/**
10779
-	* Counts all hours by route
10780
-	*
10781
-	* @return Array the hour list
10782
-	*
10783
-	*/
10779
+	 * Counts all hours by route
10780
+	 *
10781
+	 * @return Array the hour list
10782
+	 *
10783
+	 */
10784 10784
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10785 10785
 	{
10786 10786
 		global $globalTimezone, $globalDBdriver;
@@ -10824,11 +10824,11 @@  discard block
 block discarded – undo
10824 10824
 	
10825 10825
 	
10826 10826
 	/**
10827
-	* Counts all hours by country
10828
-	*
10829
-	* @return Array the hour list
10830
-	*
10831
-	*/
10827
+	 * Counts all hours by country
10828
+	 *
10829
+	 * @return Array the hour list
10830
+	 *
10831
+	 */
10832 10832
 	public function countAllHoursByCountry($country, $filters = array())
10833 10833
 	{
10834 10834
 		global $globalTimezone, $globalDBdriver;
@@ -10873,11 +10873,11 @@  discard block
 block discarded – undo
10873 10873
 
10874 10874
 
10875 10875
 	/**
10876
-	* Counts all aircraft that have flown over
10877
-	*
10878
-	* @return Integer the number of aircrafts
10879
-	*
10880
-	*/
10876
+	 * Counts all aircraft that have flown over
10877
+	 *
10878
+	 * @return Integer the number of aircrafts
10879
+	 *
10880
+	 */
10881 10881
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10882 10882
 	{
10883 10883
 		global $globalDBdriver;
@@ -10910,11 +10910,11 @@  discard block
 block discarded – undo
10910 10910
 	}
10911 10911
 
10912 10912
 	/**
10913
-	* Counts all flight that really arrival
10914
-	*
10915
-	* @return Integer the number of aircrafts
10916
-	*
10917
-	*/
10913
+	 * Counts all flight that really arrival
10914
+	 *
10915
+	 * @return Integer the number of aircrafts
10916
+	 *
10917
+	 */
10918 10918
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10919 10919
 	{
10920 10920
 		global $globalDBdriver;
@@ -10947,11 +10947,11 @@  discard block
 block discarded – undo
10947 10947
 	}
10948 10948
 
10949 10949
 	/**
10950
-	* Counts all pilots that have flown over
10951
-	*
10952
-	* @return Integer the number of pilots
10953
-	*
10954
-	*/
10950
+	 * Counts all pilots that have flown over
10951
+	 *
10952
+	 * @return Integer the number of pilots
10953
+	 *
10954
+	 */
10955 10955
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10956 10956
 	{
10957 10957
 		global $globalDBdriver;
@@ -10983,11 +10983,11 @@  discard block
 block discarded – undo
10983 10983
 	}
10984 10984
 
10985 10985
 	/**
10986
-	* Counts all owners that have flown over
10987
-	*
10988
-	* @return Integer the number of owners
10989
-	*
10990
-	*/
10986
+	 * Counts all owners that have flown over
10987
+	 *
10988
+	 * @return Integer the number of owners
10989
+	 *
10990
+	 */
10991 10991
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10992 10992
 	{
10993 10993
 		global $globalDBdriver;
@@ -11020,11 +11020,11 @@  discard block
 block discarded – undo
11020 11020
 	
11021 11021
 	
11022 11022
 	/**
11023
-	* Counts all flights that have flown over
11024
-	*
11025
-	* @return Integer the number of flights
11026
-	*
11027
-	*/
11023
+	 * Counts all flights that have flown over
11024
+	 *
11025
+	 * @return Integer the number of flights
11026
+	 *
11027
+	 */
11028 11028
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
11029 11029
 	{
11030 11030
 		global $globalDBdriver;
@@ -11058,11 +11058,11 @@  discard block
 block discarded – undo
11058 11058
 	}
11059 11059
 	
11060 11060
 	/**
11061
-	* Counts all military flights that have flown over
11062
-	*
11063
-	* @return Integer the number of flights
11064
-	*
11065
-	*/
11061
+	 * Counts all military flights that have flown over
11062
+	 *
11063
+	 * @return Integer the number of flights
11064
+	 *
11065
+	 */
11066 11066
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11067 11067
 	{
11068 11068
 		global $globalDBdriver;
@@ -11097,11 +11097,11 @@  discard block
 block discarded – undo
11097 11097
 	
11098 11098
 	
11099 11099
 	/**
11100
-	* Counts all airlines that have flown over
11101
-	*
11102
-	* @return Integer the number of airlines
11103
-	*
11104
-	*/
11100
+	 * Counts all airlines that have flown over
11101
+	 *
11102
+	 * @return Integer the number of airlines
11103
+	 *
11104
+	 */
11105 11105
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11106 11106
 	{
11107 11107
 		global $globalDBdriver;
@@ -11128,8 +11128,8 @@  discard block
 block discarded – undo
11128 11128
 				$query_values = array_merge($query_values,array(':month' => $month));
11129 11129
 			}
11130 11130
 		}
11131
-                if ($query == '') $queryi .= $this->getFilter($filters);
11132
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11131
+				if ($query == '') $queryi .= $this->getFilter($filters);
11132
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11133 11133
 
11134 11134
 
11135 11135
 		$sth = $this->db->prepare($queryi);
@@ -11139,11 +11139,11 @@  discard block
 block discarded – undo
11139 11139
 
11140 11140
   
11141 11141
 	/**
11142
-	* Counts all hours of today
11143
-	*
11144
-	* @return Array the hour list
11145
-	*
11146
-	*/
11142
+	 * Counts all hours of today
11143
+	 *
11144
+	 * @return Array the hour list
11145
+	 *
11146
+	 */
11147 11147
 	public function countAllHoursFromToday($filters = array())
11148 11148
 	{
11149 11149
 		global $globalTimezone, $globalDBdriver;
@@ -11183,11 +11183,11 @@  discard block
 block discarded – undo
11183 11183
 	}
11184 11184
     
11185 11185
 	/**
11186
-	* Gets all the spotter information based on calculated upcoming flights
11187
-	*
11188
-	* @return Array the spotter information
11189
-	*
11190
-	*/
11186
+	 * Gets all the spotter information based on calculated upcoming flights
11187
+	 *
11188
+	 * @return Array the spotter information
11189
+	 *
11190
+	 */
11191 11191
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11192 11192
 	{
11193 11193
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11262,12 +11262,12 @@  discard block
 block discarded – undo
11262 11262
 	}
11263 11263
     
11264 11264
     
11265
-     /**
11266
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11267
-	*
11268
-	* @return Integer the Barrie Spotter ID
11265
+	 /**
11266
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11267
+	  *
11268
+	  * @return Integer the Barrie Spotter ID
11269 11269
 q	*
11270
-	*/
11270
+	  */
11271 11271
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11272 11272
 	{
11273 11273
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11288,13 +11288,13 @@  discard block
 block discarded – undo
11288 11288
   
11289 11289
  
11290 11290
 	/**
11291
-	* Parses a date string
11292
-	*
11293
-	* @param String $dateString the date string
11294
-	* @param String $timezone the timezone of a user
11295
-	* @return Array the time information
11296
-	*
11297
-	*/
11291
+	 * Parses a date string
11292
+	 *
11293
+	 * @param String $dateString the date string
11294
+	 * @param String $timezone the timezone of a user
11295
+	 * @return Array the time information
11296
+	 *
11297
+	 */
11298 11298
 	public function parseDateString($dateString, $timezone = '')
11299 11299
 	{
11300 11300
 		$time_array = array();
@@ -11330,12 +11330,12 @@  discard block
 block discarded – undo
11330 11330
 	
11331 11331
 	
11332 11332
 	/**
11333
-	* Parses the direction degrees to working
11334
-	*
11335
-	* @param Float $direction the direction in degrees
11336
-	* @return Array the direction information
11337
-	*
11338
-	*/
11333
+	 * Parses the direction degrees to working
11334
+	 *
11335
+	 * @param Float $direction the direction in degrees
11336
+	 * @return Array the direction information
11337
+	 *
11338
+	 */
11339 11339
 	public function parseDirection($direction = 0)
11340 11340
 	{
11341 11341
 		if ($direction == '') $direction = 0;
@@ -11414,12 +11414,12 @@  discard block
 block discarded – undo
11414 11414
 	
11415 11415
 	
11416 11416
 	/**
11417
-	* Gets the aircraft registration
11418
-	*
11419
-	* @param String $flightaware_id the flight aware id
11420
-	* @return String the aircraft registration
11421
-	*
11422
-	*/
11417
+	 * Gets the aircraft registration
11418
+	 *
11419
+	 * @param String $flightaware_id the flight aware id
11420
+	 * @return String the aircraft registration
11421
+	 *
11422
+	 */
11423 11423
 	
11424 11424
 	public function getAircraftRegistration($flightaware_id)
11425 11425
 	{
@@ -11448,12 +11448,12 @@  discard block
 block discarded – undo
11448 11448
 
11449 11449
 
11450 11450
 	/**
11451
-	* Gets the aircraft registration from ModeS
11452
-	*
11453
-	* @param String $aircraft_modes the flight ModeS in hex
11454
-	* @return String the aircraft registration
11455
-	*
11456
-	*/
11451
+	 * Gets the aircraft registration from ModeS
11452
+	 *
11453
+	 * @param String $aircraft_modes the flight ModeS in hex
11454
+	 * @return String the aircraft registration
11455
+	 *
11456
+	 */
11457 11457
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11458 11458
 	{
11459 11459
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11469,8 +11469,8 @@  discard block
 block discarded – undo
11469 11469
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11470 11470
 		$sth->closeCursor();
11471 11471
 		if (count($row) > 0) {
11472
-		    //return $row['Registration'];
11473
-		    return $row['registration'];
11472
+			//return $row['Registration'];
11473
+			return $row['registration'];
11474 11474
 		} elseif ($source_type == 'flarm') {
11475 11475
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11476 11476
 		} else return '';
@@ -11478,12 +11478,12 @@  discard block
 block discarded – undo
11478 11478
 	}
11479 11479
 
11480 11480
 	/**
11481
-	* Gets the aircraft type from ModeS
11482
-	*
11483
-	* @param String $aircraft_modes the flight ModeS in hex
11484
-	* @return String the aircraft type
11485
-	*
11486
-	*/
11481
+	 * Gets the aircraft type from ModeS
11482
+	 *
11483
+	 * @param String $aircraft_modes the flight ModeS in hex
11484
+	 * @return String the aircraft type
11485
+	 *
11486
+	 */
11487 11487
 	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11488 11488
 	{
11489 11489
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11509,12 +11509,12 @@  discard block
 block discarded – undo
11509 11509
 	}
11510 11510
 
11511 11511
 	/**
11512
-	* Gets Country from latitude/longitude
11513
-	*
11514
-	* @param Float $latitude latitute of the flight
11515
-	* @param Float $longitude longitute of the flight
11516
-	* @return String the countrie
11517
-	*/
11512
+	 * Gets Country from latitude/longitude
11513
+	 *
11514
+	 * @param Float $latitude latitute of the flight
11515
+	 * @param Float $longitude longitute of the flight
11516
+	 * @return String the countrie
11517
+	 */
11518 11518
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11519 11519
 	{
11520 11520
 		global $globalDBdriver, $globalDebug;
@@ -11551,11 +11551,11 @@  discard block
 block discarded – undo
11551 11551
 	}
11552 11552
 
11553 11553
 	/**
11554
-	* Gets Country from iso2
11555
-	*
11556
-	* @param String $iso2 ISO2 country code
11557
-	* @return String the countrie
11558
-	*/
11554
+	 * Gets Country from iso2
11555
+	 *
11556
+	 * @param String $iso2 ISO2 country code
11557
+	 * @return String the countrie
11558
+	 */
11559 11559
 	public function getCountryFromISO2($iso2)
11560 11560
 	{
11561 11561
 		global $globalDBdriver, $globalDebug;
@@ -11583,12 +11583,12 @@  discard block
 block discarded – undo
11583 11583
 	}
11584 11584
 
11585 11585
 	/**
11586
-	* converts the registration code using the country prefix
11587
-	*
11588
-	* @param String $registration the aircraft registration
11589
-	* @return String the aircraft registration
11590
-	*
11591
-	*/
11586
+	 * converts the registration code using the country prefix
11587
+	 *
11588
+	 * @param String $registration the aircraft registration
11589
+	 * @return String the aircraft registration
11590
+	 *
11591
+	 */
11592 11592
 	public function convertAircraftRegistration($registration)
11593 11593
 	{
11594 11594
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11640,12 +11640,12 @@  discard block
 block discarded – undo
11640 11640
 	}
11641 11641
 
11642 11642
 	/**
11643
-	* Country from the registration code
11644
-	*
11645
-	* @param String $registration the aircraft registration
11646
-	* @return String the country
11647
-	*
11648
-	*/
11643
+	 * Country from the registration code
11644
+	 *
11645
+	 * @param String $registration the aircraft registration
11646
+	 * @return String the country
11647
+	 *
11648
+	 */
11649 11649
 	public function countryFromAircraftRegistration($registration)
11650 11650
 	{
11651 11651
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11664,8 +11664,8 @@  discard block
 block discarded – undo
11664 11664
 				$country = $row['country'];
11665 11665
 			}
11666 11666
 		} else {
11667
-    			$registration_1 = substr($registration, 0, 1);
11668
-		        $registration_2 = substr($registration, 0, 2);
11667
+				$registration_1 = substr($registration, 0, 1);
11668
+				$registration_2 = substr($registration, 0, 2);
11669 11669
 
11670 11670
 			$country = '';
11671 11671
 			//first get the prefix based on two characters
@@ -11701,12 +11701,12 @@  discard block
 block discarded – undo
11701 11701
 	}
11702 11702
 
11703 11703
 	/**
11704
-	* Registration prefix from the registration code
11705
-	*
11706
-	* @param String $registration the aircraft registration
11707
-	* @return String the registration prefix
11708
-	*
11709
-	*/
11704
+	 * Registration prefix from the registration code
11705
+	 *
11706
+	 * @param String $registration the aircraft registration
11707
+	 * @return String the registration prefix
11708
+	 *
11709
+	 */
11710 11710
 	public function registrationPrefixFromAircraftRegistration($registration)
11711 11711
 	{
11712 11712
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11725,8 +11725,8 @@  discard block
 block discarded – undo
11725 11725
 				//$country = $row['country'];
11726 11726
 			}
11727 11727
 		} else {
11728
-    			$registration_1 = substr($registration, 0, 1);
11729
-		        $registration_2 = substr($registration, 0, 2);
11728
+				$registration_1 = substr($registration, 0, 1);
11729
+				$registration_2 = substr($registration, 0, 2);
11730 11730
 
11731 11731
 			//first get the prefix based on two characters
11732 11732
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11762,12 +11762,12 @@  discard block
 block discarded – undo
11762 11762
 
11763 11763
 
11764 11764
 	/**
11765
-	* Country from the registration code
11766
-	*
11767
-	* @param String $registration the aircraft registration
11768
-	* @return String the country
11769
-	*
11770
-	*/
11765
+	 * Country from the registration code
11766
+	 *
11767
+	 * @param String $registration the aircraft registration
11768
+	 * @return String the country
11769
+	 *
11770
+	 */
11771 11771
 	public function countryFromAircraftRegistrationCode($registration)
11772 11772
 	{
11773 11773
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11784,11 +11784,11 @@  discard block
 block discarded – undo
11784 11784
 	}
11785 11785
 	
11786 11786
 	/**
11787
-	* Set a new highlight value for a flight
11788
-	*
11789
-	* @param String $flightaware_id flightaware_id from spotter_output table
11790
-	* @param String $highlight New highlight value
11791
-	*/
11787
+	 * Set a new highlight value for a flight
11788
+	 *
11789
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11790
+	 * @param String $highlight New highlight value
11791
+	 */
11792 11792
 	public function setHighlightFlight($flightaware_id,$highlight) {
11793 11793
 		
11794 11794
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11797,12 +11797,12 @@  discard block
 block discarded – undo
11797 11797
 	}
11798 11798
 
11799 11799
 	/**
11800
-	* Set a new highlight value for a flight by Registration
11801
-	*
11802
-	* @param String $registration Registration of the aircraft
11803
-	* @param String $date Date of spotted aircraft
11804
-	* @param String $highlight New highlight value
11805
-	*/
11800
+	 * Set a new highlight value for a flight by Registration
11801
+	 *
11802
+	 * @param String $registration Registration of the aircraft
11803
+	 * @param String $date Date of spotted aircraft
11804
+	 * @param String $highlight New highlight value
11805
+	 */
11806 11806
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11807 11807
 		if ($date == '') {
11808 11808
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11816,12 +11816,12 @@  discard block
 block discarded – undo
11816 11816
 	}
11817 11817
 	
11818 11818
 	/**
11819
-	* Gets the short url from bit.ly
11820
-	*
11821
-	* @param String $url the full url
11822
-	* @return String the bit.ly url
11823
-	*
11824
-	*/
11819
+	 * Gets the short url from bit.ly
11820
+	 *
11821
+	 * @param String $url the full url
11822
+	 * @return String the bit.ly url
11823
+	 *
11824
+	 */
11825 11825
 	public function getBitlyURL($url)
11826 11826
 	{
11827 11827
 		global $globalBitlyAccessToken;
@@ -12110,11 +12110,11 @@  discard block
 block discarded – undo
12110 12110
 			$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 
12111 12111
 	                      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)) 
12112 12112
 	                      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;";
12113
-                } else {
12113
+				} else {
12114 12114
 			$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 
12115 12115
 	                      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)) 
12116 12116
 	                      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;";
12117
-    		}
12117
+			}
12118 12118
 		$sth = $this->db->prepare($query);
12119 12119
 		$sth->execute();
12120 12120
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
statistics-registration.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/');
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
require/class.Connection.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -7,35 +7,35 @@  discard block
 block discarded – undo
7 7
 	public $latest_schema = 37;
8 8
 	
9 9
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10
-	    global $globalDBdriver, $globalNoDB;
11
-	    if (isset($globalNoDB) && $globalNoDB === TRUE) {
10
+		global $globalDBdriver, $globalNoDB;
11
+		if (isset($globalNoDB) && $globalNoDB === TRUE) {
12 12
 		$this->db = null;
13
-	    } else {
13
+		} else {
14 14
 		if ($dbc === null) {
15
-		    if ($this->db === null && $dbname === null) {
15
+			if ($this->db === null && $dbname === null) {
16 16
 			if ($user === null && $pass === null) {
17
-			    $this->createDBConnection();
17
+				$this->createDBConnection();
18 18
 			} else {
19
-			    $this->createDBConnection(null,$user,$pass);
19
+				$this->createDBConnection(null,$user,$pass);
20 20
 			}
21
-		    } else {
21
+			} else {
22 22
 			$this->createDBConnection($dbname);
23
-		    }
23
+			}
24 24
 		} elseif ($dbname === null || $dbname === 'default') {
25
-	    	    $this->db = $dbc;
26
-	    	    if ($this->connectionExists() === false) {
25
+				$this->db = $dbc;
26
+				if ($this->connectionExists() === false) {
27 27
 			/*
28 28
 			echo 'Restart Connection !!!'."\n";
29 29
 			$e = new \Exception;
30 30
 			var_dump($e->getTraceAsString());
31 31
 			*/
32 32
 			$this->createDBConnection();
33
-		    }
33
+			}
34 34
 		} else {
35
-		    //$this->connectionExists();
36
-		    $this->dbs[$dbname] = $dbc;
35
+			//$this->connectionExists();
36
+			$this->dbs[$dbname] = $dbc;
37
+		}
37 38
 		}
38
-	    }
39 39
 	}
40 40
 
41 41
 	public function db() {
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Creates the database connection
59
-	*
60
-	* @return Boolean of the database connection
61
-	*
62
-	*/
58
+	 * Creates the database connection
59
+	 *
60
+	 * @return Boolean of the database connection
61
+	 *
62
+	 */
63 63
 
64 64
 	public function createDBConnection($DBname = null, $user = null, $pass = null)
65 65
 	{
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			return false;
157 157
 		}
158 158
 		if($results->rowCount()>0) {
159
-		    return true; 
159
+			return true; 
160 160
 		}
161 161
 		else return false;
162 162
 	}
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 				$sum = $sum->fetchColumn(0);
174 174
 			} else $sum = 0;
175 175
 			if (intval($sum) !== 2) {
176
-			     return false;
176
+				 return false;
177 177
 			}
178 178
 			
179 179
 		} catch(PDOException $e) {
180 180
 			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
181
-            			throw $e;
182
-	                }
183
-	                //echo 'error ! '.$e->getMessage();
181
+						throw $e;
182
+					}
183
+					//echo 'error ! '.$e->getMessage();
184 184
 			return false;
185 185
 		}
186 186
 		return true; 
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 		$version = 0;
285 285
 		if ($this->tableExists('aircraft')) {
286 286
 			if (!$this->tableExists('config')) {
287
-	    			$version = '1';
288
-	    			return $version;
287
+					$version = '1';
288
+					return $version;
289 289
 			} else {
290 290
 				$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
291 291
 				try {
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 	* @return Boolean if latest version or not
307 307
 	*/
308 308
 	public function latest() {
309
-	    global $globalNoDB;
310
-	    if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
311
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
312
-	    else return false;
309
+		global $globalNoDB;
310
+		if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
311
+		if ($this->check_schema_version() == $this->latest_schema) return true;
312
+		else return false;
313 313
 	}
314 314
 
315 315
 }
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
-        	    $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
+				$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) {
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.