Completed
Push — master ( 637110...04cc20 )
by Yannick
07:26
created
require/class.Spotter.php 1 patch
Indentation   +1455 added lines, -1455 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;
@@ -5007,11 +5007,11 @@  discard block
 block discarded – undo
5007 5007
 	}
5008 5008
 
5009 5009
 	/**
5010
-	* Gets all number of flight over countries
5011
-	*
5012
-	* @return Array the airline country list
5013
-	*
5014
-	*/
5010
+	 * Gets all number of flight over countries
5011
+	 *
5012
+	 * @return Array the airline country list
5013
+	 *
5014
+	 */
5015 5015
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5016 5016
 	{
5017 5017
 		global $globalDBdriver;
@@ -5033,15 +5033,15 @@  discard block
 block discarded – undo
5033 5033
 		$SpotterLive = new SpotterLive();
5034 5034
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5035 5035
 		$filter_query .= ' over_country IS NOT NULL';
5036
-                if ($olderthanmonths > 0) {
5036
+				if ($olderthanmonths > 0) {
5037 5037
 			if ($globalDBdriver == 'mysql') {
5038 5038
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5039 5039
 			} else {
5040 5040
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5041 5041
 			}
5042 5042
 		}
5043
-                if ($sincedate != '') {
5044
-            		if ($globalDBdriver == 'mysql') {
5043
+				if ($sincedate != '') {
5044
+					if ($globalDBdriver == 'mysql') {
5045 5045
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5046 5046
 			} else {
5047 5047
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5071,11 +5071,11 @@  discard block
 block discarded – undo
5071 5071
 	
5072 5072
 	
5073 5073
 	/**
5074
-	* Gets all aircraft types that have flown over
5075
-	*
5076
-	* @return Array the aircraft list
5077
-	*
5078
-	*/
5074
+	 * Gets all aircraft types that have flown over
5075
+	 *
5076
+	 * @return Array the aircraft list
5077
+	 *
5078
+	 */
5079 5079
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5080 5080
 	{
5081 5081
 		global $globalDBdriver;
@@ -5145,11 +5145,11 @@  discard block
 block discarded – undo
5145 5145
 	}
5146 5146
 
5147 5147
 	/**
5148
-	* Gets all aircraft types that have flown over by airline
5149
-	*
5150
-	* @return Array the aircraft list
5151
-	*
5152
-	*/
5148
+	 * Gets all aircraft types that have flown over by airline
5149
+	 *
5150
+	 * @return Array the aircraft list
5151
+	 *
5152
+	 */
5153 5153
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5154 5154
 	{
5155 5155
 		global $globalDBdriver;
@@ -5220,11 +5220,11 @@  discard block
 block discarded – undo
5220 5220
 	}
5221 5221
 
5222 5222
 	/**
5223
-	* Gets all aircraft types that have flown over by months
5224
-	*
5225
-	* @return Array the aircraft list
5226
-	*
5227
-	*/
5223
+	 * Gets all aircraft types that have flown over by months
5224
+	 *
5225
+	 * @return Array the aircraft list
5226
+	 *
5227
+	 */
5228 5228
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5229 5229
 	{
5230 5230
 		global $globalDBdriver;
@@ -5268,11 +5268,11 @@  discard block
 block discarded – undo
5268 5268
 
5269 5269
 
5270 5270
 	/**
5271
-	* Gets all aircraft registration that have flown over by aircaft icao
5272
-	*
5273
-	* @return Array the aircraft list
5274
-	*
5275
-	*/
5271
+	 * Gets all aircraft registration that have flown over by aircaft icao
5272
+	 *
5273
+	 * @return Array the aircraft list
5274
+	 *
5275
+	 */
5276 5276
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5277 5277
 	{
5278 5278
 		$Image = new Image($this->db);
@@ -5311,11 +5311,11 @@  discard block
 block discarded – undo
5311 5311
 
5312 5312
 
5313 5313
 	/**
5314
-	* Gets all aircraft types that have flown over by airline icao
5315
-	*
5316
-	* @return Array the aircraft list
5317
-	*
5318
-	*/
5314
+	 * Gets all aircraft types that have flown over by airline icao
5315
+	 *
5316
+	 * @return Array the aircraft list
5317
+	 *
5318
+	 */
5319 5319
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5320 5320
 	{
5321 5321
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5344,11 +5344,11 @@  discard block
 block discarded – undo
5344 5344
 
5345 5345
 
5346 5346
 	/**
5347
-	* Gets all aircraft registration that have flown over by airline icao
5348
-	*
5349
-	* @return Array the aircraft list
5350
-	*
5351
-	*/
5347
+	 * Gets all aircraft registration that have flown over by airline icao
5348
+	 *
5349
+	 * @return Array the aircraft list
5350
+	 *
5351
+	 */
5352 5352
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5353 5353
 	{
5354 5354
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5386,11 +5386,11 @@  discard block
 block discarded – undo
5386 5386
 
5387 5387
 
5388 5388
 	/**
5389
-	* Gets all aircraft manufacturer that have flown over by airline icao
5390
-	*
5391
-	* @return Array the aircraft list
5392
-	*
5393
-	*/
5389
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5390
+	 *
5391
+	 * @return Array the aircraft list
5392
+	 *
5393
+	 */
5394 5394
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5395 5395
 	{
5396 5396
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5418,11 +5418,11 @@  discard block
 block discarded – undo
5418 5418
 
5419 5419
 
5420 5420
 	/**
5421
-	* Gets all aircraft types that have flown over by airline icao
5422
-	*
5423
-	* @return Array the aircraft list
5424
-	*
5425
-	*/
5421
+	 * Gets all aircraft types that have flown over by airline icao
5422
+	 *
5423
+	 * @return Array the aircraft list
5424
+	 *
5425
+	 */
5426 5426
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5427 5427
 	{
5428 5428
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5451,11 +5451,11 @@  discard block
 block discarded – undo
5451 5451
 
5452 5452
 
5453 5453
 	/**
5454
-	* Gets all aircraft registration that have flown over by airport icao
5455
-	*
5456
-	* @return Array the aircraft list
5457
-	*
5458
-	*/
5454
+	 * Gets all aircraft registration that have flown over by airport icao
5455
+	 *
5456
+	 * @return Array the aircraft list
5457
+	 *
5458
+	 */
5459 5459
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5460 5460
 	{
5461 5461
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5492,11 +5492,11 @@  discard block
 block discarded – undo
5492 5492
 	
5493 5493
 	
5494 5494
 	/**
5495
-	* Gets all aircraft manufacturer that have flown over by airport icao
5496
-	*
5497
-	* @return Array the aircraft list
5498
-	*
5499
-	*/
5495
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5496
+	 *
5497
+	 * @return Array the aircraft list
5498
+	 *
5499
+	 */
5500 5500
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5501 5501
 	{
5502 5502
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5522,11 +5522,11 @@  discard block
 block discarded – undo
5522 5522
 	}
5523 5523
 
5524 5524
 	/**
5525
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5526
-	*
5527
-	* @return Array the aircraft list
5528
-	*
5529
-	*/
5525
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5526
+	 *
5527
+	 * @return Array the aircraft list
5528
+	 *
5529
+	 */
5530 5530
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5531 5531
 	{
5532 5532
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5553,11 +5553,11 @@  discard block
 block discarded – undo
5553 5553
 
5554 5554
 
5555 5555
 	/**
5556
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5557
-	*
5558
-	* @return Array the aircraft list
5559
-	*
5560
-	*/
5556
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5557
+	 *
5558
+	 * @return Array the aircraft list
5559
+	 *
5560
+	 */
5561 5561
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5562 5562
 	{
5563 5563
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5593,11 +5593,11 @@  discard block
 block discarded – undo
5593 5593
 	}
5594 5594
 
5595 5595
 	/**
5596
-	* Gets all aircraft types that have flown over by date
5597
-	*
5598
-	* @return Array the aircraft list
5599
-	*
5600
-	*/
5596
+	 * Gets all aircraft types that have flown over by date
5597
+	 *
5598
+	 * @return Array the aircraft list
5599
+	 *
5600
+	 */
5601 5601
 	public function countAllAircraftTypesByDate($date,$filters = array())
5602 5602
 	{
5603 5603
 		global $globalTimezone, $globalDBdriver;
@@ -5639,11 +5639,11 @@  discard block
 block discarded – undo
5639 5639
 
5640 5640
 
5641 5641
 	/**
5642
-	* Gets all aircraft registration that have flown over by date
5643
-	*
5644
-	* @return Array the aircraft list
5645
-	*
5646
-	*/
5642
+	 * Gets all aircraft registration that have flown over by date
5643
+	 *
5644
+	 * @return Array the aircraft list
5645
+	 *
5646
+	 */
5647 5647
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5648 5648
 	{
5649 5649
 		global $globalTimezone, $globalDBdriver;
@@ -5694,11 +5694,11 @@  discard block
 block discarded – undo
5694 5694
 
5695 5695
 
5696 5696
 	/**
5697
-	* Gets all aircraft manufacturer that have flown over by date
5698
-	*
5699
-	* @return Array the aircraft manufacturer list
5700
-	*
5701
-	*/
5697
+	 * Gets all aircraft manufacturer that have flown over by date
5698
+	 *
5699
+	 * @return Array the aircraft manufacturer list
5700
+	 *
5701
+	 */
5702 5702
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5703 5703
 	{
5704 5704
 		global $globalTimezone, $globalDBdriver;
@@ -5740,11 +5740,11 @@  discard block
 block discarded – undo
5740 5740
 
5741 5741
 
5742 5742
 	/**
5743
-	* Gets all aircraft types that have flown over by ident/callsign
5744
-	*
5745
-	* @return Array the aircraft list
5746
-	*
5747
-	*/
5743
+	 * Gets all aircraft types that have flown over by ident/callsign
5744
+	 *
5745
+	 * @return Array the aircraft list
5746
+	 *
5747
+	 */
5748 5748
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5749 5749
 	{
5750 5750
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5772,11 +5772,11 @@  discard block
 block discarded – undo
5772 5772
 	}
5773 5773
 
5774 5774
 	/**
5775
-	* Gets all aircraft types that have flown over by pilot
5776
-	*
5777
-	* @return Array the aircraft list
5778
-	*
5779
-	*/
5775
+	 * Gets all aircraft types that have flown over by pilot
5776
+	 *
5777
+	 * @return Array the aircraft list
5778
+	 *
5779
+	 */
5780 5780
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5781 5781
 	{
5782 5782
 		global $globalDBdriver;
@@ -5822,11 +5822,11 @@  discard block
 block discarded – undo
5822 5822
 	}
5823 5823
 
5824 5824
 	/**
5825
-	* Gets all aircraft types that have flown over by owner
5826
-	*
5827
-	* @return Array the aircraft list
5828
-	*
5829
-	*/
5825
+	 * Gets all aircraft types that have flown over by owner
5826
+	 *
5827
+	 * @return Array the aircraft list
5828
+	 *
5829
+	 */
5830 5830
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5831 5831
 	{
5832 5832
 		global $globalDBdriver;
@@ -5871,11 +5871,11 @@  discard block
 block discarded – undo
5871 5871
 	}
5872 5872
 
5873 5873
 	/**
5874
-	* Gets all aircraft registration that have flown over by ident/callsign
5875
-	*
5876
-	* @return Array the aircraft list
5877
-	*
5878
-	*/
5874
+	 * Gets all aircraft registration that have flown over by ident/callsign
5875
+	 *
5876
+	 * @return Array the aircraft list
5877
+	 *
5878
+	 */
5879 5879
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5880 5880
 	{
5881 5881
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5914,11 +5914,11 @@  discard block
 block discarded – undo
5914 5914
 	}
5915 5915
 
5916 5916
 	/**
5917
-	* Gets all aircraft registration that have flown over by owner
5918
-	*
5919
-	* @return Array the aircraft list
5920
-	*
5921
-	*/
5917
+	 * Gets all aircraft registration that have flown over by owner
5918
+	 *
5919
+	 * @return Array the aircraft list
5920
+	 *
5921
+	 */
5922 5922
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5923 5923
 	{
5924 5924
 		global $globalDBdriver;
@@ -5989,11 +5989,11 @@  discard block
 block discarded – undo
5989 5989
 	}
5990 5990
 
5991 5991
 	/**
5992
-	* Gets all aircraft registration that have flown over by pilot
5993
-	*
5994
-	* @return Array the aircraft list
5995
-	*
5996
-	*/
5992
+	 * Gets all aircraft registration that have flown over by pilot
5993
+	 *
5994
+	 * @return Array the aircraft list
5995
+	 *
5996
+	 */
5997 5997
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5998 5998
 	{
5999 5999
 		global $globalDBdriver;
@@ -6065,11 +6065,11 @@  discard block
 block discarded – undo
6065 6065
 
6066 6066
 
6067 6067
 	/**
6068
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6069
-	*
6070
-	* @return Array the aircraft manufacturer list
6071
-	*
6072
-	*/
6068
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6069
+	 *
6070
+	 * @return Array the aircraft manufacturer list
6071
+	 *
6072
+	 */
6073 6073
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6074 6074
 	{
6075 6075
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6094,11 +6094,11 @@  discard block
 block discarded – undo
6094 6094
 	}
6095 6095
 
6096 6096
 	/**
6097
-	* Gets all aircraft manufacturer that have flown over by owner
6098
-	*
6099
-	* @return Array the aircraft manufacturer list
6100
-	*
6101
-	*/
6097
+	 * Gets all aircraft manufacturer that have flown over by owner
6098
+	 *
6099
+	 * @return Array the aircraft manufacturer list
6100
+	 *
6101
+	 */
6102 6102
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6103 6103
 	{
6104 6104
 		global $globalDBdriver;
@@ -6146,11 +6146,11 @@  discard block
 block discarded – undo
6146 6146
 	}
6147 6147
 
6148 6148
 	/**
6149
-	* Gets all aircraft manufacturer that have flown over by pilot
6150
-	*
6151
-	* @return Array the aircraft manufacturer list
6152
-	*
6153
-	*/
6149
+	 * Gets all aircraft manufacturer that have flown over by pilot
6150
+	 *
6151
+	 * @return Array the aircraft manufacturer list
6152
+	 *
6153
+	 */
6154 6154
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6155 6155
 	{
6156 6156
 		global $globalDBdriver;
@@ -6199,11 +6199,11 @@  discard block
 block discarded – undo
6199 6199
 
6200 6200
 
6201 6201
 	/**
6202
-	* Gets all aircraft types that have flown over by route
6203
-	*
6204
-	* @return Array the aircraft list
6205
-	*
6206
-	*/
6202
+	 * Gets all aircraft types that have flown over by route
6203
+	 *
6204
+	 * @return Array the aircraft list
6205
+	 *
6206
+	 */
6207 6207
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6208 6208
 	{
6209 6209
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6232,11 +6232,11 @@  discard block
 block discarded – undo
6232 6232
 	}
6233 6233
 
6234 6234
 	/**
6235
-	* Gets all aircraft registration that have flown over by route
6236
-	*
6237
-	* @return Array the aircraft list
6238
-	*
6239
-	*/
6235
+	 * Gets all aircraft registration that have flown over by route
6236
+	 *
6237
+	 * @return Array the aircraft list
6238
+	 *
6239
+	 */
6240 6240
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6241 6241
 	{
6242 6242
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6278,11 +6278,11 @@  discard block
 block discarded – undo
6278 6278
 	
6279 6279
 	
6280 6280
 	/**
6281
-	* Gets all aircraft manufacturer that have flown over by route
6282
-	*
6283
-	* @return Array the aircraft manufacturer list
6284
-	*
6285
-	*/
6281
+	 * Gets all aircraft manufacturer that have flown over by route
6282
+	 *
6283
+	 * @return Array the aircraft manufacturer list
6284
+	 *
6285
+	 */
6286 6286
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6287 6287
 	{
6288 6288
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6316,11 +6316,11 @@  discard block
 block discarded – undo
6316 6316
 	
6317 6317
 	
6318 6318
 	/**
6319
-	* Gets all aircraft types that have flown over by country
6320
-	*
6321
-	* @return Array the aircraft list
6322
-	*
6323
-	*/
6319
+	 * Gets all aircraft types that have flown over by country
6320
+	 *
6321
+	 * @return Array the aircraft list
6322
+	 *
6323
+	 */
6324 6324
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6325 6325
 	{
6326 6326
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6351,11 +6351,11 @@  discard block
 block discarded – undo
6351 6351
 
6352 6352
 
6353 6353
 	/**
6354
-	* Gets all aircraft registration that have flown over by country
6355
-	*
6356
-	* @return Array the aircraft list
6357
-	*
6358
-	*/
6354
+	 * Gets all aircraft registration that have flown over by country
6355
+	 *
6356
+	 * @return Array the aircraft list
6357
+	 *
6358
+	 */
6359 6359
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6360 6360
 	{
6361 6361
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6395,11 +6395,11 @@  discard block
 block discarded – undo
6395 6395
 	
6396 6396
 	
6397 6397
 	/**
6398
-	* Gets all aircraft manufacturer that have flown over by country
6399
-	*
6400
-	* @return Array the aircraft manufacturer list
6401
-	*
6402
-	*/
6398
+	 * Gets all aircraft manufacturer that have flown over by country
6399
+	 *
6400
+	 * @return Array the aircraft manufacturer list
6401
+	 *
6402
+	 */
6403 6403
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6404 6404
 	{
6405 6405
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6430,18 +6430,18 @@  discard block
 block discarded – undo
6430 6430
 	
6431 6431
 	
6432 6432
 	/**
6433
-	* Gets all aircraft manufacturers that have flown over
6434
-	*
6435
-	* @return Array the aircraft list
6436
-	*
6437
-	*/
6433
+	 * Gets all aircraft manufacturers that have flown over
6434
+	 *
6435
+	 * @return Array the aircraft list
6436
+	 *
6437
+	 */
6438 6438
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6439 6439
 	{
6440 6440
 		global $globalDBdriver;
6441 6441
 		$filter_query = $this->getFilter($filters,true,true);
6442 6442
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6443 6443
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6444
-                $query_values = array();
6444
+				$query_values = array();
6445 6445
 		if ($year != '') {
6446 6446
 			if ($globalDBdriver == 'mysql') {
6447 6447
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6494,11 +6494,11 @@  discard block
 block discarded – undo
6494 6494
 	
6495 6495
 	
6496 6496
 	/**
6497
-	* Gets all aircraft registrations that have flown over
6498
-	*
6499
-	* @return Array the aircraft list
6500
-	*
6501
-	*/
6497
+	 * Gets all aircraft registrations that have flown over
6498
+	 *
6499
+	 * @return Array the aircraft list
6500
+	 *
6501
+	 */
6502 6502
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6503 6503
 	{
6504 6504
 		global $globalDBdriver;
@@ -6506,15 +6506,15 @@  discard block
 block discarded – undo
6506 6506
 		$filter_query = $this->getFilter($filters,true,true);
6507 6507
 		$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    
6508 6508
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6509
-                if ($olderthanmonths > 0) {
6510
-            		if ($globalDBdriver == 'mysql') {
6509
+				if ($olderthanmonths > 0) {
6510
+					if ($globalDBdriver == 'mysql') {
6511 6511
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6512 6512
 			} else {
6513 6513
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6514 6514
 			}
6515 6515
 		}
6516
-                if ($sincedate != '') {
6517
-            		if ($globalDBdriver == 'mysql') {
6516
+				if ($sincedate != '') {
6517
+					if ($globalDBdriver == 'mysql') {
6518 6518
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6519 6519
 			} else {
6520 6520
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6579,11 +6579,11 @@  discard block
 block discarded – undo
6579 6579
 
6580 6580
 
6581 6581
 	/**
6582
-	* Gets all aircraft registrations that have flown over
6583
-	*
6584
-	* @return Array the aircraft list
6585
-	*
6586
-	*/
6582
+	 * Gets all aircraft registrations that have flown over
6583
+	 *
6584
+	 * @return Array the aircraft list
6585
+	 *
6586
+	 */
6587 6587
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6588 6588
 	{
6589 6589
 		global $globalDBdriver;
@@ -6591,15 +6591,15 @@  discard block
 block discarded – undo
6591 6591
 		$Image = new Image($this->db);
6592 6592
 		$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    
6593 6593
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6594
-                if ($olderthanmonths > 0) {
6595
-            		if ($globalDBdriver == 'mysql') {
6594
+				if ($olderthanmonths > 0) {
6595
+					if ($globalDBdriver == 'mysql') {
6596 6596
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6597 6597
 			} else {
6598 6598
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6599 6599
 			}
6600 6600
 		}
6601
-                if ($sincedate != '') {
6602
-            		if ($globalDBdriver == 'mysql') {
6601
+				if ($sincedate != '') {
6602
+					if ($globalDBdriver == 'mysql') {
6603 6603
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6604 6604
 			} else {
6605 6605
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6608,7 +6608,7 @@  discard block
 block discarded – undo
6608 6608
 
6609 6609
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6610 6610
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6611
-                $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";
6611
+				$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 6612
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6613 6613
 		
6614 6614
 		$sth = $this->db->prepare($query);
@@ -6640,26 +6640,26 @@  discard block
 block discarded – undo
6640 6640
 	
6641 6641
 	
6642 6642
 	/**
6643
-	* Gets all departure airports of the airplanes that have flown over
6644
-	*
6645
-	* @return Array the airport list
6646
-	*
6647
-	*/
6643
+	 * Gets all departure airports of the airplanes that have flown over
6644
+	 *
6645
+	 * @return Array the airport list
6646
+	 *
6647
+	 */
6648 6648
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6649 6649
 	{
6650 6650
 		global $globalDBdriver;
6651 6651
 		$filter_query = $this->getFilter($filters,true,true);
6652 6652
 		$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 
6653 6653
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6654
-                if ($olderthanmonths > 0) {
6655
-            		if ($globalDBdriver == 'mysql') {
6654
+				if ($olderthanmonths > 0) {
6655
+					if ($globalDBdriver == 'mysql') {
6656 6656
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6657 6657
 			} else {
6658 6658
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6659 6659
 			}
6660
-                }
6661
-                if ($sincedate != '') {
6662
-            		if ($globalDBdriver == 'mysql') {
6660
+				}
6661
+				if ($sincedate != '') {
6662
+					if ($globalDBdriver == 'mysql') {
6663 6663
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6664 6664
 			} else {
6665 6665
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6693,7 +6693,7 @@  discard block
 block discarded – undo
6693 6693
 				$query_values = array_merge($query_values,array(':day' => $day));
6694 6694
 			}
6695 6695
 		}
6696
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6696
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6697 6697
 				ORDER BY airport_departure_icao_count DESC";
6698 6698
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6699 6699
 
@@ -6716,35 +6716,35 @@  discard block
 block discarded – undo
6716 6716
 	}
6717 6717
 
6718 6718
 	/**
6719
-	* Gets all departure airports of the airplanes that have flown over
6720
-	*
6721
-	* @return Array the airport list
6722
-	*
6723
-	*/
6719
+	 * Gets all departure airports of the airplanes that have flown over
6720
+	 *
6721
+	 * @return Array the airport list
6722
+	 *
6723
+	 */
6724 6724
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6725 6725
 	{
6726 6726
 		global $globalDBdriver;
6727 6727
 		$filter_query = $this->getFilter($filters,true,true);
6728 6728
 		$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 
6729 6729
 			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 <> '' ";
6730
-                if ($olderthanmonths > 0) {
6731
-            		if ($globalDBdriver == 'mysql') {
6730
+				if ($olderthanmonths > 0) {
6731
+					if ($globalDBdriver == 'mysql') {
6732 6732
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6733 6733
 			} else {
6734 6734
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6735 6735
 			}
6736
-                }
6737
-                if ($sincedate != '') {
6738
-            		if ($globalDBdriver == 'mysql') {
6736
+				}
6737
+				if ($sincedate != '') {
6738
+					if ($globalDBdriver == 'mysql') {
6739 6739
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6740 6740
 			} else {
6741 6741
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6742 6742
 			}
6743 6743
 		}
6744 6744
 
6745
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6746
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6747
-                $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
6745
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6746
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6747
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6748 6748
 				ORDER BY airport_departure_icao_count DESC";
6749 6749
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6750 6750
       
@@ -6769,26 +6769,26 @@  discard block
 block discarded – undo
6769 6769
 	}
6770 6770
 
6771 6771
 	/**
6772
-	* Gets all detected departure airports of the airplanes that have flown over
6773
-	*
6774
-	* @return Array the airport list
6775
-	*
6776
-	*/
6772
+	 * Gets all detected departure airports of the airplanes that have flown over
6773
+	 *
6774
+	 * @return Array the airport list
6775
+	 *
6776
+	 */
6777 6777
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6778 6778
 	{
6779 6779
 		global $globalDBdriver;
6780 6780
 		$filter_query = $this->getFilter($filters,true,true);
6781 6781
 		$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
6782 6782
 				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";
6783
-                if ($olderthanmonths > 0) {
6784
-            		if ($globalDBdriver == 'mysql') {
6783
+				if ($olderthanmonths > 0) {
6784
+					if ($globalDBdriver == 'mysql') {
6785 6785
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6786 6786
 			} else {
6787 6787
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6788 6788
 			}
6789
-                }
6790
-                if ($sincedate != '') {
6791
-            		if ($globalDBdriver == 'mysql') {
6789
+				}
6790
+				if ($sincedate != '') {
6791
+					if ($globalDBdriver == 'mysql') {
6792 6792
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6793 6793
 			} else {
6794 6794
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6822,10 +6822,10 @@  discard block
 block discarded – undo
6822 6822
 				$query_values = array_merge($query_values,array(':day' => $day));
6823 6823
 			}
6824 6824
 		}
6825
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6825
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6826 6826
 				ORDER BY airport_departure_icao_count DESC";
6827 6827
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6828
-    		//echo $query;
6828
+			//echo $query;
6829 6829
 		$sth = $this->db->prepare($query);
6830 6830
 		$sth->execute($query_values);
6831 6831
       
@@ -6846,35 +6846,35 @@  discard block
 block discarded – undo
6846 6846
 	}
6847 6847
 	
6848 6848
 	/**
6849
-	* Gets all detected departure airports of the airplanes that have flown over
6850
-	*
6851
-	* @return Array the airport list
6852
-	*
6853
-	*/
6849
+	 * Gets all detected departure airports of the airplanes that have flown over
6850
+	 *
6851
+	 * @return Array the airport list
6852
+	 *
6853
+	 */
6854 6854
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6855 6855
 	{
6856 6856
 		global $globalDBdriver;
6857 6857
 		$filter_query = $this->getFilter($filters,true,true);
6858 6858
 		$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
6859 6859
 				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 ";
6860
-                if ($olderthanmonths > 0) {
6861
-            		if ($globalDBdriver == 'mysql') {
6860
+				if ($olderthanmonths > 0) {
6861
+					if ($globalDBdriver == 'mysql') {
6862 6862
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6863 6863
 			} else {
6864 6864
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6865 6865
 			}
6866
-                }
6867
-                if ($sincedate != '') {
6868
-            		if ($globalDBdriver == 'mysql') {
6866
+				}
6867
+				if ($sincedate != '') {
6868
+					if ($globalDBdriver == 'mysql') {
6869 6869
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6870 6870
 			} else {
6871 6871
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6872 6872
 			}
6873 6873
 		}
6874 6874
 
6875
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6876
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6877
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6875
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6876
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6877
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6878 6878
 				ORDER BY airport_departure_icao_count DESC";
6879 6879
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6880 6880
       
@@ -6899,11 +6899,11 @@  discard block
 block discarded – undo
6899 6899
 	}	
6900 6900
 	
6901 6901
 	/**
6902
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6903
-	*
6904
-	* @return Array the airport list
6905
-	*
6906
-	*/
6902
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6903
+	 *
6904
+	 * @return Array the airport list
6905
+	 *
6906
+	 */
6907 6907
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6908 6908
 	{
6909 6909
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6937,11 +6937,11 @@  discard block
 block discarded – undo
6937 6937
 	
6938 6938
 	
6939 6939
 	/**
6940
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6941
-	*
6942
-	* @return Array the airport list
6943
-	*
6944
-	*/
6940
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6941
+	 *
6942
+	 * @return Array the airport list
6943
+	 *
6944
+	 */
6945 6945
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6946 6946
 	{
6947 6947
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6972,11 +6972,11 @@  discard block
 block discarded – undo
6972 6972
 	
6973 6973
 	
6974 6974
 	/**
6975
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6976
-	*
6977
-	* @return Array the airport list
6978
-	*
6979
-	*/
6975
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6976
+	 *
6977
+	 * @return Array the airport list
6978
+	 *
6979
+	 */
6980 6980
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6981 6981
 	{
6982 6982
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7009,11 +7009,11 @@  discard block
 block discarded – undo
7009 7009
 	
7010 7010
 	
7011 7011
 	/**
7012
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7013
-	*
7014
-	* @return Array the airport list
7015
-	*
7016
-	*/
7012
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7013
+	 *
7014
+	 * @return Array the airport list
7015
+	 *
7016
+	 */
7017 7017
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7018 7018
 	{
7019 7019
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7043,11 +7043,11 @@  discard block
 block discarded – undo
7043 7043
 	
7044 7044
 	
7045 7045
 	/**
7046
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7047
-	*
7048
-	* @return Array the airport list
7049
-	*
7050
-	*/
7046
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7047
+	 *
7048
+	 * @return Array the airport list
7049
+	 *
7050
+	 */
7051 7051
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7052 7052
 	{
7053 7053
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7080,11 +7080,11 @@  discard block
 block discarded – undo
7080 7080
 	
7081 7081
 	
7082 7082
 	/**
7083
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7084
-	*
7085
-	* @return Array the airport list
7086
-	*
7087
-	*/
7083
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7084
+	 *
7085
+	 * @return Array the airport list
7086
+	 *
7087
+	 */
7088 7088
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7089 7089
 	{
7090 7090
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7114,11 +7114,11 @@  discard block
 block discarded – undo
7114 7114
 	
7115 7115
 	
7116 7116
 	/**
7117
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7118
-	*
7119
-	* @return Array the airport list
7120
-	*
7121
-	*/
7117
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7118
+	 *
7119
+	 * @return Array the airport list
7120
+	 *
7121
+	 */
7122 7122
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7123 7123
 	{
7124 7124
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7151,11 +7151,11 @@  discard block
 block discarded – undo
7151 7151
 	
7152 7152
 	
7153 7153
 	/**
7154
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7155
-	*
7156
-	* @return Array the airport list
7157
-	*
7158
-	*/
7154
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7155
+	 *
7156
+	 * @return Array the airport list
7157
+	 *
7158
+	 */
7159 7159
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7160 7160
 	{
7161 7161
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7186,11 +7186,11 @@  discard block
 block discarded – undo
7186 7186
 	
7187 7187
 	
7188 7188
 	/**
7189
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7190
-	*
7191
-	* @return Array the airport list
7192
-	*
7193
-	*/
7189
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7190
+	 *
7191
+	 * @return Array the airport list
7192
+	 *
7193
+	 */
7194 7194
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7195 7195
 	{
7196 7196
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7223,11 +7223,11 @@  discard block
 block discarded – undo
7223 7223
 	
7224 7224
 	
7225 7225
 	/**
7226
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7227
-	*
7228
-	* @return Array the airport list
7229
-	*
7230
-	*/
7226
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7227
+	 *
7228
+	 * @return Array the airport list
7229
+	 *
7230
+	 */
7231 7231
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7232 7232
 	{
7233 7233
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7257,11 +7257,11 @@  discard block
 block discarded – undo
7257 7257
 	
7258 7258
 	
7259 7259
 	/**
7260
-	* Gets all departure airports of the airplanes that have flown over based on a date
7261
-	*
7262
-	* @return Array the airport list
7263
-	*
7264
-	*/
7260
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7261
+	 *
7262
+	 * @return Array the airport list
7263
+	 *
7264
+	 */
7265 7265
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7266 7266
 	{
7267 7267
 		global $globalTimezone, $globalDBdriver;
@@ -7307,11 +7307,11 @@  discard block
 block discarded – undo
7307 7307
 	
7308 7308
 	
7309 7309
 	/**
7310
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7311
-	*
7312
-	* @return Array the airport list
7313
-	*
7314
-	*/
7310
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7311
+	 *
7312
+	 * @return Array the airport list
7313
+	 *
7314
+	 */
7315 7315
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7316 7316
 	{
7317 7317
 		global $globalTimezone, $globalDBdriver;
@@ -7354,11 +7354,11 @@  discard block
 block discarded – undo
7354 7354
 	
7355 7355
 	
7356 7356
 	/**
7357
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7358
-	*
7359
-	* @return Array the airport list
7360
-	*
7361
-	*/
7357
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7358
+	 *
7359
+	 * @return Array the airport list
7360
+	 *
7361
+	 */
7362 7362
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7363 7363
 	{
7364 7364
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7390,11 +7390,11 @@  discard block
 block discarded – undo
7390 7390
 	}
7391 7391
 	
7392 7392
 	/**
7393
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7394
-	*
7395
-	* @return Array the airport list
7396
-	*
7397
-	*/
7393
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7394
+	 *
7395
+	 * @return Array the airport list
7396
+	 *
7397
+	 */
7398 7398
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7399 7399
 	{
7400 7400
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7426,11 +7426,11 @@  discard block
 block discarded – undo
7426 7426
 	}
7427 7427
 	
7428 7428
 	/**
7429
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7430
-	*
7431
-	* @return Array the airport list
7432
-	*
7433
-	*/
7429
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7430
+	 *
7431
+	 * @return Array the airport list
7432
+	 *
7433
+	 */
7434 7434
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7435 7435
 	{
7436 7436
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7463,11 +7463,11 @@  discard block
 block discarded – undo
7463 7463
 	
7464 7464
 	
7465 7465
 	/**
7466
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7467
-	*
7468
-	* @return Array the airport list
7469
-	*
7470
-	*/
7466
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7467
+	 *
7468
+	 * @return Array the airport list
7469
+	 *
7470
+	 */
7471 7471
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7472 7472
 	{
7473 7473
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7496,11 +7496,11 @@  discard block
 block discarded – undo
7496 7496
 	}
7497 7497
 	
7498 7498
 	/**
7499
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7500
-	*
7501
-	* @return Array the airport list
7502
-	*
7503
-	*/
7499
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7500
+	 *
7501
+	 * @return Array the airport list
7502
+	 *
7503
+	 */
7504 7504
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7505 7505
 	{
7506 7506
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7516,11 +7516,11 @@  discard block
 block discarded – undo
7516 7516
 	}
7517 7517
 	
7518 7518
 	/**
7519
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7520
-	*
7521
-	* @return Array the airport list
7522
-	*
7523
-	*/
7519
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7520
+	 *
7521
+	 * @return Array the airport list
7522
+	 *
7523
+	 */
7524 7524
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7525 7525
 	{
7526 7526
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7538,11 +7538,11 @@  discard block
 block discarded – undo
7538 7538
 	
7539 7539
 	
7540 7540
 	/**
7541
-	* Gets all departure airports of the airplanes that have flown over based on a country
7542
-	*
7543
-	* @return Array the airport list
7544
-	*
7545
-	*/
7541
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7542
+	 *
7543
+	 * @return Array the airport list
7544
+	 *
7545
+	 */
7546 7546
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7547 7547
 	{
7548 7548
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7576,11 +7576,11 @@  discard block
 block discarded – undo
7576 7576
 
7577 7577
 
7578 7578
 	/**
7579
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7580
-	*
7581
-	* @return Array the airport list
7582
-	*
7583
-	*/
7579
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7580
+	 *
7581
+	 * @return Array the airport list
7582
+	 *
7583
+	 */
7584 7584
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7585 7585
 	{
7586 7586
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7610,31 +7610,31 @@  discard block
 block discarded – undo
7610 7610
 	
7611 7611
 
7612 7612
 	/**
7613
-	* Gets all arrival airports of the airplanes that have flown over
7614
-	*
7615
-	* @param Boolean $limit Limit result to 10 or not
7616
-	* @param Integer $olderthanmonths Only show result older than x months
7617
-	* @param String $sincedate Only show result since x date
7618
-	* @param Boolean $icaoaskey Show result by ICAO
7619
-	* @param Array $filters Filter used here
7620
-	* @return Array the airport list
7621
-	*
7622
-	*/
7613
+	 * Gets all arrival airports of the airplanes that have flown over
7614
+	 *
7615
+	 * @param Boolean $limit Limit result to 10 or not
7616
+	 * @param Integer $olderthanmonths Only show result older than x months
7617
+	 * @param String $sincedate Only show result since x date
7618
+	 * @param Boolean $icaoaskey Show result by ICAO
7619
+	 * @param Array $filters Filter used here
7620
+	 * @return Array the airport list
7621
+	 *
7622
+	 */
7623 7623
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7624 7624
 	{
7625 7625
 		global $globalDBdriver;
7626 7626
 		$filter_query = $this->getFilter($filters,true,true);
7627 7627
 		$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 
7628 7628
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7629
-                if ($olderthanmonths > 0) {
7630
-            		if ($globalDBdriver == 'mysql') {
7629
+				if ($olderthanmonths > 0) {
7630
+					if ($globalDBdriver == 'mysql') {
7631 7631
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7632 7632
 			} else {
7633 7633
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7634 7634
 			}
7635 7635
 		}
7636
-                if ($sincedate != '') {
7637
-            		if ($globalDBdriver == 'mysql') {
7636
+				if ($sincedate != '') {
7637
+					if ($globalDBdriver == 'mysql') {
7638 7638
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7639 7639
 			} else {
7640 7640
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7668,7 +7668,7 @@  discard block
 block discarded – undo
7668 7668
 				$query_values = array_merge($query_values,array(':day' => $day));
7669 7669
 			}
7670 7670
 		}
7671
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7671
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7672 7672
 					ORDER BY airport_arrival_icao_count DESC";
7673 7673
 		if ($limit) $query .= " LIMIT 10";
7674 7674
       
@@ -7697,35 +7697,35 @@  discard block
 block discarded – undo
7697 7697
 	}
7698 7698
 
7699 7699
 	/**
7700
-	* Gets all arrival airports of the airplanes that have flown over
7701
-	*
7702
-	* @return Array the airport list
7703
-	*
7704
-	*/
7700
+	 * Gets all arrival airports of the airplanes that have flown over
7701
+	 *
7702
+	 * @return Array the airport list
7703
+	 *
7704
+	 */
7705 7705
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7706 7706
 	{
7707 7707
 		global $globalDBdriver;
7708 7708
 		$filter_query = $this->getFilter($filters,true,true);
7709 7709
 		$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 
7710 7710
 			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 <> '' ";
7711
-                if ($olderthanmonths > 0) {
7712
-            		if ($globalDBdriver == 'mysql') {
7711
+				if ($olderthanmonths > 0) {
7712
+					if ($globalDBdriver == 'mysql') {
7713 7713
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7714 7714
 			} else {
7715 7715
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7716 7716
 			}
7717 7717
 		}
7718
-                if ($sincedate != '') {
7719
-            		if ($globalDBdriver == 'mysql') {
7718
+				if ($sincedate != '') {
7719
+					if ($globalDBdriver == 'mysql') {
7720 7720
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7721 7721
 			} else {
7722 7722
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7723 7723
 			}
7724 7724
 		}
7725 7725
 
7726
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7727
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7728
-                $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
7726
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7727
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7728
+				$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
7729 7729
 					ORDER BY airport_arrival_icao_count DESC";
7730 7730
 		if ($limit) $query .= " LIMIT 10";
7731 7731
       
@@ -7756,26 +7756,26 @@  discard block
 block discarded – undo
7756 7756
 
7757 7757
 
7758 7758
 	/**
7759
-	* Gets all detected arrival airports of the airplanes that have flown over
7760
-	*
7761
-	* @return Array the airport list
7762
-	*
7763
-	*/
7759
+	 * Gets all detected arrival airports of the airplanes that have flown over
7760
+	 *
7761
+	 * @return Array the airport list
7762
+	 *
7763
+	 */
7764 7764
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7765 7765
 	{
7766 7766
 		global $globalDBdriver;
7767 7767
 		$filter_query = $this->getFilter($filters,true,true);
7768 7768
 		$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 
7769 7769
 			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";
7770
-                if ($olderthanmonths > 0) {
7771
-            		if ($globalDBdriver == 'mysql') {
7770
+				if ($olderthanmonths > 0) {
7771
+					if ($globalDBdriver == 'mysql') {
7772 7772
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7773 7773
 			} else {
7774 7774
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7775 7775
 			}
7776 7776
 		}
7777
-                if ($sincedate != '') {
7778
-            		if ($globalDBdriver == 'mysql') {
7777
+				if ($sincedate != '') {
7778
+					if ($globalDBdriver == 'mysql') {
7779 7779
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7780 7780
 			} else {
7781 7781
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7809,7 +7809,7 @@  discard block
 block discarded – undo
7809 7809
 				$query_values = array_merge($query_values,array(':day' => $day));
7810 7810
 			}
7811 7811
 		}
7812
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7812
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7813 7813
 					ORDER BY airport_arrival_icao_count DESC";
7814 7814
 		if ($limit) $query .= " LIMIT 10";
7815 7815
       
@@ -7837,35 +7837,35 @@  discard block
 block discarded – undo
7837 7837
 	}
7838 7838
 	
7839 7839
 	/**
7840
-	* Gets all detected arrival airports of the airplanes that have flown over
7841
-	*
7842
-	* @return Array the airport list
7843
-	*
7844
-	*/
7840
+	 * Gets all detected arrival airports of the airplanes that have flown over
7841
+	 *
7842
+	 * @return Array the airport list
7843
+	 *
7844
+	 */
7845 7845
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7846 7846
 	{
7847 7847
 		global $globalDBdriver;
7848 7848
 		$filter_query = $this->getFilter($filters,true,true);
7849 7849
 		$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 
7850 7850
 			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 ";
7851
-                if ($olderthanmonths > 0) {
7852
-            		if ($globalDBdriver == 'mysql') {
7851
+				if ($olderthanmonths > 0) {
7852
+					if ($globalDBdriver == 'mysql') {
7853 7853
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7854 7854
 			} else {
7855 7855
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7856 7856
 			}
7857 7857
 		}
7858
-                if ($sincedate != '') {
7859
-            		if ($globalDBdriver == 'mysql') {
7858
+				if ($sincedate != '') {
7859
+					if ($globalDBdriver == 'mysql') {
7860 7860
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7861 7861
 			} else {
7862 7862
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7863 7863
 			}
7864 7864
 		}
7865 7865
 
7866
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7867
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7868
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7866
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7867
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7868
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7869 7869
 					ORDER BY airport_arrival_icao_count DESC";
7870 7870
 		if ($limit) $query .= " LIMIT 10";
7871 7871
       
@@ -7895,11 +7895,11 @@  discard block
 block discarded – undo
7895 7895
 	}	
7896 7896
 	
7897 7897
 	/**
7898
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7899
-	*
7900
-	* @return Array the airport list
7901
-	*
7902
-	*/
7898
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7899
+	 *
7900
+	 * @return Array the airport list
7901
+	 *
7902
+	 */
7903 7903
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7904 7904
 	{
7905 7905
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7931,11 +7931,11 @@  discard block
 block discarded – undo
7931 7931
 	
7932 7932
 	
7933 7933
 	/**
7934
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7935
-	*
7936
-	* @return Array the airport list
7937
-	*
7938
-	*/
7934
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7935
+	 *
7936
+	 * @return Array the airport list
7937
+	 *
7938
+	 */
7939 7939
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7940 7940
 	{
7941 7941
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7966,11 +7966,11 @@  discard block
 block discarded – undo
7966 7966
 	
7967 7967
 	
7968 7968
 	/**
7969
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7970
-	*
7971
-	* @return Array the airport list
7972
-	*
7973
-	*/
7969
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7970
+	 *
7971
+	 * @return Array the airport list
7972
+	 *
7973
+	 */
7974 7974
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7975 7975
 	{
7976 7976
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8004,11 +8004,11 @@  discard block
 block discarded – undo
8004 8004
 	
8005 8005
 	
8006 8006
 	/**
8007
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8008
-	*
8009
-	* @return Array the airport list
8010
-	*
8011
-	*/
8007
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8008
+	 *
8009
+	 * @return Array the airport list
8010
+	 *
8011
+	 */
8012 8012
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8013 8013
 	{
8014 8014
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8038,11 +8038,11 @@  discard block
 block discarded – undo
8038 8038
 	
8039 8039
 	
8040 8040
 	/**
8041
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8042
-	*
8043
-	* @return Array the airport list
8044
-	*
8045
-	*/
8041
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8042
+	 *
8043
+	 * @return Array the airport list
8044
+	 *
8045
+	 */
8046 8046
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8047 8047
 	{
8048 8048
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8076,11 +8076,11 @@  discard block
 block discarded – undo
8076 8076
 	
8077 8077
 	
8078 8078
 	/**
8079
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8080
-	*
8081
-	* @return Array the airport list
8082
-	*
8083
-	*/
8079
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8080
+	 *
8081
+	 * @return Array the airport list
8082
+	 *
8083
+	 */
8084 8084
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8085 8085
 	{
8086 8086
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8111,11 +8111,11 @@  discard block
 block discarded – undo
8111 8111
 	
8112 8112
 	
8113 8113
 	/**
8114
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8115
-	*
8116
-	* @return Array the airport list
8117
-	*
8118
-	*/
8114
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8115
+	 *
8116
+	 * @return Array the airport list
8117
+	 *
8118
+	 */
8119 8119
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8120 8120
 	{
8121 8121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8148,11 +8148,11 @@  discard block
 block discarded – undo
8148 8148
 	
8149 8149
 	
8150 8150
 	/**
8151
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8152
-	*
8153
-	* @return Array the airport list
8154
-	*
8155
-	*/
8151
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8152
+	 *
8153
+	 * @return Array the airport list
8154
+	 *
8155
+	 */
8156 8156
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8157 8157
 	{
8158 8158
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8182,11 +8182,11 @@  discard block
 block discarded – undo
8182 8182
 	
8183 8183
 	
8184 8184
 	/**
8185
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8186
-	*
8187
-	* @return Array the airport list
8188
-	*
8189
-	*/
8185
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8186
+	 *
8187
+	 * @return Array the airport list
8188
+	 *
8189
+	 */
8190 8190
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8191 8191
 	{
8192 8192
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8220,11 +8220,11 @@  discard block
 block discarded – undo
8220 8220
 	
8221 8221
 	
8222 8222
 	/**
8223
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8224
-	*
8225
-	* @return Array the airport list
8226
-	*
8227
-	*/
8223
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8224
+	 *
8225
+	 * @return Array the airport list
8226
+	 *
8227
+	 */
8228 8228
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8229 8229
 	{
8230 8230
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8255,11 +8255,11 @@  discard block
 block discarded – undo
8255 8255
 	
8256 8256
 	
8257 8257
 	/**
8258
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8259
-	*
8260
-	* @return Array the airport list
8261
-	*
8262
-	*/
8258
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8259
+	 *
8260
+	 * @return Array the airport list
8261
+	 *
8262
+	 */
8263 8263
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8264 8264
 	{
8265 8265
 		global $globalTimezone, $globalDBdriver;
@@ -8305,11 +8305,11 @@  discard block
 block discarded – undo
8305 8305
 	
8306 8306
 	
8307 8307
 	/**
8308
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8309
-	*
8310
-	* @return Array the airport list
8311
-	*
8312
-	*/
8308
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8309
+	 *
8310
+	 * @return Array the airport list
8311
+	 *
8312
+	 */
8313 8313
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8314 8314
 	{
8315 8315
 		global $globalTimezone, $globalDBdriver;
@@ -8352,11 +8352,11 @@  discard block
 block discarded – undo
8352 8352
 	
8353 8353
 	
8354 8354
 	/**
8355
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8356
-	*
8357
-	* @return Array the airport list
8358
-	*
8359
-	*/
8355
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8356
+	 *
8357
+	 * @return Array the airport list
8358
+	 *
8359
+	 */
8360 8360
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8361 8361
 	{
8362 8362
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8388,11 +8388,11 @@  discard block
 block discarded – undo
8388 8388
 	}
8389 8389
 	
8390 8390
 	/**
8391
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8392
-	*
8393
-	* @return Array the airport list
8394
-	*
8395
-	*/
8391
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8392
+	 *
8393
+	 * @return Array the airport list
8394
+	 *
8395
+	 */
8396 8396
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8397 8397
 	{
8398 8398
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8423,11 +8423,11 @@  discard block
 block discarded – undo
8423 8423
 	}
8424 8424
 
8425 8425
 	/**
8426
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8427
-	*
8428
-	* @return Array the airport list
8429
-	*
8430
-	*/
8426
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8427
+	 *
8428
+	 * @return Array the airport list
8429
+	 *
8430
+	 */
8431 8431
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8432 8432
 	{
8433 8433
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8458,11 +8458,11 @@  discard block
 block discarded – undo
8458 8458
 	}
8459 8459
 	
8460 8460
 	/**
8461
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8462
-	*
8463
-	* @return Array the airport list
8464
-	*
8465
-	*/
8461
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8462
+	 *
8463
+	 * @return Array the airport list
8464
+	 *
8465
+	 */
8466 8466
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8467 8467
 	{
8468 8468
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8491,11 +8491,11 @@  discard block
 block discarded – undo
8491 8491
 	}
8492 8492
 	
8493 8493
 	/**
8494
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8495
-	*
8496
-	* @return Array the airport list
8497
-	*
8498
-	*/
8494
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8495
+	 *
8496
+	 * @return Array the airport list
8497
+	 *
8498
+	 */
8499 8499
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8500 8500
 	{
8501 8501
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8511,11 +8511,11 @@  discard block
 block discarded – undo
8511 8511
 	}
8512 8512
 	
8513 8513
 	/**
8514
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8515
-	*
8516
-	* @return Array the airport list
8517
-	*
8518
-	*/
8514
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8515
+	 *
8516
+	 * @return Array the airport list
8517
+	 *
8518
+	 */
8519 8519
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8520 8520
 	{
8521 8521
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8533,11 +8533,11 @@  discard block
 block discarded – undo
8533 8533
 	
8534 8534
 	
8535 8535
 	/**
8536
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8537
-	*
8538
-	* @return Array the airport list
8539
-	*
8540
-	*/
8536
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8537
+	 *
8538
+	 * @return Array the airport list
8539
+	 *
8540
+	 */
8541 8541
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8542 8542
 	{
8543 8543
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8570,11 +8570,11 @@  discard block
 block discarded – undo
8570 8570
 	
8571 8571
 	
8572 8572
 	/**
8573
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8574
-	*
8575
-	* @return Array the airport list
8576
-	*
8577
-	*/
8573
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8574
+	 *
8575
+	 * @return Array the airport list
8576
+	 *
8577
+	 */
8578 8578
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8579 8579
 	{
8580 8580
 		global $globalDBdriver;
@@ -8606,11 +8606,11 @@  discard block
 block discarded – undo
8606 8606
 
8607 8607
 
8608 8608
 	/**
8609
-	* Counts all airport departure countries
8610
-	*
8611
-	* @return Array the airport departure list
8612
-	*
8613
-	*/
8609
+	 * Counts all airport departure countries
8610
+	 *
8611
+	 * @return Array the airport departure list
8612
+	 *
8613
+	 */
8614 8614
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8615 8615
 	{
8616 8616
 		global $globalDBdriver;
@@ -8669,11 +8669,11 @@  discard block
 block discarded – undo
8669 8669
 	
8670 8670
 	
8671 8671
 	/**
8672
-	* Counts all airport arrival countries
8673
-	*
8674
-	* @return Array the airport arrival list
8675
-	*
8676
-	*/
8672
+	 * Counts all airport arrival countries
8673
+	 *
8674
+	 * @return Array the airport arrival list
8675
+	 *
8676
+	 */
8677 8677
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8678 8678
 	{
8679 8679
 		global $globalDBdriver;
@@ -8735,11 +8735,11 @@  discard block
 block discarded – undo
8735 8735
 
8736 8736
 
8737 8737
 	/**
8738
-	* Gets all route combinations
8739
-	*
8740
-	* @return Array the route list
8741
-	*
8742
-	*/
8738
+	 * Gets all route combinations
8739
+	 *
8740
+	 * @return Array the route list
8741
+	 *
8742
+	 */
8743 8743
 	public function countAllRoutes($filters = array())
8744 8744
 	{
8745 8745
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8778,11 +8778,11 @@  discard block
 block discarded – undo
8778 8778
 	
8779 8779
 	
8780 8780
 	/**
8781
-	* Gets all route combinations based on an aircraft
8782
-	*
8783
-	* @return Array the route list
8784
-	*
8785
-	*/
8781
+	 * Gets all route combinations based on an aircraft
8782
+	 *
8783
+	 * @return Array the route list
8784
+	 *
8785
+	 */
8786 8786
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8787 8787
 	{
8788 8788
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8818,11 +8818,11 @@  discard block
 block discarded – undo
8818 8818
 	
8819 8819
 	
8820 8820
 	/**
8821
-	* Gets all route combinations based on an aircraft registration
8822
-	*
8823
-	* @return Array the route list
8824
-	*
8825
-	*/
8821
+	 * Gets all route combinations based on an aircraft registration
8822
+	 *
8823
+	 * @return Array the route list
8824
+	 *
8825
+	 */
8826 8826
 	public function countAllRoutesByRegistration($registration, $filters = array())
8827 8827
 	{
8828 8828
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8860,11 +8860,11 @@  discard block
 block discarded – undo
8860 8860
 	
8861 8861
 	
8862 8862
 	/**
8863
-	* Gets all route combinations based on an airline
8864
-	*
8865
-	* @return Array the route list
8866
-	*
8867
-	*/
8863
+	 * Gets all route combinations based on an airline
8864
+	 *
8865
+	 * @return Array the route list
8866
+	 *
8867
+	 */
8868 8868
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8869 8869
 	{
8870 8870
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8902,11 +8902,11 @@  discard block
 block discarded – undo
8902 8902
 	
8903 8903
 	
8904 8904
 	/**
8905
-	* Gets all route combinations based on an airport
8906
-	*
8907
-	* @return Array the route list
8908
-	*
8909
-	*/
8905
+	 * Gets all route combinations based on an airport
8906
+	 *
8907
+	 * @return Array the route list
8908
+	 *
8909
+	 */
8910 8910
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8911 8911
 	{
8912 8912
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8943,11 +8943,11 @@  discard block
 block discarded – undo
8943 8943
 	
8944 8944
 	
8945 8945
 	/**
8946
-	* Gets all route combinations based on an country
8947
-	*
8948
-	* @return Array the route list
8949
-	*
8950
-	*/
8946
+	 * Gets all route combinations based on an country
8947
+	 *
8948
+	 * @return Array the route list
8949
+	 *
8950
+	 */
8951 8951
 	public function countAllRoutesByCountry($country, $filters = array())
8952 8952
 	{
8953 8953
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8983,11 +8983,11 @@  discard block
 block discarded – undo
8983 8983
 
8984 8984
 
8985 8985
 	/**
8986
-	* Gets all route combinations based on an date
8987
-	*
8988
-	* @return Array the route list
8989
-	*
8990
-	*/
8986
+	 * Gets all route combinations based on an date
8987
+	 *
8988
+	 * @return Array the route list
8989
+	 *
8990
+	 */
8991 8991
 	public function countAllRoutesByDate($date, $filters = array())
8992 8992
 	{
8993 8993
 		global $globalTimezone, $globalDBdriver;
@@ -9037,11 +9037,11 @@  discard block
 block discarded – undo
9037 9037
 	
9038 9038
 	
9039 9039
 	/**
9040
-	* Gets all route combinations based on an ident/callsign
9041
-	*
9042
-	* @return Array the route list
9043
-	*
9044
-	*/
9040
+	 * Gets all route combinations based on an ident/callsign
9041
+	 *
9042
+	 * @return Array the route list
9043
+	 *
9044
+	 */
9045 9045
 	public function countAllRoutesByIdent($ident, $filters = array())
9046 9046
 	{
9047 9047
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9077,11 +9077,11 @@  discard block
 block discarded – undo
9077 9077
 	}
9078 9078
 	
9079 9079
 	/**
9080
-	* Gets all route combinations based on an owner
9081
-	*
9082
-	* @return Array the route list
9083
-	*
9084
-	*/
9080
+	 * Gets all route combinations based on an owner
9081
+	 *
9082
+	 * @return Array the route list
9083
+	 *
9084
+	 */
9085 9085
 	public function countAllRoutesByOwner($owner,$filters = array())
9086 9086
 	{
9087 9087
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9117,11 +9117,11 @@  discard block
 block discarded – undo
9117 9117
 	}
9118 9118
 	
9119 9119
 	/**
9120
-	* Gets all route combinations based on a pilot
9121
-	*
9122
-	* @return Array the route list
9123
-	*
9124
-	*/
9120
+	 * Gets all route combinations based on a pilot
9121
+	 *
9122
+	 * @return Array the route list
9123
+	 *
9124
+	 */
9125 9125
 	public function countAllRoutesByPilot($pilot,$filters = array())
9126 9126
 	{
9127 9127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9158,11 +9158,11 @@  discard block
 block discarded – undo
9158 9158
 	
9159 9159
 	
9160 9160
 	/**
9161
-	* Gets all route combinations based on an manufacturer
9162
-	*
9163
-	* @return Array the route list
9164
-	*
9165
-	*/
9161
+	 * Gets all route combinations based on an manufacturer
9162
+	 *
9163
+	 * @return Array the route list
9164
+	 *
9165
+	 */
9166 9166
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9167 9167
 	{
9168 9168
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9200,11 +9200,11 @@  discard block
 block discarded – undo
9200 9200
 	
9201 9201
 	
9202 9202
 	/**
9203
-	* Gets all route combinations with waypoints
9204
-	*
9205
-	* @return Array the route list
9206
-	*
9207
-	*/
9203
+	 * Gets all route combinations with waypoints
9204
+	 *
9205
+	 * @return Array the route list
9206
+	 *
9207
+	 */
9208 9208
 	public function countAllRoutesWithWaypoints($filters = array())
9209 9209
 	{
9210 9210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9241,11 +9241,11 @@  discard block
 block discarded – undo
9241 9241
 	}
9242 9242
 	
9243 9243
 	/**
9244
-	* Gets all callsigns that have flown over
9245
-	*
9246
-	* @return Array the callsign list
9247
-	*
9248
-	*/
9244
+	 * Gets all callsigns that have flown over
9245
+	 *
9246
+	 * @return Array the callsign list
9247
+	 *
9248
+	 */
9249 9249
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9250 9250
 	{
9251 9251
 		global $globalDBdriver;
@@ -9311,11 +9311,11 @@  discard block
 block discarded – undo
9311 9311
 	}
9312 9312
 
9313 9313
 	/**
9314
-	* Gets all callsigns that have flown over
9315
-	*
9316
-	* @return Array the callsign list
9317
-	*
9318
-	*/
9314
+	 * Gets all callsigns that have flown over
9315
+	 *
9316
+	 * @return Array the callsign list
9317
+	 *
9318
+	 */
9319 9319
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9320 9320
 	{
9321 9321
 		global $globalDBdriver;
@@ -9356,11 +9356,11 @@  discard block
 block discarded – undo
9356 9356
 
9357 9357
 
9358 9358
 	/**
9359
-	* Counts all dates
9360
-	*
9361
-	* @return Array the date list
9362
-	*
9363
-	*/
9359
+	 * Counts all dates
9360
+	 *
9361
+	 * @return Array the date list
9362
+	 *
9363
+	 */
9364 9364
 	public function countAllDates($filters = array())
9365 9365
 	{
9366 9366
 		global $globalTimezone, $globalDBdriver;
@@ -9405,11 +9405,11 @@  discard block
 block discarded – undo
9405 9405
 	}
9406 9406
 	
9407 9407
 	/**
9408
-	* Counts all dates
9409
-	*
9410
-	* @return Array the date list
9411
-	*
9412
-	*/
9408
+	 * Counts all dates
9409
+	 *
9410
+	 * @return Array the date list
9411
+	 *
9412
+	 */
9413 9413
 	public function countAllDatesByAirlines($filters = array())
9414 9414
 	{
9415 9415
 		global $globalTimezone, $globalDBdriver;
@@ -9454,11 +9454,11 @@  discard block
 block discarded – undo
9454 9454
 	}	
9455 9455
 	
9456 9456
 	/**
9457
-	* Counts all dates during the last 7 days
9458
-	*
9459
-	* @return Array the date list
9460
-	*
9461
-	*/
9457
+	 * Counts all dates during the last 7 days
9458
+	 *
9459
+	 * @return Array the date list
9460
+	 *
9461
+	 */
9462 9462
 	public function countAllDatesLast7Days($filters = array())
9463 9463
 	{
9464 9464
 		global $globalTimezone, $globalDBdriver;
@@ -9480,7 +9480,7 @@  discard block
 block discarded – undo
9480 9480
 			$query .= " GROUP BY date_name 
9481 9481
 								ORDER BY date_name ASC";
9482 9482
 			$query_data = array(':offset' => $offset);
9483
-    		}
9483
+			}
9484 9484
 		
9485 9485
 		$sth = $this->db->prepare($query);
9486 9486
 		$sth->execute($query_data);
@@ -9500,11 +9500,11 @@  discard block
 block discarded – undo
9500 9500
 	}
9501 9501
 
9502 9502
 	/**
9503
-	* Counts all dates during the last month
9504
-	*
9505
-	* @return Array the date list
9506
-	*
9507
-	*/
9503
+	 * Counts all dates during the last month
9504
+	 *
9505
+	 * @return Array the date list
9506
+	 *
9507
+	 */
9508 9508
 	public function countAllDatesLastMonth($filters = array())
9509 9509
 	{
9510 9510
 		global $globalTimezone, $globalDBdriver;
@@ -9526,7 +9526,7 @@  discard block
 block discarded – undo
9526 9526
 			$query .= " GROUP BY date_name 
9527 9527
 								ORDER BY date_name ASC";
9528 9528
 			$query_data = array(':offset' => $offset);
9529
-    		}
9529
+			}
9530 9530
 		
9531 9531
 		$sth = $this->db->prepare($query);
9532 9532
 		$sth->execute($query_data);
@@ -9547,11 +9547,11 @@  discard block
 block discarded – undo
9547 9547
 
9548 9548
 
9549 9549
 	/**
9550
-	* Counts all dates during the last month
9551
-	*
9552
-	* @return Array the date list
9553
-	*
9554
-	*/
9550
+	 * Counts all dates during the last month
9551
+	 *
9552
+	 * @return Array the date list
9553
+	 *
9554
+	 */
9555 9555
 	public function countAllDatesLastMonthByAirlines($filters = array())
9556 9556
 	{
9557 9557
 		global $globalTimezone, $globalDBdriver;
@@ -9574,7 +9574,7 @@  discard block
 block discarded – undo
9574 9574
 								GROUP BY spotter_output.airline_icao, date_name 
9575 9575
 								ORDER BY date_name ASC";
9576 9576
 			$query_data = array(':offset' => $offset);
9577
-    		}
9577
+			}
9578 9578
 		
9579 9579
 		$sth = $this->db->prepare($query);
9580 9580
 		$sth->execute($query_data);
@@ -9596,11 +9596,11 @@  discard block
 block discarded – undo
9596 9596
 	
9597 9597
 
9598 9598
 	/**
9599
-	* Counts all month
9600
-	*
9601
-	* @return Array the month list
9602
-	*
9603
-	*/
9599
+	 * Counts all month
9600
+	 *
9601
+	 * @return Array the month list
9602
+	 *
9603
+	 */
9604 9604
 	public function countAllMonths($filters = array())
9605 9605
 	{
9606 9606
 		global $globalTimezone, $globalDBdriver;
@@ -9642,11 +9642,11 @@  discard block
 block discarded – undo
9642 9642
 	}
9643 9643
 
9644 9644
 	/**
9645
-	* Counts all month
9646
-	*
9647
-	* @return Array the month list
9648
-	*
9649
-	*/
9645
+	 * Counts all month
9646
+	 *
9647
+	 * @return Array the month list
9648
+	 *
9649
+	 */
9650 9650
 	public function countAllMonthsByAirlines($filters = array())
9651 9651
 	{
9652 9652
 		global $globalTimezone, $globalDBdriver;
@@ -9691,11 +9691,11 @@  discard block
 block discarded – undo
9691 9691
 	}
9692 9692
 
9693 9693
 	/**
9694
-	* Counts all military month
9695
-	*
9696
-	* @return Array the month list
9697
-	*
9698
-	*/
9694
+	 * Counts all military month
9695
+	 *
9696
+	 * @return Array the month list
9697
+	 *
9698
+	 */
9699 9699
 	public function countAllMilitaryMonths($filters = array())
9700 9700
 	{
9701 9701
 		global $globalTimezone, $globalDBdriver;
@@ -9736,11 +9736,11 @@  discard block
 block discarded – undo
9736 9736
 	}
9737 9737
 	
9738 9738
 	/**
9739
-	* Counts all month owners
9740
-	*
9741
-	* @return Array the month list
9742
-	*
9743
-	*/
9739
+	 * Counts all month owners
9740
+	 *
9741
+	 * @return Array the month list
9742
+	 *
9743
+	 */
9744 9744
 	public function countAllMonthsOwners($filters = array())
9745 9745
 	{
9746 9746
 		global $globalTimezone, $globalDBdriver;
@@ -9782,11 +9782,11 @@  discard block
 block discarded – undo
9782 9782
 	}
9783 9783
 	
9784 9784
 	/**
9785
-	* Counts all month owners
9786
-	*
9787
-	* @return Array the month list
9788
-	*
9789
-	*/
9785
+	 * Counts all month owners
9786
+	 *
9787
+	 * @return Array the month list
9788
+	 *
9789
+	 */
9790 9790
 	public function countAllMonthsOwnersByAirlines($filters = array())
9791 9791
 	{
9792 9792
 		global $globalTimezone, $globalDBdriver;
@@ -9829,11 +9829,11 @@  discard block
 block discarded – undo
9829 9829
 	}
9830 9830
 
9831 9831
 	/**
9832
-	* Counts all month pilot
9833
-	*
9834
-	* @return Array the month list
9835
-	*
9836
-	*/
9832
+	 * Counts all month pilot
9833
+	 *
9834
+	 * @return Array the month list
9835
+	 *
9836
+	 */
9837 9837
 	public function countAllMonthsPilots($filters = array())
9838 9838
 	{
9839 9839
 		global $globalTimezone, $globalDBdriver;
@@ -9875,11 +9875,11 @@  discard block
 block discarded – undo
9875 9875
 	}
9876 9876
 	
9877 9877
 	/**
9878
-	* Counts all month pilot
9879
-	*
9880
-	* @return Array the month list
9881
-	*
9882
-	*/
9878
+	 * Counts all month pilot
9879
+	 *
9880
+	 * @return Array the month list
9881
+	 *
9882
+	 */
9883 9883
 	public function countAllMonthsPilotsByAirlines($filters = array())
9884 9884
 	{
9885 9885
 		global $globalTimezone, $globalDBdriver;
@@ -9922,11 +9922,11 @@  discard block
 block discarded – undo
9922 9922
 	}
9923 9923
 
9924 9924
 	/**
9925
-	* Counts all month airline
9926
-	*
9927
-	* @return Array the month list
9928
-	*
9929
-	*/
9925
+	 * Counts all month airline
9926
+	 *
9927
+	 * @return Array the month list
9928
+	 *
9929
+	 */
9930 9930
 	public function countAllMonthsAirlines($filters = array())
9931 9931
 	{
9932 9932
 		global $globalTimezone, $globalDBdriver;
@@ -9968,11 +9968,11 @@  discard block
 block discarded – undo
9968 9968
 	}
9969 9969
 	
9970 9970
 	/**
9971
-	* Counts all month aircraft
9972
-	*
9973
-	* @return Array the month list
9974
-	*
9975
-	*/
9971
+	 * Counts all month aircraft
9972
+	 *
9973
+	 * @return Array the month list
9974
+	 *
9975
+	 */
9976 9976
 	public function countAllMonthsAircrafts($filters = array())
9977 9977
 	{
9978 9978
 		global $globalTimezone, $globalDBdriver;
@@ -10015,11 +10015,11 @@  discard block
 block discarded – undo
10015 10015
 	
10016 10016
 
10017 10017
 	/**
10018
-	* Counts all month aircraft
10019
-	*
10020
-	* @return Array the month list
10021
-	*
10022
-	*/
10018
+	 * Counts all month aircraft
10019
+	 *
10020
+	 * @return Array the month list
10021
+	 *
10022
+	 */
10023 10023
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10024 10024
 	{
10025 10025
 		global $globalTimezone, $globalDBdriver;
@@ -10062,11 +10062,11 @@  discard block
 block discarded – undo
10062 10062
 	}
10063 10063
 
10064 10064
 	/**
10065
-	* Counts all month real arrival
10066
-	*
10067
-	* @return Array the month list
10068
-	*
10069
-	*/
10065
+	 * Counts all month real arrival
10066
+	 *
10067
+	 * @return Array the month list
10068
+	 *
10069
+	 */
10070 10070
 	public function countAllMonthsRealArrivals($filters = array())
10071 10071
 	{
10072 10072
 		global $globalTimezone, $globalDBdriver;
@@ -10109,11 +10109,11 @@  discard block
 block discarded – undo
10109 10109
 	
10110 10110
 
10111 10111
 	/**
10112
-	* Counts all month real arrival
10113
-	*
10114
-	* @return Array the month list
10115
-	*
10116
-	*/
10112
+	 * Counts all month real arrival
10113
+	 *
10114
+	 * @return Array the month list
10115
+	 *
10116
+	 */
10117 10117
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10118 10118
 	{
10119 10119
 		global $globalTimezone, $globalDBdriver;
@@ -10157,11 +10157,11 @@  discard block
 block discarded – undo
10157 10157
 	
10158 10158
 
10159 10159
 	/**
10160
-	* Counts all dates during the last year
10161
-	*
10162
-	* @return Array the date list
10163
-	*
10164
-	*/
10160
+	 * Counts all dates during the last year
10161
+	 *
10162
+	 * @return Array the date list
10163
+	 *
10164
+	 */
10165 10165
 	public function countAllMonthsLastYear($filters)
10166 10166
 	{
10167 10167
 		global $globalTimezone, $globalDBdriver;
@@ -10183,7 +10183,7 @@  discard block
 block discarded – undo
10183 10183
 			$query .= " GROUP BY year_name, month_name
10184 10184
 								ORDER BY year_name, month_name ASC";
10185 10185
 			$query_data = array(':offset' => $offset);
10186
-    		}
10186
+			}
10187 10187
 		
10188 10188
 		$sth = $this->db->prepare($query);
10189 10189
 		$sth->execute($query_data);
@@ -10206,11 +10206,11 @@  discard block
 block discarded – undo
10206 10206
 	
10207 10207
 	
10208 10208
 	/**
10209
-	* Counts all hours
10210
-	*
10211
-	* @return Array the hour list
10212
-	*
10213
-	*/
10209
+	 * Counts all hours
10210
+	 *
10211
+	 * @return Array the hour list
10212
+	 *
10213
+	 */
10214 10214
 	public function countAllHours($orderby,$filters = array())
10215 10215
 	{
10216 10216
 		global $globalTimezone, $globalDBdriver;
@@ -10271,11 +10271,11 @@  discard block
 block discarded – undo
10271 10271
 	}
10272 10272
 	
10273 10273
 	/**
10274
-	* Counts all hours
10275
-	*
10276
-	* @return Array the hour list
10277
-	*
10278
-	*/
10274
+	 * Counts all hours
10275
+	 *
10276
+	 * @return Array the hour list
10277
+	 *
10278
+	 */
10279 10279
 	public function countAllHoursByAirlines($orderby, $filters = array())
10280 10280
 	{
10281 10281
 		global $globalTimezone, $globalDBdriver;
@@ -10338,11 +10338,11 @@  discard block
 block discarded – undo
10338 10338
 
10339 10339
 
10340 10340
 	/**
10341
-	* Counts all hours by airline
10342
-	*
10343
-	* @return Array the hour list
10344
-	*
10345
-	*/
10341
+	 * Counts all hours by airline
10342
+	 *
10343
+	 * @return Array the hour list
10344
+	 *
10345
+	 */
10346 10346
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10347 10347
 	{
10348 10348
 		global $globalTimezone, $globalDBdriver;
@@ -10388,11 +10388,11 @@  discard block
 block discarded – undo
10388 10388
 	
10389 10389
 	
10390 10390
 	/**
10391
-	* Counts all hours by aircraft
10392
-	*
10393
-	* @return Array the hour list
10394
-	*
10395
-	*/
10391
+	 * Counts all hours by aircraft
10392
+	 *
10393
+	 * @return Array the hour list
10394
+	 *
10395
+	 */
10396 10396
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10397 10397
 	{
10398 10398
 		global $globalTimezone, $globalDBdriver;
@@ -10435,11 +10435,11 @@  discard block
 block discarded – undo
10435 10435
 	
10436 10436
 	
10437 10437
 	/**
10438
-	* Counts all hours by aircraft registration
10439
-	*
10440
-	* @return Array the hour list
10441
-	*
10442
-	*/
10438
+	 * Counts all hours by aircraft registration
10439
+	 *
10440
+	 * @return Array the hour list
10441
+	 *
10442
+	 */
10443 10443
 	public function countAllHoursByRegistration($registration, $filters = array())
10444 10444
 	{
10445 10445
 		global $globalTimezone, $globalDBdriver;
@@ -10482,11 +10482,11 @@  discard block
 block discarded – undo
10482 10482
 	
10483 10483
 	
10484 10484
 	/**
10485
-	* Counts all hours by airport
10486
-	*
10487
-	* @return Array the hour list
10488
-	*
10489
-	*/
10485
+	 * Counts all hours by airport
10486
+	 *
10487
+	 * @return Array the hour list
10488
+	 *
10489
+	 */
10490 10490
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10491 10491
 	{
10492 10492
 		global $globalTimezone, $globalDBdriver;
@@ -10530,11 +10530,11 @@  discard block
 block discarded – undo
10530 10530
 	
10531 10531
 	
10532 10532
 	/**
10533
-	* Counts all hours by manufacturer
10534
-	*
10535
-	* @return Array the hour list
10536
-	*
10537
-	*/
10533
+	 * Counts all hours by manufacturer
10534
+	 *
10535
+	 * @return Array the hour list
10536
+	 *
10537
+	 */
10538 10538
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10539 10539
 	{
10540 10540
 		global $globalTimezone, $globalDBdriver;
@@ -10578,11 +10578,11 @@  discard block
 block discarded – undo
10578 10578
 	
10579 10579
 	
10580 10580
 	/**
10581
-	* Counts all hours by date
10582
-	*
10583
-	* @return Array the hour list
10584
-	*
10585
-	*/
10581
+	 * Counts all hours by date
10582
+	 *
10583
+	 * @return Array the hour list
10584
+	 *
10585
+	 */
10586 10586
 	public function countAllHoursByDate($date, $filters = array())
10587 10587
 	{
10588 10588
 		global $globalTimezone, $globalDBdriver;
@@ -10626,11 +10626,11 @@  discard block
 block discarded – undo
10626 10626
 	
10627 10627
 	
10628 10628
 	/**
10629
-	* Counts all hours by a ident/callsign
10630
-	*
10631
-	* @return Array the hour list
10632
-	*
10633
-	*/
10629
+	 * Counts all hours by a ident/callsign
10630
+	 *
10631
+	 * @return Array the hour list
10632
+	 *
10633
+	 */
10634 10634
 	public function countAllHoursByIdent($ident, $filters = array())
10635 10635
 	{
10636 10636
 		global $globalTimezone, $globalDBdriver;
@@ -10673,11 +10673,11 @@  discard block
 block discarded – undo
10673 10673
 	}
10674 10674
 	
10675 10675
 	/**
10676
-	* Counts all hours by a owner
10677
-	*
10678
-	* @return Array the hour list
10679
-	*
10680
-	*/
10676
+	 * Counts all hours by a owner
10677
+	 *
10678
+	 * @return Array the hour list
10679
+	 *
10680
+	 */
10681 10681
 	public function countAllHoursByOwner($owner, $filters = array())
10682 10682
 	{
10683 10683
 		global $globalTimezone, $globalDBdriver;
@@ -10720,11 +10720,11 @@  discard block
 block discarded – undo
10720 10720
 	}
10721 10721
 	
10722 10722
 	/**
10723
-	* Counts all hours by a pilot
10724
-	*
10725
-	* @return Array the hour list
10726
-	*
10727
-	*/
10723
+	 * Counts all hours by a pilot
10724
+	 *
10725
+	 * @return Array the hour list
10726
+	 *
10727
+	 */
10728 10728
 	public function countAllHoursByPilot($pilot, $filters = array())
10729 10729
 	{
10730 10730
 		global $globalTimezone, $globalDBdriver;
@@ -10769,11 +10769,11 @@  discard block
 block discarded – undo
10769 10769
 	
10770 10770
 	
10771 10771
 	/**
10772
-	* Counts all hours by route
10773
-	*
10774
-	* @return Array the hour list
10775
-	*
10776
-	*/
10772
+	 * Counts all hours by route
10773
+	 *
10774
+	 * @return Array the hour list
10775
+	 *
10776
+	 */
10777 10777
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10778 10778
 	{
10779 10779
 		global $globalTimezone, $globalDBdriver;
@@ -10817,11 +10817,11 @@  discard block
 block discarded – undo
10817 10817
 	
10818 10818
 	
10819 10819
 	/**
10820
-	* Counts all hours by country
10821
-	*
10822
-	* @return Array the hour list
10823
-	*
10824
-	*/
10820
+	 * Counts all hours by country
10821
+	 *
10822
+	 * @return Array the hour list
10823
+	 *
10824
+	 */
10825 10825
 	public function countAllHoursByCountry($country, $filters = array())
10826 10826
 	{
10827 10827
 		global $globalTimezone, $globalDBdriver;
@@ -10866,11 +10866,11 @@  discard block
 block discarded – undo
10866 10866
 
10867 10867
 
10868 10868
 	/**
10869
-	* Counts all aircraft that have flown over
10870
-	*
10871
-	* @return Integer the number of aircrafts
10872
-	*
10873
-	*/
10869
+	 * Counts all aircraft that have flown over
10870
+	 *
10871
+	 * @return Integer the number of aircrafts
10872
+	 *
10873
+	 */
10874 10874
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10875 10875
 	{
10876 10876
 		global $globalDBdriver;
@@ -10903,11 +10903,11 @@  discard block
 block discarded – undo
10903 10903
 	}
10904 10904
 
10905 10905
 	/**
10906
-	* Counts all flight that really arrival
10907
-	*
10908
-	* @return Integer the number of aircrafts
10909
-	*
10910
-	*/
10906
+	 * Counts all flight that really arrival
10907
+	 *
10908
+	 * @return Integer the number of aircrafts
10909
+	 *
10910
+	 */
10911 10911
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10912 10912
 	{
10913 10913
 		global $globalDBdriver;
@@ -10940,11 +10940,11 @@  discard block
 block discarded – undo
10940 10940
 	}
10941 10941
 
10942 10942
 	/**
10943
-	* Counts all pilots that have flown over
10944
-	*
10945
-	* @return Integer the number of pilots
10946
-	*
10947
-	*/
10943
+	 * Counts all pilots that have flown over
10944
+	 *
10945
+	 * @return Integer the number of pilots
10946
+	 *
10947
+	 */
10948 10948
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10949 10949
 	{
10950 10950
 		global $globalDBdriver;
@@ -10976,11 +10976,11 @@  discard block
 block discarded – undo
10976 10976
 	}
10977 10977
 
10978 10978
 	/**
10979
-	* Counts all owners that have flown over
10980
-	*
10981
-	* @return Integer the number of owners
10982
-	*
10983
-	*/
10979
+	 * Counts all owners that have flown over
10980
+	 *
10981
+	 * @return Integer the number of owners
10982
+	 *
10983
+	 */
10984 10984
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10985 10985
 	{
10986 10986
 		global $globalDBdriver;
@@ -11013,11 +11013,11 @@  discard block
 block discarded – undo
11013 11013
 	
11014 11014
 	
11015 11015
 	/**
11016
-	* Counts all flights that have flown over
11017
-	*
11018
-	* @return Integer the number of flights
11019
-	*
11020
-	*/
11016
+	 * Counts all flights that have flown over
11017
+	 *
11018
+	 * @return Integer the number of flights
11019
+	 *
11020
+	 */
11021 11021
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
11022 11022
 	{
11023 11023
 		global $globalDBdriver;
@@ -11051,11 +11051,11 @@  discard block
 block discarded – undo
11051 11051
 	}
11052 11052
 	
11053 11053
 	/**
11054
-	* Counts all military flights that have flown over
11055
-	*
11056
-	* @return Integer the number of flights
11057
-	*
11058
-	*/
11054
+	 * Counts all military flights that have flown over
11055
+	 *
11056
+	 * @return Integer the number of flights
11057
+	 *
11058
+	 */
11059 11059
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11060 11060
 	{
11061 11061
 		global $globalDBdriver;
@@ -11090,11 +11090,11 @@  discard block
 block discarded – undo
11090 11090
 	
11091 11091
 	
11092 11092
 	/**
11093
-	* Counts all airlines that have flown over
11094
-	*
11095
-	* @return Integer the number of airlines
11096
-	*
11097
-	*/
11093
+	 * Counts all airlines that have flown over
11094
+	 *
11095
+	 * @return Integer the number of airlines
11096
+	 *
11097
+	 */
11098 11098
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11099 11099
 	{
11100 11100
 		global $globalDBdriver;
@@ -11121,8 +11121,8 @@  discard block
 block discarded – undo
11121 11121
 				$query_values = array_merge($query_values,array(':month' => $month));
11122 11122
 			}
11123 11123
 		}
11124
-                if ($query == '') $queryi .= $this->getFilter($filters);
11125
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11124
+				if ($query == '') $queryi .= $this->getFilter($filters);
11125
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11126 11126
 
11127 11127
 
11128 11128
 		$sth = $this->db->prepare($queryi);
@@ -11132,11 +11132,11 @@  discard block
 block discarded – undo
11132 11132
 
11133 11133
   
11134 11134
 	/**
11135
-	* Counts all hours of today
11136
-	*
11137
-	* @return Array the hour list
11138
-	*
11139
-	*/
11135
+	 * Counts all hours of today
11136
+	 *
11137
+	 * @return Array the hour list
11138
+	 *
11139
+	 */
11140 11140
 	public function countAllHoursFromToday($filters = array())
11141 11141
 	{
11142 11142
 		global $globalTimezone, $globalDBdriver;
@@ -11176,11 +11176,11 @@  discard block
 block discarded – undo
11176 11176
 	}
11177 11177
     
11178 11178
 	/**
11179
-	* Gets all the spotter information based on calculated upcoming flights
11180
-	*
11181
-	* @return Array the spotter information
11182
-	*
11183
-	*/
11179
+	 * Gets all the spotter information based on calculated upcoming flights
11180
+	 *
11181
+	 * @return Array the spotter information
11182
+	 *
11183
+	 */
11184 11184
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11185 11185
 	{
11186 11186
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11255,12 +11255,12 @@  discard block
 block discarded – undo
11255 11255
 	}
11256 11256
     
11257 11257
     
11258
-     /**
11259
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11260
-	*
11261
-	* @return Integer the Barrie Spotter ID
11258
+	 /**
11259
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11260
+	  *
11261
+	  * @return Integer the Barrie Spotter ID
11262 11262
 q	*
11263
-	*/
11263
+	  */
11264 11264
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11265 11265
 	{
11266 11266
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11281,13 +11281,13 @@  discard block
 block discarded – undo
11281 11281
   
11282 11282
  
11283 11283
 	/**
11284
-	* Parses a date string
11285
-	*
11286
-	* @param String $dateString the date string
11287
-	* @param String $timezone the timezone of a user
11288
-	* @return Array the time information
11289
-	*
11290
-	*/
11284
+	 * Parses a date string
11285
+	 *
11286
+	 * @param String $dateString the date string
11287
+	 * @param String $timezone the timezone of a user
11288
+	 * @return Array the time information
11289
+	 *
11290
+	 */
11291 11291
 	public function parseDateString($dateString, $timezone = '')
11292 11292
 	{
11293 11293
 		$time_array = array();
@@ -11323,12 +11323,12 @@  discard block
 block discarded – undo
11323 11323
 	
11324 11324
 	
11325 11325
 	/**
11326
-	* Parses the direction degrees to working
11327
-	*
11328
-	* @param Float $direction the direction in degrees
11329
-	* @return Array the direction information
11330
-	*
11331
-	*/
11326
+	 * Parses the direction degrees to working
11327
+	 *
11328
+	 * @param Float $direction the direction in degrees
11329
+	 * @return Array the direction information
11330
+	 *
11331
+	 */
11332 11332
 	public function parseDirection($direction = 0)
11333 11333
 	{
11334 11334
 		if ($direction == '') $direction = 0;
@@ -11407,12 +11407,12 @@  discard block
 block discarded – undo
11407 11407
 	
11408 11408
 	
11409 11409
 	/**
11410
-	* Gets the aircraft registration
11411
-	*
11412
-	* @param String $flightaware_id the flight aware id
11413
-	* @return String the aircraft registration
11414
-	*
11415
-	*/
11410
+	 * Gets the aircraft registration
11411
+	 *
11412
+	 * @param String $flightaware_id the flight aware id
11413
+	 * @return String the aircraft registration
11414
+	 *
11415
+	 */
11416 11416
 	
11417 11417
 	public function getAircraftRegistration($flightaware_id)
11418 11418
 	{
@@ -11441,12 +11441,12 @@  discard block
 block discarded – undo
11441 11441
 
11442 11442
 
11443 11443
 	/**
11444
-	* Gets the aircraft registration from ModeS
11445
-	*
11446
-	* @param String $aircraft_modes the flight ModeS in hex
11447
-	* @return String the aircraft registration
11448
-	*
11449
-	*/
11444
+	 * Gets the aircraft registration from ModeS
11445
+	 *
11446
+	 * @param String $aircraft_modes the flight ModeS in hex
11447
+	 * @return String the aircraft registration
11448
+	 *
11449
+	 */
11450 11450
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11451 11451
 	{
11452 11452
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11462,8 +11462,8 @@  discard block
 block discarded – undo
11462 11462
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11463 11463
 		$sth->closeCursor();
11464 11464
 		if (count($row) > 0) {
11465
-		    //return $row['Registration'];
11466
-		    return $row['registration'];
11465
+			//return $row['Registration'];
11466
+			return $row['registration'];
11467 11467
 		} elseif ($source_type == 'flarm') {
11468 11468
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11469 11469
 		} else return '';
@@ -11471,12 +11471,12 @@  discard block
 block discarded – undo
11471 11471
 	}
11472 11472
 
11473 11473
 	/**
11474
-	* Gets the aircraft type from ModeS
11475
-	*
11476
-	* @param String $aircraft_modes the flight ModeS in hex
11477
-	* @return String the aircraft type
11478
-	*
11479
-	*/
11474
+	 * Gets the aircraft type from ModeS
11475
+	 *
11476
+	 * @param String $aircraft_modes the flight ModeS in hex
11477
+	 * @return String the aircraft type
11478
+	 *
11479
+	 */
11480 11480
 	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11481 11481
 	{
11482 11482
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11502,12 +11502,12 @@  discard block
 block discarded – undo
11502 11502
 	}
11503 11503
 
11504 11504
 	/**
11505
-	* Gets Country from latitude/longitude
11506
-	*
11507
-	* @param Float $latitude latitute of the flight
11508
-	* @param Float $longitude longitute of the flight
11509
-	* @return String the countrie
11510
-	*/
11505
+	 * Gets Country from latitude/longitude
11506
+	 *
11507
+	 * @param Float $latitude latitute of the flight
11508
+	 * @param Float $longitude longitute of the flight
11509
+	 * @return String the countrie
11510
+	 */
11511 11511
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11512 11512
 	{
11513 11513
 		global $globalDBdriver, $globalDebug;
@@ -11544,11 +11544,11 @@  discard block
 block discarded – undo
11544 11544
 	}
11545 11545
 
11546 11546
 	/**
11547
-	* Gets Country from iso2
11548
-	*
11549
-	* @param String $iso2 ISO2 country code
11550
-	* @return String the countrie
11551
-	*/
11547
+	 * Gets Country from iso2
11548
+	 *
11549
+	 * @param String $iso2 ISO2 country code
11550
+	 * @return String the countrie
11551
+	 */
11552 11552
 	public function getCountryFromISO2($iso2)
11553 11553
 	{
11554 11554
 		global $globalDBdriver, $globalDebug;
@@ -11576,12 +11576,12 @@  discard block
 block discarded – undo
11576 11576
 	}
11577 11577
 
11578 11578
 	/**
11579
-	* converts the registration code using the country prefix
11580
-	*
11581
-	* @param String $registration the aircraft registration
11582
-	* @return String the aircraft registration
11583
-	*
11584
-	*/
11579
+	 * converts the registration code using the country prefix
11580
+	 *
11581
+	 * @param String $registration the aircraft registration
11582
+	 * @return String the aircraft registration
11583
+	 *
11584
+	 */
11585 11585
 	public function convertAircraftRegistration($registration)
11586 11586
 	{
11587 11587
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11633,12 +11633,12 @@  discard block
 block discarded – undo
11633 11633
 	}
11634 11634
 
11635 11635
 	/**
11636
-	* Country from the registration code
11637
-	*
11638
-	* @param String $registration the aircraft registration
11639
-	* @return String the country
11640
-	*
11641
-	*/
11636
+	 * Country from the registration code
11637
+	 *
11638
+	 * @param String $registration the aircraft registration
11639
+	 * @return String the country
11640
+	 *
11641
+	 */
11642 11642
 	public function countryFromAircraftRegistration($registration)
11643 11643
 	{
11644 11644
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11657,8 +11657,8 @@  discard block
 block discarded – undo
11657 11657
 				$country = $row['country'];
11658 11658
 			}
11659 11659
 		} else {
11660
-    			$registration_1 = substr($registration, 0, 1);
11661
-		        $registration_2 = substr($registration, 0, 2);
11660
+				$registration_1 = substr($registration, 0, 1);
11661
+				$registration_2 = substr($registration, 0, 2);
11662 11662
 
11663 11663
 			$country = '';
11664 11664
 			//first get the prefix based on two characters
@@ -11694,12 +11694,12 @@  discard block
 block discarded – undo
11694 11694
 	}
11695 11695
 
11696 11696
 	/**
11697
-	* Registration prefix from the registration code
11698
-	*
11699
-	* @param String $registration the aircraft registration
11700
-	* @return String the registration prefix
11701
-	*
11702
-	*/
11697
+	 * Registration prefix from the registration code
11698
+	 *
11699
+	 * @param String $registration the aircraft registration
11700
+	 * @return String the registration prefix
11701
+	 *
11702
+	 */
11703 11703
 	public function registrationPrefixFromAircraftRegistration($registration)
11704 11704
 	{
11705 11705
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11718,8 +11718,8 @@  discard block
 block discarded – undo
11718 11718
 				//$country = $row['country'];
11719 11719
 			}
11720 11720
 		} else {
11721
-    			$registration_1 = substr($registration, 0, 1);
11722
-		        $registration_2 = substr($registration, 0, 2);
11721
+				$registration_1 = substr($registration, 0, 1);
11722
+				$registration_2 = substr($registration, 0, 2);
11723 11723
 
11724 11724
 			//first get the prefix based on two characters
11725 11725
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11755,12 +11755,12 @@  discard block
 block discarded – undo
11755 11755
 
11756 11756
 
11757 11757
 	/**
11758
-	* Country from the registration code
11759
-	*
11760
-	* @param String $registration the aircraft registration
11761
-	* @return String the country
11762
-	*
11763
-	*/
11758
+	 * Country from the registration code
11759
+	 *
11760
+	 * @param String $registration the aircraft registration
11761
+	 * @return String the country
11762
+	 *
11763
+	 */
11764 11764
 	public function countryFromAircraftRegistrationCode($registration)
11765 11765
 	{
11766 11766
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11777,11 +11777,11 @@  discard block
 block discarded – undo
11777 11777
 	}
11778 11778
 	
11779 11779
 	/**
11780
-	* Set a new highlight value for a flight
11781
-	*
11782
-	* @param String $flightaware_id flightaware_id from spotter_output table
11783
-	* @param String $highlight New highlight value
11784
-	*/
11780
+	 * Set a new highlight value for a flight
11781
+	 *
11782
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11783
+	 * @param String $highlight New highlight value
11784
+	 */
11785 11785
 	public function setHighlightFlight($flightaware_id,$highlight) {
11786 11786
 		
11787 11787
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11790,12 +11790,12 @@  discard block
 block discarded – undo
11790 11790
 	}
11791 11791
 
11792 11792
 	/**
11793
-	* Set a new highlight value for a flight by Registration
11794
-	*
11795
-	* @param String $registration Registration of the aircraft
11796
-	* @param String $date Date of spotted aircraft
11797
-	* @param String $highlight New highlight value
11798
-	*/
11793
+	 * Set a new highlight value for a flight by Registration
11794
+	 *
11795
+	 * @param String $registration Registration of the aircraft
11796
+	 * @param String $date Date of spotted aircraft
11797
+	 * @param String $highlight New highlight value
11798
+	 */
11799 11799
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11800 11800
 		if ($date == '') {
11801 11801
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11809,12 +11809,12 @@  discard block
 block discarded – undo
11809 11809
 	}
11810 11810
 	
11811 11811
 	/**
11812
-	* Gets the short url from bit.ly
11813
-	*
11814
-	* @param String $url the full url
11815
-	* @return String the bit.ly url
11816
-	*
11817
-	*/
11812
+	 * Gets the short url from bit.ly
11813
+	 *
11814
+	 * @param String $url the full url
11815
+	 * @return String the bit.ly url
11816
+	 *
11817
+	 */
11818 11818
 	public function getBitlyURL($url)
11819 11819
 	{
11820 11820
 		global $globalBitlyAccessToken;
@@ -12103,11 +12103,11 @@  discard block
 block discarded – undo
12103 12103
 			$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 
12104 12104
 	                      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)) 
12105 12105
 	                      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;";
12106
-                } else {
12106
+				} else {
12107 12107
 			$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 
12108 12108
 	                      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)) 
12109 12109
 	                      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;";
12110
-    		}
12110
+			}
12111 12111
 		$sth = $this->db->prepare($query);
12112 12112
 		$sth->execute();
12113 12113
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 require_once(dirname(__FILE__).'/class.Common.php');
4 4
 class aprs {
5
-    private $socket;
6
-    private $connected = false;
5
+	private $socket;
6
+	private $connected = false;
7 7
 
8
-    protected $symbols = array('!' => 'Police',
8
+	protected $symbols = array('!' => 'Police',
9 9
 	'#' => 'DIGI',
10 10
 	'$' => 'Phone',
11 11
 	'%' => 'DX Cluster',
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	'y' => 'Yagi At QTH');
90 90
 	
91 91
 
92
-    private function urshift($n, $s) {
92
+	private function urshift($n, $s) {
93 93
 	return ($n >= 0) ? ($n >> $s) :
94
-	    (($n & 0x7fffffff) >> $s) | 
94
+		(($n & 0x7fffffff) >> $s) | 
95 95
 		(0x40000000 >> ($s - 1));
96
-    }
96
+	}
97 97
 
98
-    public function parse($input) {
98
+	public function parse($input) {
99 99
 	global $globalDebug;
100 100
 	$debug = false;
101 101
 	$result = array();
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 	
108 108
 	/* Check that end was found and body has at least one byte. */
109 109
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
110
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
111
-	    return false;
110
+		if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
111
+		return false;
112 112
 	}
113 113
 	
114 114
 	if ($debug) echo 'input : '.$input."\n";
@@ -122,31 +122,31 @@  discard block
 block discarded – undo
122 122
 	/* Parse source, target and path. */
123 123
 	//FLRDF0A52>APRS,qAS,LSTB
124 124
 	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
125
-	    $ident = $matches[1];
126
-	    $all_elements = $matches[2];
127
-	    if ($ident == 'AIRCRAFT') {
125
+		$ident = $matches[1];
126
+		$all_elements = $matches[2];
127
+		if ($ident == 'AIRCRAFT') {
128 128
 		$result['format_source'] = 'famaprs';
129 129
 		$result['source_type'] = 'modes';
130
-	    } elseif ($ident == 'MARINE') {
130
+		} elseif ($ident == 'MARINE') {
131 131
 		$result['format_source'] = 'famaprs';
132 132
 		$result['source_type'] = 'ais';
133
-	    } else {
133
+		} else {
134 134
 		if ($debug) echo 'ident : '.$ident."\n";
135 135
 		$result['ident'] = $ident;
136
-	    }
136
+		}
137 137
 	} else return false;
138 138
 	$elements = explode(',',$all_elements);
139 139
 	$source = end($elements);
140 140
 	$result['source'] = $source;
141 141
 	foreach ($elements as $element) {
142
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
143
-	        //echo "ok";
144
-	        //if ($element == 'TCPIP*') return false;
145
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
142
+		if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
143
+			//echo "ok";
144
+			//if ($element == 'TCPIP*') return false;
145
+		} elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
146 146
 		if ($debug) echo 'element : '.$element."\n";
147 147
 		return false;
148
-	    }
149
-	    /*
148
+		}
149
+		/*
150 150
 	    } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) {
151 151
 		//echo "ok";
152 152
 	    } else {
@@ -171,49 +171,49 @@  discard block
 block discarded – undo
171 171
 	$body_parse = substr($body,1);
172 172
 	//echo 'Body : '.$body."\n";
173 173
 	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
174
-	    $body_parse = substr($body_parse,10);
175
-	    $find = true;
176
-	    //echo $body_parse."\n";
174
+		$body_parse = substr($body_parse,10);
175
+		$find = true;
176
+		//echo $body_parse."\n";
177 177
 	}
178 178
 	if (preg_match('/^`(.*)\//',$body,$matches)) {
179
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
180
-	    $find = true;
181
-	    //echo $body_parse."\n";
179
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
180
+		$find = true;
181
+		//echo $body_parse."\n";
182 182
 	}
183 183
 	if (preg_match("/^'(.*)\//",$body,$matches)) {
184
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
185
-	    $find = true;
186
-	    //echo $body_parse."\n";
184
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
185
+		$find = true;
186
+		//echo $body_parse."\n";
187 187
 	}
188 188
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
189
-	    $find = true;
190
-	    //print_r($matches);
191
-	    $timestamp = $matches[0];
192
-	    if ($matches[4] == 'h') {
189
+		$find = true;
190
+		//print_r($matches);
191
+		$timestamp = $matches[0];
192
+		if ($matches[4] == 'h') {
193 193
 		$timestamp = strtotime($matches[1].':'.$matches[2].':'.$matches[3]);
194 194
 		//echo 'timestamp : '.$timestamp.' - now : '.time()."\n";
195 195
 		/*
196 196
 		if (time() + 3900 < $timestamp) $timestamp -= 86400;
197 197
 		elseif (time() - 82500 > $timestamp) $timestamp += 86400;
198 198
 		*/
199
-	    } elseif ($matches[4] == 'z' || $matches[4] == '/') {
199
+		} elseif ($matches[4] == 'z' || $matches[4] == '/') {
200 200
 		// This work or not ?
201 201
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
202
-	    }
203
-	    $body_parse = substr($body_parse,7);
204
-	    $result['timestamp'] = $timestamp;
205
-	    //echo date('Ymd H:i:s',$timestamp);
202
+		}
203
+		$body_parse = substr($body_parse,7);
204
+		$result['timestamp'] = $timestamp;
205
+		//echo date('Ymd H:i:s',$timestamp);
206 206
 	}
207 207
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
208
-	    $find = true;
209
-	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
210
-	    $body_parse = substr($body_parse,8);
211
-	    $result['timestamp'] = $timestamp;
212
-	    //echo date('Ymd H:i:s',$timestamp);
208
+		$find = true;
209
+		$timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
210
+		$body_parse = substr($body_parse,8);
211
+		$result['timestamp'] = $timestamp;
212
+		//echo date('Ymd H:i:s',$timestamp);
213 213
 	}
214 214
 	//if (strlen($body_parse) > 19) {
215
-	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
216
-	    $find = true;
215
+		if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
216
+		$find = true;
217 217
 		// 4658.70N/00707.78Ez
218 218
 		//print_r(str_split($body_parse));
219 219
 		
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$lon = intval($lon_deg);
231 231
 		if ($lat > 89 || $lon > 179) return false;
232 232
 	    
233
-	    /*
233
+		/*
234 234
 	    $tmp_5b = str_replace('.','',$lat_min);
235 235
 	    if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) {
236 236
 	        print_r($matches);
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
 		$result['longitude'] = $longitude;
245 245
 		$body_parse = substr($body_parse,18);
246 246
 		$body_parse_len = strlen($body_parse);
247
-	    }
248
-	    $body_parse_len = strlen($body_parse);
249
-	    if ($body_parse_len > 0) {
247
+		}
248
+		$body_parse_len = strlen($body_parse);
249
+		if ($body_parse_len > 0) {
250 250
 		/*
251 251
 		if (!isset($result['timestamp']) && !isset($result['latitude'])) {
252 252
 			$body_split = str_split($body);
@@ -276,85 +276,85 @@  discard block
 block discarded – undo
276 276
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
277 277
 			if ($symbol_code != '_') {
278 278
 			}
279
-		    //$body_parse = substr($body_parse,1);
280
-		    //$body_parse = trim($body_parse);
281
-		    //$body_parse_len = strlen($body_parse);
282
-		    if ($body_parse_len >= 7) {
279
+			//$body_parse = substr($body_parse,1);
280
+			//$body_parse = trim($body_parse);
281
+			//$body_parse_len = strlen($body_parse);
282
+			if ($body_parse_len >= 7) {
283 283
 			
284
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
285
-		    	    $course = substr($body_parse,0,3);
286
-		    	    $tmp_s = intval($course);
287
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
288
-		    	    $speed = substr($body_parse,4,3);
289
-		    	    if ($speed != '...') {
290
-		    		    $result['speed'] = round($speed*1.852);
291
-		    	    }
292
-		    	    $body_parse = substr($body_parse,7);
293
-		        }
294
-		        // Check PHGR, PHG, RNG
295
-		    } 
296
-		    /*
284
+				if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
285
+					$course = substr($body_parse,0,3);
286
+					$tmp_s = intval($course);
287
+					if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
288
+					$speed = substr($body_parse,4,3);
289
+					if ($speed != '...') {
290
+						$result['speed'] = round($speed*1.852);
291
+					}
292
+					$body_parse = substr($body_parse,7);
293
+				}
294
+				// Check PHGR, PHG, RNG
295
+			} 
296
+			/*
297 297
 		    else if ($body_parse_len > 0) {
298 298
 			$rest = $body_parse;
299 299
 		    }
300 300
 		    */
301
-		    if (strlen($body_parse) > 0) {
302
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
303
-		            $altitude = intval($matches[1]);
304
-		            //$result['altitude'] = round($altitude*0.3048);
305
-		            $result['altitude'] = $altitude;
306
-		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
307
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
308
-		        }
309
-		    }
301
+			if (strlen($body_parse) > 0) {
302
+				if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
303
+					$altitude = intval($matches[1]);
304
+					//$result['altitude'] = round($altitude*0.3048);
305
+					$result['altitude'] = $altitude;
306
+					//$body_parse = trim(substr($body_parse,strlen($matches[0])));
307
+					$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
308
+				}
309
+			}
310 310
 		    
311
-		    // Telemetry
312
-		    /*
311
+			// Telemetry
312
+			/*
313 313
 		    if (preg_match('/^([0-9]+),(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,([01]{0,8})/',$body_parse,$matches)) {
314 314
 		        // Nothing yet...
315 315
 		    }
316 316
 		    */
317
-		    // DAO
318
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
319
-			    $dao = $matches[1];
320
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
317
+			// DAO
318
+			if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
319
+				$dao = $matches[1];
320
+				if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
321 321
 				$dao_split = str_split($dao);
322
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
323
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
322
+					$lat_off = (($dao_split[1])-48.0)*0.001/60.0;
323
+					$lon_off = (($dao_split[2])-48.0)*0.001/60.0;
324 324
 			    
325 325
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
326 326
 				else $result['latitude'] += $lat_off;
327 327
 				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
328 328
 				else $result['longitude'] += $lon_off;
329
-			    }
330
-		            $body_parse = substr($body_parse,6);
331
-		    }
329
+				}
330
+					$body_parse = substr($body_parse,6);
331
+			}
332 332
 		    
333
-		    if (preg_match('/CS=([0-9A-Z]*)/',$body_parse,$matches)) {
333
+			if (preg_match('/CS=([0-9A-Z]*)/',$body_parse,$matches)) {
334 334
 			$result['ident'] = $matches[1];
335
-		    }
336
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
335
+			}
336
+			if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
337 337
 			$result['squawk'] = $matches[1];
338
-		    }
339
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
338
+			}
339
+			if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
340 340
 			$result['aircraft_icao'] = $matches[1];
341
-		    }
342
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
341
+			}
342
+			if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
343 343
 			$result['typeid'] = $matches[1];
344
-		    }
345
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
344
+			}
345
+			if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
346 346
 			$result['imo'] = $matches[1];
347
-		    }
348
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
347
+			}
348
+			if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
349 349
 			$result['arrival_date'] = $matches[1];
350
-		    }
351
-		    if (preg_match('/AC=([0-9A-Z]*)/',$body_parse,$matches)) {
350
+			}
351
+			if (preg_match('/AC=([0-9A-Z]*)/',$body_parse,$matches)) {
352 352
 			$result['arrival_code'] = $matches[1];
353
-		    }
354
-		    // OGN comment
353
+			}
354
+			// OGN comment
355 355
 		   // echo "Before OGN : ".$body_parse."\n";
356
-		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
357
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
356
+			//if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
357
+			if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
358 358
 			$id = $matches[1];
359 359
 			//$mode = substr($id,0,2);
360 360
 			$address = substr($id,2);
@@ -384,53 +384,53 @@  discard block
 block discarded – undo
384 384
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
385 385
 			$result['stealth'] = $stealth;
386 386
 			$result['address'] = $address;
387
-		    }
387
+			}
388 388
 		    
389
-		    //Comment
390
-		    $result['comment'] = trim($body_parse);
389
+			//Comment
390
+			$result['comment'] = trim($body_parse);
391 391
 		} else {
392
-		    // parse weather
393
-		    //$body_parse = substr($body_parse,1);
394
-		    //$body_parse_len = strlen($body_parse);
392
+			// parse weather
393
+			//$body_parse = substr($body_parse,1);
394
+			//$body_parse_len = strlen($body_parse);
395 395
 
396
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
397
-			    $result['wind_dir'] = intval($matches[1]);
398
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
399
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
400
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
401
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
402
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
396
+			if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
397
+				$result['wind_dir'] = intval($matches[1]);
398
+				$result['wind_speed'] = round(intval($matches[2])*1.60934,1);
399
+				$result['wind_gust'] = round(intval($matches[3])*1.60934,1);
400
+				$result['temp'] = round(5/9*((intval($matches[4]))-32),1);
401
+					$body_parse = substr($body_parse,strlen($matches[0])+1);
402
+			} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
403 403
 			$result['wind_dir'] = intval($matches[1]);
404 404
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
405 405
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
406 406
 			$result['temp'] = round(5/9*(($matches[4])-32),1);
407
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
408
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
407
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
408
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
409 409
 			$result['wind_dir'] = intval($matches[1]);
410 410
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
411 411
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
412
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
413
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
412
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
413
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
414 414
 			$result['wind_dir'] = intval($matches[1]);
415 415
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
416 416
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
417
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
418
-		    }
419
-		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
417
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
418
+			}
419
+			if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
420 420
 			$result['temp'] = round(5/9*(($matches[1])-32),1);
421
-		    }
421
+			}
422 422
 		}
423 423
 		} else $result['comment'] = trim($body_parse);
424 424
 
425
-	    }
425
+		}
426 426
 	//}
427 427
 	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
428 428
 	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
429 429
 	if ($debug) print_r($result);
430 430
 	return $result;
431
-    }
431
+	}
432 432
     
433
-    function connect() {
433
+	function connect() {
434 434
 	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
435 435
 	$aprs_connect = 0;
436 436
 	$aprs_keep = 120;
@@ -453,24 +453,24 @@  discard block
 block discarded – undo
453 453
 		$send = socket_send( $this->socket  , $aprs_login , strlen($aprs_login) , 0 );
454 454
 		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
455 455
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
456
-			    echo 'APRS user verified !'."\n";
457
-			    $this->connected = true;
458
-			    return true;
459
-			    break;
456
+				echo 'APRS user verified !'."\n";
457
+				$this->connected = true;
458
+				return true;
459
+				break;
460 460
 			}
461 461
 			if (time()-$authstart > 5) {
462
-			    echo 'APRS timeout'."\n";
463
-			    break;
462
+				echo 'APRS timeout'."\n";
463
+				break;
464 464
 			}
465 465
 		}
466 466
 	}
467
-    }
467
+	}
468 468
     
469
-    function send($data) {
469
+	function send($data) {
470 470
 	if ($this->connected === false) $this->connect();
471 471
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
472 472
 	if ($send === FALSE) $this->connect();
473
-    }
473
+	}
474 474
 }
475 475
 
476 476
 class APRSSpotter extends APRS {
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Indentation   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
 require_once(dirname(__FILE__).'/class.Source.php');
11 11
 
12 12
 class SpotterImport {
13
-    private $all_flights = array();
14
-    private $last_delete_hourly = 0;
15
-    private $last_delete = 0;
16
-    private $stats = array();
17
-    private $tmd = 0;
18
-    private $source_location = array();
19
-    public $db = null;
20
-    public $nb = 0;
21
-
22
-    public function __construct($dbc = null) {
13
+	private $all_flights = array();
14
+	private $last_delete_hourly = 0;
15
+	private $last_delete = 0;
16
+	private $stats = array();
17
+	private $tmd = 0;
18
+	private $source_location = array();
19
+	public $db = null;
20
+	public $nb = 0;
21
+
22
+	public function __construct($dbc = null) {
23 23
 	global $globalBeta, $globalServerAPRS, $APRSSpotter;
24 24
 	$Connection = new Connection($dbc);
25 25
 	$this->db = $Connection->db();
@@ -30,23 +30,23 @@  discard block
 block discarded – undo
30 30
 	$currentdate = date('Y-m-d');
31 31
 	$sourcestat = $Stats->getStatsSource($currentdate);
32 32
 	if (!empty($sourcestat)) {
33
-	    foreach($sourcestat as $srcst) {
34
-	    	$type = $srcst['stats_type'];
33
+		foreach($sourcestat as $srcst) {
34
+			$type = $srcst['stats_type'];
35 35
 		if ($type == 'polar' || $type == 'hist') {
36
-		    $source = $srcst['source_name'];
37
-		    $data = $srcst['source_data'];
38
-		    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
39
-	        }
40
-	    }
36
+			$source = $srcst['source_name'];
37
+			$data = $srcst['source_data'];
38
+			$this->stats[$currentdate][$source][$type] = json_decode($data,true);
39
+			}
40
+		}
41 41
 	}
42 42
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
43 43
 		$APRSSpotter = new APRSSpotter();
44 44
 		//$APRSSpotter->connect();
45 45
 	}
46 46
 
47
-    }
47
+	}
48 48
 
49
-    public function get_Schedule($id,$ident) {
49
+	public function get_Schedule($id,$ident) {
50 50
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
51 51
 	// Get schedule here, so it's done only one time
52 52
 	
@@ -66,42 +66,42 @@  discard block
 block discarded – undo
66 66
 	$operator = $Spotter->getOperator($ident);
67 67
 	$scheduleexist = false;
68 68
 	if ($Schedule->checkSchedule($operator) == 0) {
69
-	    $operator = $Translation->checkTranslation($ident);
70
-	    if ($Schedule->checkSchedule($operator) == 0) {
69
+		$operator = $Translation->checkTranslation($ident);
70
+		if ($Schedule->checkSchedule($operator) == 0) {
71 71
 		$schedule = $Schedule->fetchSchedule($operator);
72 72
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
73
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
74
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
75
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
76
-		    // Should also check if route schedule = route from DB
77
-		    if ($schedule['DepartureAirportIATA'] != '') {
73
+			if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
74
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
75
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
76
+			// Should also check if route schedule = route from DB
77
+			if ($schedule['DepartureAirportIATA'] != '') {
78 78
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
79
-			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
80
-			    if (trim($airport_icao) != '') {
79
+				$airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
80
+				if (trim($airport_icao) != '') {
81 81
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
82 82
 				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
83
-			    }
83
+				}
84
+			}
84 85
 			}
85
-		    }
86
-		    if ($schedule['ArrivalAirportIATA'] != '') {
86
+			if ($schedule['ArrivalAirportIATA'] != '') {
87 87
 			if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
88
-			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
89
-			    if (trim($airport_icao) != '') {
88
+				$airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
89
+				if (trim($airport_icao) != '') {
90 90
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
91 91
 				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
92
-			    }
92
+				}
93
+			}
93 94
 			}
94
-		    }
95
-		    $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']);
95
+			$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']);
96 96
 		}
97
-	    } else $scheduleexist = true;
97
+		} else $scheduleexist = true;
98 98
 	} else $scheduleexist = true;
99 99
 	// close connection, at least one way will work ?
100
-       if ($scheduleexist) {
100
+	   if ($scheduleexist) {
101 101
 		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
102
-    		$sch = $Schedule->getSchedule($operator);
102
+			$sch = $Schedule->getSchedule($operator);
103 103
 		$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']));
104
-       }
104
+	   }
105 105
 	$Spotter->db = null;
106 106
 	$Schedule->db = null;
107 107
 	$Translation->db = null;
@@ -116,96 +116,96 @@  discard block
 block discarded – undo
116 116
 	}
117 117
 	  */
118 118
 	}
119
-    }
119
+	}
120 120
 
121
-    public function checkAll() {
121
+	public function checkAll() {
122 122
 	global $globalDebug, $globalNoImport;
123 123
 	if ($globalDebug) echo "Update last seen flights data...\n";
124 124
 	if (!isset($globalNoImport) || $globalNoImport === FALSE) {
125
-	    foreach ($this->all_flights as $key => $flight) {
125
+		foreach ($this->all_flights as $key => $flight) {
126 126
 		if (isset($this->all_flights[$key]['id'])) {
127
-		    //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
128
-    		    $Spotter = new Spotter($this->db);
129
-        	    $real_arrival = $this->arrival($key);
130
-        	    $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']);
131
-        	}
132
-	    }
127
+			//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
128
+				$Spotter = new Spotter($this->db);
129
+				$real_arrival = $this->arrival($key);
130
+				$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']);
131
+			}
132
+		}
133
+	}
133 134
 	}
134
-    }
135 135
 
136
-    public function arrival($key) {
136
+	public function arrival($key) {
137 137
 	global $globalClosestMinDist, $globalDebug;
138 138
 	if ($globalDebug) echo 'Update arrival...'."\n";
139 139
 	$Spotter = new Spotter($this->db);
140
-        $airport_icao = '';
141
-        $airport_time = '';
142
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
140
+		$airport_icao = '';
141
+		$airport_time = '';
142
+		if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
143 143
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
144
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
145
-    	    if (isset($closestAirports[0])) {
146
-        	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
147
-        	    $airport_icao = $closestAirports[0]['icao'];
148
-        	    $airport_time = $this->all_flights[$key]['datetime'];
149
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
150
-        	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
151
-        	    foreach ($closestAirports as $airport) {
152
-        		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
153
-        		    $airport_icao = $airport['icao'];
154
-        		    $airport_time = $this->all_flights[$key]['datetime'];
155
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
156
-        		    break;
157
-        		}
158
-        	    }
159
-        	} 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))) {
160
-        		$airport_icao = $closestAirports[0]['icao'];
161
-        		$airport_time = $this->all_flights[$key]['datetime'];
162
-        	} else {
163
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
164
-        	}
165
-    	    } else {
166
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
167
-    	    }
168
-
169
-        } else {
170
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
171
-        }
172
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
173
-    }
174
-
175
-
176
-
177
-    public function del() {
144
+		$closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
145
+			if (isset($closestAirports[0])) {
146
+			if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
147
+				$airport_icao = $closestAirports[0]['icao'];
148
+				$airport_time = $this->all_flights[$key]['datetime'];
149
+				if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
150
+			} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
151
+				foreach ($closestAirports as $airport) {
152
+				if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
153
+					$airport_icao = $airport['icao'];
154
+					$airport_time = $this->all_flights[$key]['datetime'];
155
+					if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
156
+					break;
157
+				}
158
+				}
159
+			} 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))) {
160
+				$airport_icao = $closestAirports[0]['icao'];
161
+				$airport_time = $this->all_flights[$key]['datetime'];
162
+			} else {
163
+				if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
164
+			}
165
+			} else {
166
+				if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
167
+			}
168
+
169
+		} else {
170
+			if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
171
+		}
172
+		return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
173
+	}
174
+
175
+
176
+
177
+	public function del() {
178 178
 	global $globalDebug, $globalNoImport;
179 179
 	// Delete old infos
180 180
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
181 181
 	foreach ($this->all_flights as $key => $flight) {
182
-    	    if (isset($flight['lastupdate'])) {
183
-        	if ($flight['lastupdate'] < (time()-3000)) {
184
-            	    if (isset($this->all_flights[$key]['id'])) {
185
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
182
+			if (isset($flight['lastupdate'])) {
183
+			if ($flight['lastupdate'] < (time()-3000)) {
184
+					if (isset($this->all_flights[$key]['id'])) {
185
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
186 186
 			/*
187 187
 			$SpotterLive = new SpotterLive();
188 188
             		$SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']);
189 189
 			$SpotterLive->db = null;
190 190
 			*/
191 191
 			if (!isset($globalNoImport) || $globalNoImport === FALSE) {
192
-            		    $real_arrival = $this->arrival($key);
193
-            		    $Spotter = new Spotter($this->db);
194
-            	    	    if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
192
+						$real_arrival = $this->arrival($key);
193
+						$Spotter = new Spotter($this->db);
194
+							if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
195 195
 				$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']);
196 196
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
197
-			    }
197
+				}
198 198
 			// Put in archive
199 199
 //				$Spotter->db = null;
200 200
 			}
201
-            	    }
202
-            	    unset($this->all_flights[$key]);
203
-    	        }
204
-	    }
205
-        }
206
-    }
201
+					}
202
+					unset($this->all_flights[$key]);
203
+				}
204
+		}
205
+		}
206
+	}
207 207
 
208
-    public function add($line) {
208
+	public function add($line) {
209 209
 	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;
210 210
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
211 211
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
 	
231 231
 	// SBS format is CSV format
232 232
 	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
233
-	    //print_r($line);
234
-  	    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)) {
233
+		//print_r($line);
234
+  		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)) {
235 235
 
236 236
 		// Increment message number
237 237
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
238
-		    $current_date = date('Y-m-d');
239
-		    $source = $line['source_name'];
240
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
241
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
242
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
243
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
244
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
238
+			$current_date = date('Y-m-d');
239
+			$source = $line['source_name'];
240
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
241
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
242
+				$this->stats[$current_date][$source]['msg']['date'] = time();
243
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
244
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
245 245
 		}
246 246
 		
247 247
 		/*
@@ -257,34 +257,34 @@  discard block
 block discarded – undo
257 257
 		//$this->db = $dbc;
258 258
 
259 259
 		//$hex = trim($line['hex']);
260
-	        if (!isset($line['id'])) $id = trim($line['hex']);
261
-	        else $id = trim($line['id']);
260
+			if (!isset($line['id'])) $id = trim($line['hex']);
261
+			else $id = trim($line['id']);
262 262
 		
263 263
 		if (!isset($this->all_flights[$id])) {
264
-		    $this->all_flights[$id] = array();
265
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
266
-		    $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' => ''));
267
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
268
-		    if (!isset($line['id'])) {
264
+			$this->all_flights[$id] = array();
265
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
266
+			$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' => ''));
267
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
268
+			if (!isset($line['id'])) {
269 269
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
270 270
 //			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')));
271 271
 //			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')));
272 272
 			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')));
273
-		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
274
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
275
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
273
+				//else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
274
+			 } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
275
+			if ($globalAllFlights !== FALSE) $dataFound = true;
276 276
 		}
277 277
 		if (isset($line['source_type']) && $line['source_type'] != '') {
278
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
278
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
279 279
 		}
280 280
 		
281 281
 		//print_r($this->all_flights);
282 282
 		if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) {
283
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
284
-		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
283
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
284
+			//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
285 285
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
286
-		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
287
-		    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') {
286
+			//} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
287
+			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') {
288 288
 			$timeelapsed = microtime(true);
289 289
 			$Spotter = new Spotter($this->db);
290 290
 			if (isset($this->all_flights[$id]['source_type'])) {
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 			$Spotter->db = null;
296 296
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
297 297
 			if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
298
-		    }
299
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
300
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
298
+			}
299
+			if ($globalAllFlights !== FALSE) $dataFound = true;
300
+			if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
301 301
 		}
302 302
 		if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') {
303 303
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 		}
322 322
 		//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
323 323
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) {
324
-		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
324
+			if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
325 325
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
326
-		    } else {
326
+			} else {
327 327
 				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";
328 328
 				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";
329 329
 				/*
@@ -332,41 +332,41 @@  discard block
 block discarded – undo
332 332
 				print_r($line);
333 333
 				*/
334 334
 				return '';
335
-		    }
335
+			}
336 336
 		} else {
337 337
 			date_default_timezone_set('UTC');
338 338
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
339 339
 		}
340 340
 
341 341
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
342
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
342
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
343 343
 		}
344 344
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
345
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
345
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
346 346
 		}
347 347
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
348
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
348
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
349 349
 		}
350 350
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
351
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
351
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
352 352
 		}
353 353
  
354 354
 		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'])) {
355
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
356
-		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
355
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
356
+			if ($this->all_flights[$id]['addedSpotter'] == 1) {
357 357
 			$timeelapsed = microtime(true);
358
-            		$Spotter = new Spotter($this->db);
359
-            		$fromsource = NULL;
360
-            		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
361
-            		elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
358
+					$Spotter = new Spotter($this->db);
359
+					$fromsource = NULL;
360
+					if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
361
+					elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
362 362
 			elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
363 363
 			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
364 364
 			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
365
-            		$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
365
+					$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
366 366
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
367 367
 			$Spotter->db = null;
368 368
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
369
-		    }
369
+			}
370 370
 
371 371
 /*
372 372
 		    if (!isset($line['id'])) {
@@ -376,26 +376,26 @@  discard block
 block discarded – undo
376 376
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
377 377
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
378 378
   */
379
-		    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']));
379
+			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']));
380 380
 
381
-		    //$putinarchive = true;
382
-		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
381
+			//$putinarchive = true;
382
+			if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
383 383
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
384
-		    }
385
-		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
384
+			}
385
+			if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
386 386
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
387
-		    }
388
-		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
389
-		    		$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' => ''));
390
-		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
387
+			}
388
+			if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
389
+					$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' => ''));
390
+			} elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
391 391
 				$timeelapsed = microtime(true);
392 392
 				$Spotter = new Spotter($this->db);
393 393
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
394 394
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
395
-		    		$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' => ''));
395
+					$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' => ''));
396 396
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
397 397
 
398
-		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
398
+			} elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
399 399
 			$timeelapsed = microtime(true);
400 400
 			$Spotter = new Spotter($this->db);
401 401
 			$route = $Spotter->getRouteInfo(trim($line['ident']));
@@ -409,67 +409,67 @@  discard block
 block discarded – undo
409 409
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
410 410
 
411 411
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
412
-			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
413
-			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
412
+				//if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
413
+				if ($route['fromairport_icao'] != $route['toairport_icao']) {
414 414
 				//    $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']));
415
-		    		$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']));
416
-		    	    }
415
+					$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']));
416
+					}
417 417
 			}
418 418
 			if (!isset($globalFork)) $globalFork = TRUE;
419 419
 			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
420 420
 				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
421 421
 			}
422
-		    }
422
+			}
423 423
 		}
424 424
 
425 425
 		if (isset($line['speed']) && $line['speed'] != '') {
426 426
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
427
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
428
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
429
-		    //$dataFound = true;
427
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
428
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
429
+			//$dataFound = true;
430 430
 		} 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'])) {
431
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
432
-		    if ($distance > 1000 && $distance < 10000) {
433
-		    // use datetime
431
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
432
+			if ($distance > 1000 && $distance < 10000) {
433
+			// use datetime
434 434
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
435 435
 			$speed = $speed*3.6;
436 436
 			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
437 437
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
438
-		    }
438
+			}
439 439
 		}
440 440
 
441 441
 
442 442
 
443
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
444
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
445
-	    	    else unset($timediff);
446
-	    	    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')))) {
443
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
444
+				if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
445
+				else unset($timediff);
446
+				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')))) {
447 447
 			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'])) {
448
-			    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'])) {
448
+				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'])) {
449 449
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
450 450
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
451 451
 				$this->all_flights[$id]['putinarchive'] = true;
452 452
 				$this->tmd = 0;
453 453
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
454
-				    if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
455
-				    $timeelapsed = microtime(true);
456
-				    $Spotter = new Spotter($this->db);
457
-				    $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
458
-				    if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
459
-				    $Spotter->db = null;
460
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
461
-				    if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
454
+					if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
455
+					$timeelapsed = microtime(true);
456
+					$Spotter = new Spotter($this->db);
457
+					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
458
+					if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
459
+					$Spotter->db = null;
460
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
461
+					if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
462
+				}
462 463
 				}
463
-			    }
464 464
 			}
465 465
 
466 466
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
467
-			    //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) {
467
+				//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) {
468 468
 				if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
469 469
 				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') {
470
-				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
471
-				    $dataFound = true;
472
-				    $this->all_flights[$id]['time_last_coord'] = time();
470
+					$this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
471
+					$dataFound = true;
472
+					$this->all_flights[$id]['time_last_coord'] = time();
473 473
 				}
474 474
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
475 475
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
@@ -480,20 +480,20 @@  discard block
 block discarded – undo
480 480
 				    //$putinarchive = true;
481 481
 				}
482 482
 				*/
483
-			    /*
483
+				/*
484 484
 			    } elseif (isset($this->all_flights[$id]['latitude'])) {
485 485
 				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";
486 486
 			    }
487 487
 			    */
488 488
 			}
489 489
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
490
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
491
-			    //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) {
490
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
491
+				//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) {
492 492
 				if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
493 493
 				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') {
494
-				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
495
-				    $dataFound = true;
496
-				    $this->all_flights[$id]['time_last_coord'] = time();
494
+					$this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
495
+					$dataFound = true;
496
+					$this->all_flights[$id]['time_last_coord'] = time();
497 497
 				}
498 498
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
499 499
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
@@ -511,54 +511,54 @@  discard block
 block discarded – undo
511 511
 			    */
512 512
 			}
513 513
 
514
-		    } else if ($globalDebug && $timediff > 20) {
514
+			} else if ($globalDebug && $timediff > 20) {
515 515
 			$this->tmd = $this->tmd + 1;
516 516
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
517 517
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
518 518
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
519 519
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
520
-		    }
520
+			}
521 521
 		}
522 522
 		if (isset($line['last_update']) && $line['last_update'] != '') {
523
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
524
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
523
+			if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
524
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
525 525
 		}
526 526
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
527
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
528
-		    //$dataFound = true;
527
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
528
+			//$dataFound = true;
529 529
 		}
530 530
 		if (isset($line['format_source']) && $line['format_source'] != '') {
531
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
531
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
532 532
 		}
533 533
 		if (isset($line['source_name']) && $line['source_name'] != '') {
534
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
534
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
535 535
 		}
536 536
 		if (isset($line['emergency']) && $line['emergency'] != '') {
537
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
538
-		    //$dataFound = true;
537
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
538
+			//$dataFound = true;
539 539
 		}
540 540
 		if (isset($line['ground']) && $line['ground'] != '') {
541
-		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
541
+			if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
542 542
 			// Here we force archive of flight because after ground it's a new one (or should be)
543 543
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
544 544
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
545 545
 			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')));
546
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
546
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
547 547
 			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']));
548
-		    }
549
-		    if ($line['ground'] != 1) $line['ground'] = 0;
550
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
551
-		    //$dataFound = true;
548
+			}
549
+			if ($line['ground'] != 1) $line['ground'] = 0;
550
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
551
+			//$dataFound = true;
552 552
 		}
553 553
 		if (isset($line['squawk']) && $line['squawk'] != '') {
554
-		    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'])) {
555
-			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
556
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
557
-			    $highlight = '';
558
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
559
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
560
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
561
-			    if ($highlight != '') {
554
+			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'])) {
555
+				if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
556
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
557
+				$highlight = '';
558
+				if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
559
+				if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
560
+				if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
561
+				if ($highlight != '') {
562 562
 				$timeelapsed = microtime(true);
563 563
 				$Spotter = new Spotter($this->db);
564 564
 				$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
@@ -567,38 +567,38 @@  discard block
 block discarded – undo
567 567
 
568 568
 				//$putinarchive = true;
569 569
 				//$highlight = '';
570
-			    }
570
+				}
571 571
 			    
572
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
573
-		    //$dataFound = true;
572
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
573
+			//$dataFound = true;
574 574
 		}
575 575
 
576 576
 		if (isset($line['altitude']) && $line['altitude'] != '') {
577
-		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
577
+			//if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
578 578
 			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;
579 579
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
580 580
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
581 581
 			//$dataFound = true;
582
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
582
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
583 583
   		}
584 584
 
585 585
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
586
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
586
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
587 587
 		}
588 588
 		
589 589
 		if (isset($line['heading']) && $line['heading'] != '') {
590
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
591
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
592
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
593
-		    //$dataFound = true;
590
+			if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
591
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
592
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
593
+			//$dataFound = true;
594 594
   		} 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']) {
595
-  		    $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']);
596
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
597
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
598
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
595
+  			$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']);
596
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
597
+			if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
598
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
599 599
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
600
-  		    // If not enough messages and ACARS set heading to 0
601
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
600
+  			// If not enough messages and ACARS set heading to 0
601
+  			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
602 602
   		}
603 603
 		if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
604 604
 		elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
@@ -609,121 +609,121 @@  discard block
 block discarded – undo
609 609
 		//if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
610 610
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
611 611
 		if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
612
-		    $this->all_flights[$id]['lastupdate'] = time();
613
-		    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
614
-		        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'])) {
615
-			    //print_r($this->all_flights);
616
-			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
617
-			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
618
-			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
612
+			$this->all_flights[$id]['lastupdate'] = time();
613
+			if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
614
+				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'])) {
615
+				//print_r($this->all_flights);
616
+				//echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
617
+				//$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
618
+				if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
619 619
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
620 620
 				$timeelapsed = microtime(true);
621 621
 				$SpotterLive = new SpotterLive($this->db);
622 622
 				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')) {
623
-				    $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
624
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
623
+					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
624
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
625 625
 				} elseif (isset($line['id'])) {
626
-				    $recent_ident = $SpotterLive->checkIdRecent($line['id']);
627
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
626
+					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
627
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
628 628
 				} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
629
-				    $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
630
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
629
+					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
630
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
631 631
 				} else $recent_ident = '';
632 632
 				$SpotterLive->db=null;
633 633
 
634 634
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
635 635
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
636
-			    } else {
636
+				} else {
637 637
 				$recent_ident = '';
638 638
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
639
-			    }
640
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
641
-			    if($recent_ident == "")
642
-			    {
639
+				}
640
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
641
+				if($recent_ident == "")
642
+				{
643 643
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
644 644
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
645 645
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
646 646
 				//adds the spotter data for the archive
647 647
 				$ignoreImport = false;
648 648
 				foreach($globalAirportIgnore as $airportIgnore) {
649
-				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
649
+					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
650 650
 					$ignoreImport = true;
651
-				    }
651
+					}
652 652
 				}
653 653
 				if (count($globalAirportAccept) > 0) {
654
-				    $ignoreImport = true;
655
-				    foreach($globalAirportIgnore as $airportIgnore) {
654
+					$ignoreImport = true;
655
+					foreach($globalAirportIgnore as $airportIgnore) {
656 656
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
657
-					    $ignoreImport = false;
657
+						$ignoreImport = false;
658
+					}
658 659
 					}
659
-				    }
660 660
 				}
661 661
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
662
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
662
+					foreach($globalAirlineIgnore as $airlineIgnore) {
663 663
 					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)) {
664
-					    $ignoreImport = true;
664
+						$ignoreImport = true;
665
+					}
665 666
 					}
666
-				    }
667 667
 				}
668 668
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
669
-				    $ignoreImport = true;
670
-				    foreach($globalAirlineAccept as $airlineAccept) {
669
+					$ignoreImport = true;
670
+					foreach($globalAirlineAccept as $airlineAccept) {
671 671
 					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)) {
672
-					    $ignoreImport = false;
672
+						$ignoreImport = false;
673
+					}
673 674
 					}
674
-				    }
675 675
 				}
676 676
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
677
-				    $ignoreImport = true;
678
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
677
+					$ignoreImport = true;
678
+					foreach($globalPilotIdAccept as $pilotIdAccept) {
679 679
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
680
-					    $ignoreImport = false;
680
+						$ignoreImport = false;
681
+					}
681 682
 					}
682
-				    }
683 683
 				}
684 684
 				
685 685
 				if (!$ignoreImport) {
686
-				    $highlight = '';
687
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
688
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
689
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
690
-				    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')));
691
-				    $timeelapsed = microtime(true);
692
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
686
+					$highlight = '';
687
+					if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
688
+					if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
689
+					if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
690
+					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')));
691
+					$timeelapsed = microtime(true);
692
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
693 693
 					$Spotter = new Spotter($this->db);
694 694
 					$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']);
695 695
 					$Spotter->db = null;
696 696
 					if ($globalDebug && isset($result)) echo $result."\n";
697
-				    }
698
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
697
+					}
698
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
699 699
 				    
700
-				    // Add source stat in DB
701
-				    $Stats = new Stats($this->db);
702
-				    if (!empty($this->stats)) {
700
+					// Add source stat in DB
701
+					$Stats = new Stats($this->db);
702
+					if (!empty($this->stats)) {
703 703
 					if ($globalDebug) echo 'Add source stats : ';
704
-				        foreach($this->stats as $date => $data) {
705
-					    foreach($data as $source => $sourced) {
706
-					        //print_r($sourced);
707
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
708
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
709
-				    		if (isset($sourced['msg'])) {
710
-				    		    if (time() - $sourced['msg']['date'] > 10) {
711
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
712
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
713
-			    			        unset($this->stats[$date][$source]['msg']);
714
-			    			    }
715
-			    			}
716
-			    		    }
717
-			    		    if ($date != date('Y-m-d')) {
718
-			    			unset($this->stats[$date]);
719
-			    		    }
720
-				    	}
721
-				    	if ($globalDebug) echo 'Done'."\n";
722
-
723
-				    }
724
-				    $Stats->db = null;
704
+						foreach($this->stats as $date => $data) {
705
+						foreach($data as $source => $sourced) {
706
+							//print_r($sourced);
707
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
708
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
709
+							if (isset($sourced['msg'])) {
710
+								if (time() - $sourced['msg']['date'] > 10) {
711
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
712
+									echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
713
+									unset($this->stats[$date][$source]['msg']);
714
+								}
715
+							}
716
+							}
717
+							if ($date != date('Y-m-d')) {
718
+							unset($this->stats[$date]);
719
+							}
720
+						}
721
+						if ($globalDebug) echo 'Done'."\n";
722
+
723
+					}
724
+					$Stats->db = null;
725 725
 				    
726
-				    $this->del();
726
+					$this->del();
727 727
 				} elseif ($globalDebug) echo 'Ignore data'."\n";
728 728
 				//$ignoreImport = false;
729 729
 				$this->all_flights[$id]['addedSpotter'] = 1;
@@ -741,37 +741,37 @@  discard block
 block discarded – undo
741 741
 			*/
742 742
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
743 743
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
744
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
745
-				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
746
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
744
+					if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
745
+					//SpotterLive->deleteLiveSpotterDataNotUpdated();
746
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
747 747
 					$SpotterLive = new SpotterLive($this->db);
748 748
 					$SpotterLive->deleteLiveSpotterData();
749 749
 					$SpotterLive->db=null;
750
-				    }
751
-				    if ($globalDebug) echo " Done\n";
752
-				    $this->last_delete = time();
750
+					}
751
+					if ($globalDebug) echo " Done\n";
752
+					$this->last_delete = time();
753 753
 				}
754
-			    } else {
754
+				} else {
755 755
 				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')) {
756
-				    $this->all_flights[$id]['id'] = $recent_ident;
757
-				    $this->all_flights[$id]['addedSpotter'] = 1;
756
+					$this->all_flights[$id]['id'] = $recent_ident;
757
+					$this->all_flights[$id]['addedSpotter'] = 1;
758 758
 				}
759 759
 				if (isset($globalDaemon) && !$globalDaemon) {
760
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
760
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
761 761
 					$Spotter = new Spotter($this->db);
762 762
 					$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']);
763 763
 					$Spotter->db = null;
764
-				    }
764
+					}
765 765
 				}
766 766
 				
767
-			    }
767
+				}
768 768
 			}
769
-		    }
770
-		    //adds the spotter LIVE data
771
-		    //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
772
-		    //echo "\nAdd in Live !! \n";
773
-		    //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";
774
-		    if ($globalDebug) {
769
+			}
770
+			//adds the spotter LIVE data
771
+			//SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
772
+			//echo "\nAdd in Live !! \n";
773
+			//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";
774
+			if ($globalDebug) {
775 775
 			if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
776 776
 				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";
777 777
 				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";
@@ -779,49 +779,49 @@  discard block
 block discarded – undo
779 779
 				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";
780 780
 				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";
781 781
 			}
782
-		    }
783
-		    $ignoreImport = false;
784
-		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
785
-		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
782
+			}
783
+			$ignoreImport = false;
784
+			if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
785
+			if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
786 786
 
787
-		    foreach($globalAirportIgnore as $airportIgnore) {
788
-		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
789
-			    $ignoreImport = true;
787
+			foreach($globalAirportIgnore as $airportIgnore) {
788
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
789
+				$ignoreImport = true;
790
+			}
790 791
 			}
791
-		    }
792
-		    if (count($globalAirportAccept) > 0) {
793
-		        $ignoreImport = true;
794
-		        foreach($globalAirportIgnore as $airportIgnore) {
795
-			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
792
+			if (count($globalAirportAccept) > 0) {
793
+				$ignoreImport = true;
794
+				foreach($globalAirportIgnore as $airportIgnore) {
795
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
796 796
 				$ignoreImport = false;
797
-			    }
797
+				}
798 798
 			}
799
-		    }
800
-		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
799
+			}
800
+			if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
801 801
 			foreach($globalAirlineIgnore as $airlineIgnore) {
802
-			    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)) {
802
+				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)) {
803 803
 				$ignoreImport = true;
804
-			    }
804
+				}
805 805
 			}
806
-		    }
807
-		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
806
+			}
807
+			if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
808 808
 			$ignoreImport = true;
809 809
 			foreach($globalAirlineAccept as $airlineAccept) {
810
-			    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)) {
810
+				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)) {
811 811
 				$ignoreImport = false;
812
-			    }
812
+				}
813
+			}
813 814
 			}
814
-		    }
815
-		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
815
+			if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
816 816
 			$ignoreImport = true;
817 817
 			foreach($globalPilotIdAccept as $pilotIdAccept) {
818
-			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
819
-			        $ignoreImport = false;
820
-			    }
818
+				if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
819
+					$ignoreImport = false;
820
+				}
821
+			}
821 822
 			}
822
-		    }
823 823
 
824
-		    if (!$ignoreImport) {
824
+			if (!$ignoreImport) {
825 825
 			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'])) {
826 826
 				$timeelapsed = microtime(true);
827 827
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 					if ($stats_heading == 16) $stats_heading = 0;
867 867
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
868 868
 						for ($i=0;$i<=15;$i++) {
869
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
869
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
870 870
 						}
871 871
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
872 872
 					} else {
@@ -879,11 +879,11 @@  discard block
 block discarded – undo
879 879
 					//var_dump($this->stats);
880 880
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
881 881
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
882
-						    end($this->stats[$current_date][$source]['hist']);
883
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
882
+							end($this->stats[$current_date][$source]['hist']);
883
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
884 884
 						} else $mini = 0;
885 885
 						for ($i=$mini;$i<=$distance;$i+=10) {
886
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
886
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
887 887
 						}
888 888
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
889 889
 					} else {
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 			//$this->del();
899 899
 			
900 900
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
901
-			    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
901
+				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
902 902
 				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
903 903
 				$SpotterLive = new SpotterLive($this->db);
904 904
 				$SpotterLive->deleteLiveSpotterDataNotUpdated();
@@ -906,19 +906,19 @@  discard block
 block discarded – undo
906 906
 				//SpotterLive->deleteLiveSpotterData();
907 907
 				if ($globalDebug) echo " Done\n";
908 908
 				$this->last_delete_hourly = time();
909
-			    } else {
909
+				} else {
910 910
 				$this->del();
911 911
 				$this->last_delete_hourly = time();
912
-			    }
912
+				}
913 913
 			}
914 914
 			
915
-		    }
916
-		    //$ignoreImport = false;
915
+			}
916
+			//$ignoreImport = false;
917 917
 		}
918 918
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
919 919
 		if ($send) return $this->all_flights[$id];
920
-	    }
920
+		}
921
+	}
921 922
 	}
922
-    }
923 923
 }
924 924
 ?>
Please login to merge, or discard this patch.
scripts/daemon-spotter.php 1 patch
Indentation   +854 added lines, -854 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 require_once(dirname(__FILE__).'/../require/class.Common.php');
16 16
 if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
17 17
 if (isset($globalMarine) && $globalMarine) {
18
-    require_once(dirname(__FILE__).'/../require/class.AIS.php');
19
-    require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
18
+	require_once(dirname(__FILE__).'/../require/class.AIS.php');
19
+	require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
20 20
 }
21 21
 
22 22
 if (!isset($globalDebug)) $globalDebug = FALSE;
@@ -24,48 +24,48 @@  discard block
 block discarded – undo
24 24
 // Check if schema is at latest version
25 25
 $Connection = new Connection();
26 26
 if ($Connection->latest() === false) {
27
-    echo "You MUST update to latest schema. Run install/index.php";
28
-    exit();
27
+	echo "You MUST update to latest schema. Run install/index.php";
28
+	exit();
29 29
 }
30 30
 if (PHP_SAPI != 'cli') {
31
-    echo "This script MUST be called from console, not a web browser.";
31
+	echo "This script MUST be called from console, not a web browser.";
32 32
 //    exit();
33 33
 }
34 34
 
35 35
 // This is to be compatible with old version of settings.php
36 36
 if (!isset($globalSources)) {
37
-    if (isset($globalSBS1Hosts)) {
38
-        //$hosts = $globalSBS1Hosts;
39
-        foreach ($globalSBS1Hosts as $host) {
40
-	    $globalSources[] = array('host' => $host);
41
-    	}
42
-    } else {
43
-        if (!isset($globalSBS1Host)) {
44
-	    echo '$globalSources MUST be defined !';
45
-	    die;
37
+	if (isset($globalSBS1Hosts)) {
38
+		//$hosts = $globalSBS1Hosts;
39
+		foreach ($globalSBS1Hosts as $host) {
40
+		$globalSources[] = array('host' => $host);
41
+		}
42
+	} else {
43
+		if (!isset($globalSBS1Host)) {
44
+		echo '$globalSources MUST be defined !';
45
+		die;
46 46
 	}
47 47
 	//$hosts = array($globalSBS1Host.':'.$globalSBS1Port);
48 48
 	$globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port);
49
-    }
49
+	}
50 50
 }
51 51
 
52 52
 $options = getopt('s::',array('source::','server','nodaemon','idsource::'));
53 53
 //if (isset($options['s'])) $hosts = array($options['s']);
54 54
 //elseif (isset($options['source'])) $hosts = array($options['source']);
55 55
 if (isset($options['s'])) {
56
-    $globalSources = array();
57
-    $globalSources[] = array('host' => $options['s']);
56
+	$globalSources = array();
57
+	$globalSources[] = array('host' => $options['s']);
58 58
 } elseif (isset($options['source'])) {
59
-    $globalSources = array();
60
-    $globalSources[] = array('host' => $options['source']);
59
+	$globalSources = array();
60
+	$globalSources[] = array('host' => $options['source']);
61 61
 }
62 62
 if (isset($options['nodaemon'])) $globalDaemon = FALSE;
63 63
 if (isset($options['server'])) $globalServer = TRUE;
64 64
 if (isset($options['idsource'])) $id_source = $options['idsource'];
65 65
 else $id_source = 1;
66 66
 if (isset($globalServer) && $globalServer) {
67
-    if ($globalDebug) echo "Using Server Mode\n";
68
-    $SI=new SpotterServer();
67
+	if ($globalDebug) echo "Using Server Mode\n";
68
+	$SI=new SpotterServer();
69 69
 /*
70 70
     require_once(dirname(__FILE__).'/../require/class.APRS.php');
71 71
     $SI = new adsb2aprs();
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 } else $SI=new SpotterImport($Connection->db);
75 75
 if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
76 76
 if (isset($globalMarine) && $globalMarine) {
77
-    $AIS = new AIS();
78
-    $MI = new MarineImport($Connection->db);
77
+	$AIS = new AIS();
78
+	$MI = new MarineImport($Connection->db);
79 79
 }
80 80
 //$APRS=new APRS($Connection->db);
81 81
 $SBS=new SBS();
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 //$servertz = system('date +%Z');
86 86
 // signal handler - playing nice with sockets and dump1090
87 87
 if (function_exists('pcntl_fork')) {
88
-    pcntl_signal(SIGINT,  function() {
89
-        global $sockets;
90
-        echo "\n\nctrl-c or kill signal received. Tidying up ... ";
91
-        die("Bye!\n");
92
-    });
93
-    pcntl_signal_dispatch();
88
+	pcntl_signal(SIGINT,  function() {
89
+		global $sockets;
90
+		echo "\n\nctrl-c or kill signal received. Tidying up ... ";
91
+		die("Bye!\n");
92
+	});
93
+	pcntl_signal_dispatch();
94 94
 }
95 95
 
96 96
 // let's try and connect
@@ -100,151 +100,151 @@  discard block
 block discarded – undo
100 100
 $reset = 0;
101 101
 
102 102
 function connect_all($hosts) {
103
-    //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
104
-    global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context;
105
-    $reset++;
106
-    if ($globalDebug) echo 'Connect to all...'."\n";
107
-    foreach ($hosts as $id => $value) {
103
+	//global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
104
+	global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context;
105
+	$reset++;
106
+	if ($globalDebug) echo 'Connect to all...'."\n";
107
+	foreach ($hosts as $id => $value) {
108 108
 	$host = $value['host'];
109 109
 	$globalSources[$id]['last_exec'] = 0;
110 110
 	// Here we check type of source(s)
111 111
 	if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) {
112
-            if (preg_match('/deltadb.txt$/i',$host)) {
113
-        	//$formats[$id] = 'deltadbtxt';
114
-        	$globalSources[$id]['format'] = 'deltadbtxt';
115
-        	//$last_exec['deltadbtxt'] = 0;
116
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
117
-            } else if (preg_match('/vatsim-data.txt$/i',$host)) {
118
-        	//$formats[$id] = 'vatsimtxt';
119
-        	$globalSources[$id]['format'] = 'vatsimtxt';
120
-        	//$last_exec['vatsimtxt'] = 0;
121
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
122
-    	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
123
-        	//$formats[$id] = 'aircraftlistjson';
124
-        	$globalSources[$id]['format'] = 'aircraftlistjson';
125
-        	//$last_exec['aircraftlistjson'] = 0;
126
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
127
-    	    } else if (preg_match('/opensky/i',$host)) {
128
-        	//$formats[$id] = 'aircraftlistjson';
129
-        	$globalSources[$id]['format'] = 'opensky';
130
-        	//$last_exec['aircraftlistjson'] = 0;
131
-        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
132
-    	    } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) {
133
-        	//$formats[$id] = 'radarvirtueljson';
134
-        	$globalSources[$id]['format'] = 'radarvirtueljson';
135
-        	//$last_exec['radarvirtueljson'] = 0;
136
-        	if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
137
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
138
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
139
-        	    exit(0);
140
-        	}
141
-    	    } else if (preg_match('/planeUpdateFAA.php$/i',$host)) {
142
-        	//$formats[$id] = 'planeupdatefaa';
143
-        	$globalSources[$id]['format'] = 'planeupdatefaa';
144
-        	//$last_exec['planeupdatefaa'] = 0;
145
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
146
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
147
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
148
-        	    exit(0);
149
-        	}
150
-            } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) {
151
-        	//$formats[$id] = 'phpvmacars';
152
-        	$globalSources[$id]['format'] = 'phpvmacars';
153
-        	//$last_exec['phpvmacars'] = 0;
154
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
155
-            } else if (preg_match('/VAM-json.php$/i',$host)) {
156
-        	//$formats[$id] = 'phpvmacars';
157
-        	$globalSources[$id]['format'] = 'vam';
158
-        	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
159
-            } else if (preg_match('/whazzup/i',$host)) {
160
-        	//$formats[$id] = 'whazzup';
161
-        	$globalSources[$id]['format'] = 'whazzup';
162
-        	//$last_exec['whazzup'] = 0;
163
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
164
-            } else if (preg_match('/recentpireps/i',$host)) {
165
-        	//$formats[$id] = 'pirepsjson';
166
-        	$globalSources[$id]['format'] = 'pirepsjson';
167
-        	//$last_exec['pirepsjson'] = 0;
168
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
169
-            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
170
-        	//$formats[$id] = 'fr24json';
171
-        	$globalSources[$id]['format'] = 'fr24json';
172
-        	//$last_exec['fr24json'] = 0;
173
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
174
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
175
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
176
-        	    exit(0);
177
-        	}
178
-            } else if (preg_match(':myshiptracking.com/:i',$host)) {
179
-        	//$formats[$id] = 'fr24json';
180
-        	$globalSources[$id]['format'] = 'myshiptracking';
181
-        	//$last_exec['fr24json'] = 0;
182
-        	if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n";
183
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
184
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
185
-        	    exit(0);
186
-        	}
187
-            //} else if (preg_match('/10001/',$host)) {
188
-            } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
189
-        	//$formats[$id] = 'tsv';
190
-        	$globalSources[$id]['format'] = 'tsv';
191
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
192
-            }
193
-        } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
194
-    		if ($globalSources[$id]['format'] == 'aisnmeahttp') {
195
-    		    $idf = fopen($globalSources[$id]['host'],'r',false,$context);
196
-    		    if ($idf !== false) {
197
-    			$httpfeeds[$id] = $idf;
198
-        		if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
199
-    		    }
200
-    		    elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n";
201
-    		} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
202
-        } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
203
-	    $hostport = explode(':',$host);
204
-	    if (isset($hostport[1])) {
112
+			if (preg_match('/deltadb.txt$/i',$host)) {
113
+			//$formats[$id] = 'deltadbtxt';
114
+			$globalSources[$id]['format'] = 'deltadbtxt';
115
+			//$last_exec['deltadbtxt'] = 0;
116
+			if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
117
+			} else if (preg_match('/vatsim-data.txt$/i',$host)) {
118
+			//$formats[$id] = 'vatsimtxt';
119
+			$globalSources[$id]['format'] = 'vatsimtxt';
120
+			//$last_exec['vatsimtxt'] = 0;
121
+			if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
122
+			} else if (preg_match('/aircraftlist.json$/i',$host)) {
123
+			//$formats[$id] = 'aircraftlistjson';
124
+			$globalSources[$id]['format'] = 'aircraftlistjson';
125
+			//$last_exec['aircraftlistjson'] = 0;
126
+			if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
127
+			} else if (preg_match('/opensky/i',$host)) {
128
+			//$formats[$id] = 'aircraftlistjson';
129
+			$globalSources[$id]['format'] = 'opensky';
130
+			//$last_exec['aircraftlistjson'] = 0;
131
+			if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
132
+			} else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) {
133
+			//$formats[$id] = 'radarvirtueljson';
134
+			$globalSources[$id]['format'] = 'radarvirtueljson';
135
+			//$last_exec['radarvirtueljson'] = 0;
136
+			if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
137
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
138
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
139
+				exit(0);
140
+			}
141
+			} else if (preg_match('/planeUpdateFAA.php$/i',$host)) {
142
+			//$formats[$id] = 'planeupdatefaa';
143
+			$globalSources[$id]['format'] = 'planeupdatefaa';
144
+			//$last_exec['planeupdatefaa'] = 0;
145
+			if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
146
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
147
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
148
+				exit(0);
149
+			}
150
+			} else if (preg_match('/\/action.php\/acars\/data$/i',$host)) {
151
+			//$formats[$id] = 'phpvmacars';
152
+			$globalSources[$id]['format'] = 'phpvmacars';
153
+			//$last_exec['phpvmacars'] = 0;
154
+			if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
155
+			} else if (preg_match('/VAM-json.php$/i',$host)) {
156
+			//$formats[$id] = 'phpvmacars';
157
+			$globalSources[$id]['format'] = 'vam';
158
+			if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
159
+			} else if (preg_match('/whazzup/i',$host)) {
160
+			//$formats[$id] = 'whazzup';
161
+			$globalSources[$id]['format'] = 'whazzup';
162
+			//$last_exec['whazzup'] = 0;
163
+			if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
164
+			} else if (preg_match('/recentpireps/i',$host)) {
165
+			//$formats[$id] = 'pirepsjson';
166
+			$globalSources[$id]['format'] = 'pirepsjson';
167
+			//$last_exec['pirepsjson'] = 0;
168
+			if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
169
+			} else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
170
+			//$formats[$id] = 'fr24json';
171
+			$globalSources[$id]['format'] = 'fr24json';
172
+			//$last_exec['fr24json'] = 0;
173
+			if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
174
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
175
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
176
+				exit(0);
177
+			}
178
+			} else if (preg_match(':myshiptracking.com/:i',$host)) {
179
+			//$formats[$id] = 'fr24json';
180
+			$globalSources[$id]['format'] = 'myshiptracking';
181
+			//$last_exec['fr24json'] = 0;
182
+			if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n";
183
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
184
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
185
+				exit(0);
186
+			}
187
+			//} else if (preg_match('/10001/',$host)) {
188
+			} else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
189
+			//$formats[$id] = 'tsv';
190
+			$globalSources[$id]['format'] = 'tsv';
191
+			if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
192
+			}
193
+		} elseif (filter_var($host,FILTER_VALIDATE_URL)) {
194
+			if ($globalSources[$id]['format'] == 'aisnmeahttp') {
195
+				$idf = fopen($globalSources[$id]['host'],'r',false,$context);
196
+				if ($idf !== false) {
197
+				$httpfeeds[$id] = $idf;
198
+				if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
199
+				}
200
+				elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n";
201
+			} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
202
+		} elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
203
+		$hostport = explode(':',$host);
204
+		if (isset($hostport[1])) {
205 205
 		$port = $hostport[1];
206 206
 		$hostn = $hostport[0];
207
-	    } else {
207
+		} else {
208 208
 		$port = $globalSources[$id]['port'];
209 209
 		$hostn = $globalSources[$id]['host'];
210
-	    }
211
-	    $Common = new Common();
212
-	    if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) {
213
-        	$s = $Common->create_socket($hostn,$port, $errno, $errstr);
214
-    	    } else {
215
-        	$s = $Common->create_socket_udp($hostn,$port, $errno, $errstr);
216
-	    }
217
-	    if ($s) {
218
-    	        $sockets[$id] = $s;
219
-    	        if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') {
220
-		    if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') {
210
+		}
211
+		$Common = new Common();
212
+		if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) {
213
+			$s = $Common->create_socket($hostn,$port, $errno, $errstr);
214
+			} else {
215
+			$s = $Common->create_socket_udp($hostn,$port, $errno, $errstr);
216
+		}
217
+		if ($s) {
218
+				$sockets[$id] = $s;
219
+				if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') {
220
+			if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') {
221 221
 			//$formats[$id] = 'aprs';
222 222
 			$globalSources[$id]['format'] = 'aprs';
223 223
 			//$aprs_connect = 0;
224 224
 			//$use_aprs = true;
225
-    		    } elseif ($port == '10001') {
226
-        		//$formats[$id] = 'tsv';
227
-        		$globalSources[$id]['format'] = 'tsv';
228
-		    } elseif ($port == '30002') {
229
-        		//$formats[$id] = 'raw';
230
-        		$globalSources[$id]['format'] = 'raw';
231
-		    } elseif ($port == '5001') {
232
-        		//$formats[$id] = 'raw';
233
-        		$globalSources[$id]['format'] = 'flightgearmp';
234
-		    } elseif ($port == '30005') {
225
+				} elseif ($port == '10001') {
226
+				//$formats[$id] = 'tsv';
227
+				$globalSources[$id]['format'] = 'tsv';
228
+			} elseif ($port == '30002') {
229
+				//$formats[$id] = 'raw';
230
+				$globalSources[$id]['format'] = 'raw';
231
+			} elseif ($port == '5001') {
232
+				//$formats[$id] = 'raw';
233
+				$globalSources[$id]['format'] = 'flightgearmp';
234
+			} elseif ($port == '30005') {
235 235
 			// Not yet supported
236
-        		//$formats[$id] = 'beast';
237
-        		$globalSources[$id]['format'] = 'beast';
238
-		    //} else $formats[$id] = 'sbs';
239
-		    } else $globalSources[$id]['format'] = 'sbs';
240
-		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
236
+				//$formats[$id] = 'beast';
237
+				$globalSources[$id]['format'] = 'beast';
238
+			//} else $formats[$id] = 'sbs';
239
+			} else $globalSources[$id]['format'] = 'sbs';
240
+			//if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
241 241
 		}
242 242
 		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
243
-            } else {
243
+			} else {
244 244
 		if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
245
-    	    }
246
-        }
247
-    }
245
+			}
246
+		}
247
+	}
248 248
 }
249 249
 if (!isset($globalMinFetch)) $globalMinFetch = 15;
250 250
 
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 //connect_all($globalSources);
268 268
 
269 269
 if (isset($globalProxy) && $globalProxy) {
270
-    $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true)));
270
+	$context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true)));
271 271
 } else {
272
-    $context = stream_context_create(array('http' => array('timeout' => $timeout)));
272
+	$context = stream_context_create(array('http' => array('timeout' => $timeout)));
273 273
 }
274 274
 
275 275
 // APRS Configuration
@@ -278,18 +278,18 @@  discard block
 block discarded – undo
278 278
 	die;
279 279
 }
280 280
 foreach ($globalSources as $key => $source) {
281
-    if (!isset($source['format'])) {
282
-        $globalSources[$key]['format'] = 'auto';
283
-    }
281
+	if (!isset($source['format'])) {
282
+		$globalSources[$key]['format'] = 'auto';
283
+	}
284 284
 }
285 285
 connect_all($globalSources);
286 286
 foreach ($globalSources as $key => $source) {
287
-    if (isset($source['format']) && $source['format'] == 'aprs') {
287
+	if (isset($source['format']) && $source['format'] == 'aprs') {
288 288
 	$aprs_connect = 0;
289 289
 	$use_aprs = true;
290 290
 	if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true;
291 291
 	break;
292
-    }
292
+	}
293 293
 }
294 294
 
295 295
 if ($use_aprs) {
@@ -331,152 +331,152 @@  discard block
 block discarded – undo
331 331
 
332 332
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
333 333
 while ($i > 0) {
334
-    if (!$globalDaemon) $i = $endtime-time();
335
-    // Delete old ATC
336
-    if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
334
+	if (!$globalDaemon) $i = $endtime-time();
335
+	// Delete old ATC
336
+	if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
337 337
 	if ($globalDebug) echo 'Delete old ATC...'."\n";
338
-        $ATC->deleteOldATC();
339
-    }
338
+		$ATC->deleteOldATC();
339
+	}
340 340
     
341
-    //if (count($last_exec) > 0) {
342
-    if (count($last_exec) == count($globalSources)) {
341
+	//if (count($last_exec) > 0) {
342
+	if (count($last_exec) == count($globalSources)) {
343 343
 	$max = $globalMinFetch;
344 344
 	foreach ($last_exec as $last) {
345
-	    if ((time() - $last['last']) < $max) $max = time() - $last['last'];
345
+		if ((time() - $last['last']) < $max) $max = time() - $last['last'];
346 346
 	}
347 347
 	if ($max != $globalMinFetch) {
348
-	    if ($globalDebug) echo 'Sleeping...'."\n";
349
-	    sleep($globalMinFetch-$max+2);
348
+		if ($globalDebug) echo 'Sleeping...'."\n";
349
+		sleep($globalMinFetch-$max+2);
350
+	}
350 351
 	}
351
-    }
352 352
 
353 353
     
354
-    //foreach ($formats as $id => $value) {
355
-    foreach ($globalSources as $id => $value) {
354
+	//foreach ($formats as $id => $value) {
355
+	foreach ($globalSources as $id => $value) {
356 356
 	date_default_timezone_set('UTC');
357 357
 	if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0;
358 358
 	if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
359
-	    //$buffer = $Common->getData($hosts[$id]);
360
-	    $buffer = $Common->getData($value['host']);
361
-	    if ($buffer != '') $reset = 0;
362
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
363
-	    $buffer = explode('\n',$buffer);
364
-	    foreach ($buffer as $line) {
365
-    		if ($line != '' && count($line) > 7) {
366
-    		    $line = explode(',', $line);
367
-	            $data = array();
368
-	            $data['hex'] = $line[1]; // hex
369
-	            $data['ident'] = $line[2]; // ident
370
-	            if (isset($line[3])) $data['altitude'] = $line[3]; // altitude
371
-	            if (isset($line[4])) $data['speed'] = $line[4]; // speed
372
-	            if (isset($line[5])) $data['heading'] = $line[5]; // heading
373
-	            if (isset($line[6])) $data['latitude'] = $line[6]; // lat
374
-	            if (isset($line[7])) $data['longitude'] = $line[7]; // long
375
-	            $data['verticalrate'] = ''; // vertical rate
376
-	            //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk
377
-	            $data['emergency'] = ''; // emergency
378
-		    $data['datetime'] = date('Y-m-d H:i:s');
379
-		    $data['format_source'] = 'deltadbtxt';
380
-    		    $data['id_source'] = $id_source;
381
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
382
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
383
-    		    $SI->add($data);
384
-		    unset($data);
385
-    		}
386
-    	    }
387
-    	    $last_exec[$id]['last'] = time();
359
+		//$buffer = $Common->getData($hosts[$id]);
360
+		$buffer = $Common->getData($value['host']);
361
+		if ($buffer != '') $reset = 0;
362
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
363
+		$buffer = explode('\n',$buffer);
364
+		foreach ($buffer as $line) {
365
+			if ($line != '' && count($line) > 7) {
366
+				$line = explode(',', $line);
367
+				$data = array();
368
+				$data['hex'] = $line[1]; // hex
369
+				$data['ident'] = $line[2]; // ident
370
+				if (isset($line[3])) $data['altitude'] = $line[3]; // altitude
371
+				if (isset($line[4])) $data['speed'] = $line[4]; // speed
372
+				if (isset($line[5])) $data['heading'] = $line[5]; // heading
373
+				if (isset($line[6])) $data['latitude'] = $line[6]; // lat
374
+				if (isset($line[7])) $data['longitude'] = $line[7]; // long
375
+				$data['verticalrate'] = ''; // vertical rate
376
+				//if (isset($line[9])) $data['squawk'] = $line[9]; // squawk
377
+				$data['emergency'] = ''; // emergency
378
+			$data['datetime'] = date('Y-m-d H:i:s');
379
+			$data['format_source'] = 'deltadbtxt';
380
+				$data['id_source'] = $id_source;
381
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
382
+			if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
383
+				$SI->add($data);
384
+			unset($data);
385
+			}
386
+			}
387
+			$last_exec[$id]['last'] = time();
388 388
 	} elseif ($value['format'] == 'aisnmeatxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) {
389
-	    date_default_timezone_set('CET');
390
-	    $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host']));
391
-	    date_default_timezone_set('UTC');
392
-	    if ($buffer != '') $reset = 0;
393
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
394
-	    $buffer = explode('\n',$buffer);
395
-	    foreach ($buffer as $line) {
389
+		date_default_timezone_set('CET');
390
+		$buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host']));
391
+		date_default_timezone_set('UTC');
392
+		if ($buffer != '') $reset = 0;
393
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
394
+		$buffer = explode('\n',$buffer);
395
+		foreach ($buffer as $line) {
396 396
 		if ($line != '') {
397
-		    echo "'".$line."'\n";
398
-		    $add = false;
399
-		    $ais_data = $AIS->parse_line(trim($line));
400
-		    $data = array();
401
-		    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
402
-		    if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi'];
403
-		    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
404
-		    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
405
-		    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
406
-		    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
407
-		    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
408
-		    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
409
-		    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
410
-		    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
411
-		    if (isset($ais_data['timestamp'])) {
397
+			echo "'".$line."'\n";
398
+			$add = false;
399
+			$ais_data = $AIS->parse_line(trim($line));
400
+			$data = array();
401
+			if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
402
+			if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi'];
403
+			if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
404
+			if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
405
+			if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
406
+			if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
407
+			if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
408
+			if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
409
+			if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
410
+			if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
411
+			if (isset($ais_data['timestamp'])) {
412 412
 			$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
413 413
 			if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) {
414
-			    $last_exec[$id]['timestamp'] = $ais_data['timestamp'];
415
-			    $add = true;
414
+				$last_exec[$id]['timestamp'] = $ais_data['timestamp'];
415
+				$add = true;
416 416
 			}
417
-		    } else {
417
+			} else {
418 418
 			$data['datetime'] = date('Y-m-d H:i:s');
419 419
 			$add = true;
420
-		    }
421
-		    $data['format_source'] = 'aisnmeatxt';
422
-    		    $data['id_source'] = $id_source;
423
-		    print_r($data);
424
-		    echo 'Add...'."\n";
425
-		    if ($add && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
426
-		    unset($data);
420
+			}
421
+			$data['format_source'] = 'aisnmeatxt';
422
+				$data['id_source'] = $id_source;
423
+			print_r($data);
424
+			echo 'Add...'."\n";
425
+			if ($add && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
426
+			unset($data);
427 427
 		}
428
-    	    }
429
-    	    $last_exec[$id]['last'] = time();
428
+			}
429
+			$last_exec[$id]['last'] = time();
430 430
 	} elseif ($value['format'] == 'aisnmeahttp') {
431
-	    $arr = $httpfeeds;
432
-	    $w = $e = null;
431
+		$arr = $httpfeeds;
432
+		$w = $e = null;
433 433
 	    
434
-	    if (isset($arr[$id])) {
435
-	    $nn = stream_select($arr,$w,$e,$timeout);
436
-	    if ($nn > 0) {
434
+		if (isset($arr[$id])) {
435
+		$nn = stream_select($arr,$w,$e,$timeout);
436
+		if ($nn > 0) {
437 437
 		foreach ($httpfeeds as $feed) {
438
-		    $buffer = stream_get_line($feed,2000,"\n");
439
-		    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
440
-		    $buffer = explode('\n',$buffer);
441
-		    foreach ($buffer as $line) {
438
+			$buffer = stream_get_line($feed,2000,"\n");
439
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
440
+			$buffer = explode('\n',$buffer);
441
+			foreach ($buffer as $line) {
442 442
 			if ($line != '') {
443
-			    $ais_data = $AIS->parse_line(trim($line));
444
-			    $data = array();
445
-			    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
446
-			    if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi'];
447
-			    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
448
-			    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
449
-			    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
450
-			    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
451
-			    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
452
-			    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
453
-			    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
454
-			    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
455
-			    if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
456
-			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
457
-			    if (isset($ais_data['timestamp'])) {
443
+				$ais_data = $AIS->parse_line(trim($line));
444
+				$data = array();
445
+				if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
446
+				if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi'];
447
+				if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
448
+				if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
449
+				if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
450
+				if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
451
+				if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
452
+				if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
453
+				if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
454
+				if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
455
+				if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
456
+				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
457
+				if (isset($ais_data['timestamp'])) {
458 458
 				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
459
-			    } else {
459
+				} else {
460 460
 				$data['datetime'] = date('Y-m-d H:i:s');
461
-			    }
462
-			    $data['format_source'] = 'aisnmeahttp';
463
-			    $data['id_source'] = $id_source;
464
-			    if ($ais_data['mmsi_type'] == 'Ship') $MI->add($data);
465
-			    unset($data);
461
+				}
462
+				$data['format_source'] = 'aisnmeahttp';
463
+				$data['id_source'] = $id_source;
464
+				if ($ais_data['mmsi_type'] == 'Ship') $MI->add($data);
465
+				unset($data);
466 466
 			}
467
-		    }
467
+			}
468
+		}
468 469
 		}
469 470
 		}
470
-	    }
471 471
 	} elseif ($value['format'] == 'myshiptracking' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) {
472
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
473
-	    if ($buffer != '') {
472
+		$buffer = $Common->getData($value['host'],'get','','','','','20');
473
+		if ($buffer != '') {
474 474
 		//echo $buffer;
475 475
 		$all_data = json_decode($buffer,true);
476 476
 		//print_r($all_data);
477 477
 		if (isset($all_data[0]['DATA'])) {
478 478
 		foreach ($all_data[0]['DATA'] as $line) {
479
-		    if ($line != '') {
479
+			if ($line != '') {
480 480
 			$data = array();
481 481
 			$data['ident'] = $line['NAME'];
482 482
 			$data['mmsi'] = $line['MMSI'];
@@ -492,87 +492,87 @@  discard block
 block discarded – undo
492 492
 			$data['id_source'] = $id_source;
493 493
 			$MI->add($data);
494 494
 			unset($data);
495
-		    }
495
+			}
496 496
 		}
497 497
 		}
498 498
 		
499
-	    }
500
-    	    $last_exec[$id]['last'] = time();
499
+		}
500
+			$last_exec[$id]['last'] = time();
501 501
 	} elseif ($value['format'] == 'boatbeaconapp' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) {
502
-	    $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host']));
503
-	    if ($buffer != '') {
502
+		$buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host']));
503
+		if ($buffer != '') {
504 504
 		$all_data = json_decode($buffer,true);
505 505
 		if (isset($all_data[0]['mmsi'])) {
506
-		    foreach ($all_data as $line) {
506
+			foreach ($all_data as $line) {
507 507
 			if ($line != '') {
508
-			    $data = array();
509
-			    $data['ident'] = $line['shipname'];
510
-			    $data['callsign'] = $line['callsign'];
511
-			    $data['mmsi'] = $line['mmsi'];
512
-			    $data['speed'] = $line['sog'];
513
-			    if ($line['heading'] != '511') $data['heading'] = $line['heading'];
514
-			    $data['latitude'] = $line['latitude'];
515
-			    $data['longitude'] = $line['longitude'];
516
-			    $data['type_id'] = $line['shiptype'];
517
-			    $data['arrival_code'] = $line['destination'];
518
-			    $data['datetime'] = $line['time'];
519
-			    $data['format_source'] = 'boatbeaconapp';
520
-			    $data['id_source'] = $id_source;
521
-			    $MI->add($data);
522
-			    unset($data);
508
+				$data = array();
509
+				$data['ident'] = $line['shipname'];
510
+				$data['callsign'] = $line['callsign'];
511
+				$data['mmsi'] = $line['mmsi'];
512
+				$data['speed'] = $line['sog'];
513
+				if ($line['heading'] != '511') $data['heading'] = $line['heading'];
514
+				$data['latitude'] = $line['latitude'];
515
+				$data['longitude'] = $line['longitude'];
516
+				$data['type_id'] = $line['shiptype'];
517
+				$data['arrival_code'] = $line['destination'];
518
+				$data['datetime'] = $line['time'];
519
+				$data['format_source'] = 'boatbeaconapp';
520
+				$data['id_source'] = $id_source;
521
+				$MI->add($data);
522
+				unset($data);
523
+			}
523 524
 			}
524
-		    }
525 525
 		}
526 526
 		
527
-	    }
528
-    	    $last_exec[$id]['last'] = time();
527
+		}
528
+			$last_exec[$id]['last'] = time();
529 529
 	} elseif ($value['format'] == 'shipplotter' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) {
530
-	    echo 'download...';
531
-	    $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter');
532
-	    echo 'done !'."\n";
533
-	    if ($buffer != '') $reset = 0;
534
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
535
-	    $buffer = explode('\n',$buffer);
536
-	    foreach ($buffer as $line) {
530
+		echo 'download...';
531
+		$buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter');
532
+		echo 'done !'."\n";
533
+		if ($buffer != '') $reset = 0;
534
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
535
+		$buffer = explode('\n',$buffer);
536
+		foreach ($buffer as $line) {
537 537
 		if ($line != '') {
538
-		    $data = array();
539
-		    $data['mmsi'] = (int)substr($line,0,9);
540
-		    $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10));
541
-		    //$data['status'] = substr($line,21,2);
542
-		    //$data['type'] = substr($line,24,3);
543
-		    $data['latitude'] = substr($line,29,9);
544
-		    $data['longitude'] = substr($line,41,9);
545
-		    $data['speed'] = round(substr($line,51,5));
546
-		    //$data['course'] = substr($line,57,5);
547
-		    $data['heading'] = round(substr($line,63,3));
548
-		    //$data['draft'] = substr($line,67,4);
549
-		    //$data['length'] = substr($line,72,3);
550
-		    //$data['beam'] = substr($line,76,2);
551
-		    $data['ident'] = trim(utf8_encode(substr($line,79,20)));
552
-		    //$data['callsign'] = trim(substr($line,100,7);
553
-		    //$data['dest'] = substr($line,108,20);
554
-		    //$data['etaDate'] = substr($line,129,5);
555
-		    //$data['etaTime'] = substr($line,135,5);
556
-		    $data['format_source'] = 'shipplotter';
557
-    		    $data['id_source'] = $id_source;
558
-		    print_r($data);
559
-		    echo 'Add...'."\n";
560
-		    $MI->add($data);
561
-		    unset($data);
538
+			$data = array();
539
+			$data['mmsi'] = (int)substr($line,0,9);
540
+			$data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10));
541
+			//$data['status'] = substr($line,21,2);
542
+			//$data['type'] = substr($line,24,3);
543
+			$data['latitude'] = substr($line,29,9);
544
+			$data['longitude'] = substr($line,41,9);
545
+			$data['speed'] = round(substr($line,51,5));
546
+			//$data['course'] = substr($line,57,5);
547
+			$data['heading'] = round(substr($line,63,3));
548
+			//$data['draft'] = substr($line,67,4);
549
+			//$data['length'] = substr($line,72,3);
550
+			//$data['beam'] = substr($line,76,2);
551
+			$data['ident'] = trim(utf8_encode(substr($line,79,20)));
552
+			//$data['callsign'] = trim(substr($line,100,7);
553
+			//$data['dest'] = substr($line,108,20);
554
+			//$data['etaDate'] = substr($line,129,5);
555
+			//$data['etaTime'] = substr($line,135,5);
556
+			$data['format_source'] = 'shipplotter';
557
+				$data['id_source'] = $id_source;
558
+			print_r($data);
559
+			echo 'Add...'."\n";
560
+			$MI->add($data);
561
+			unset($data);
562 562
 		}
563
-    	    }
564
-    	    $last_exec[$id]['last'] = time();
563
+			}
564
+			$last_exec[$id]['last'] = time();
565 565
 	//} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) {
566 566
 	} elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) {
567
-	    //$buffer = $Common->getData($hosts[$id]);
568
-	    $buffer = $Common->getData($value['host']);
569
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
570
-	    $buffer = explode('\n',$buffer);
571
-	    $reset = 0;
572
-	    foreach ($buffer as $line) {
573
-    		if ($line != '') {
574
-    		    $line = explode(':', $line);
575
-    		    if (count($line) > 30 && $line[0] != 'callsign') {
567
+		//$buffer = $Common->getData($hosts[$id]);
568
+		$buffer = $Common->getData($value['host']);
569
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
570
+		$buffer = explode('\n',$buffer);
571
+		$reset = 0;
572
+		foreach ($buffer as $line) {
573
+			if ($line != '') {
574
+				$line = explode(':', $line);
575
+				if (count($line) > 30 && $line[0] != 'callsign') {
576 576
 			$data = array();
577 577
 			if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37];
578 578
 			else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
@@ -585,36 +585,36 @@  discard block
 block discarded – undo
585 585
 			if (isset($line[45])) $data['heading'] = $line[45]; // heading
586 586
 			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
587 587
 			$data['latitude'] = $line[5]; // lat
588
-	        	$data['longitude'] = $line[6]; // long
589
-	        	$data['verticalrate'] = ''; // vertical rate
590
-	        	$data['squawk'] = ''; // squawk
591
-	        	$data['emergency'] = ''; // emergency
592
-	        	$data['waypoints'] = $line[30];
588
+				$data['longitude'] = $line[6]; // long
589
+				$data['verticalrate'] = ''; // vertical rate
590
+				$data['squawk'] = ''; // squawk
591
+				$data['emergency'] = ''; // emergency
592
+				$data['waypoints'] = $line[30];
593 593
 			$data['datetime'] = date('Y-m-d H:i:s');
594 594
 			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37]));
595 595
 			//if (isset($line[37])) $data['last_update'] = $line[37];
596
-		        $data['departure_airport_icao'] = $line[11];
597
-		        $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
598
-		        $data['arrival_airport_icao'] = $line[13];
596
+				$data['departure_airport_icao'] = $line[11];
597
+				$data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
598
+				$data['arrival_airport_icao'] = $line[13];
599 599
 			$data['frequency'] = $line[4];
600 600
 			$data['type'] = $line[18];
601 601
 			$data['range'] = $line[19];
602 602
 			if (isset($line[35])) $data['info'] = $line[35];
603
-    			$data['id_source'] = $id_source;
604
-	    		//$data['arrival_airport_time'] = ;
605
-	    		if ($line[9] != '') {
606
-	    		    $aircraft_data = explode('/',$line[9]);
607
-	    		    if (isset($aircraft_data[1])) {
608
-	    			$data['aircraft_icao'] = $aircraft_data[1];
609
-	    		    }
610
-        		}
611
-	    		/*
603
+				$data['id_source'] = $id_source;
604
+				//$data['arrival_airport_time'] = ;
605
+				if ($line[9] != '') {
606
+					$aircraft_data = explode('/',$line[9]);
607
+					if (isset($aircraft_data[1])) {
608
+					$data['aircraft_icao'] = $aircraft_data[1];
609
+					}
610
+				}
611
+				/*
612 612
 	    		if ($value == 'whazzup') $data['format_source'] = 'whazzup';
613 613
 	    		elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
614 614
 	    		*/
615
-	    		$data['format_source'] = $value['format'];
615
+				$data['format_source'] = $value['format'];
616 616
 			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
617
-    			if ($line[3] == 'PILOT') $SI->add($data);
617
+				if ($line[3] == 'PILOT') $SI->add($data);
618 618
 			elseif ($line[3] == 'ATC') {
619 619
 				//print_r($data);
620 620
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
@@ -632,247 +632,247 @@  discard block
 block discarded – undo
632 632
 				if (!isset($data['source_name'])) $data['source_name'] = '';
633 633
 				if (isset($ATC)) echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
634 634
 			}
635
-    			unset($data);
636
-    		    }
637
-    		}
638
-    	    }
639
-    	    //if ($value == 'whazzup') $last_exec['whazzup'] = time();
640
-    	    //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time();
641
-    	    $last_exec[$id]['last'] = time();
642
-    	//} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) {
643
-    	} elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
644
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
645
-	    if ($buffer != '') {
646
-	    $all_data = json_decode($buffer,true);
647
-	    if (isset($all_data['acList'])) {
635
+				unset($data);
636
+				}
637
+			}
638
+			}
639
+			//if ($value == 'whazzup') $last_exec['whazzup'] = time();
640
+			//elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time();
641
+			$last_exec[$id]['last'] = time();
642
+		//} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) {
643
+		} elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
644
+		$buffer = $Common->getData($value['host'],'get','','','','','20');
645
+		if ($buffer != '') {
646
+		$all_data = json_decode($buffer,true);
647
+		if (isset($all_data['acList'])) {
648 648
 		$reset = 0;
649 649
 		foreach ($all_data['acList'] as $line) {
650
-		    $data = array();
651
-		    $data['hex'] = $line['Icao']; // hex
652
-		    if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
653
-		    if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
654
-		    if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
655
-		    if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
656
-		    if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
657
-		    if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
658
-		    //$data['verticalrate'] = $line['']; // verticale rate
659
-		    if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
660
-		    $data['emergency'] = ''; // emergency
661
-		    if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
662
-		    /*
650
+			$data = array();
651
+			$data['hex'] = $line['Icao']; // hex
652
+			if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
653
+			if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
654
+			if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
655
+			if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
656
+			if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
657
+			if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
658
+			//$data['verticalrate'] = $line['']; // verticale rate
659
+			if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
660
+			$data['emergency'] = ''; // emergency
661
+			if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
662
+			/*
663 663
 		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000);
664 664
 		    else $data['datetime'] = date('Y-m-d H:i:s');
665 665
 		    */
666
-		    $data['datetime'] = date('Y-m-d H:i:s');
667
-		    if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
668
-	    	    $data['format_source'] = 'aircraftlistjson';
669
-		    $data['id_source'] = $id_source;
670
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
671
-		    if (isset($data['datetime'])) $SI->add($data);
672
-		    unset($data);
666
+			$data['datetime'] = date('Y-m-d H:i:s');
667
+			if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
668
+				$data['format_source'] = 'aircraftlistjson';
669
+			$data['id_source'] = $id_source;
670
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
671
+			if (isset($data['datetime'])) $SI->add($data);
672
+			unset($data);
673 673
 		}
674
-	    } elseif (is_array($all_data)) {
674
+		} elseif (is_array($all_data)) {
675 675
 		$reset = 0;
676 676
 		foreach ($all_data as $line) {
677
-		    $data = array();
678
-		    $data['hex'] = $line['hex']; // hex
679
-		    $data['ident'] = $line['flight']; // ident
680
-		    $data['altitude'] = $line['altitude']; // altitude
681
-		    $data['speed'] = $line['speed']; // speed
682
-		    $data['heading'] = $line['track']; // heading
683
-		    $data['latitude'] = $line['lat']; // lat
684
-		    $data['longitude'] = $line['lon']; // long
685
-		    $data['verticalrate'] = $line['vrt']; // verticale rate
686
-		    $data['squawk'] = $line['squawk']; // squawk
687
-		    $data['emergency'] = ''; // emergency
688
-		    $data['datetime'] = date('Y-m-d H:i:s');
689
-	    	    $data['format_source'] = 'aircraftlistjson';
690
-    		    $data['id_source'] = $id_source;
691
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
692
-		    $SI->add($data);
693
-		    unset($data);
677
+			$data = array();
678
+			$data['hex'] = $line['hex']; // hex
679
+			$data['ident'] = $line['flight']; // ident
680
+			$data['altitude'] = $line['altitude']; // altitude
681
+			$data['speed'] = $line['speed']; // speed
682
+			$data['heading'] = $line['track']; // heading
683
+			$data['latitude'] = $line['lat']; // lat
684
+			$data['longitude'] = $line['lon']; // long
685
+			$data['verticalrate'] = $line['vrt']; // verticale rate
686
+			$data['squawk'] = $line['squawk']; // squawk
687
+			$data['emergency'] = ''; // emergency
688
+			$data['datetime'] = date('Y-m-d H:i:s');
689
+				$data['format_source'] = 'aircraftlistjson';
690
+				$data['id_source'] = $id_source;
691
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
692
+			$SI->add($data);
693
+			unset($data);
694
+		}
694 695
 		}
695
-	    }
696
-	    }
697
-    	    //$last_exec['aircraftlistjson'] = time();
698
-    	    $last_exec[$id]['last'] = time();
699
-    	//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
700
-    	} elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
701
-	    $buffer = $Common->getData($value['host']);
702
-	    $all_data = json_decode($buffer,true);
703
-	    if (isset($all_data['planes'])) {
696
+		}
697
+			//$last_exec['aircraftlistjson'] = time();
698
+			$last_exec[$id]['last'] = time();
699
+		//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
700
+		} elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
701
+		$buffer = $Common->getData($value['host']);
702
+		$all_data = json_decode($buffer,true);
703
+		if (isset($all_data['planes'])) {
704 704
 		$reset = 0;
705 705
 		foreach ($all_data['planes'] as $key => $line) {
706
-		    $data = array();
707
-		    $data['hex'] = $key; // hex
708
-		    $data['ident'] = $line[3]; // ident
709
-		    $data['altitude'] = $line[6]; // altitude
710
-		    $data['speed'] = $line[8]; // speed
711
-		    $data['heading'] = $line[7]; // heading
712
-		    $data['latitude'] = $line[4]; // lat
713
-		    $data['longitude'] = $line[5]; // long
714
-		    //$data['verticalrate'] = $line[]; // verticale rate
715
-		    $data['squawk'] = $line[10]; // squawk
716
-		    $data['emergency'] = ''; // emergency
717
-		    $data['registration'] = $line[2];
718
-		    $data['aircraft_icao'] = $line[0];
719
-		    $deparr = explode('-',$line[1]);
720
-		    if (count($deparr) == 2) {
706
+			$data = array();
707
+			$data['hex'] = $key; // hex
708
+			$data['ident'] = $line[3]; // ident
709
+			$data['altitude'] = $line[6]; // altitude
710
+			$data['speed'] = $line[8]; // speed
711
+			$data['heading'] = $line[7]; // heading
712
+			$data['latitude'] = $line[4]; // lat
713
+			$data['longitude'] = $line[5]; // long
714
+			//$data['verticalrate'] = $line[]; // verticale rate
715
+			$data['squawk'] = $line[10]; // squawk
716
+			$data['emergency'] = ''; // emergency
717
+			$data['registration'] = $line[2];
718
+			$data['aircraft_icao'] = $line[0];
719
+			$deparr = explode('-',$line[1]);
720
+			if (count($deparr) == 2) {
721 721
 			$data['departure_airport_icao'] = $deparr[0];
722 722
 			$data['arrival_airport_icao'] = $deparr[1];
723
-		    }
724
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
725
-	    	    $data['format_source'] = 'planeupdatefaa';
726
-    		    $data['id_source'] = $id_source;
727
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
728
-		    $SI->add($data);
729
-		    unset($data);
723
+			}
724
+			$data['datetime'] = date('Y-m-d H:i:s',$line[9]);
725
+				$data['format_source'] = 'planeupdatefaa';
726
+				$data['id_source'] = $id_source;
727
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
728
+			$SI->add($data);
729
+			unset($data);
730
+		}
730 731
 		}
731
-	    }
732
-    	    //$last_exec['planeupdatefaa'] = time();
733
-    	    $last_exec[$id]['last'] = time();
734
-    	} elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
735
-	    $buffer = $Common->getData($value['host']);
736
-	    $all_data = json_decode($buffer,true);
737
-	    if (isset($all_data['states'])) {
732
+			//$last_exec['planeupdatefaa'] = time();
733
+			$last_exec[$id]['last'] = time();
734
+		} elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
735
+		$buffer = $Common->getData($value['host']);
736
+		$all_data = json_decode($buffer,true);
737
+		if (isset($all_data['states'])) {
738 738
 		$reset = 0;
739 739
 		foreach ($all_data['states'] as $key => $line) {
740
-		    $data = array();
741
-		    $data['hex'] = $line[0]; // hex
742
-		    $data['ident'] = trim($line[1]); // ident
743
-		    $data['altitude'] = round($line[7]*3.28084); // altitude
744
-		    $data['speed'] = round($line[9]*1.94384); // speed
745
-		    $data['heading'] = round($line[10]); // heading
746
-		    $data['latitude'] = $line[5]; // lat
747
-		    $data['longitude'] = $line[6]; // long
748
-		    $data['verticalrate'] = $line[11]; // verticale rate
749
-		    //$data['squawk'] = $line[10]; // squawk
750
-		    //$data['emergency'] = ''; // emergency
751
-		    //$data['registration'] = $line[2];
752
-		    //$data['aircraft_icao'] = $line[0];
753
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]);
754
-	    	    $data['format_source'] = 'opensky';
755
-    		    $data['id_source'] = $id_source;
756
-		    $SI->add($data);
757
-		    unset($data);
740
+			$data = array();
741
+			$data['hex'] = $line[0]; // hex
742
+			$data['ident'] = trim($line[1]); // ident
743
+			$data['altitude'] = round($line[7]*3.28084); // altitude
744
+			$data['speed'] = round($line[9]*1.94384); // speed
745
+			$data['heading'] = round($line[10]); // heading
746
+			$data['latitude'] = $line[5]; // lat
747
+			$data['longitude'] = $line[6]; // long
748
+			$data['verticalrate'] = $line[11]; // verticale rate
749
+			//$data['squawk'] = $line[10]; // squawk
750
+			//$data['emergency'] = ''; // emergency
751
+			//$data['registration'] = $line[2];
752
+			//$data['aircraft_icao'] = $line[0];
753
+			$data['datetime'] = date('Y-m-d H:i:s',$line[3]);
754
+				$data['format_source'] = 'opensky';
755
+				$data['id_source'] = $id_source;
756
+			$SI->add($data);
757
+			unset($data);
758
+		}
758 759
 		}
759
-	    }
760
-    	    //$last_exec['planeupdatefaa'] = time();
761
-    	    $last_exec[$id]['last'] = time();
762
-    	//} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) {
763
-    	} elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
764
-	    //$buffer = $Common->getData($hosts[$id]);
765
-	    $buffer = $Common->getData($value['host']);
766
-	    $all_data = json_decode($buffer,true);
767
-	    if (!empty($all_data)) $reset = 0;
768
-	    foreach ($all_data as $key => $line) {
760
+			//$last_exec['planeupdatefaa'] = time();
761
+			$last_exec[$id]['last'] = time();
762
+		//} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) {
763
+		} elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
764
+		//$buffer = $Common->getData($hosts[$id]);
765
+		$buffer = $Common->getData($value['host']);
766
+		$all_data = json_decode($buffer,true);
767
+		if (!empty($all_data)) $reset = 0;
768
+		foreach ($all_data as $key => $line) {
769 769
 		if ($key != 'full_count' && $key != 'version' && $key != 'stats') {
770
-		    $data = array();
771
-		    $data['hex'] = $line[0];
772
-		    $data['ident'] = $line[16]; //$line[13]
773
-	    	    $data['altitude'] = $line[4]; // altitude
774
-	    	    $data['speed'] = $line[5]; // speed
775
-	    	    $data['heading'] = $line[3]; // heading
776
-	    	    $data['latitude'] = $line[1]; // lat
777
-	    	    $data['longitude'] = $line[2]; // long
778
-	    	    $data['verticalrate'] = $line[15]; // verticale rate
779
-	    	    $data['squawk'] = $line[6]; // squawk
780
-	    	    $data['aircraft_icao'] = $line[8];
781
-	    	    $data['registration'] = $line[9];
782
-		    $data['departure_airport_iata'] = $line[11];
783
-		    $data['arrival_airport_iata'] = $line[12];
784
-	    	    $data['emergency'] = ''; // emergency
785
-		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
786
-	    	    $data['format_source'] = 'fr24json';
787
-    		    $data['id_source'] = $id_source;
788
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
789
-		    $SI->add($data);
790
-		    unset($data);
770
+			$data = array();
771
+			$data['hex'] = $line[0];
772
+			$data['ident'] = $line[16]; //$line[13]
773
+				$data['altitude'] = $line[4]; // altitude
774
+				$data['speed'] = $line[5]; // speed
775
+				$data['heading'] = $line[3]; // heading
776
+				$data['latitude'] = $line[1]; // lat
777
+				$data['longitude'] = $line[2]; // long
778
+				$data['verticalrate'] = $line[15]; // verticale rate
779
+				$data['squawk'] = $line[6]; // squawk
780
+				$data['aircraft_icao'] = $line[8];
781
+				$data['registration'] = $line[9];
782
+			$data['departure_airport_iata'] = $line[11];
783
+			$data['arrival_airport_iata'] = $line[12];
784
+				$data['emergency'] = ''; // emergency
785
+			$data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
786
+				$data['format_source'] = 'fr24json';
787
+				$data['id_source'] = $id_source;
788
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
789
+			$SI->add($data);
790
+			unset($data);
791
+		}
791 792
 		}
792
-	    }
793
-    	    //$last_exec['fr24json'] = time();
794
-    	    $last_exec[$id]['last'] = time();
795
-    	//} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) {
796
-    	} elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
797
-	    //$buffer = $Common->getData($hosts[$id],'get','','','','','150');
798
-	    $buffer = $Common->getData($value['host'],'get','','','','','150');
799
-	    //echo $buffer;
800
-	    $buffer = str_replace(array("\n","\r"),"",$buffer);
801
-	    $buffer = preg_replace('/,"num":(.+)/','}',$buffer);
802
-	    $all_data = json_decode($buffer,true);
803
-	    if (json_last_error() != JSON_ERROR_NONE) {
793
+			//$last_exec['fr24json'] = time();
794
+			$last_exec[$id]['last'] = time();
795
+		//} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) {
796
+		} elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
797
+		//$buffer = $Common->getData($hosts[$id],'get','','','','','150');
798
+		$buffer = $Common->getData($value['host'],'get','','','','','150');
799
+		//echo $buffer;
800
+		$buffer = str_replace(array("\n","\r"),"",$buffer);
801
+		$buffer = preg_replace('/,"num":(.+)/','}',$buffer);
802
+		$all_data = json_decode($buffer,true);
803
+		if (json_last_error() != JSON_ERROR_NONE) {
804 804
 		die(json_last_error_msg());
805
-	    }
806
-	    if (isset($all_data['mrkrs'])) {
805
+		}
806
+		if (isset($all_data['mrkrs'])) {
807 807
 		$reset = 0;
808 808
 		foreach ($all_data['mrkrs'] as $key => $line) {
809
-		    if (isset($line['inf'])) {
809
+			if (isset($line['inf'])) {
810 810
 			$data = array();
811 811
 			$data['hex'] = $line['inf']['ia'];
812 812
 			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
813
-	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
814
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
815
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
816
-	    		$data['latitude'] = $line['pt'][0]; // lat
817
-	    		$data['longitude'] = $line['pt'][1]; // long
818
-	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
819
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
820
-	    		//$data['aircraft_icao'] = $line[8];
821
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
813
+				$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
814
+				if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
815
+				if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
816
+				$data['latitude'] = $line['pt'][0]; // lat
817
+				$data['longitude'] = $line['pt'][1]; // long
818
+				//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
819
+				if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
820
+				//$data['aircraft_icao'] = $line[8];
821
+				if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
822 822
 			//$data['departure_airport_iata'] = $line[11];
823 823
 			//$data['arrival_airport_iata'] = $line[12];
824
-	    		//$data['emergency'] = ''; // emergency
824
+				//$data['emergency'] = ''; // emergency
825 825
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
826
-	    		$data['format_source'] = 'radarvirtueljson';
827
-    			$data['id_source'] = $id_source;
826
+				$data['format_source'] = 'radarvirtueljson';
827
+				$data['id_source'] = $id_source;
828 828
 			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
829 829
 			$SI->add($data);
830 830
 			unset($data);
831
-		    }
831
+			}
832 832
 		}
833
-	    }
834
-    	    //$last_exec['radarvirtueljson'] = time();
835
-    	    $last_exec[$id]['last'] = time();
836
-    	//} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) {
837
-    	} elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
838
-	    //$buffer = $Common->getData($hosts[$id]);
839
-	    $buffer = $Common->getData($value['host'].'?'.time());
840
-	    $all_data = json_decode(utf8_encode($buffer),true);
833
+		}
834
+			//$last_exec['radarvirtueljson'] = time();
835
+			$last_exec[$id]['last'] = time();
836
+		//} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) {
837
+		} elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
838
+		//$buffer = $Common->getData($hosts[$id]);
839
+		$buffer = $Common->getData($value['host'].'?'.time());
840
+		$all_data = json_decode(utf8_encode($buffer),true);
841 841
 	    
842
-	    if (isset($all_data['pireps'])) {
842
+		if (isset($all_data['pireps'])) {
843 843
 		$reset = 0;
844
-	        foreach ($all_data['pireps'] as $line) {
845
-		    $data = array();
846
-		    $data['id'] = $line['id'];
847
-		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
848
-		    $data['ident'] = $line['callsign']; // ident
849
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
850
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
851
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
852
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
853
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
854
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
855
-		    $data['latitude'] = $line['lat']; // lat
856
-		    $data['longitude'] = $line['lon']; // long
857
-		    //$data['verticalrate'] = $line['vrt']; // verticale rate
858
-		    //$data['squawk'] = $line['squawk']; // squawk
859
-		    //$data['emergency'] = ''; // emergency
860
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
861
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
862
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
863
-		    //$data['arrival_airport_time'] = $line['arrtime'];
864
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
865
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
866
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
867
-		    else $data['info'] = '';
868
-		    $data['format_source'] = 'pireps';
869
-    		    $data['id_source'] = $id_source;
870
-		    $data['datetime'] = date('Y-m-d H:i:s');
871
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
872
-		    if ($line['icon'] == 'plane') {
844
+			foreach ($all_data['pireps'] as $line) {
845
+			$data = array();
846
+			$data['id'] = $line['id'];
847
+			$data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
848
+			$data['ident'] = $line['callsign']; // ident
849
+			if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
850
+			if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
851
+			if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
852
+			if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
853
+			if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
854
+			if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
855
+			$data['latitude'] = $line['lat']; // lat
856
+			$data['longitude'] = $line['lon']; // long
857
+			//$data['verticalrate'] = $line['vrt']; // verticale rate
858
+			//$data['squawk'] = $line['squawk']; // squawk
859
+			//$data['emergency'] = ''; // emergency
860
+			if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
861
+			if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
862
+			if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
863
+			//$data['arrival_airport_time'] = $line['arrtime'];
864
+			if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
865
+			if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
866
+			if (isset($line['atis'])) $data['info'] = $line['atis'];
867
+			else $data['info'] = '';
868
+			$data['format_source'] = 'pireps';
869
+				$data['id_source'] = $id_source;
870
+			$data['datetime'] = date('Y-m-d H:i:s');
871
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
872
+			if ($line['icon'] == 'plane') {
873 873
 			$SI->add($data);
874
-		    //    print_r($data);
875
-    		    } elseif ($line['icon'] == 'ct') {
874
+			//    print_r($data);
875
+				} elseif ($line['icon'] == 'ct') {
876 876
 			$data['info'] = str_replace('^&sect;','<br />',$data['info']);
877 877
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
878 878
 			$typec = substr($data['ident'],-3);
@@ -887,188 +887,188 @@  discard block
 block discarded – undo
887 887
 			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
888 888
 			else $data['type'] = 'Observer';
889 889
 			if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']);
890
-		    }
891
-		    unset($data);
890
+			}
891
+			unset($data);
892 892
 		}
893
-	    }
894
-    	    //$last_exec['pirepsjson'] = time();
895
-    	    $last_exec[$id]['last'] = time();
896
-    	//} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) {
897
-    	} elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
898
-	    //$buffer = $Common->getData($hosts[$id]);
899
-	    if ($globalDebug) echo 'Get Data...'."\n";
900
-	    $buffer = $Common->getData($value['host']);
901
-	    $all_data = json_decode($buffer,true);
902
-	    if ($buffer != '' && is_array($all_data)) {
893
+		}
894
+			//$last_exec['pirepsjson'] = time();
895
+			$last_exec[$id]['last'] = time();
896
+		//} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) {
897
+		} elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
898
+		//$buffer = $Common->getData($hosts[$id]);
899
+		if ($globalDebug) echo 'Get Data...'."\n";
900
+		$buffer = $Common->getData($value['host']);
901
+		$all_data = json_decode($buffer,true);
902
+		if ($buffer != '' && is_array($all_data)) {
903 903
 		$reset = 0;
904 904
 		foreach ($all_data as $line) {
905
-	    	    $data = array();
906
-	    	    //$data['id'] = $line['id']; // id not usable
907
-	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
908
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
909
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
910
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
911
-	    	    $data['ident'] = $line['flightnum']; // ident
912
-	    	    $data['altitude'] = $line['alt']; // altitude
913
-	    	    $data['speed'] = $line['gs']; // speed
914
-	    	    $data['heading'] = $line['heading']; // heading
915
-	    	    $data['latitude'] = $line['lat']; // lat
916
-	    	    $data['longitude'] = $line['lng']; // long
917
-	    	    $data['verticalrate'] = ''; // verticale rate
918
-	    	    $data['squawk'] = ''; // squawk
919
-	    	    $data['emergency'] = ''; // emergency
920
-	    	    //$data['datetime'] = $line['lastupdate'];
921
-	    	    $data['last_update'] = $line['lastupdate'];
922
-		    $data['datetime'] = date('Y-m-d H:i:s');
923
-	    	    $data['departure_airport_icao'] = $line['depicao'];
924
-	    	    $data['departure_airport_time'] = $line['deptime'];
925
-	    	    $data['arrival_airport_icao'] = $line['arricao'];
926
-    		    $data['arrival_airport_time'] = $line['arrtime'];
927
-    		    $data['registration'] = $line['aircraft'];
928
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
929
-		    if (isset($line['aircraftname'])) {
905
+				$data = array();
906
+				//$data['id'] = $line['id']; // id not usable
907
+				if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
908
+				$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
909
+				if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
910
+				if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
911
+				$data['ident'] = $line['flightnum']; // ident
912
+				$data['altitude'] = $line['alt']; // altitude
913
+				$data['speed'] = $line['gs']; // speed
914
+				$data['heading'] = $line['heading']; // heading
915
+				$data['latitude'] = $line['lat']; // lat
916
+				$data['longitude'] = $line['lng']; // long
917
+				$data['verticalrate'] = ''; // verticale rate
918
+				$data['squawk'] = ''; // squawk
919
+				$data['emergency'] = ''; // emergency
920
+				//$data['datetime'] = $line['lastupdate'];
921
+				$data['last_update'] = $line['lastupdate'];
922
+			$data['datetime'] = date('Y-m-d H:i:s');
923
+				$data['departure_airport_icao'] = $line['depicao'];
924
+				$data['departure_airport_time'] = $line['deptime'];
925
+				$data['arrival_airport_icao'] = $line['arricao'];
926
+				$data['arrival_airport_time'] = $line['arrtime'];
927
+				$data['registration'] = $line['aircraft'];
928
+			if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
929
+			if (isset($line['aircraftname'])) {
930 930
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
931 931
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
932
-	    		$aircraft_data = explode('-',$line['aircraftname']);
933
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0];
934
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1];
935
-	    		else {
936
-	    		    $aircraft_data = explode(' ',$line['aircraftname']);
937
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1];
938
-	    		    else $data['aircraft_icao'] = $line['aircraftname'];
939
-	    		}
940
-	    	    }
941
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
942
-    		    $data['id_source'] = $id_source;
943
-	    	    $data['format_source'] = 'phpvmacars';
944
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
945
-		    $SI->add($data);
946
-		    unset($data);
932
+				$aircraft_data = explode('-',$line['aircraftname']);
933
+				if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0];
934
+				elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1];
935
+				else {
936
+					$aircraft_data = explode(' ',$line['aircraftname']);
937
+					if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1];
938
+					else $data['aircraft_icao'] = $line['aircraftname'];
939
+				}
940
+				}
941
+				if (isset($line['route'])) $data['waypoints'] = $line['route'];
942
+				$data['id_source'] = $id_source;
943
+				$data['format_source'] = 'phpvmacars';
944
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
945
+			$SI->add($data);
946
+			unset($data);
947 947
 		}
948 948
 		if ($globalDebug) echo 'No more data...'."\n";
949 949
 		unset($buffer);
950 950
 		unset($all_data);
951
-	    }
952
-    	    //$last_exec['phpvmacars'] = time();
953
-    	    $last_exec[$id]['last'] = time();
954
-    	} elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
955
-	    //$buffer = $Common->getData($hosts[$id]);
956
-	    if ($globalDebug) echo 'Get Data...'."\n";
957
-	    $buffer = $Common->getData($value['host']);
958
-	    $all_data = json_decode($buffer,true);
959
-	    if ($buffer != '' && is_array($all_data)) {
951
+		}
952
+			//$last_exec['phpvmacars'] = time();
953
+			$last_exec[$id]['last'] = time();
954
+		} elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
955
+		//$buffer = $Common->getData($hosts[$id]);
956
+		if ($globalDebug) echo 'Get Data...'."\n";
957
+		$buffer = $Common->getData($value['host']);
958
+		$all_data = json_decode($buffer,true);
959
+		if ($buffer != '' && is_array($all_data)) {
960 960
 		$reset = 0;
961 961
 		foreach ($all_data as $line) {
962
-	    	    $data = array();
963
-	    	    //$data['id'] = $line['id']; // id not usable
964
-	    	    $data['id'] = trim($line['flight_id']);
965
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex
966
-	    	    $data['pilot_name'] = $line['pilot_name'];
967
-	    	    $data['pilot_id'] = $line['pilot_id'];
968
-	    	    $data['ident'] = trim($line['callsign']); // ident
969
-	    	    $data['altitude'] = $line['altitude']; // altitude
970
-	    	    $data['speed'] = $line['gs']; // speed
971
-	    	    $data['heading'] = $line['heading']; // heading
972
-	    	    $data['latitude'] = $line['latitude']; // lat
973
-	    	    $data['longitude'] = $line['longitude']; // long
974
-	    	    $data['verticalrate'] = ''; // verticale rate
975
-	    	    $data['squawk'] = ''; // squawk
976
-	    	    $data['emergency'] = ''; // emergency
977
-	    	    //$data['datetime'] = $line['lastupdate'];
978
-	    	    $data['last_update'] = $line['last_update'];
979
-		    $data['datetime'] = date('Y-m-d H:i:s');
980
-	    	    $data['departure_airport_icao'] = $line['departure'];
981
-	    	    //$data['departure_airport_time'] = $line['departure_time'];
982
-	    	    $data['arrival_airport_icao'] = $line['arrival'];
983
-    		    //$data['arrival_airport_time'] = $line['arrival_time'];
984
-    		    //$data['registration'] = $line['aircraft'];
985
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
986
-	    	    $data['aircraft_icao'] = $line['plane_type'];
987
-    		    $data['id_source'] = $id_source;
988
-	    	    $data['format_source'] = 'vam';
989
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
990
-		    $SI->add($data);
991
-		    unset($data);
962
+				$data = array();
963
+				//$data['id'] = $line['id']; // id not usable
964
+				$data['id'] = trim($line['flight_id']);
965
+				$data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex
966
+				$data['pilot_name'] = $line['pilot_name'];
967
+				$data['pilot_id'] = $line['pilot_id'];
968
+				$data['ident'] = trim($line['callsign']); // ident
969
+				$data['altitude'] = $line['altitude']; // altitude
970
+				$data['speed'] = $line['gs']; // speed
971
+				$data['heading'] = $line['heading']; // heading
972
+				$data['latitude'] = $line['latitude']; // lat
973
+				$data['longitude'] = $line['longitude']; // long
974
+				$data['verticalrate'] = ''; // verticale rate
975
+				$data['squawk'] = ''; // squawk
976
+				$data['emergency'] = ''; // emergency
977
+				//$data['datetime'] = $line['lastupdate'];
978
+				$data['last_update'] = $line['last_update'];
979
+			$data['datetime'] = date('Y-m-d H:i:s');
980
+				$data['departure_airport_icao'] = $line['departure'];
981
+				//$data['departure_airport_time'] = $line['departure_time'];
982
+				$data['arrival_airport_icao'] = $line['arrival'];
983
+				//$data['arrival_airport_time'] = $line['arrival_time'];
984
+				//$data['registration'] = $line['aircraft'];
985
+			if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
986
+				$data['aircraft_icao'] = $line['plane_type'];
987
+				$data['id_source'] = $id_source;
988
+				$data['format_source'] = 'vam';
989
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
990
+			$SI->add($data);
991
+			unset($data);
992 992
 		}
993 993
 		if ($globalDebug) echo 'No more data...'."\n";
994 994
 		unset($buffer);
995 995
 		unset($all_data);
996
-	    }
997
-    	    //$last_exec['phpvmacars'] = time();
998
-    	    $last_exec[$id]['last'] = time();
996
+		}
997
+			//$last_exec['phpvmacars'] = time();
998
+			$last_exec[$id]['last'] = time();
999 999
 	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') {
1000 1000
 	} elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais') {
1001
-	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1002
-    	    //$last_exec[$id]['last'] = time();
1001
+		if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1002
+			//$last_exec[$id]['last'] = time();
1003 1003
 
1004
-	    //$read = array( $sockets[$id] );
1005
-	    $read = $sockets;
1006
-	    $write = NULL;
1007
-	    $e = NULL;
1008
-	    $n = socket_select($read, $write, $e, $timeout);
1009
-	    if ($e != NULL) var_dump($e);
1010
-	    if ($n > 0) {
1004
+		//$read = array( $sockets[$id] );
1005
+		$read = $sockets;
1006
+		$write = NULL;
1007
+		$e = NULL;
1008
+		$n = socket_select($read, $write, $e, $timeout);
1009
+		if ($e != NULL) var_dump($e);
1010
+		if ($n > 0) {
1011 1011
 		$reset = 0;
1012 1012
 		foreach ($read as $nb => $r) {
1013
-		    //$value = $formats[$nb];
1014
-		    $format = $globalSources[$nb]['format'];
1015
-        	    if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') {
1016
-        		$buffer = socket_read($r, 6000,PHP_NORMAL_READ);
1017
-        	    } else {
1018
-	    	        $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port);
1019
-	    	    }
1020
-        	    //$buffer = socket_read($r, 60000,PHP_NORMAL_READ);
1021
-        	    //echo $buffer."\n";
1022
-		    // lets play nice and handle signals such as ctrl-c/kill properly
1023
-		    //if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1024
-		    $error = false;
1025
-		    //$SI::del();
1026
-		    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
1027
-		    // SBS format is CSV format
1028
-		    if ($buffer != '') {
1013
+			//$value = $formats[$nb];
1014
+			$format = $globalSources[$nb]['format'];
1015
+				if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') {
1016
+				$buffer = socket_read($r, 6000,PHP_NORMAL_READ);
1017
+				} else {
1018
+					$az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port);
1019
+				}
1020
+				//$buffer = socket_read($r, 60000,PHP_NORMAL_READ);
1021
+				//echo $buffer."\n";
1022
+			// lets play nice and handle signals such as ctrl-c/kill properly
1023
+			//if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1024
+			$error = false;
1025
+			//$SI::del();
1026
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
1027
+			// SBS format is CSV format
1028
+			if ($buffer != '') {
1029 1029
 			$tt[$format] = 0;
1030 1030
 			if ($format == 'acarssbs3') {
1031
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1032
-			    $ACARS->add(trim($buffer));
1033
-			    $ACARS->deleteLiveAcarsData();
1031
+							if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1032
+				$ACARS->add(trim($buffer));
1033
+				$ACARS->deleteLiveAcarsData();
1034 1034
 			} elseif ($format == 'raw') {
1035
-			    // AVR format
1036
-			    $data = $SBS->parse($buffer);
1037
-			    if (is_array($data)) {
1035
+				// AVR format
1036
+				$data = $SBS->parse($buffer);
1037
+				if (is_array($data)) {
1038 1038
 				$data['datetime'] = date('Y-m-d H:i:s');
1039 1039
 				$data['format_source'] = 'raw';
1040 1040
 				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1041
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1042
-                                if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1043
-                            }
1044
-                        } elseif ($format == 'ais') {
1045
-			    $ais_data = $AIS->parse_line(trim($buffer));
1046
-			    $data = array();
1047
-			    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
1048
-			    if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi'];
1049
-			    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
1050
-			    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
1051
-			    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
1052
-			    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
1053
-			    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
1054
-			    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
1055
-			    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
1056
-			    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
1057
-			    if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
1058
-			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1041
+					if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1042
+								if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1043
+							}
1044
+						} elseif ($format == 'ais') {
1045
+				$ais_data = $AIS->parse_line(trim($buffer));
1046
+				$data = array();
1047
+				if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
1048
+				if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi'];
1049
+				if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
1050
+				if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
1051
+				if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
1052
+				if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
1053
+				if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
1054
+				if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
1055
+				if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
1056
+				if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
1057
+				if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
1058
+				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1059 1059
 
1060
-			    if (isset($ais_data['timestamp'])) {
1060
+				if (isset($ais_data['timestamp'])) {
1061 1061
 				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
1062
-			    } else {
1062
+				} else {
1063 1063
 				$data['datetime'] = date('Y-m-d H:i:s');
1064
-			    }
1065
-			    $data['format_source'] = 'aisnmea';
1066
-    			    $data['id_source'] = $id_source;
1067
-			    if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
1068
-			    unset($data);
1069
-                        } elseif ($format == 'flightgearsp') {
1070
-                    	    //echo $buffer."\n";
1071
-                    	    if (strlen($buffer) > 5) {
1064
+				}
1065
+				$data['format_source'] = 'aisnmea';
1066
+					$data['id_source'] = $id_source;
1067
+				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
1068
+				unset($data);
1069
+						} elseif ($format == 'flightgearsp') {
1070
+							//echo $buffer."\n";
1071
+							if (strlen($buffer) > 5) {
1072 1072
 				$line = explode(',',$buffer);
1073 1073
 				$data = array();
1074 1074
 				//XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p
@@ -1084,123 +1084,123 @@  discard block
 block discarded – undo
1084 1084
 				$data['format_source'] = 'flightgearsp';
1085 1085
 				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1086 1086
 				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1087
-			    }
1088
-                        } elseif ($format == 'acars') {
1089
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1090
-			    $ACARS->add(trim($buffer));
1091
-			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
1092
-			    $ACARS->deleteLiveAcarsData();
1087
+				}
1088
+						} elseif ($format == 'acars') {
1089
+							if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1090
+				$ACARS->add(trim($buffer));
1091
+				socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
1092
+				$ACARS->deleteLiveAcarsData();
1093 1093
 			} elseif ($format == 'flightgearmp') {
1094
-			    if (substr($buffer,0,1) != '#') {
1094
+				if (substr($buffer,0,1) != '#') {
1095 1095
 				$data = array();
1096 1096
 				//echo $buffer."\n";
1097 1097
 				$line = explode(' ',$buffer);
1098 1098
 				if (count($line) == 11) {
1099
-				    $userserver = explode('@',$line[0]);
1100
-				    $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex
1101
-				    $data['ident'] = $userserver[0];
1102
-				    $data['registration'] = $userserver[0];
1103
-				    $data['latitude'] = $line[4];
1104
-				    $data['longitude'] = $line[5];
1105
-				    $data['altitude'] = $line[6];
1106
-				    $data['datetime'] = date('Y-m-d H:i:s');
1107
-				    $aircraft_type = $line[10];
1108
-				    $aircraft_type = preg_split(':/:',$aircraft_type);
1109
-				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
1110
-				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1099
+					$userserver = explode('@',$line[0]);
1100
+					$data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex
1101
+					$data['ident'] = $userserver[0];
1102
+					$data['registration'] = $userserver[0];
1103
+					$data['latitude'] = $line[4];
1104
+					$data['longitude'] = $line[5];
1105
+					$data['altitude'] = $line[6];
1106
+					$data['datetime'] = date('Y-m-d H:i:s');
1107
+					$aircraft_type = $line[10];
1108
+					$aircraft_type = preg_split(':/:',$aircraft_type);
1109
+					$data['aircraft_name'] = substr(end($aircraft_type),0,-4);
1110
+					if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1111
+				}
1111 1112
 				}
1112
-			    }
1113 1113
 			} elseif ($format == 'beast') {
1114
-			    echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n";
1115
-			    die;
1114
+				echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n";
1115
+				die;
1116 1116
 			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') {
1117
-			    $line = explode("\t", $buffer);
1118
-			    for($k = 0; $k < count($line); $k=$k+2) {
1117
+				$line = explode("\t", $buffer);
1118
+				for($k = 0; $k < count($line); $k=$k+2) {
1119 1119
 				$key = $line[$k];
1120
-			        $lined[$key] = $line[$k+1];
1121
-			    }
1122
-    			    if (count($lined) > 3) {
1123
-    				$data['hex'] = $lined['hexid'];
1124
-    				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
1125
-    				$data['datetime'] = date('Y-m-d H:i:s');;
1126
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
1127
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
1128
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
1129
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
1130
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
1131
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
1132
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
1133
-    				$data['id_source'] = $id_source;
1134
-    				$data['format_source'] = 'tsv';
1135
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1136
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1137
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1138
-    				unset($lined);
1139
-    				unset($data);
1140
-    			    } else $error = true;
1120
+					$lined[$key] = $line[$k+1];
1121
+				}
1122
+					if (count($lined) > 3) {
1123
+					$data['hex'] = $lined['hexid'];
1124
+					//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
1125
+					$data['datetime'] = date('Y-m-d H:i:s');;
1126
+					if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
1127
+					if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
1128
+					if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
1129
+					if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
1130
+					if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
1131
+					if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
1132
+					if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
1133
+					$data['id_source'] = $id_source;
1134
+					$data['format_source'] = 'tsv';
1135
+					if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1136
+					if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1137
+					if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1138
+					unset($lined);
1139
+					unset($data);
1140
+					} else $error = true;
1141 1141
 			} elseif ($format == 'aprs' && $use_aprs) {
1142
-			    if ($aprs_connect == 0) {
1142
+				if ($aprs_connect == 0) {
1143 1143
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
1144 1144
 				$aprs_connect = 1;
1145
-			    }
1145
+				}
1146 1146
 			    
1147
-			    if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) {
1147
+				if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) {
1148 1148
 				$aprs_last_tx = time();
1149 1149
 				$data_aprs = "# Keep alive";
1150 1150
 				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1151
-			    }
1151
+				}
1152 1152
 			    
1153
-			    //echo 'Connect : '.$aprs_connect.' '.$buffer."\n";
1154
-			    //echo 'APRS data : '.$buffer."\n";
1155
-			    $buffer = str_replace('APRS <- ','',$buffer);
1156
-			    $buffer = str_replace('APRS -> ','',$buffer);
1157
-			    echo $buffer."\n";
1158
-			    if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') {
1153
+				//echo 'Connect : '.$aprs_connect.' '.$buffer."\n";
1154
+				//echo 'APRS data : '.$buffer."\n";
1155
+				$buffer = str_replace('APRS <- ','',$buffer);
1156
+				$buffer = str_replace('APRS -> ','',$buffer);
1157
+				echo $buffer."\n";
1158
+				if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') {
1159 1159
 				$line = $APRS->parse($buffer);
1160 1160
 				//print_r($line);
1161 1161
 				//if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) {
1162 1162
 				if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']))) {
1163
-				    $aprs_last_tx = time();
1164
-				    $data = array();
1165
-				    //print_r($line);
1166
-				    if (isset($line['address'])) $data['hex'] = $line['address'];
1167
-				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
1168
-				    else $data['datetime'] = date('Y-m-d H:i:s');
1169
-				    //$data['datetime'] = date('Y-m-d H:i:s');
1170
-				    if (isset($line['ident'])) $data['ident'] = $line['ident'];
1171
-				    $data['latitude'] = $line['latitude'];
1172
-				    $data['longitude'] = $line['longitude'];
1173
-				    //$data['verticalrate'] = $line[16];
1174
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
1175
-				    else $data['speed'] = 0;
1176
-				    if (isset($line['altitude'])) $data['altitude'] = $line['altitude'];
1177
-				    if (isset($line['comment'])) $data['comment'] = $line['comment'];
1178
-				    if (isset($line['symbol'])) $data['type'] = $line['symbol'];
1179
-				    if (isset($line['heading'])) $data['heading'] = $line['heading'];
1180
-				    //else $data['heading'] = 0;
1181
-				    if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth'];
1182
-				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true;
1183
-    				    $data['id_source'] = $id_source;
1184
-    				    if (isset($line['format_source'])) $data['format_source'] = $line['format_source'];
1185
-				    else $data['format_source'] = 'aprs';
1186
-				    $data['source_name'] = $line['source'];
1187
-				    if (isset($line['source_type'])) $data['source_type'] = $line['source_type'];
1188
-				    else $data['source_type'] = 'flarm';
1189
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1190
-				    $currentdate = date('Y-m-d H:i:s');
1191
-				    $aprsdate = strtotime($data['datetime']);
1192
-				    // Accept data if time <= system time + 20s
1193
-				    if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1163
+					$aprs_last_tx = time();
1164
+					$data = array();
1165
+					//print_r($line);
1166
+					if (isset($line['address'])) $data['hex'] = $line['address'];
1167
+					if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
1168
+					else $data['datetime'] = date('Y-m-d H:i:s');
1169
+					//$data['datetime'] = date('Y-m-d H:i:s');
1170
+					if (isset($line['ident'])) $data['ident'] = $line['ident'];
1171
+					$data['latitude'] = $line['latitude'];
1172
+					$data['longitude'] = $line['longitude'];
1173
+					//$data['verticalrate'] = $line[16];
1174
+					if (isset($line['speed'])) $data['speed'] = $line['speed'];
1175
+					else $data['speed'] = 0;
1176
+					if (isset($line['altitude'])) $data['altitude'] = $line['altitude'];
1177
+					if (isset($line['comment'])) $data['comment'] = $line['comment'];
1178
+					if (isset($line['symbol'])) $data['type'] = $line['symbol'];
1179
+					if (isset($line['heading'])) $data['heading'] = $line['heading'];
1180
+					//else $data['heading'] = 0;
1181
+					if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth'];
1182
+					if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true;
1183
+						$data['id_source'] = $id_source;
1184
+						if (isset($line['format_source'])) $data['format_source'] = $line['format_source'];
1185
+					else $data['format_source'] = 'aprs';
1186
+					$data['source_name'] = $line['source'];
1187
+					if (isset($line['source_type'])) $data['source_type'] = $line['source_type'];
1188
+					else $data['source_type'] = 'flarm';
1189
+						if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1190
+					$currentdate = date('Y-m-d H:i:s');
1191
+					$aprsdate = strtotime($data['datetime']);
1192
+					// Accept data if time <= system time + 20s
1193
+					if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1194 1194
 					$send = $SI->add($data);
1195
-				    } elseif (isset($line['stealth'])) {
1195
+					} elseif (isset($line['stealth'])) {
1196 1196
 					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
1197 1197
 					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
1198
-				    //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] == 'Car' || $line['symbol'] == 'Ambulance' || $line['symbol'] == 'Van' || $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || $line['symbol'] == 'Motorcycle' || $line['symbol'] == 'Police' || $line['symbol'] == 'Bike' || $line['symbol'] == 'Jogger' || $line['symbol'] == 'Bus' || $line['symbol'] == 'Jeep' || $line['symbol'] == 'Recreational Vehicle' || $line['symbol'] == 'Yacht (Sail)' || $line['symbol'] == 'Ship (Power Boat)' || $line['symbol'] == 'Firetruck' || $line['symbol'] == 'Balloon' || $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) {
1199
-				    } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1198
+					//} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] == 'Car' || $line['symbol'] == 'Ambulance' || $line['symbol'] == 'Van' || $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || $line['symbol'] == 'Motorcycle' || $line['symbol'] == 'Police' || $line['symbol'] == 'Bike' || $line['symbol'] == 'Jogger' || $line['symbol'] == 'Bus' || $line['symbol'] == 'Jeep' || $line['symbol'] == 'Recreational Vehicle' || $line['symbol'] == 'Yacht (Sail)' || $line['symbol'] == 'Ship (Power Boat)' || $line['symbol'] == 'Firetruck' || $line['symbol'] == 'Balloon' || $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) {
1199
+					} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1200 1200
 					//echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n";
1201 1201
 					if (isset($globalTracker) && $globalTracker) $send = $TI->add($data);
1202
-				    }
1203
-				    unset($data);
1202
+					}
1203
+					unset($data);
1204 1204
 				} 
1205 1205
 				elseif (is_array($line) && $globalDebug && isset($line['symbol']) && $line['symbol'] == 'Weather Station') {
1206 1206
 					echo '!! Weather Station not yet supported'."\n";
@@ -1210,12 +1210,12 @@  discard block
 block discarded – undo
1210 1210
 				}
1211 1211
 				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
1212 1212
 				//elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
1213
-			    }
1213
+				}
1214 1214
 			} else {
1215
-			    $line = explode(',', $buffer);
1216
-    			    if (count($line) > 20) {
1217
-    			    	$data['hex'] = $line[4];
1218
-    				/*
1215
+				$line = explode(',', $buffer);
1216
+					if (count($line) > 20) {
1217
+						$data['hex'] = $line[4];
1218
+					/*
1219 1219
     				$data['datetime'] = $line[6].' '.$line[7];
1220 1220
     					date_default_timezone_set($globalTimezone);
1221 1221
     					$datetime = new DateTime($data['datetime']);
@@ -1223,29 +1223,29 @@  discard block
 block discarded – undo
1223 1223
     					$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1224 1224
     					date_default_timezone_set('UTC');
1225 1225
     				*/
1226
-    				// Force datetime to current UTC datetime
1227
-    				date_default_timezone_set('UTC');
1228
-    				$data['datetime'] = date('Y-m-d H:i:s');
1229
-    				$data['ident'] = trim($line[10]);
1230
-    				$data['latitude'] = $line[14];
1231
-    				$data['longitude'] = $line[15];
1232
-    				$data['verticalrate'] = $line[16];
1233
-    				$data['emergency'] = $line[20];
1234
-    				$data['speed'] = $line[12];
1235
-    				$data['squawk'] = $line[17];
1236
-    				$data['altitude'] = $line[11];
1237
-    				$data['heading'] = $line[13];
1238
-    				$data['ground'] = $line[21];
1239
-    				$data['emergency'] = $line[19];
1240
-    				$data['format_source'] = 'sbs';
1226
+					// Force datetime to current UTC datetime
1227
+					date_default_timezone_set('UTC');
1228
+					$data['datetime'] = date('Y-m-d H:i:s');
1229
+					$data['ident'] = trim($line[10]);
1230
+					$data['latitude'] = $line[14];
1231
+					$data['longitude'] = $line[15];
1232
+					$data['verticalrate'] = $line[16];
1233
+					$data['emergency'] = $line[20];
1234
+					$data['speed'] = $line[12];
1235
+					$data['squawk'] = $line[17];
1236
+					$data['altitude'] = $line[11];
1237
+					$data['heading'] = $line[13];
1238
+					$data['ground'] = $line[21];
1239
+					$data['emergency'] = $line[19];
1240
+					$data['format_source'] = 'sbs';
1241 1241
 				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1242
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1243
-    				$data['id_source'] = $id_source;
1244
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
1245
-    				else $error = true;
1246
-    				unset($data);
1247
-    			    } else $error = true;
1248
-			    if ($error) {
1242
+					if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1243
+					$data['id_source'] = $id_source;
1244
+					if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
1245
+					else $error = true;
1246
+					unset($data);
1247
+					} else $error = true;
1248
+				if ($error) {
1249 1249
 				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { 
1250 1250
 					if ($globalDebug) echo "Not a message. Ignoring... \n";
1251 1251
 				} else {
@@ -1261,13 +1261,13 @@  discard block
 block discarded – undo
1261 1261
 					connect_all($sourceer);
1262 1262
 					$sourceer = array();
1263 1263
 				}
1264
-			    }
1264
+				}
1265 1265
 			}
1266 1266
 			// Sleep for xxx microseconds
1267 1267
 			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
1268
-		    } else {
1268
+			} else {
1269 1269
 			if ($format == 'flightgearmp') {
1270
-			    	if ($globalDebug) echo "Reconnect FlightGear MP...";
1270
+					if ($globalDebug) echo "Reconnect FlightGear MP...";
1271 1271
 				//@socket_close($r);
1272 1272
 				sleep($globalMinFetch);
1273 1273
 				$sourcefg[$nb] = $globalSources[$nb];
@@ -1276,9 +1276,9 @@  discard block
 block discarded – undo
1276 1276
 				break;
1277 1277
 				
1278 1278
 			} elseif ($format != 'acars' && $format != 'flightgearsp') {
1279
-			    if (isset($tt[$format])) $tt[$format]++;
1280
-			    else $tt[$format] = 0;
1281
-			    if ($tt[$format] > 30) {
1279
+				if (isset($tt[$format])) $tt[$format]++;
1280
+				else $tt[$format] = 0;
1281
+				if ($tt[$format] > 30) {
1282 1282
 				if ($globalDebug) echo "ERROR : Reconnect ".$format."...";
1283 1283
 				//@socket_close($r);
1284 1284
 				sleep(2);
@@ -1289,23 +1289,23 @@  discard block
 block discarded – undo
1289 1289
 				//connect_all($globalSources);
1290 1290
 				$tt[$format]=0;
1291 1291
 				break;
1292
-			    }
1292
+				}
1293
+			}
1293 1294
 			}
1294
-		    }
1295 1295
 		}
1296
-	    } else {
1296
+		} else {
1297 1297
 		$error = socket_strerror(socket_last_error());
1298 1298
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) {
1299 1299
 			if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1300 1300
 			if (isset($globalDebug)) echo "Restarting...\n";
1301 1301
 			// Restart the script if possible
1302 1302
 			if (is_array($sockets)) {
1303
-			    if ($globalDebug) echo "Shutdown all sockets...";
1303
+				if ($globalDebug) echo "Shutdown all sockets...";
1304 1304
 			    
1305
-			    foreach ($sockets as $sock) {
1305
+				foreach ($sockets as $sock) {
1306 1306
 				@socket_shutdown($sock,2);
1307 1307
 				@socket_close($sock);
1308
-			    }
1308
+				}
1309 1309
 			    
1310 1310
 			}
1311 1311
 			if ($globalDebug) echo "Restart all connections...";
@@ -1316,13 +1316,13 @@  discard block
 block discarded – undo
1316 1316
 			if ($reset > 40) exit('Too many attempts...');
1317 1317
 			connect_all($globalSources);
1318 1318
 		}
1319
-	    }
1319
+		}
1320 1320
 	}
1321 1321
 	if ($globalDaemon === false) {
1322
-	    if ($globalDebug) echo 'Check all...'."\n";
1323
-	    $SI->checkAll();
1322
+		if ($globalDebug) echo 'Check all...'."\n";
1323
+		$SI->checkAll();
1324
+	}
1324 1325
 	}
1325
-    }
1326 1326
 }
1327 1327
 
1328 1328
 ?>
Please login to merge, or discard this patch.