@@ -55,10 +55,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 4337 | 4337 | |
| 4338 | 4338 | |
| 4339 | 4339 | /** |
| 4340 | - * Gets all airline countries that have flown over by aircraft |
|
| 4341 | - * |
|
| 4342 | - * @return Array the airline country list |
|
| 4343 | - * |
|
| 4344 | - */ |
|
| 4340 | + * Gets all airline countries that have flown over by aircraft |
|
| 4341 | + * |
|
| 4342 | + * @return Array the airline country list |
|
| 4343 | + * |
|
| 4344 | + */ |
|
| 4345 | 4345 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
| 4346 | 4346 | { |
| 4347 | 4347 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4374,11 +4374,11 @@ discard block |
||
| 4374 | 4374 | |
| 4375 | 4375 | |
| 4376 | 4376 | /** |
| 4377 | - * Gets all airlines that have flown over by airport |
|
| 4378 | - * |
|
| 4379 | - * @return Array the airline list |
|
| 4380 | - * |
|
| 4381 | - */ |
|
| 4377 | + * Gets all airlines that have flown over by airport |
|
| 4378 | + * |
|
| 4379 | + * @return Array the airline list |
|
| 4380 | + * |
|
| 4381 | + */ |
|
| 4382 | 4382 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
| 4383 | 4383 | { |
| 4384 | 4384 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4409,11 +4409,11 @@ discard block |
||
| 4409 | 4409 | |
| 4410 | 4410 | |
| 4411 | 4411 | /** |
| 4412 | - * Gets all airline countries that have flown over by airport icao |
|
| 4413 | - * |
|
| 4414 | - * @return Array the airline country list |
|
| 4415 | - * |
|
| 4416 | - */ |
|
| 4412 | + * Gets all airline countries that have flown over by airport icao |
|
| 4413 | + * |
|
| 4414 | + * @return Array the airline country list |
|
| 4415 | + * |
|
| 4416 | + */ |
|
| 4417 | 4417 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
| 4418 | 4418 | { |
| 4419 | 4419 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4443,11 +4443,11 @@ discard block |
||
| 4443 | 4443 | |
| 4444 | 4444 | |
| 4445 | 4445 | /** |
| 4446 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4447 | - * |
|
| 4448 | - * @return Array the airline list |
|
| 4449 | - * |
|
| 4450 | - */ |
|
| 4446 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4447 | + * |
|
| 4448 | + * @return Array the airline list |
|
| 4449 | + * |
|
| 4450 | + */ |
|
| 4451 | 4451 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4452 | 4452 | { |
| 4453 | 4453 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4478,11 +4478,11 @@ discard block |
||
| 4478 | 4478 | |
| 4479 | 4479 | |
| 4480 | 4480 | /** |
| 4481 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4482 | - * |
|
| 4483 | - * @return Array the airline country list |
|
| 4484 | - * |
|
| 4485 | - */ |
|
| 4481 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4482 | + * |
|
| 4483 | + * @return Array the airline country list |
|
| 4484 | + * |
|
| 4485 | + */ |
|
| 4486 | 4486 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4487 | 4487 | { |
| 4488 | 4488 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4511,11 +4511,11 @@ discard block |
||
| 4511 | 4511 | |
| 4512 | 4512 | |
| 4513 | 4513 | /** |
| 4514 | - * Gets all airlines that have flown over by date |
|
| 4515 | - * |
|
| 4516 | - * @return Array the airline list |
|
| 4517 | - * |
|
| 4518 | - */ |
|
| 4514 | + * Gets all airlines that have flown over by date |
|
| 4515 | + * |
|
| 4516 | + * @return Array the airline list |
|
| 4517 | + * |
|
| 4518 | + */ |
|
| 4519 | 4519 | public function countAllAirlinesByDate($date,$filters = array()) |
| 4520 | 4520 | { |
| 4521 | 4521 | global $globalTimezone, $globalDBdriver; |
@@ -4559,11 +4559,11 @@ discard block |
||
| 4559 | 4559 | |
| 4560 | 4560 | |
| 4561 | 4561 | /** |
| 4562 | - * Gets all airline countries that have flown over by date |
|
| 4563 | - * |
|
| 4564 | - * @return Array the airline country list |
|
| 4565 | - * |
|
| 4566 | - */ |
|
| 4562 | + * Gets all airline countries that have flown over by date |
|
| 4563 | + * |
|
| 4564 | + * @return Array the airline country list |
|
| 4565 | + * |
|
| 4566 | + */ |
|
| 4567 | 4567 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
| 4568 | 4568 | { |
| 4569 | 4569 | global $globalTimezone, $globalDBdriver; |
@@ -4606,11 +4606,11 @@ discard block |
||
| 4606 | 4606 | |
| 4607 | 4607 | |
| 4608 | 4608 | /** |
| 4609 | - * Gets all airlines that have flown over by ident/callsign |
|
| 4610 | - * |
|
| 4611 | - * @return Array the airline list |
|
| 4612 | - * |
|
| 4613 | - */ |
|
| 4609 | + * Gets all airlines that have flown over by ident/callsign |
|
| 4610 | + * |
|
| 4611 | + * @return Array the airline list |
|
| 4612 | + * |
|
| 4613 | + */ |
|
| 4614 | 4614 | public function countAllAirlinesByIdent($ident,$filters = array()) |
| 4615 | 4615 | { |
| 4616 | 4616 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4627,11 +4627,11 @@ discard block |
||
| 4627 | 4627 | } |
| 4628 | 4628 | |
| 4629 | 4629 | /** |
| 4630 | - * Gets all airlines by owner |
|
| 4631 | - * |
|
| 4632 | - * @return Array the airline list |
|
| 4633 | - * |
|
| 4634 | - */ |
|
| 4630 | + * Gets all airlines by owner |
|
| 4631 | + * |
|
| 4632 | + * @return Array the airline list |
|
| 4633 | + * |
|
| 4634 | + */ |
|
| 4635 | 4635 | public function countAllAirlinesByOwner($owner,$filters = array()) |
| 4636 | 4636 | { |
| 4637 | 4637 | $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
@@ -4648,11 +4648,11 @@ discard block |
||
| 4648 | 4648 | } |
| 4649 | 4649 | |
| 4650 | 4650 | /** |
| 4651 | - * Gets flight duration by owner |
|
| 4652 | - * |
|
| 4653 | - * @return String Duration of all flights |
|
| 4654 | - * |
|
| 4655 | - */ |
|
| 4651 | + * Gets flight duration by owner |
|
| 4652 | + * |
|
| 4653 | + * @return String Duration of all flights |
|
| 4654 | + * |
|
| 4655 | + */ |
|
| 4656 | 4656 | public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 4657 | 4657 | { |
| 4658 | 4658 | global $globalDBdriver; |
@@ -4699,11 +4699,11 @@ discard block |
||
| 4699 | 4699 | } |
| 4700 | 4700 | |
| 4701 | 4701 | /** |
| 4702 | - * Count flights by owner |
|
| 4703 | - * |
|
| 4704 | - * @return String Duration of all flights |
|
| 4705 | - * |
|
| 4706 | - */ |
|
| 4702 | + * Count flights by owner |
|
| 4703 | + * |
|
| 4704 | + * @return String Duration of all flights |
|
| 4705 | + * |
|
| 4706 | + */ |
|
| 4707 | 4707 | public function countFlightsByOwner($owner,$filters = array()) |
| 4708 | 4708 | { |
| 4709 | 4709 | $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
@@ -4719,11 +4719,11 @@ discard block |
||
| 4719 | 4719 | } |
| 4720 | 4720 | |
| 4721 | 4721 | /** |
| 4722 | - * Count flights by pilot |
|
| 4723 | - * |
|
| 4724 | - * @return String Duration of all flights |
|
| 4725 | - * |
|
| 4726 | - */ |
|
| 4722 | + * Count flights by pilot |
|
| 4723 | + * |
|
| 4724 | + * @return String Duration of all flights |
|
| 4725 | + * |
|
| 4726 | + */ |
|
| 4727 | 4727 | public function countFlightsByPilot($pilot,$filters = array()) |
| 4728 | 4728 | { |
| 4729 | 4729 | $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
@@ -4739,11 +4739,11 @@ discard block |
||
| 4739 | 4739 | } |
| 4740 | 4740 | |
| 4741 | 4741 | /** |
| 4742 | - * Gets flight duration by pilot |
|
| 4743 | - * |
|
| 4744 | - * @return String Duration of all flights |
|
| 4745 | - * |
|
| 4746 | - */ |
|
| 4742 | + * Gets flight duration by pilot |
|
| 4743 | + * |
|
| 4744 | + * @return String Duration of all flights |
|
| 4745 | + * |
|
| 4746 | + */ |
|
| 4747 | 4747 | public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 4748 | 4748 | { |
| 4749 | 4749 | global $globalDBdriver; |
@@ -4789,11 +4789,11 @@ discard block |
||
| 4789 | 4789 | } |
| 4790 | 4790 | |
| 4791 | 4791 | /** |
| 4792 | - * Gets all airlines used by pilot |
|
| 4793 | - * |
|
| 4794 | - * @return Array the airline list |
|
| 4795 | - * |
|
| 4796 | - */ |
|
| 4792 | + * Gets all airlines used by pilot |
|
| 4793 | + * |
|
| 4794 | + * @return Array the airline list |
|
| 4795 | + * |
|
| 4796 | + */ |
|
| 4797 | 4797 | public function countAllAirlinesByPilot($pilot,$filters = array()) |
| 4798 | 4798 | { |
| 4799 | 4799 | $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
@@ -4810,11 +4810,11 @@ discard block |
||
| 4810 | 4810 | } |
| 4811 | 4811 | |
| 4812 | 4812 | /** |
| 4813 | - * Gets all airlines that have flown over by route |
|
| 4814 | - * |
|
| 4815 | - * @return Array the airline list |
|
| 4816 | - * |
|
| 4817 | - */ |
|
| 4813 | + * Gets all airlines that have flown over by route |
|
| 4814 | + * |
|
| 4815 | + * @return Array the airline list |
|
| 4816 | + * |
|
| 4817 | + */ |
|
| 4818 | 4818 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 4819 | 4819 | { |
| 4820 | 4820 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4846,11 +4846,11 @@ discard block |
||
| 4846 | 4846 | } |
| 4847 | 4847 | |
| 4848 | 4848 | /** |
| 4849 | - * Gets all airline countries that have flown over by route |
|
| 4850 | - * |
|
| 4851 | - * @return Array the airline country list |
|
| 4852 | - * |
|
| 4853 | - */ |
|
| 4849 | + * Gets all airline countries that have flown over by route |
|
| 4850 | + * |
|
| 4851 | + * @return Array the airline country list |
|
| 4852 | + * |
|
| 4853 | + */ |
|
| 4854 | 4854 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
| 4855 | 4855 | { |
| 4856 | 4856 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4882,11 +4882,11 @@ discard block |
||
| 4882 | 4882 | |
| 4883 | 4883 | |
| 4884 | 4884 | /** |
| 4885 | - * Gets all airlines that have flown over by country |
|
| 4886 | - * |
|
| 4887 | - * @return Array the airline list |
|
| 4888 | - * |
|
| 4889 | - */ |
|
| 4885 | + * Gets all airlines that have flown over by country |
|
| 4886 | + * |
|
| 4887 | + * @return Array the airline list |
|
| 4888 | + * |
|
| 4889 | + */ |
|
| 4890 | 4890 | public function countAllAirlinesByCountry($country,$filters = array()) |
| 4891 | 4891 | { |
| 4892 | 4892 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4916,11 +4916,11 @@ discard block |
||
| 4916 | 4916 | |
| 4917 | 4917 | |
| 4918 | 4918 | /** |
| 4919 | - * Gets all airline countries that have flown over by country |
|
| 4920 | - * |
|
| 4921 | - * @return Array the airline country list |
|
| 4922 | - * |
|
| 4923 | - */ |
|
| 4919 | + * Gets all airline countries that have flown over by country |
|
| 4920 | + * |
|
| 4921 | + * @return Array the airline country list |
|
| 4922 | + * |
|
| 4923 | + */ |
|
| 4924 | 4924 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
| 4925 | 4925 | { |
| 4926 | 4926 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4949,11 +4949,11 @@ discard block |
||
| 4949 | 4949 | |
| 4950 | 4950 | |
| 4951 | 4951 | /** |
| 4952 | - * Gets all airlines countries |
|
| 4953 | - * |
|
| 4954 | - * @return Array the airline country list |
|
| 4955 | - * |
|
| 4956 | - */ |
|
| 4952 | + * Gets all airlines countries |
|
| 4953 | + * |
|
| 4954 | + * @return Array the airline country list |
|
| 4955 | + * |
|
| 4956 | + */ |
|
| 4957 | 4957 | public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
| 4958 | 4958 | { |
| 4959 | 4959 | global $globalDBdriver; |
@@ -5009,11 +5009,11 @@ discard block |
||
| 5009 | 5009 | } |
| 5010 | 5010 | |
| 5011 | 5011 | /** |
| 5012 | - * Gets all number of flight over countries |
|
| 5013 | - * |
|
| 5014 | - * @return Array the airline country list |
|
| 5015 | - * |
|
| 5016 | - */ |
|
| 5012 | + * Gets all number of flight over countries |
|
| 5013 | + * |
|
| 5014 | + * @return Array the airline country list |
|
| 5015 | + * |
|
| 5016 | + */ |
|
| 5017 | 5017 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5018 | 5018 | { |
| 5019 | 5019 | global $globalDBdriver; |
@@ -5035,15 +5035,15 @@ discard block |
||
| 5035 | 5035 | $SpotterLive = new SpotterLive(); |
| 5036 | 5036 | $filter_query = $SpotterLive->getFilter($filters,true,true); |
| 5037 | 5037 | $filter_query .= ' over_country IS NOT NULL'; |
| 5038 | - if ($olderthanmonths > 0) { |
|
| 5038 | + if ($olderthanmonths > 0) { |
|
| 5039 | 5039 | if ($globalDBdriver == 'mysql') { |
| 5040 | 5040 | $filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5041 | 5041 | } else { |
| 5042 | 5042 | $filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5043 | 5043 | } |
| 5044 | 5044 | } |
| 5045 | - if ($sincedate != '') { |
|
| 5046 | - if ($globalDBdriver == 'mysql') { |
|
| 5045 | + if ($sincedate != '') { |
|
| 5046 | + if ($globalDBdriver == 'mysql') { |
|
| 5047 | 5047 | $filter_query .= " AND spotter_live.date > '".$sincedate."' "; |
| 5048 | 5048 | } else { |
| 5049 | 5049 | $filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5073,11 +5073,11 @@ discard block |
||
| 5073 | 5073 | |
| 5074 | 5074 | |
| 5075 | 5075 | /** |
| 5076 | - * Gets all aircraft types that have flown over |
|
| 5077 | - * |
|
| 5078 | - * @return Array the aircraft list |
|
| 5079 | - * |
|
| 5080 | - */ |
|
| 5076 | + * Gets all aircraft types that have flown over |
|
| 5077 | + * |
|
| 5078 | + * @return Array the aircraft list |
|
| 5079 | + * |
|
| 5080 | + */ |
|
| 5081 | 5081 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 5082 | 5082 | { |
| 5083 | 5083 | global $globalDBdriver; |
@@ -5147,11 +5147,11 @@ discard block |
||
| 5147 | 5147 | } |
| 5148 | 5148 | |
| 5149 | 5149 | /** |
| 5150 | - * Gets all aircraft types that have flown over by airline |
|
| 5151 | - * |
|
| 5152 | - * @return Array the aircraft list |
|
| 5153 | - * |
|
| 5154 | - */ |
|
| 5150 | + * Gets all aircraft types that have flown over by airline |
|
| 5151 | + * |
|
| 5152 | + * @return Array the aircraft list |
|
| 5153 | + * |
|
| 5154 | + */ |
|
| 5155 | 5155 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '') |
| 5156 | 5156 | { |
| 5157 | 5157 | global $globalDBdriver; |
@@ -5222,11 +5222,11 @@ discard block |
||
| 5222 | 5222 | } |
| 5223 | 5223 | |
| 5224 | 5224 | /** |
| 5225 | - * Gets all aircraft types that have flown over by months |
|
| 5226 | - * |
|
| 5227 | - * @return Array the aircraft list |
|
| 5228 | - * |
|
| 5229 | - */ |
|
| 5225 | + * Gets all aircraft types that have flown over by months |
|
| 5226 | + * |
|
| 5227 | + * @return Array the aircraft list |
|
| 5228 | + * |
|
| 5229 | + */ |
|
| 5230 | 5230 | public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5231 | 5231 | { |
| 5232 | 5232 | global $globalDBdriver; |
@@ -5270,11 +5270,11 @@ discard block |
||
| 5270 | 5270 | |
| 5271 | 5271 | |
| 5272 | 5272 | /** |
| 5273 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
| 5274 | - * |
|
| 5275 | - * @return Array the aircraft list |
|
| 5276 | - * |
|
| 5277 | - */ |
|
| 5273 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
| 5274 | + * |
|
| 5275 | + * @return Array the aircraft list |
|
| 5276 | + * |
|
| 5277 | + */ |
|
| 5278 | 5278 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
| 5279 | 5279 | { |
| 5280 | 5280 | $Image = new Image($this->db); |
@@ -5313,11 +5313,11 @@ discard block |
||
| 5313 | 5313 | |
| 5314 | 5314 | |
| 5315 | 5315 | /** |
| 5316 | - * Gets all aircraft types that have flown over by airline icao |
|
| 5317 | - * |
|
| 5318 | - * @return Array the aircraft list |
|
| 5319 | - * |
|
| 5320 | - */ |
|
| 5316 | + * Gets all aircraft types that have flown over by airline icao |
|
| 5317 | + * |
|
| 5318 | + * @return Array the aircraft list |
|
| 5319 | + * |
|
| 5320 | + */ |
|
| 5321 | 5321 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
| 5322 | 5322 | { |
| 5323 | 5323 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5346,11 +5346,11 @@ discard block |
||
| 5346 | 5346 | |
| 5347 | 5347 | |
| 5348 | 5348 | /** |
| 5349 | - * Gets all aircraft registration that have flown over by airline icao |
|
| 5350 | - * |
|
| 5351 | - * @return Array the aircraft list |
|
| 5352 | - * |
|
| 5353 | - */ |
|
| 5349 | + * Gets all aircraft registration that have flown over by airline icao |
|
| 5350 | + * |
|
| 5351 | + * @return Array the aircraft list |
|
| 5352 | + * |
|
| 5353 | + */ |
|
| 5354 | 5354 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
| 5355 | 5355 | { |
| 5356 | 5356 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5388,11 +5388,11 @@ discard block |
||
| 5388 | 5388 | |
| 5389 | 5389 | |
| 5390 | 5390 | /** |
| 5391 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5392 | - * |
|
| 5393 | - * @return Array the aircraft list |
|
| 5394 | - * |
|
| 5395 | - */ |
|
| 5391 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5392 | + * |
|
| 5393 | + * @return Array the aircraft list |
|
| 5394 | + * |
|
| 5395 | + */ |
|
| 5396 | 5396 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
| 5397 | 5397 | { |
| 5398 | 5398 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5420,11 +5420,11 @@ discard block |
||
| 5420 | 5420 | |
| 5421 | 5421 | |
| 5422 | 5422 | /** |
| 5423 | - * Gets all aircraft types that have flown over by airline icao |
|
| 5424 | - * |
|
| 5425 | - * @return Array the aircraft list |
|
| 5426 | - * |
|
| 5427 | - */ |
|
| 5423 | + * Gets all aircraft types that have flown over by airline icao |
|
| 5424 | + * |
|
| 5425 | + * @return Array the aircraft list |
|
| 5426 | + * |
|
| 5427 | + */ |
|
| 5428 | 5428 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
| 5429 | 5429 | { |
| 5430 | 5430 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5453,11 +5453,11 @@ discard block |
||
| 5453 | 5453 | |
| 5454 | 5454 | |
| 5455 | 5455 | /** |
| 5456 | - * Gets all aircraft registration that have flown over by airport icao |
|
| 5457 | - * |
|
| 5458 | - * @return Array the aircraft list |
|
| 5459 | - * |
|
| 5460 | - */ |
|
| 5456 | + * Gets all aircraft registration that have flown over by airport icao |
|
| 5457 | + * |
|
| 5458 | + * @return Array the aircraft list |
|
| 5459 | + * |
|
| 5460 | + */ |
|
| 5461 | 5461 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
| 5462 | 5462 | { |
| 5463 | 5463 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5494,11 +5494,11 @@ discard block |
||
| 5494 | 5494 | |
| 5495 | 5495 | |
| 5496 | 5496 | /** |
| 5497 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5498 | - * |
|
| 5499 | - * @return Array the aircraft list |
|
| 5500 | - * |
|
| 5501 | - */ |
|
| 5497 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5498 | + * |
|
| 5499 | + * @return Array the aircraft list |
|
| 5500 | + * |
|
| 5501 | + */ |
|
| 5502 | 5502 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
| 5503 | 5503 | { |
| 5504 | 5504 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5524,11 +5524,11 @@ discard block |
||
| 5524 | 5524 | } |
| 5525 | 5525 | |
| 5526 | 5526 | /** |
| 5527 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5528 | - * |
|
| 5529 | - * @return Array the aircraft list |
|
| 5530 | - * |
|
| 5531 | - */ |
|
| 5527 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5528 | + * |
|
| 5529 | + * @return Array the aircraft list |
|
| 5530 | + * |
|
| 5531 | + */ |
|
| 5532 | 5532 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 5533 | 5533 | { |
| 5534 | 5534 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5555,11 +5555,11 @@ discard block |
||
| 5555 | 5555 | |
| 5556 | 5556 | |
| 5557 | 5557 | /** |
| 5558 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5559 | - * |
|
| 5560 | - * @return Array the aircraft list |
|
| 5561 | - * |
|
| 5562 | - */ |
|
| 5558 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5559 | + * |
|
| 5560 | + * @return Array the aircraft list |
|
| 5561 | + * |
|
| 5562 | + */ |
|
| 5563 | 5563 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5564 | 5564 | { |
| 5565 | 5565 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5595,11 +5595,11 @@ discard block |
||
| 5595 | 5595 | } |
| 5596 | 5596 | |
| 5597 | 5597 | /** |
| 5598 | - * Gets all aircraft types that have flown over by date |
|
| 5599 | - * |
|
| 5600 | - * @return Array the aircraft list |
|
| 5601 | - * |
|
| 5602 | - */ |
|
| 5598 | + * Gets all aircraft types that have flown over by date |
|
| 5599 | + * |
|
| 5600 | + * @return Array the aircraft list |
|
| 5601 | + * |
|
| 5602 | + */ |
|
| 5603 | 5603 | public function countAllAircraftTypesByDate($date,$filters = array()) |
| 5604 | 5604 | { |
| 5605 | 5605 | global $globalTimezone, $globalDBdriver; |
@@ -5641,11 +5641,11 @@ discard block |
||
| 5641 | 5641 | |
| 5642 | 5642 | |
| 5643 | 5643 | /** |
| 5644 | - * Gets all aircraft registration that have flown over by date |
|
| 5645 | - * |
|
| 5646 | - * @return Array the aircraft list |
|
| 5647 | - * |
|
| 5648 | - */ |
|
| 5644 | + * Gets all aircraft registration that have flown over by date |
|
| 5645 | + * |
|
| 5646 | + * @return Array the aircraft list |
|
| 5647 | + * |
|
| 5648 | + */ |
|
| 5649 | 5649 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
| 5650 | 5650 | { |
| 5651 | 5651 | global $globalTimezone, $globalDBdriver; |
@@ -5696,11 +5696,11 @@ discard block |
||
| 5696 | 5696 | |
| 5697 | 5697 | |
| 5698 | 5698 | /** |
| 5699 | - * Gets all aircraft manufacturer that have flown over by date |
|
| 5700 | - * |
|
| 5701 | - * @return Array the aircraft manufacturer list |
|
| 5702 | - * |
|
| 5703 | - */ |
|
| 5699 | + * Gets all aircraft manufacturer that have flown over by date |
|
| 5700 | + * |
|
| 5701 | + * @return Array the aircraft manufacturer list |
|
| 5702 | + * |
|
| 5703 | + */ |
|
| 5704 | 5704 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
| 5705 | 5705 | { |
| 5706 | 5706 | global $globalTimezone, $globalDBdriver; |
@@ -5742,11 +5742,11 @@ discard block |
||
| 5742 | 5742 | |
| 5743 | 5743 | |
| 5744 | 5744 | /** |
| 5745 | - * Gets all aircraft types that have flown over by ident/callsign |
|
| 5746 | - * |
|
| 5747 | - * @return Array the aircraft list |
|
| 5748 | - * |
|
| 5749 | - */ |
|
| 5745 | + * Gets all aircraft types that have flown over by ident/callsign |
|
| 5746 | + * |
|
| 5747 | + * @return Array the aircraft list |
|
| 5748 | + * |
|
| 5749 | + */ |
|
| 5750 | 5750 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
| 5751 | 5751 | { |
| 5752 | 5752 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5774,11 +5774,11 @@ discard block |
||
| 5774 | 5774 | } |
| 5775 | 5775 | |
| 5776 | 5776 | /** |
| 5777 | - * Gets all aircraft types that have flown over by pilot |
|
| 5778 | - * |
|
| 5779 | - * @return Array the aircraft list |
|
| 5780 | - * |
|
| 5781 | - */ |
|
| 5777 | + * Gets all aircraft types that have flown over by pilot |
|
| 5778 | + * |
|
| 5779 | + * @return Array the aircraft list |
|
| 5780 | + * |
|
| 5781 | + */ |
|
| 5782 | 5782 | public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 5783 | 5783 | { |
| 5784 | 5784 | global $globalDBdriver; |
@@ -5824,11 +5824,11 @@ discard block |
||
| 5824 | 5824 | } |
| 5825 | 5825 | |
| 5826 | 5826 | /** |
| 5827 | - * Gets all aircraft types that have flown over by owner |
|
| 5828 | - * |
|
| 5829 | - * @return Array the aircraft list |
|
| 5830 | - * |
|
| 5831 | - */ |
|
| 5827 | + * Gets all aircraft types that have flown over by owner |
|
| 5828 | + * |
|
| 5829 | + * @return Array the aircraft list |
|
| 5830 | + * |
|
| 5831 | + */ |
|
| 5832 | 5832 | public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 5833 | 5833 | { |
| 5834 | 5834 | global $globalDBdriver; |
@@ -5873,11 +5873,11 @@ discard block |
||
| 5873 | 5873 | } |
| 5874 | 5874 | |
| 5875 | 5875 | /** |
| 5876 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5877 | - * |
|
| 5878 | - * @return Array the aircraft list |
|
| 5879 | - * |
|
| 5880 | - */ |
|
| 5876 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5877 | + * |
|
| 5878 | + * @return Array the aircraft list |
|
| 5879 | + * |
|
| 5880 | + */ |
|
| 5881 | 5881 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
| 5882 | 5882 | { |
| 5883 | 5883 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5916,11 +5916,11 @@ discard block |
||
| 5916 | 5916 | } |
| 5917 | 5917 | |
| 5918 | 5918 | /** |
| 5919 | - * Gets all aircraft registration that have flown over by owner |
|
| 5920 | - * |
|
| 5921 | - * @return Array the aircraft list |
|
| 5922 | - * |
|
| 5923 | - */ |
|
| 5919 | + * Gets all aircraft registration that have flown over by owner |
|
| 5920 | + * |
|
| 5921 | + * @return Array the aircraft list |
|
| 5922 | + * |
|
| 5923 | + */ |
|
| 5924 | 5924 | public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 5925 | 5925 | { |
| 5926 | 5926 | global $globalDBdriver; |
@@ -5991,11 +5991,11 @@ discard block |
||
| 5991 | 5991 | } |
| 5992 | 5992 | |
| 5993 | 5993 | /** |
| 5994 | - * Gets all aircraft registration that have flown over by pilot |
|
| 5995 | - * |
|
| 5996 | - * @return Array the aircraft list |
|
| 5997 | - * |
|
| 5998 | - */ |
|
| 5994 | + * Gets all aircraft registration that have flown over by pilot |
|
| 5995 | + * |
|
| 5996 | + * @return Array the aircraft list |
|
| 5997 | + * |
|
| 5998 | + */ |
|
| 5999 | 5999 | public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 6000 | 6000 | { |
| 6001 | 6001 | global $globalDBdriver; |
@@ -6067,11 +6067,11 @@ discard block |
||
| 6067 | 6067 | |
| 6068 | 6068 | |
| 6069 | 6069 | /** |
| 6070 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 6071 | - * |
|
| 6072 | - * @return Array the aircraft manufacturer list |
|
| 6073 | - * |
|
| 6074 | - */ |
|
| 6070 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 6071 | + * |
|
| 6072 | + * @return Array the aircraft manufacturer list |
|
| 6073 | + * |
|
| 6074 | + */ |
|
| 6075 | 6075 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
| 6076 | 6076 | { |
| 6077 | 6077 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6096,11 +6096,11 @@ discard block |
||
| 6096 | 6096 | } |
| 6097 | 6097 | |
| 6098 | 6098 | /** |
| 6099 | - * Gets all aircraft manufacturer that have flown over by owner |
|
| 6100 | - * |
|
| 6101 | - * @return Array the aircraft manufacturer list |
|
| 6102 | - * |
|
| 6103 | - */ |
|
| 6099 | + * Gets all aircraft manufacturer that have flown over by owner |
|
| 6100 | + * |
|
| 6101 | + * @return Array the aircraft manufacturer list |
|
| 6102 | + * |
|
| 6103 | + */ |
|
| 6104 | 6104 | public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 6105 | 6105 | { |
| 6106 | 6106 | global $globalDBdriver; |
@@ -6148,11 +6148,11 @@ discard block |
||
| 6148 | 6148 | } |
| 6149 | 6149 | |
| 6150 | 6150 | /** |
| 6151 | - * Gets all aircraft manufacturer that have flown over by pilot |
|
| 6152 | - * |
|
| 6153 | - * @return Array the aircraft manufacturer list |
|
| 6154 | - * |
|
| 6155 | - */ |
|
| 6151 | + * Gets all aircraft manufacturer that have flown over by pilot |
|
| 6152 | + * |
|
| 6153 | + * @return Array the aircraft manufacturer list |
|
| 6154 | + * |
|
| 6155 | + */ |
|
| 6156 | 6156 | public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 6157 | 6157 | { |
| 6158 | 6158 | global $globalDBdriver; |
@@ -6201,11 +6201,11 @@ discard block |
||
| 6201 | 6201 | |
| 6202 | 6202 | |
| 6203 | 6203 | /** |
| 6204 | - * Gets all aircraft types that have flown over by route |
|
| 6205 | - * |
|
| 6206 | - * @return Array the aircraft list |
|
| 6207 | - * |
|
| 6208 | - */ |
|
| 6204 | + * Gets all aircraft types that have flown over by route |
|
| 6205 | + * |
|
| 6206 | + * @return Array the aircraft list |
|
| 6207 | + * |
|
| 6208 | + */ |
|
| 6209 | 6209 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 6210 | 6210 | { |
| 6211 | 6211 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6234,11 +6234,11 @@ discard block |
||
| 6234 | 6234 | } |
| 6235 | 6235 | |
| 6236 | 6236 | /** |
| 6237 | - * Gets all aircraft registration that have flown over by route |
|
| 6238 | - * |
|
| 6239 | - * @return Array the aircraft list |
|
| 6240 | - * |
|
| 6241 | - */ |
|
| 6237 | + * Gets all aircraft registration that have flown over by route |
|
| 6238 | + * |
|
| 6239 | + * @return Array the aircraft list |
|
| 6240 | + * |
|
| 6241 | + */ |
|
| 6242 | 6242 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 6243 | 6243 | { |
| 6244 | 6244 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6280,11 +6280,11 @@ discard block |
||
| 6280 | 6280 | |
| 6281 | 6281 | |
| 6282 | 6282 | /** |
| 6283 | - * Gets all aircraft manufacturer that have flown over by route |
|
| 6284 | - * |
|
| 6285 | - * @return Array the aircraft manufacturer list |
|
| 6286 | - * |
|
| 6287 | - */ |
|
| 6283 | + * Gets all aircraft manufacturer that have flown over by route |
|
| 6284 | + * |
|
| 6285 | + * @return Array the aircraft manufacturer list |
|
| 6286 | + * |
|
| 6287 | + */ |
|
| 6288 | 6288 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 6289 | 6289 | { |
| 6290 | 6290 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6318,11 +6318,11 @@ discard block |
||
| 6318 | 6318 | |
| 6319 | 6319 | |
| 6320 | 6320 | /** |
| 6321 | - * Gets all aircraft types that have flown over by country |
|
| 6322 | - * |
|
| 6323 | - * @return Array the aircraft list |
|
| 6324 | - * |
|
| 6325 | - */ |
|
| 6321 | + * Gets all aircraft types that have flown over by country |
|
| 6322 | + * |
|
| 6323 | + * @return Array the aircraft list |
|
| 6324 | + * |
|
| 6325 | + */ |
|
| 6326 | 6326 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
| 6327 | 6327 | { |
| 6328 | 6328 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6353,11 +6353,11 @@ discard block |
||
| 6353 | 6353 | |
| 6354 | 6354 | |
| 6355 | 6355 | /** |
| 6356 | - * Gets all aircraft registration that have flown over by country |
|
| 6357 | - * |
|
| 6358 | - * @return Array the aircraft list |
|
| 6359 | - * |
|
| 6360 | - */ |
|
| 6356 | + * Gets all aircraft registration that have flown over by country |
|
| 6357 | + * |
|
| 6358 | + * @return Array the aircraft list |
|
| 6359 | + * |
|
| 6360 | + */ |
|
| 6361 | 6361 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
| 6362 | 6362 | { |
| 6363 | 6363 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6397,11 +6397,11 @@ discard block |
||
| 6397 | 6397 | |
| 6398 | 6398 | |
| 6399 | 6399 | /** |
| 6400 | - * Gets all aircraft manufacturer that have flown over by country |
|
| 6401 | - * |
|
| 6402 | - * @return Array the aircraft manufacturer list |
|
| 6403 | - * |
|
| 6404 | - */ |
|
| 6400 | + * Gets all aircraft manufacturer that have flown over by country |
|
| 6401 | + * |
|
| 6402 | + * @return Array the aircraft manufacturer list |
|
| 6403 | + * |
|
| 6404 | + */ |
|
| 6405 | 6405 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
| 6406 | 6406 | { |
| 6407 | 6407 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6432,18 +6432,18 @@ discard block |
||
| 6432 | 6432 | |
| 6433 | 6433 | |
| 6434 | 6434 | /** |
| 6435 | - * Gets all aircraft manufacturers that have flown over |
|
| 6436 | - * |
|
| 6437 | - * @return Array the aircraft list |
|
| 6438 | - * |
|
| 6439 | - */ |
|
| 6435 | + * Gets all aircraft manufacturers that have flown over |
|
| 6436 | + * |
|
| 6437 | + * @return Array the aircraft list |
|
| 6438 | + * |
|
| 6439 | + */ |
|
| 6440 | 6440 | public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '') |
| 6441 | 6441 | { |
| 6442 | 6442 | global $globalDBdriver; |
| 6443 | 6443 | $filter_query = $this->getFilter($filters,true,true); |
| 6444 | 6444 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
| 6445 | 6445 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 6446 | - $query_values = array(); |
|
| 6446 | + $query_values = array(); |
|
| 6447 | 6447 | if ($year != '') { |
| 6448 | 6448 | if ($globalDBdriver == 'mysql') { |
| 6449 | 6449 | $query .= " AND YEAR(spotter_output.date) = :year"; |
@@ -6496,11 +6496,11 @@ discard block |
||
| 6496 | 6496 | |
| 6497 | 6497 | |
| 6498 | 6498 | /** |
| 6499 | - * Gets all aircraft registrations that have flown over |
|
| 6500 | - * |
|
| 6501 | - * @return Array the aircraft list |
|
| 6502 | - * |
|
| 6503 | - */ |
|
| 6499 | + * Gets all aircraft registrations that have flown over |
|
| 6500 | + * |
|
| 6501 | + * @return Array the aircraft list |
|
| 6502 | + * |
|
| 6503 | + */ |
|
| 6504 | 6504 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 6505 | 6505 | { |
| 6506 | 6506 | global $globalDBdriver; |
@@ -6508,15 +6508,15 @@ discard block |
||
| 6508 | 6508 | $filter_query = $this->getFilter($filters,true,true); |
| 6509 | 6509 | $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 6510 | 6510 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 6511 | - if ($olderthanmonths > 0) { |
|
| 6512 | - if ($globalDBdriver == 'mysql') { |
|
| 6511 | + if ($olderthanmonths > 0) { |
|
| 6512 | + if ($globalDBdriver == 'mysql') { |
|
| 6513 | 6513 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6514 | 6514 | } else { |
| 6515 | 6515 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6516 | 6516 | } |
| 6517 | 6517 | } |
| 6518 | - if ($sincedate != '') { |
|
| 6519 | - if ($globalDBdriver == 'mysql') { |
|
| 6518 | + if ($sincedate != '') { |
|
| 6519 | + if ($globalDBdriver == 'mysql') { |
|
| 6520 | 6520 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6521 | 6521 | } else { |
| 6522 | 6522 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6581,11 +6581,11 @@ discard block |
||
| 6581 | 6581 | |
| 6582 | 6582 | |
| 6583 | 6583 | /** |
| 6584 | - * Gets all aircraft registrations that have flown over |
|
| 6585 | - * |
|
| 6586 | - * @return Array the aircraft list |
|
| 6587 | - * |
|
| 6588 | - */ |
|
| 6584 | + * Gets all aircraft registrations that have flown over |
|
| 6585 | + * |
|
| 6586 | + * @return Array the aircraft list |
|
| 6587 | + * |
|
| 6588 | + */ |
|
| 6589 | 6589 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 6590 | 6590 | { |
| 6591 | 6591 | global $globalDBdriver; |
@@ -6593,15 +6593,15 @@ discard block |
||
| 6593 | 6593 | $Image = new Image($this->db); |
| 6594 | 6594 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 6595 | 6595 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 6596 | - if ($olderthanmonths > 0) { |
|
| 6597 | - if ($globalDBdriver == 'mysql') { |
|
| 6596 | + if ($olderthanmonths > 0) { |
|
| 6597 | + if ($globalDBdriver == 'mysql') { |
|
| 6598 | 6598 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6599 | 6599 | } else { |
| 6600 | 6600 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6601 | 6601 | } |
| 6602 | 6602 | } |
| 6603 | - if ($sincedate != '') { |
|
| 6604 | - if ($globalDBdriver == 'mysql') { |
|
| 6603 | + if ($sincedate != '') { |
|
| 6604 | + if ($globalDBdriver == 'mysql') { |
|
| 6605 | 6605 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6606 | 6606 | } else { |
| 6607 | 6607 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6610,7 +6610,7 @@ discard block |
||
| 6610 | 6610 | |
| 6611 | 6611 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6612 | 6612 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6613 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 6613 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 6614 | 6614 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6615 | 6615 | |
| 6616 | 6616 | $sth = $this->db->prepare($query); |
@@ -6642,26 +6642,26 @@ discard block |
||
| 6642 | 6642 | |
| 6643 | 6643 | |
| 6644 | 6644 | /** |
| 6645 | - * Gets all departure airports of the airplanes that have flown over |
|
| 6646 | - * |
|
| 6647 | - * @return Array the airport list |
|
| 6648 | - * |
|
| 6649 | - */ |
|
| 6645 | + * Gets all departure airports of the airplanes that have flown over |
|
| 6646 | + * |
|
| 6647 | + * @return Array the airport list |
|
| 6648 | + * |
|
| 6649 | + */ |
|
| 6650 | 6650 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 6651 | 6651 | { |
| 6652 | 6652 | global $globalDBdriver; |
| 6653 | 6653 | $filter_query = $this->getFilter($filters,true,true); |
| 6654 | 6654 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
| 6655 | 6655 | FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.departure_airport_icao AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 6656 | - if ($olderthanmonths > 0) { |
|
| 6657 | - if ($globalDBdriver == 'mysql') { |
|
| 6656 | + if ($olderthanmonths > 0) { |
|
| 6657 | + if ($globalDBdriver == 'mysql') { |
|
| 6658 | 6658 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6659 | 6659 | } else { |
| 6660 | 6660 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6661 | 6661 | } |
| 6662 | - } |
|
| 6663 | - if ($sincedate != '') { |
|
| 6664 | - if ($globalDBdriver == 'mysql') { |
|
| 6662 | + } |
|
| 6663 | + if ($sincedate != '') { |
|
| 6664 | + if ($globalDBdriver == 'mysql') { |
|
| 6665 | 6665 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6666 | 6666 | } else { |
| 6667 | 6667 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6695,7 +6695,7 @@ discard block |
||
| 6695 | 6695 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6696 | 6696 | } |
| 6697 | 6697 | } |
| 6698 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
|
| 6698 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
|
| 6699 | 6699 | ORDER BY airport_departure_icao_count DESC"; |
| 6700 | 6700 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6701 | 6701 | |
@@ -6719,35 +6719,35 @@ discard block |
||
| 6719 | 6719 | } |
| 6720 | 6720 | |
| 6721 | 6721 | /** |
| 6722 | - * Gets all departure airports of the airplanes that have flown over |
|
| 6723 | - * |
|
| 6724 | - * @return Array the airport list |
|
| 6725 | - * |
|
| 6726 | - */ |
|
| 6722 | + * Gets all departure airports of the airplanes that have flown over |
|
| 6723 | + * |
|
| 6724 | + * @return Array the airport list |
|
| 6725 | + * |
|
| 6726 | + */ |
|
| 6727 | 6727 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6728 | 6728 | { |
| 6729 | 6729 | global $globalDBdriver; |
| 6730 | 6730 | $filter_query = $this->getFilter($filters,true,true); |
| 6731 | 6731 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6732 | 6732 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' "; |
| 6733 | - if ($olderthanmonths > 0) { |
|
| 6734 | - if ($globalDBdriver == 'mysql') { |
|
| 6733 | + if ($olderthanmonths > 0) { |
|
| 6734 | + if ($globalDBdriver == 'mysql') { |
|
| 6735 | 6735 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6736 | 6736 | } else { |
| 6737 | 6737 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6738 | 6738 | } |
| 6739 | - } |
|
| 6740 | - if ($sincedate != '') { |
|
| 6741 | - if ($globalDBdriver == 'mysql') { |
|
| 6739 | + } |
|
| 6740 | + if ($sincedate != '') { |
|
| 6741 | + if ($globalDBdriver == 'mysql') { |
|
| 6742 | 6742 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6743 | 6743 | } else { |
| 6744 | 6744 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6745 | 6745 | } |
| 6746 | 6746 | } |
| 6747 | 6747 | |
| 6748 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6749 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6750 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6748 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6749 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6750 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6751 | 6751 | ORDER BY airport_departure_icao_count DESC"; |
| 6752 | 6752 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6753 | 6753 | |
@@ -6772,26 +6772,26 @@ discard block |
||
| 6772 | 6772 | } |
| 6773 | 6773 | |
| 6774 | 6774 | /** |
| 6775 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6776 | - * |
|
| 6777 | - * @return Array the airport list |
|
| 6778 | - * |
|
| 6779 | - */ |
|
| 6775 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6776 | + * |
|
| 6777 | + * @return Array the airport list |
|
| 6778 | + * |
|
| 6779 | + */ |
|
| 6780 | 6780 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 6781 | 6781 | { |
| 6782 | 6782 | global $globalDBdriver; |
| 6783 | 6783 | $filter_query = $this->getFilter($filters,true,true); |
| 6784 | 6784 | $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport.longitude |
| 6785 | 6785 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 6786 | - if ($olderthanmonths > 0) { |
|
| 6787 | - if ($globalDBdriver == 'mysql') { |
|
| 6786 | + if ($olderthanmonths > 0) { |
|
| 6787 | + if ($globalDBdriver == 'mysql') { |
|
| 6788 | 6788 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6789 | 6789 | } else { |
| 6790 | 6790 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6791 | 6791 | } |
| 6792 | - } |
|
| 6793 | - if ($sincedate != '') { |
|
| 6794 | - if ($globalDBdriver == 'mysql') { |
|
| 6792 | + } |
|
| 6793 | + if ($sincedate != '') { |
|
| 6794 | + if ($globalDBdriver == 'mysql') { |
|
| 6795 | 6795 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6796 | 6796 | } else { |
| 6797 | 6797 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6825,10 +6825,10 @@ discard block |
||
| 6825 | 6825 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6826 | 6826 | } |
| 6827 | 6827 | } |
| 6828 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
|
| 6828 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
|
| 6829 | 6829 | ORDER BY airport_departure_icao_count DESC"; |
| 6830 | 6830 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6831 | - //echo $query; |
|
| 6831 | + //echo $query; |
|
| 6832 | 6832 | $sth = $this->db->prepare($query); |
| 6833 | 6833 | $sth->execute($query_values); |
| 6834 | 6834 | |
@@ -6851,35 +6851,35 @@ discard block |
||
| 6851 | 6851 | } |
| 6852 | 6852 | |
| 6853 | 6853 | /** |
| 6854 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6855 | - * |
|
| 6856 | - * @return Array the airport list |
|
| 6857 | - * |
|
| 6858 | - */ |
|
| 6854 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6855 | + * |
|
| 6856 | + * @return Array the airport list |
|
| 6857 | + * |
|
| 6858 | + */ |
|
| 6859 | 6859 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6860 | 6860 | { |
| 6861 | 6861 | global $globalDBdriver; |
| 6862 | 6862 | $filter_query = $this->getFilter($filters,true,true); |
| 6863 | 6863 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
| 6864 | 6864 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 6865 | - if ($olderthanmonths > 0) { |
|
| 6866 | - if ($globalDBdriver == 'mysql') { |
|
| 6865 | + if ($olderthanmonths > 0) { |
|
| 6866 | + if ($globalDBdriver == 'mysql') { |
|
| 6867 | 6867 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6868 | 6868 | } else { |
| 6869 | 6869 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6870 | 6870 | } |
| 6871 | - } |
|
| 6872 | - if ($sincedate != '') { |
|
| 6873 | - if ($globalDBdriver == 'mysql') { |
|
| 6871 | + } |
|
| 6872 | + if ($sincedate != '') { |
|
| 6873 | + if ($globalDBdriver == 'mysql') { |
|
| 6874 | 6874 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6875 | 6875 | } else { |
| 6876 | 6876 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
| 6877 | 6877 | } |
| 6878 | 6878 | } |
| 6879 | 6879 | |
| 6880 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6881 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6882 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6880 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6881 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6882 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6883 | 6883 | ORDER BY airport_departure_icao_count DESC"; |
| 6884 | 6884 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6885 | 6885 | |
@@ -6904,11 +6904,11 @@ discard block |
||
| 6904 | 6904 | } |
| 6905 | 6905 | |
| 6906 | 6906 | /** |
| 6907 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6908 | - * |
|
| 6909 | - * @return Array the airport list |
|
| 6910 | - * |
|
| 6911 | - */ |
|
| 6907 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6908 | + * |
|
| 6909 | + * @return Array the airport list |
|
| 6910 | + * |
|
| 6911 | + */ |
|
| 6912 | 6912 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
| 6913 | 6913 | { |
| 6914 | 6914 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6942,11 +6942,11 @@ discard block |
||
| 6942 | 6942 | |
| 6943 | 6943 | |
| 6944 | 6944 | /** |
| 6945 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6946 | - * |
|
| 6947 | - * @return Array the airport list |
|
| 6948 | - * |
|
| 6949 | - */ |
|
| 6945 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6946 | + * |
|
| 6947 | + * @return Array the airport list |
|
| 6948 | + * |
|
| 6949 | + */ |
|
| 6950 | 6950 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
| 6951 | 6951 | { |
| 6952 | 6952 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6975,11 +6975,11 @@ discard block |
||
| 6975 | 6975 | |
| 6976 | 6976 | |
| 6977 | 6977 | /** |
| 6978 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6979 | - * |
|
| 6980 | - * @return Array the airport list |
|
| 6981 | - * |
|
| 6982 | - */ |
|
| 6978 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6979 | + * |
|
| 6980 | + * @return Array the airport list |
|
| 6981 | + * |
|
| 6982 | + */ |
|
| 6983 | 6983 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
| 6984 | 6984 | { |
| 6985 | 6985 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7012,11 +7012,11 @@ discard block |
||
| 7012 | 7012 | |
| 7013 | 7013 | |
| 7014 | 7014 | /** |
| 7015 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7016 | - * |
|
| 7017 | - * @return Array the airport list |
|
| 7018 | - * |
|
| 7019 | - */ |
|
| 7015 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7016 | + * |
|
| 7017 | + * @return Array the airport list |
|
| 7018 | + * |
|
| 7019 | + */ |
|
| 7020 | 7020 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 7021 | 7021 | { |
| 7022 | 7022 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7046,11 +7046,11 @@ discard block |
||
| 7046 | 7046 | |
| 7047 | 7047 | |
| 7048 | 7048 | /** |
| 7049 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 7050 | - * |
|
| 7051 | - * @return Array the airport list |
|
| 7052 | - * |
|
| 7053 | - */ |
|
| 7049 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 7050 | + * |
|
| 7051 | + * @return Array the airport list |
|
| 7052 | + * |
|
| 7053 | + */ |
|
| 7054 | 7054 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
| 7055 | 7055 | { |
| 7056 | 7056 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7083,11 +7083,11 @@ discard block |
||
| 7083 | 7083 | |
| 7084 | 7084 | |
| 7085 | 7085 | /** |
| 7086 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7087 | - * |
|
| 7088 | - * @return Array the airport list |
|
| 7089 | - * |
|
| 7090 | - */ |
|
| 7086 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7087 | + * |
|
| 7088 | + * @return Array the airport list |
|
| 7089 | + * |
|
| 7090 | + */ |
|
| 7091 | 7091 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
| 7092 | 7092 | { |
| 7093 | 7093 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7117,11 +7117,11 @@ discard block |
||
| 7117 | 7117 | |
| 7118 | 7118 | |
| 7119 | 7119 | /** |
| 7120 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 7121 | - * |
|
| 7122 | - * @return Array the airport list |
|
| 7123 | - * |
|
| 7124 | - */ |
|
| 7120 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 7121 | + * |
|
| 7122 | + * @return Array the airport list |
|
| 7123 | + * |
|
| 7124 | + */ |
|
| 7125 | 7125 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
| 7126 | 7126 | { |
| 7127 | 7127 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7154,11 +7154,11 @@ discard block |
||
| 7154 | 7154 | |
| 7155 | 7155 | |
| 7156 | 7156 | /** |
| 7157 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 7158 | - * |
|
| 7159 | - * @return Array the airport list |
|
| 7160 | - * |
|
| 7161 | - */ |
|
| 7157 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 7158 | + * |
|
| 7159 | + * @return Array the airport list |
|
| 7160 | + * |
|
| 7161 | + */ |
|
| 7162 | 7162 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
| 7163 | 7163 | { |
| 7164 | 7164 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7189,11 +7189,11 @@ discard block |
||
| 7189 | 7189 | |
| 7190 | 7190 | |
| 7191 | 7191 | /** |
| 7192 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7193 | - * |
|
| 7194 | - * @return Array the airport list |
|
| 7195 | - * |
|
| 7196 | - */ |
|
| 7192 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7193 | + * |
|
| 7194 | + * @return Array the airport list |
|
| 7195 | + * |
|
| 7196 | + */ |
|
| 7197 | 7197 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7198 | 7198 | { |
| 7199 | 7199 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7226,11 +7226,11 @@ discard block |
||
| 7226 | 7226 | |
| 7227 | 7227 | |
| 7228 | 7228 | /** |
| 7229 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7230 | - * |
|
| 7231 | - * @return Array the airport list |
|
| 7232 | - * |
|
| 7233 | - */ |
|
| 7229 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7230 | + * |
|
| 7231 | + * @return Array the airport list |
|
| 7232 | + * |
|
| 7233 | + */ |
|
| 7234 | 7234 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7235 | 7235 | { |
| 7236 | 7236 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7260,11 +7260,11 @@ discard block |
||
| 7260 | 7260 | |
| 7261 | 7261 | |
| 7262 | 7262 | /** |
| 7263 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 7264 | - * |
|
| 7265 | - * @return Array the airport list |
|
| 7266 | - * |
|
| 7267 | - */ |
|
| 7263 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 7264 | + * |
|
| 7265 | + * @return Array the airport list |
|
| 7266 | + * |
|
| 7267 | + */ |
|
| 7268 | 7268 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
| 7269 | 7269 | { |
| 7270 | 7270 | global $globalTimezone, $globalDBdriver; |
@@ -7310,11 +7310,11 @@ discard block |
||
| 7310 | 7310 | |
| 7311 | 7311 | |
| 7312 | 7312 | /** |
| 7313 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 7314 | - * |
|
| 7315 | - * @return Array the airport list |
|
| 7316 | - * |
|
| 7317 | - */ |
|
| 7313 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 7314 | + * |
|
| 7315 | + * @return Array the airport list |
|
| 7316 | + * |
|
| 7317 | + */ |
|
| 7318 | 7318 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
| 7319 | 7319 | { |
| 7320 | 7320 | global $globalTimezone, $globalDBdriver; |
@@ -7357,11 +7357,11 @@ discard block |
||
| 7357 | 7357 | |
| 7358 | 7358 | |
| 7359 | 7359 | /** |
| 7360 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 7361 | - * |
|
| 7362 | - * @return Array the airport list |
|
| 7363 | - * |
|
| 7364 | - */ |
|
| 7360 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 7361 | + * |
|
| 7362 | + * @return Array the airport list |
|
| 7363 | + * |
|
| 7364 | + */ |
|
| 7365 | 7365 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
| 7366 | 7366 | { |
| 7367 | 7367 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7393,11 +7393,11 @@ discard block |
||
| 7393 | 7393 | } |
| 7394 | 7394 | |
| 7395 | 7395 | /** |
| 7396 | - * Gets all departure airports of the airplanes that have flown over based on a owner |
|
| 7397 | - * |
|
| 7398 | - * @return Array the airport list |
|
| 7399 | - * |
|
| 7400 | - */ |
|
| 7396 | + * Gets all departure airports of the airplanes that have flown over based on a owner |
|
| 7397 | + * |
|
| 7398 | + * @return Array the airport list |
|
| 7399 | + * |
|
| 7400 | + */ |
|
| 7401 | 7401 | public function countAllDepartureAirportsByOwner($owner,$filters = array()) |
| 7402 | 7402 | { |
| 7403 | 7403 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7429,11 +7429,11 @@ discard block |
||
| 7429 | 7429 | } |
| 7430 | 7430 | |
| 7431 | 7431 | /** |
| 7432 | - * Gets all departure airports of the airplanes that have flown over based on a pilot |
|
| 7433 | - * |
|
| 7434 | - * @return Array the airport list |
|
| 7435 | - * |
|
| 7436 | - */ |
|
| 7432 | + * Gets all departure airports of the airplanes that have flown over based on a pilot |
|
| 7433 | + * |
|
| 7434 | + * @return Array the airport list |
|
| 7435 | + * |
|
| 7436 | + */ |
|
| 7437 | 7437 | public function countAllDepartureAirportsByPilot($pilot,$filters = array()) |
| 7438 | 7438 | { |
| 7439 | 7439 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7466,11 +7466,11 @@ discard block |
||
| 7466 | 7466 | |
| 7467 | 7467 | |
| 7468 | 7468 | /** |
| 7469 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7470 | - * |
|
| 7471 | - * @return Array the airport list |
|
| 7472 | - * |
|
| 7473 | - */ |
|
| 7469 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7470 | + * |
|
| 7471 | + * @return Array the airport list |
|
| 7472 | + * |
|
| 7473 | + */ |
|
| 7474 | 7474 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
| 7475 | 7475 | { |
| 7476 | 7476 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7499,11 +7499,11 @@ discard block |
||
| 7499 | 7499 | } |
| 7500 | 7500 | |
| 7501 | 7501 | /** |
| 7502 | - * Gets all departure airports by country of the airplanes that have flown over based on owner |
|
| 7503 | - * |
|
| 7504 | - * @return Array the airport list |
|
| 7505 | - * |
|
| 7506 | - */ |
|
| 7502 | + * Gets all departure airports by country of the airplanes that have flown over based on owner |
|
| 7503 | + * |
|
| 7504 | + * @return Array the airport list |
|
| 7505 | + * |
|
| 7506 | + */ |
|
| 7507 | 7507 | public function countAllDepartureAirportCountriesByOwner($owner,$filters = array()) |
| 7508 | 7508 | { |
| 7509 | 7509 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7519,11 +7519,11 @@ discard block |
||
| 7519 | 7519 | } |
| 7520 | 7520 | |
| 7521 | 7521 | /** |
| 7522 | - * Gets all departure airports by country of the airplanes that have flown over based on pilot |
|
| 7523 | - * |
|
| 7524 | - * @return Array the airport list |
|
| 7525 | - * |
|
| 7526 | - */ |
|
| 7522 | + * Gets all departure airports by country of the airplanes that have flown over based on pilot |
|
| 7523 | + * |
|
| 7524 | + * @return Array the airport list |
|
| 7525 | + * |
|
| 7526 | + */ |
|
| 7527 | 7527 | public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array()) |
| 7528 | 7528 | { |
| 7529 | 7529 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7541,11 +7541,11 @@ discard block |
||
| 7541 | 7541 | |
| 7542 | 7542 | |
| 7543 | 7543 | /** |
| 7544 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 7545 | - * |
|
| 7546 | - * @return Array the airport list |
|
| 7547 | - * |
|
| 7548 | - */ |
|
| 7544 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 7545 | + * |
|
| 7546 | + * @return Array the airport list |
|
| 7547 | + * |
|
| 7548 | + */ |
|
| 7549 | 7549 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
| 7550 | 7550 | { |
| 7551 | 7551 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7579,11 +7579,11 @@ discard block |
||
| 7579 | 7579 | |
| 7580 | 7580 | |
| 7581 | 7581 | /** |
| 7582 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7583 | - * |
|
| 7584 | - * @return Array the airport list |
|
| 7585 | - * |
|
| 7586 | - */ |
|
| 7582 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7583 | + * |
|
| 7584 | + * @return Array the airport list |
|
| 7585 | + * |
|
| 7586 | + */ |
|
| 7587 | 7587 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
| 7588 | 7588 | { |
| 7589 | 7589 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7613,31 +7613,31 @@ discard block |
||
| 7613 | 7613 | |
| 7614 | 7614 | |
| 7615 | 7615 | /** |
| 7616 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 7617 | - * |
|
| 7618 | - * @param Boolean $limit Limit result to 10 or not |
|
| 7619 | - * @param Integer $olderthanmonths Only show result older than x months |
|
| 7620 | - * @param String $sincedate Only show result since x date |
|
| 7621 | - * @param Boolean $icaoaskey Show result by ICAO |
|
| 7622 | - * @param Array $filters Filter used here |
|
| 7623 | - * @return Array the airport list |
|
| 7624 | - * |
|
| 7625 | - */ |
|
| 7616 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 7617 | + * |
|
| 7618 | + * @param Boolean $limit Limit result to 10 or not |
|
| 7619 | + * @param Integer $olderthanmonths Only show result older than x months |
|
| 7620 | + * @param String $sincedate Only show result since x date |
|
| 7621 | + * @param Boolean $icaoaskey Show result by ICAO |
|
| 7622 | + * @param Array $filters Filter used here |
|
| 7623 | + * @return Array the airport list |
|
| 7624 | + * |
|
| 7625 | + */ |
|
| 7626 | 7626 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 7627 | 7627 | { |
| 7628 | 7628 | global $globalDBdriver; |
| 7629 | 7629 | $filter_query = $this->getFilter($filters,true,true); |
| 7630 | 7630 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude |
| 7631 | 7631 | FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.arrival_airport_icao AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7632 | - if ($olderthanmonths > 0) { |
|
| 7633 | - if ($globalDBdriver == 'mysql') { |
|
| 7632 | + if ($olderthanmonths > 0) { |
|
| 7633 | + if ($globalDBdriver == 'mysql') { |
|
| 7634 | 7634 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 7635 | 7635 | } else { |
| 7636 | 7636 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 7637 | 7637 | } |
| 7638 | 7638 | } |
| 7639 | - if ($sincedate != '') { |
|
| 7640 | - if ($globalDBdriver == 'mysql') { |
|
| 7639 | + if ($sincedate != '') { |
|
| 7640 | + if ($globalDBdriver == 'mysql') { |
|
| 7641 | 7641 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 7642 | 7642 | } else { |
| 7643 | 7643 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -7671,7 +7671,7 @@ discard block |
||
| 7671 | 7671 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 7672 | 7672 | } |
| 7673 | 7673 | } |
| 7674 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude |
|
| 7674 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude |
|
| 7675 | 7675 | ORDER BY airport_arrival_icao_count DESC"; |
| 7676 | 7676 | if ($limit) $query .= " LIMIT 10"; |
| 7677 | 7677 | |
@@ -7702,35 +7702,35 @@ discard block |
||
| 7702 | 7702 | } |
| 7703 | 7703 | |
| 7704 | 7704 | /** |
| 7705 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 7706 | - * |
|
| 7707 | - * @return Array the airport list |
|
| 7708 | - * |
|
| 7709 | - */ |
|
| 7705 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 7706 | + * |
|
| 7707 | + * @return Array the airport list |
|
| 7708 | + * |
|
| 7709 | + */ |
|
| 7710 | 7710 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 7711 | 7711 | { |
| 7712 | 7712 | global $globalDBdriver; |
| 7713 | 7713 | $filter_query = $this->getFilter($filters,true,true); |
| 7714 | 7714 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, country.iso3 AS arrival_airport_country_iso3 |
| 7715 | 7715 | FROM countries,spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' "; |
| 7716 | - if ($olderthanmonths > 0) { |
|
| 7717 | - if ($globalDBdriver == 'mysql') { |
|
| 7716 | + if ($olderthanmonths > 0) { |
|
| 7717 | + if ($globalDBdriver == 'mysql') { |
|
| 7718 | 7718 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 7719 | 7719 | } else { |
| 7720 | 7720 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 7721 | 7721 | } |
| 7722 | 7722 | } |
| 7723 | - if ($sincedate != '') { |
|
| 7724 | - if ($globalDBdriver == 'mysql') { |
|
| 7723 | + if ($sincedate != '') { |
|
| 7724 | + if ($globalDBdriver == 'mysql') { |
|
| 7725 | 7725 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 7726 | 7726 | } else { |
| 7727 | 7727 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 7728 | 7728 | } |
| 7729 | 7729 | } |
| 7730 | 7730 | |
| 7731 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7732 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7733 | - $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, countries.iso3 |
|
| 7731 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7732 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7733 | + $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, countries.iso3 |
|
| 7734 | 7734 | ORDER BY airport_arrival_icao_count DESC"; |
| 7735 | 7735 | if ($limit) $query .= " LIMIT 10"; |
| 7736 | 7736 | |
@@ -7762,26 +7762,26 @@ discard block |
||
| 7762 | 7762 | |
| 7763 | 7763 | |
| 7764 | 7764 | /** |
| 7765 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7766 | - * |
|
| 7767 | - * @return Array the airport list |
|
| 7768 | - * |
|
| 7769 | - */ |
|
| 7765 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7766 | + * |
|
| 7767 | + * @return Array the airport list |
|
| 7768 | + * |
|
| 7769 | + */ |
|
| 7770 | 7770 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 7771 | 7771 | { |
| 7772 | 7772 | global $globalDBdriver; |
| 7773 | 7773 | $filter_query = $this->getFilter($filters,true,true); |
| 7774 | 7774 | $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude |
| 7775 | 7775 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 7776 | - if ($olderthanmonths > 0) { |
|
| 7777 | - if ($globalDBdriver == 'mysql') { |
|
| 7776 | + if ($olderthanmonths > 0) { |
|
| 7777 | + if ($globalDBdriver == 'mysql') { |
|
| 7778 | 7778 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 7779 | 7779 | } else { |
| 7780 | 7780 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 7781 | 7781 | } |
| 7782 | 7782 | } |
| 7783 | - if ($sincedate != '') { |
|
| 7784 | - if ($globalDBdriver == 'mysql') { |
|
| 7783 | + if ($sincedate != '') { |
|
| 7784 | + if ($globalDBdriver == 'mysql') { |
|
| 7785 | 7785 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 7786 | 7786 | } else { |
| 7787 | 7787 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -7843,35 +7843,35 @@ discard block |
||
| 7843 | 7843 | } |
| 7844 | 7844 | |
| 7845 | 7845 | /** |
| 7846 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7847 | - * |
|
| 7848 | - * @return Array the airport list |
|
| 7849 | - * |
|
| 7850 | - */ |
|
| 7846 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7847 | + * |
|
| 7848 | + * @return Array the airport list |
|
| 7849 | + * |
|
| 7850 | + */ |
|
| 7851 | 7851 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 7852 | 7852 | { |
| 7853 | 7853 | global $globalDBdriver; |
| 7854 | 7854 | $filter_query = $this->getFilter($filters,true,true); |
| 7855 | 7855 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
| 7856 | 7856 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 7857 | - if ($olderthanmonths > 0) { |
|
| 7858 | - if ($globalDBdriver == 'mysql') { |
|
| 7857 | + if ($olderthanmonths > 0) { |
|
| 7858 | + if ($globalDBdriver == 'mysql') { |
|
| 7859 | 7859 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 7860 | 7860 | } else { |
| 7861 | 7861 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 7862 | 7862 | } |
| 7863 | 7863 | } |
| 7864 | - if ($sincedate != '') { |
|
| 7865 | - if ($globalDBdriver == 'mysql') { |
|
| 7864 | + if ($sincedate != '') { |
|
| 7865 | + if ($globalDBdriver == 'mysql') { |
|
| 7866 | 7866 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 7867 | 7867 | } else { |
| 7868 | 7868 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 7869 | 7869 | } |
| 7870 | 7870 | } |
| 7871 | 7871 | |
| 7872 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7873 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7874 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7872 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7873 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7874 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7875 | 7875 | ORDER BY airport_arrival_icao_count DESC"; |
| 7876 | 7876 | if ($limit) $query .= " LIMIT 10"; |
| 7877 | 7877 | |
@@ -7901,11 +7901,11 @@ discard block |
||
| 7901 | 7901 | } |
| 7902 | 7902 | |
| 7903 | 7903 | /** |
| 7904 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7905 | - * |
|
| 7906 | - * @return Array the airport list |
|
| 7907 | - * |
|
| 7908 | - */ |
|
| 7904 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7905 | + * |
|
| 7906 | + * @return Array the airport list |
|
| 7907 | + * |
|
| 7908 | + */ |
|
| 7909 | 7909 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 7910 | 7910 | { |
| 7911 | 7911 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7937,11 +7937,11 @@ discard block |
||
| 7937 | 7937 | |
| 7938 | 7938 | |
| 7939 | 7939 | /** |
| 7940 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7941 | - * |
|
| 7942 | - * @return Array the airport list |
|
| 7943 | - * |
|
| 7944 | - */ |
|
| 7940 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7941 | + * |
|
| 7942 | + * @return Array the airport list |
|
| 7943 | + * |
|
| 7944 | + */ |
|
| 7945 | 7945 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
| 7946 | 7946 | { |
| 7947 | 7947 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7971,11 +7971,11 @@ discard block |
||
| 7971 | 7971 | |
| 7972 | 7972 | |
| 7973 | 7973 | /** |
| 7974 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7975 | - * |
|
| 7976 | - * @return Array the airport list |
|
| 7977 | - * |
|
| 7978 | - */ |
|
| 7974 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7975 | + * |
|
| 7976 | + * @return Array the airport list |
|
| 7977 | + * |
|
| 7978 | + */ |
|
| 7979 | 7979 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
| 7980 | 7980 | { |
| 7981 | 7981 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8009,11 +8009,11 @@ discard block |
||
| 8009 | 8009 | |
| 8010 | 8010 | |
| 8011 | 8011 | /** |
| 8012 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 8013 | - * |
|
| 8014 | - * @return Array the airport list |
|
| 8015 | - * |
|
| 8016 | - */ |
|
| 8012 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 8013 | + * |
|
| 8014 | + * @return Array the airport list |
|
| 8015 | + * |
|
| 8016 | + */ |
|
| 8017 | 8017 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 8018 | 8018 | { |
| 8019 | 8019 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8043,11 +8043,11 @@ discard block |
||
| 8043 | 8043 | |
| 8044 | 8044 | |
| 8045 | 8045 | /** |
| 8046 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 8047 | - * |
|
| 8048 | - * @return Array the airport list |
|
| 8049 | - * |
|
| 8050 | - */ |
|
| 8046 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 8047 | + * |
|
| 8048 | + * @return Array the airport list |
|
| 8049 | + * |
|
| 8050 | + */ |
|
| 8051 | 8051 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
| 8052 | 8052 | { |
| 8053 | 8053 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8081,11 +8081,11 @@ discard block |
||
| 8081 | 8081 | |
| 8082 | 8082 | |
| 8083 | 8083 | /** |
| 8084 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 8085 | - * |
|
| 8086 | - * @return Array the airport list |
|
| 8087 | - * |
|
| 8088 | - */ |
|
| 8084 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 8085 | + * |
|
| 8086 | + * @return Array the airport list |
|
| 8087 | + * |
|
| 8088 | + */ |
|
| 8089 | 8089 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
| 8090 | 8090 | { |
| 8091 | 8091 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8116,11 +8116,11 @@ discard block |
||
| 8116 | 8116 | |
| 8117 | 8117 | |
| 8118 | 8118 | /** |
| 8119 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 8120 | - * |
|
| 8121 | - * @return Array the airport list |
|
| 8122 | - * |
|
| 8123 | - */ |
|
| 8119 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 8120 | + * |
|
| 8121 | + * @return Array the airport list |
|
| 8122 | + * |
|
| 8123 | + */ |
|
| 8124 | 8124 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
| 8125 | 8125 | { |
| 8126 | 8126 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8153,11 +8153,11 @@ discard block |
||
| 8153 | 8153 | |
| 8154 | 8154 | |
| 8155 | 8155 | /** |
| 8156 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 8157 | - * |
|
| 8158 | - * @return Array the airport list |
|
| 8159 | - * |
|
| 8160 | - */ |
|
| 8156 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 8157 | + * |
|
| 8158 | + * @return Array the airport list |
|
| 8159 | + * |
|
| 8160 | + */ |
|
| 8161 | 8161 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
| 8162 | 8162 | { |
| 8163 | 8163 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8187,11 +8187,11 @@ discard block |
||
| 8187 | 8187 | |
| 8188 | 8188 | |
| 8189 | 8189 | /** |
| 8190 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8191 | - * |
|
| 8192 | - * @return Array the airport list |
|
| 8193 | - * |
|
| 8194 | - */ |
|
| 8190 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8191 | + * |
|
| 8192 | + * @return Array the airport list |
|
| 8193 | + * |
|
| 8194 | + */ |
|
| 8195 | 8195 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 8196 | 8196 | { |
| 8197 | 8197 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8225,11 +8225,11 @@ discard block |
||
| 8225 | 8225 | |
| 8226 | 8226 | |
| 8227 | 8227 | /** |
| 8228 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8229 | - * |
|
| 8230 | - * @return Array the airport list |
|
| 8231 | - * |
|
| 8232 | - */ |
|
| 8228 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8229 | + * |
|
| 8230 | + * @return Array the airport list |
|
| 8231 | + * |
|
| 8232 | + */ |
|
| 8233 | 8233 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 8234 | 8234 | { |
| 8235 | 8235 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8260,11 +8260,11 @@ discard block |
||
| 8260 | 8260 | |
| 8261 | 8261 | |
| 8262 | 8262 | /** |
| 8263 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 8264 | - * |
|
| 8265 | - * @return Array the airport list |
|
| 8266 | - * |
|
| 8267 | - */ |
|
| 8263 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 8264 | + * |
|
| 8265 | + * @return Array the airport list |
|
| 8266 | + * |
|
| 8267 | + */ |
|
| 8268 | 8268 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
| 8269 | 8269 | { |
| 8270 | 8270 | global $globalTimezone, $globalDBdriver; |
@@ -8310,11 +8310,11 @@ discard block |
||
| 8310 | 8310 | |
| 8311 | 8311 | |
| 8312 | 8312 | /** |
| 8313 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 8314 | - * |
|
| 8315 | - * @return Array the airport list |
|
| 8316 | - * |
|
| 8317 | - */ |
|
| 8313 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 8314 | + * |
|
| 8315 | + * @return Array the airport list |
|
| 8316 | + * |
|
| 8317 | + */ |
|
| 8318 | 8318 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 8319 | 8319 | { |
| 8320 | 8320 | global $globalTimezone, $globalDBdriver; |
@@ -8357,11 +8357,11 @@ discard block |
||
| 8357 | 8357 | |
| 8358 | 8358 | |
| 8359 | 8359 | /** |
| 8360 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 8361 | - * |
|
| 8362 | - * @return Array the airport list |
|
| 8363 | - * |
|
| 8364 | - */ |
|
| 8360 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 8361 | + * |
|
| 8362 | + * @return Array the airport list |
|
| 8363 | + * |
|
| 8364 | + */ |
|
| 8365 | 8365 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
| 8366 | 8366 | { |
| 8367 | 8367 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8393,11 +8393,11 @@ discard block |
||
| 8393 | 8393 | } |
| 8394 | 8394 | |
| 8395 | 8395 | /** |
| 8396 | - * Gets all arrival airports of the airplanes that have flown over based on a owner |
|
| 8397 | - * |
|
| 8398 | - * @return Array the airport list |
|
| 8399 | - * |
|
| 8400 | - */ |
|
| 8396 | + * Gets all arrival airports of the airplanes that have flown over based on a owner |
|
| 8397 | + * |
|
| 8398 | + * @return Array the airport list |
|
| 8399 | + * |
|
| 8400 | + */ |
|
| 8401 | 8401 | public function countAllArrivalAirportsByOwner($owner,$filters = array()) |
| 8402 | 8402 | { |
| 8403 | 8403 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8428,11 +8428,11 @@ discard block |
||
| 8428 | 8428 | } |
| 8429 | 8429 | |
| 8430 | 8430 | /** |
| 8431 | - * Gets all arrival airports of the airplanes that have flown over based on a pilot |
|
| 8432 | - * |
|
| 8433 | - * @return Array the airport list |
|
| 8434 | - * |
|
| 8435 | - */ |
|
| 8431 | + * Gets all arrival airports of the airplanes that have flown over based on a pilot |
|
| 8432 | + * |
|
| 8433 | + * @return Array the airport list |
|
| 8434 | + * |
|
| 8435 | + */ |
|
| 8436 | 8436 | public function countAllArrivalAirportsByPilot($pilot,$filters = array()) |
| 8437 | 8437 | { |
| 8438 | 8438 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8463,11 +8463,11 @@ discard block |
||
| 8463 | 8463 | } |
| 8464 | 8464 | |
| 8465 | 8465 | /** |
| 8466 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 8467 | - * |
|
| 8468 | - * @return Array the airport list |
|
| 8469 | - * |
|
| 8470 | - */ |
|
| 8466 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 8467 | + * |
|
| 8468 | + * @return Array the airport list |
|
| 8469 | + * |
|
| 8470 | + */ |
|
| 8471 | 8471 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 8472 | 8472 | { |
| 8473 | 8473 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8496,11 +8496,11 @@ discard block |
||
| 8496 | 8496 | } |
| 8497 | 8497 | |
| 8498 | 8498 | /** |
| 8499 | - * Gets all arrival airports by country of the airplanes that have flown over based on a owner |
|
| 8500 | - * |
|
| 8501 | - * @return Array the airport list |
|
| 8502 | - * |
|
| 8503 | - */ |
|
| 8499 | + * Gets all arrival airports by country of the airplanes that have flown over based on a owner |
|
| 8500 | + * |
|
| 8501 | + * @return Array the airport list |
|
| 8502 | + * |
|
| 8503 | + */ |
|
| 8504 | 8504 | public function countAllArrivalAirportCountriesByOwner($owner, $filters = array()) |
| 8505 | 8505 | { |
| 8506 | 8506 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8516,11 +8516,11 @@ discard block |
||
| 8516 | 8516 | } |
| 8517 | 8517 | |
| 8518 | 8518 | /** |
| 8519 | - * Gets all arrival airports by country of the airplanes that have flown over based on a pilot |
|
| 8520 | - * |
|
| 8521 | - * @return Array the airport list |
|
| 8522 | - * |
|
| 8523 | - */ |
|
| 8519 | + * Gets all arrival airports by country of the airplanes that have flown over based on a pilot |
|
| 8520 | + * |
|
| 8521 | + * @return Array the airport list |
|
| 8522 | + * |
|
| 8523 | + */ |
|
| 8524 | 8524 | public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array()) |
| 8525 | 8525 | { |
| 8526 | 8526 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8538,11 +8538,11 @@ discard block |
||
| 8538 | 8538 | |
| 8539 | 8539 | |
| 8540 | 8540 | /** |
| 8541 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 8542 | - * |
|
| 8543 | - * @return Array the airport list |
|
| 8544 | - * |
|
| 8545 | - */ |
|
| 8541 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 8542 | + * |
|
| 8543 | + * @return Array the airport list |
|
| 8544 | + * |
|
| 8545 | + */ |
|
| 8546 | 8546 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
| 8547 | 8547 | { |
| 8548 | 8548 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8575,11 +8575,11 @@ discard block |
||
| 8575 | 8575 | |
| 8576 | 8576 | |
| 8577 | 8577 | /** |
| 8578 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 8579 | - * |
|
| 8580 | - * @return Array the airport list |
|
| 8581 | - * |
|
| 8582 | - */ |
|
| 8578 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 8579 | + * |
|
| 8580 | + * @return Array the airport list |
|
| 8581 | + * |
|
| 8582 | + */ |
|
| 8583 | 8583 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
| 8584 | 8584 | { |
| 8585 | 8585 | global $globalDBdriver; |
@@ -8611,11 +8611,11 @@ discard block |
||
| 8611 | 8611 | |
| 8612 | 8612 | |
| 8613 | 8613 | /** |
| 8614 | - * Counts all airport departure countries |
|
| 8615 | - * |
|
| 8616 | - * @return Array the airport departure list |
|
| 8617 | - * |
|
| 8618 | - */ |
|
| 8614 | + * Counts all airport departure countries |
|
| 8615 | + * |
|
| 8616 | + * @return Array the airport departure list |
|
| 8617 | + * |
|
| 8618 | + */ |
|
| 8619 | 8619 | public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '') |
| 8620 | 8620 | { |
| 8621 | 8621 | global $globalDBdriver; |
@@ -8674,11 +8674,11 @@ discard block |
||
| 8674 | 8674 | |
| 8675 | 8675 | |
| 8676 | 8676 | /** |
| 8677 | - * Counts all airport arrival countries |
|
| 8678 | - * |
|
| 8679 | - * @return Array the airport arrival list |
|
| 8680 | - * |
|
| 8681 | - */ |
|
| 8677 | + * Counts all airport arrival countries |
|
| 8678 | + * |
|
| 8679 | + * @return Array the airport arrival list |
|
| 8680 | + * |
|
| 8681 | + */ |
|
| 8682 | 8682 | public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
| 8683 | 8683 | { |
| 8684 | 8684 | global $globalDBdriver; |
@@ -8741,11 +8741,11 @@ discard block |
||
| 8741 | 8741 | |
| 8742 | 8742 | |
| 8743 | 8743 | /** |
| 8744 | - * Gets all route combinations |
|
| 8745 | - * |
|
| 8746 | - * @return Array the route list |
|
| 8747 | - * |
|
| 8748 | - */ |
|
| 8744 | + * Gets all route combinations |
|
| 8745 | + * |
|
| 8746 | + * @return Array the route list |
|
| 8747 | + * |
|
| 8748 | + */ |
|
| 8749 | 8749 | public function countAllRoutes($filters = array()) |
| 8750 | 8750 | { |
| 8751 | 8751 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8784,11 +8784,11 @@ discard block |
||
| 8784 | 8784 | |
| 8785 | 8785 | |
| 8786 | 8786 | /** |
| 8787 | - * Gets all route combinations based on an aircraft |
|
| 8788 | - * |
|
| 8789 | - * @return Array the route list |
|
| 8790 | - * |
|
| 8791 | - */ |
|
| 8787 | + * Gets all route combinations based on an aircraft |
|
| 8788 | + * |
|
| 8789 | + * @return Array the route list |
|
| 8790 | + * |
|
| 8791 | + */ |
|
| 8792 | 8792 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
| 8793 | 8793 | { |
| 8794 | 8794 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8824,11 +8824,11 @@ discard block |
||
| 8824 | 8824 | |
| 8825 | 8825 | |
| 8826 | 8826 | /** |
| 8827 | - * Gets all route combinations based on an aircraft registration |
|
| 8828 | - * |
|
| 8829 | - * @return Array the route list |
|
| 8830 | - * |
|
| 8831 | - */ |
|
| 8827 | + * Gets all route combinations based on an aircraft registration |
|
| 8828 | + * |
|
| 8829 | + * @return Array the route list |
|
| 8830 | + * |
|
| 8831 | + */ |
|
| 8832 | 8832 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 8833 | 8833 | { |
| 8834 | 8834 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8866,11 +8866,11 @@ discard block |
||
| 8866 | 8866 | |
| 8867 | 8867 | |
| 8868 | 8868 | /** |
| 8869 | - * Gets all route combinations based on an airline |
|
| 8870 | - * |
|
| 8871 | - * @return Array the route list |
|
| 8872 | - * |
|
| 8873 | - */ |
|
| 8869 | + * Gets all route combinations based on an airline |
|
| 8870 | + * |
|
| 8871 | + * @return Array the route list |
|
| 8872 | + * |
|
| 8873 | + */ |
|
| 8874 | 8874 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 8875 | 8875 | { |
| 8876 | 8876 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8908,11 +8908,11 @@ discard block |
||
| 8908 | 8908 | |
| 8909 | 8909 | |
| 8910 | 8910 | /** |
| 8911 | - * Gets all route combinations based on an airport |
|
| 8912 | - * |
|
| 8913 | - * @return Array the route list |
|
| 8914 | - * |
|
| 8915 | - */ |
|
| 8911 | + * Gets all route combinations based on an airport |
|
| 8912 | + * |
|
| 8913 | + * @return Array the route list |
|
| 8914 | + * |
|
| 8915 | + */ |
|
| 8916 | 8916 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 8917 | 8917 | { |
| 8918 | 8918 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8949,11 +8949,11 @@ discard block |
||
| 8949 | 8949 | |
| 8950 | 8950 | |
| 8951 | 8951 | /** |
| 8952 | - * Gets all route combinations based on an country |
|
| 8953 | - * |
|
| 8954 | - * @return Array the route list |
|
| 8955 | - * |
|
| 8956 | - */ |
|
| 8952 | + * Gets all route combinations based on an country |
|
| 8953 | + * |
|
| 8954 | + * @return Array the route list |
|
| 8955 | + * |
|
| 8956 | + */ |
|
| 8957 | 8957 | public function countAllRoutesByCountry($country, $filters = array()) |
| 8958 | 8958 | { |
| 8959 | 8959 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8989,11 +8989,11 @@ discard block |
||
| 8989 | 8989 | |
| 8990 | 8990 | |
| 8991 | 8991 | /** |
| 8992 | - * Gets all route combinations based on an date |
|
| 8993 | - * |
|
| 8994 | - * @return Array the route list |
|
| 8995 | - * |
|
| 8996 | - */ |
|
| 8992 | + * Gets all route combinations based on an date |
|
| 8993 | + * |
|
| 8994 | + * @return Array the route list |
|
| 8995 | + * |
|
| 8996 | + */ |
|
| 8997 | 8997 | public function countAllRoutesByDate($date, $filters = array()) |
| 8998 | 8998 | { |
| 8999 | 8999 | global $globalTimezone, $globalDBdriver; |
@@ -9043,11 +9043,11 @@ discard block |
||
| 9043 | 9043 | |
| 9044 | 9044 | |
| 9045 | 9045 | /** |
| 9046 | - * Gets all route combinations based on an ident/callsign |
|
| 9047 | - * |
|
| 9048 | - * @return Array the route list |
|
| 9049 | - * |
|
| 9050 | - */ |
|
| 9046 | + * Gets all route combinations based on an ident/callsign |
|
| 9047 | + * |
|
| 9048 | + * @return Array the route list |
|
| 9049 | + * |
|
| 9050 | + */ |
|
| 9051 | 9051 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 9052 | 9052 | { |
| 9053 | 9053 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9083,11 +9083,11 @@ discard block |
||
| 9083 | 9083 | } |
| 9084 | 9084 | |
| 9085 | 9085 | /** |
| 9086 | - * Gets all route combinations based on an owner |
|
| 9087 | - * |
|
| 9088 | - * @return Array the route list |
|
| 9089 | - * |
|
| 9090 | - */ |
|
| 9086 | + * Gets all route combinations based on an owner |
|
| 9087 | + * |
|
| 9088 | + * @return Array the route list |
|
| 9089 | + * |
|
| 9090 | + */ |
|
| 9091 | 9091 | public function countAllRoutesByOwner($owner,$filters = array()) |
| 9092 | 9092 | { |
| 9093 | 9093 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9123,11 +9123,11 @@ discard block |
||
| 9123 | 9123 | } |
| 9124 | 9124 | |
| 9125 | 9125 | /** |
| 9126 | - * Gets all route combinations based on a pilot |
|
| 9127 | - * |
|
| 9128 | - * @return Array the route list |
|
| 9129 | - * |
|
| 9130 | - */ |
|
| 9126 | + * Gets all route combinations based on a pilot |
|
| 9127 | + * |
|
| 9128 | + * @return Array the route list |
|
| 9129 | + * |
|
| 9130 | + */ |
|
| 9131 | 9131 | public function countAllRoutesByPilot($pilot,$filters = array()) |
| 9132 | 9132 | { |
| 9133 | 9133 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9164,11 +9164,11 @@ discard block |
||
| 9164 | 9164 | |
| 9165 | 9165 | |
| 9166 | 9166 | /** |
| 9167 | - * Gets all route combinations based on an manufacturer |
|
| 9168 | - * |
|
| 9169 | - * @return Array the route list |
|
| 9170 | - * |
|
| 9171 | - */ |
|
| 9167 | + * Gets all route combinations based on an manufacturer |
|
| 9168 | + * |
|
| 9169 | + * @return Array the route list |
|
| 9170 | + * |
|
| 9171 | + */ |
|
| 9172 | 9172 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 9173 | 9173 | { |
| 9174 | 9174 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9206,11 +9206,11 @@ discard block |
||
| 9206 | 9206 | |
| 9207 | 9207 | |
| 9208 | 9208 | /** |
| 9209 | - * Gets all route combinations with waypoints |
|
| 9210 | - * |
|
| 9211 | - * @return Array the route list |
|
| 9212 | - * |
|
| 9213 | - */ |
|
| 9209 | + * Gets all route combinations with waypoints |
|
| 9210 | + * |
|
| 9211 | + * @return Array the route list |
|
| 9212 | + * |
|
| 9213 | + */ |
|
| 9214 | 9214 | public function countAllRoutesWithWaypoints($filters = array()) |
| 9215 | 9215 | { |
| 9216 | 9216 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9247,11 +9247,11 @@ discard block |
||
| 9247 | 9247 | } |
| 9248 | 9248 | |
| 9249 | 9249 | /** |
| 9250 | - * Gets all callsigns that have flown over |
|
| 9251 | - * |
|
| 9252 | - * @return Array the callsign list |
|
| 9253 | - * |
|
| 9254 | - */ |
|
| 9250 | + * Gets all callsigns that have flown over |
|
| 9251 | + * |
|
| 9252 | + * @return Array the callsign list |
|
| 9253 | + * |
|
| 9254 | + */ |
|
| 9255 | 9255 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 9256 | 9256 | { |
| 9257 | 9257 | global $globalDBdriver; |
@@ -9317,11 +9317,11 @@ discard block |
||
| 9317 | 9317 | } |
| 9318 | 9318 | |
| 9319 | 9319 | /** |
| 9320 | - * Gets all callsigns that have flown over |
|
| 9321 | - * |
|
| 9322 | - * @return Array the callsign list |
|
| 9323 | - * |
|
| 9324 | - */ |
|
| 9320 | + * Gets all callsigns that have flown over |
|
| 9321 | + * |
|
| 9322 | + * @return Array the callsign list |
|
| 9323 | + * |
|
| 9324 | + */ |
|
| 9325 | 9325 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 9326 | 9326 | { |
| 9327 | 9327 | global $globalDBdriver; |
@@ -9362,11 +9362,11 @@ discard block |
||
| 9362 | 9362 | |
| 9363 | 9363 | |
| 9364 | 9364 | /** |
| 9365 | - * Counts all dates |
|
| 9366 | - * |
|
| 9367 | - * @return Array the date list |
|
| 9368 | - * |
|
| 9369 | - */ |
|
| 9365 | + * Counts all dates |
|
| 9366 | + * |
|
| 9367 | + * @return Array the date list |
|
| 9368 | + * |
|
| 9369 | + */ |
|
| 9370 | 9370 | public function countAllDates($filters = array()) |
| 9371 | 9371 | { |
| 9372 | 9372 | global $globalTimezone, $globalDBdriver; |
@@ -9411,11 +9411,11 @@ discard block |
||
| 9411 | 9411 | } |
| 9412 | 9412 | |
| 9413 | 9413 | /** |
| 9414 | - * Counts all dates |
|
| 9415 | - * |
|
| 9416 | - * @return Array the date list |
|
| 9417 | - * |
|
| 9418 | - */ |
|
| 9414 | + * Counts all dates |
|
| 9415 | + * |
|
| 9416 | + * @return Array the date list |
|
| 9417 | + * |
|
| 9418 | + */ |
|
| 9419 | 9419 | public function countAllDatesByAirlines($filters = array()) |
| 9420 | 9420 | { |
| 9421 | 9421 | global $globalTimezone, $globalDBdriver; |
@@ -9460,11 +9460,11 @@ discard block |
||
| 9460 | 9460 | } |
| 9461 | 9461 | |
| 9462 | 9462 | /** |
| 9463 | - * Counts all dates during the last 7 days |
|
| 9464 | - * |
|
| 9465 | - * @return Array the date list |
|
| 9466 | - * |
|
| 9467 | - */ |
|
| 9463 | + * Counts all dates during the last 7 days |
|
| 9464 | + * |
|
| 9465 | + * @return Array the date list |
|
| 9466 | + * |
|
| 9467 | + */ |
|
| 9468 | 9468 | public function countAllDatesLast7Days($filters = array()) |
| 9469 | 9469 | { |
| 9470 | 9470 | global $globalTimezone, $globalDBdriver; |
@@ -9486,7 +9486,7 @@ discard block |
||
| 9486 | 9486 | $query .= " GROUP BY date_name |
| 9487 | 9487 | ORDER BY date_name ASC"; |
| 9488 | 9488 | $query_data = array(':offset' => $offset); |
| 9489 | - } |
|
| 9489 | + } |
|
| 9490 | 9490 | |
| 9491 | 9491 | $sth = $this->db->prepare($query); |
| 9492 | 9492 | $sth->execute($query_data); |
@@ -9506,11 +9506,11 @@ discard block |
||
| 9506 | 9506 | } |
| 9507 | 9507 | |
| 9508 | 9508 | /** |
| 9509 | - * Counts all dates during the last month |
|
| 9510 | - * |
|
| 9511 | - * @return Array the date list |
|
| 9512 | - * |
|
| 9513 | - */ |
|
| 9509 | + * Counts all dates during the last month |
|
| 9510 | + * |
|
| 9511 | + * @return Array the date list |
|
| 9512 | + * |
|
| 9513 | + */ |
|
| 9514 | 9514 | public function countAllDatesLastMonth($filters = array()) |
| 9515 | 9515 | { |
| 9516 | 9516 | global $globalTimezone, $globalDBdriver; |
@@ -9532,7 +9532,7 @@ discard block |
||
| 9532 | 9532 | $query .= " GROUP BY date_name |
| 9533 | 9533 | ORDER BY date_name ASC"; |
| 9534 | 9534 | $query_data = array(':offset' => $offset); |
| 9535 | - } |
|
| 9535 | + } |
|
| 9536 | 9536 | |
| 9537 | 9537 | $sth = $this->db->prepare($query); |
| 9538 | 9538 | $sth->execute($query_data); |
@@ -9553,11 +9553,11 @@ discard block |
||
| 9553 | 9553 | |
| 9554 | 9554 | |
| 9555 | 9555 | /** |
| 9556 | - * Counts all dates during the last month |
|
| 9557 | - * |
|
| 9558 | - * @return Array the date list |
|
| 9559 | - * |
|
| 9560 | - */ |
|
| 9556 | + * Counts all dates during the last month |
|
| 9557 | + * |
|
| 9558 | + * @return Array the date list |
|
| 9559 | + * |
|
| 9560 | + */ |
|
| 9561 | 9561 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 9562 | 9562 | { |
| 9563 | 9563 | global $globalTimezone, $globalDBdriver; |
@@ -9580,7 +9580,7 @@ discard block |
||
| 9580 | 9580 | GROUP BY spotter_output.airline_icao, date_name |
| 9581 | 9581 | ORDER BY date_name ASC"; |
| 9582 | 9582 | $query_data = array(':offset' => $offset); |
| 9583 | - } |
|
| 9583 | + } |
|
| 9584 | 9584 | |
| 9585 | 9585 | $sth = $this->db->prepare($query); |
| 9586 | 9586 | $sth->execute($query_data); |
@@ -9602,11 +9602,11 @@ discard block |
||
| 9602 | 9602 | |
| 9603 | 9603 | |
| 9604 | 9604 | /** |
| 9605 | - * Counts all month |
|
| 9606 | - * |
|
| 9607 | - * @return Array the month list |
|
| 9608 | - * |
|
| 9609 | - */ |
|
| 9605 | + * Counts all month |
|
| 9606 | + * |
|
| 9607 | + * @return Array the month list |
|
| 9608 | + * |
|
| 9609 | + */ |
|
| 9610 | 9610 | public function countAllMonths($filters = array()) |
| 9611 | 9611 | { |
| 9612 | 9612 | global $globalTimezone, $globalDBdriver; |
@@ -9648,11 +9648,11 @@ discard block |
||
| 9648 | 9648 | } |
| 9649 | 9649 | |
| 9650 | 9650 | /** |
| 9651 | - * Counts all month |
|
| 9652 | - * |
|
| 9653 | - * @return Array the month list |
|
| 9654 | - * |
|
| 9655 | - */ |
|
| 9651 | + * Counts all month |
|
| 9652 | + * |
|
| 9653 | + * @return Array the month list |
|
| 9654 | + * |
|
| 9655 | + */ |
|
| 9656 | 9656 | public function countAllMonthsByAirlines($filters = array()) |
| 9657 | 9657 | { |
| 9658 | 9658 | global $globalTimezone, $globalDBdriver; |
@@ -9697,11 +9697,11 @@ discard block |
||
| 9697 | 9697 | } |
| 9698 | 9698 | |
| 9699 | 9699 | /** |
| 9700 | - * Counts all military month |
|
| 9701 | - * |
|
| 9702 | - * @return Array the month list |
|
| 9703 | - * |
|
| 9704 | - */ |
|
| 9700 | + * Counts all military month |
|
| 9701 | + * |
|
| 9702 | + * @return Array the month list |
|
| 9703 | + * |
|
| 9704 | + */ |
|
| 9705 | 9705 | public function countAllMilitaryMonths($filters = array()) |
| 9706 | 9706 | { |
| 9707 | 9707 | global $globalTimezone, $globalDBdriver; |
@@ -9742,11 +9742,11 @@ discard block |
||
| 9742 | 9742 | } |
| 9743 | 9743 | |
| 9744 | 9744 | /** |
| 9745 | - * Counts all month owners |
|
| 9746 | - * |
|
| 9747 | - * @return Array the month list |
|
| 9748 | - * |
|
| 9749 | - */ |
|
| 9745 | + * Counts all month owners |
|
| 9746 | + * |
|
| 9747 | + * @return Array the month list |
|
| 9748 | + * |
|
| 9749 | + */ |
|
| 9750 | 9750 | public function countAllMonthsOwners($filters = array()) |
| 9751 | 9751 | { |
| 9752 | 9752 | global $globalTimezone, $globalDBdriver; |
@@ -9788,11 +9788,11 @@ discard block |
||
| 9788 | 9788 | } |
| 9789 | 9789 | |
| 9790 | 9790 | /** |
| 9791 | - * Counts all month owners |
|
| 9792 | - * |
|
| 9793 | - * @return Array the month list |
|
| 9794 | - * |
|
| 9795 | - */ |
|
| 9791 | + * Counts all month owners |
|
| 9792 | + * |
|
| 9793 | + * @return Array the month list |
|
| 9794 | + * |
|
| 9795 | + */ |
|
| 9796 | 9796 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 9797 | 9797 | { |
| 9798 | 9798 | global $globalTimezone, $globalDBdriver; |
@@ -9835,11 +9835,11 @@ discard block |
||
| 9835 | 9835 | } |
| 9836 | 9836 | |
| 9837 | 9837 | /** |
| 9838 | - * Counts all month pilot |
|
| 9839 | - * |
|
| 9840 | - * @return Array the month list |
|
| 9841 | - * |
|
| 9842 | - */ |
|
| 9838 | + * Counts all month pilot |
|
| 9839 | + * |
|
| 9840 | + * @return Array the month list |
|
| 9841 | + * |
|
| 9842 | + */ |
|
| 9843 | 9843 | public function countAllMonthsPilots($filters = array()) |
| 9844 | 9844 | { |
| 9845 | 9845 | global $globalTimezone, $globalDBdriver; |
@@ -9881,11 +9881,11 @@ discard block |
||
| 9881 | 9881 | } |
| 9882 | 9882 | |
| 9883 | 9883 | /** |
| 9884 | - * Counts all month pilot |
|
| 9885 | - * |
|
| 9886 | - * @return Array the month list |
|
| 9887 | - * |
|
| 9888 | - */ |
|
| 9884 | + * Counts all month pilot |
|
| 9885 | + * |
|
| 9886 | + * @return Array the month list |
|
| 9887 | + * |
|
| 9888 | + */ |
|
| 9889 | 9889 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 9890 | 9890 | { |
| 9891 | 9891 | global $globalTimezone, $globalDBdriver; |
@@ -9928,11 +9928,11 @@ discard block |
||
| 9928 | 9928 | } |
| 9929 | 9929 | |
| 9930 | 9930 | /** |
| 9931 | - * Counts all month airline |
|
| 9932 | - * |
|
| 9933 | - * @return Array the month list |
|
| 9934 | - * |
|
| 9935 | - */ |
|
| 9931 | + * Counts all month airline |
|
| 9932 | + * |
|
| 9933 | + * @return Array the month list |
|
| 9934 | + * |
|
| 9935 | + */ |
|
| 9936 | 9936 | public function countAllMonthsAirlines($filters = array()) |
| 9937 | 9937 | { |
| 9938 | 9938 | global $globalTimezone, $globalDBdriver; |
@@ -9974,11 +9974,11 @@ discard block |
||
| 9974 | 9974 | } |
| 9975 | 9975 | |
| 9976 | 9976 | /** |
| 9977 | - * Counts all month aircraft |
|
| 9978 | - * |
|
| 9979 | - * @return Array the month list |
|
| 9980 | - * |
|
| 9981 | - */ |
|
| 9977 | + * Counts all month aircraft |
|
| 9978 | + * |
|
| 9979 | + * @return Array the month list |
|
| 9980 | + * |
|
| 9981 | + */ |
|
| 9982 | 9982 | public function countAllMonthsAircrafts($filters = array()) |
| 9983 | 9983 | { |
| 9984 | 9984 | global $globalTimezone, $globalDBdriver; |
@@ -10021,11 +10021,11 @@ discard block |
||
| 10021 | 10021 | |
| 10022 | 10022 | |
| 10023 | 10023 | /** |
| 10024 | - * Counts all month aircraft |
|
| 10025 | - * |
|
| 10026 | - * @return Array the month list |
|
| 10027 | - * |
|
| 10028 | - */ |
|
| 10024 | + * Counts all month aircraft |
|
| 10025 | + * |
|
| 10026 | + * @return Array the month list |
|
| 10027 | + * |
|
| 10028 | + */ |
|
| 10029 | 10029 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 10030 | 10030 | { |
| 10031 | 10031 | global $globalTimezone, $globalDBdriver; |
@@ -10068,11 +10068,11 @@ discard block |
||
| 10068 | 10068 | } |
| 10069 | 10069 | |
| 10070 | 10070 | /** |
| 10071 | - * Counts all month real arrival |
|
| 10072 | - * |
|
| 10073 | - * @return Array the month list |
|
| 10074 | - * |
|
| 10075 | - */ |
|
| 10071 | + * Counts all month real arrival |
|
| 10072 | + * |
|
| 10073 | + * @return Array the month list |
|
| 10074 | + * |
|
| 10075 | + */ |
|
| 10076 | 10076 | public function countAllMonthsRealArrivals($filters = array()) |
| 10077 | 10077 | { |
| 10078 | 10078 | global $globalTimezone, $globalDBdriver; |
@@ -10115,11 +10115,11 @@ discard block |
||
| 10115 | 10115 | |
| 10116 | 10116 | |
| 10117 | 10117 | /** |
| 10118 | - * Counts all month real arrival |
|
| 10119 | - * |
|
| 10120 | - * @return Array the month list |
|
| 10121 | - * |
|
| 10122 | - */ |
|
| 10118 | + * Counts all month real arrival |
|
| 10119 | + * |
|
| 10120 | + * @return Array the month list |
|
| 10121 | + * |
|
| 10122 | + */ |
|
| 10123 | 10123 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 10124 | 10124 | { |
| 10125 | 10125 | global $globalTimezone, $globalDBdriver; |
@@ -10163,11 +10163,11 @@ discard block |
||
| 10163 | 10163 | |
| 10164 | 10164 | |
| 10165 | 10165 | /** |
| 10166 | - * Counts all dates during the last year |
|
| 10167 | - * |
|
| 10168 | - * @return Array the date list |
|
| 10169 | - * |
|
| 10170 | - */ |
|
| 10166 | + * Counts all dates during the last year |
|
| 10167 | + * |
|
| 10168 | + * @return Array the date list |
|
| 10169 | + * |
|
| 10170 | + */ |
|
| 10171 | 10171 | public function countAllMonthsLastYear($filters) |
| 10172 | 10172 | { |
| 10173 | 10173 | global $globalTimezone, $globalDBdriver; |
@@ -10189,7 +10189,7 @@ discard block |
||
| 10189 | 10189 | $query .= " GROUP BY year_name, month_name |
| 10190 | 10190 | ORDER BY year_name, month_name ASC"; |
| 10191 | 10191 | $query_data = array(':offset' => $offset); |
| 10192 | - } |
|
| 10192 | + } |
|
| 10193 | 10193 | |
| 10194 | 10194 | $sth = $this->db->prepare($query); |
| 10195 | 10195 | $sth->execute($query_data); |
@@ -10212,11 +10212,11 @@ discard block |
||
| 10212 | 10212 | |
| 10213 | 10213 | |
| 10214 | 10214 | /** |
| 10215 | - * Counts all hours |
|
| 10216 | - * |
|
| 10217 | - * @return Array the hour list |
|
| 10218 | - * |
|
| 10219 | - */ |
|
| 10215 | + * Counts all hours |
|
| 10216 | + * |
|
| 10217 | + * @return Array the hour list |
|
| 10218 | + * |
|
| 10219 | + */ |
|
| 10220 | 10220 | public function countAllHours($orderby,$filters = array()) |
| 10221 | 10221 | { |
| 10222 | 10222 | global $globalTimezone, $globalDBdriver; |
@@ -10277,11 +10277,11 @@ discard block |
||
| 10277 | 10277 | } |
| 10278 | 10278 | |
| 10279 | 10279 | /** |
| 10280 | - * Counts all hours |
|
| 10281 | - * |
|
| 10282 | - * @return Array the hour list |
|
| 10283 | - * |
|
| 10284 | - */ |
|
| 10280 | + * Counts all hours |
|
| 10281 | + * |
|
| 10282 | + * @return Array the hour list |
|
| 10283 | + * |
|
| 10284 | + */ |
|
| 10285 | 10285 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 10286 | 10286 | { |
| 10287 | 10287 | global $globalTimezone, $globalDBdriver; |
@@ -10344,11 +10344,11 @@ discard block |
||
| 10344 | 10344 | |
| 10345 | 10345 | |
| 10346 | 10346 | /** |
| 10347 | - * Counts all hours by airline |
|
| 10348 | - * |
|
| 10349 | - * @return Array the hour list |
|
| 10350 | - * |
|
| 10351 | - */ |
|
| 10347 | + * Counts all hours by airline |
|
| 10348 | + * |
|
| 10349 | + * @return Array the hour list |
|
| 10350 | + * |
|
| 10351 | + */ |
|
| 10352 | 10352 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 10353 | 10353 | { |
| 10354 | 10354 | global $globalTimezone, $globalDBdriver; |
@@ -10394,11 +10394,11 @@ discard block |
||
| 10394 | 10394 | |
| 10395 | 10395 | |
| 10396 | 10396 | /** |
| 10397 | - * Counts all hours by aircraft |
|
| 10398 | - * |
|
| 10399 | - * @return Array the hour list |
|
| 10400 | - * |
|
| 10401 | - */ |
|
| 10397 | + * Counts all hours by aircraft |
|
| 10398 | + * |
|
| 10399 | + * @return Array the hour list |
|
| 10400 | + * |
|
| 10401 | + */ |
|
| 10402 | 10402 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 10403 | 10403 | { |
| 10404 | 10404 | global $globalTimezone, $globalDBdriver; |
@@ -10441,11 +10441,11 @@ discard block |
||
| 10441 | 10441 | |
| 10442 | 10442 | |
| 10443 | 10443 | /** |
| 10444 | - * Counts all hours by aircraft registration |
|
| 10445 | - * |
|
| 10446 | - * @return Array the hour list |
|
| 10447 | - * |
|
| 10448 | - */ |
|
| 10444 | + * Counts all hours by aircraft registration |
|
| 10445 | + * |
|
| 10446 | + * @return Array the hour list |
|
| 10447 | + * |
|
| 10448 | + */ |
|
| 10449 | 10449 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 10450 | 10450 | { |
| 10451 | 10451 | global $globalTimezone, $globalDBdriver; |
@@ -10488,11 +10488,11 @@ discard block |
||
| 10488 | 10488 | |
| 10489 | 10489 | |
| 10490 | 10490 | /** |
| 10491 | - * Counts all hours by airport |
|
| 10492 | - * |
|
| 10493 | - * @return Array the hour list |
|
| 10494 | - * |
|
| 10495 | - */ |
|
| 10491 | + * Counts all hours by airport |
|
| 10492 | + * |
|
| 10493 | + * @return Array the hour list |
|
| 10494 | + * |
|
| 10495 | + */ |
|
| 10496 | 10496 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 10497 | 10497 | { |
| 10498 | 10498 | global $globalTimezone, $globalDBdriver; |
@@ -10536,11 +10536,11 @@ discard block |
||
| 10536 | 10536 | |
| 10537 | 10537 | |
| 10538 | 10538 | /** |
| 10539 | - * Counts all hours by manufacturer |
|
| 10540 | - * |
|
| 10541 | - * @return Array the hour list |
|
| 10542 | - * |
|
| 10543 | - */ |
|
| 10539 | + * Counts all hours by manufacturer |
|
| 10540 | + * |
|
| 10541 | + * @return Array the hour list |
|
| 10542 | + * |
|
| 10543 | + */ |
|
| 10544 | 10544 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
| 10545 | 10545 | { |
| 10546 | 10546 | global $globalTimezone, $globalDBdriver; |
@@ -10584,11 +10584,11 @@ discard block |
||
| 10584 | 10584 | |
| 10585 | 10585 | |
| 10586 | 10586 | /** |
| 10587 | - * Counts all hours by date |
|
| 10588 | - * |
|
| 10589 | - * @return Array the hour list |
|
| 10590 | - * |
|
| 10591 | - */ |
|
| 10587 | + * Counts all hours by date |
|
| 10588 | + * |
|
| 10589 | + * @return Array the hour list |
|
| 10590 | + * |
|
| 10591 | + */ |
|
| 10592 | 10592 | public function countAllHoursByDate($date, $filters = array()) |
| 10593 | 10593 | { |
| 10594 | 10594 | global $globalTimezone, $globalDBdriver; |
@@ -10632,11 +10632,11 @@ discard block |
||
| 10632 | 10632 | |
| 10633 | 10633 | |
| 10634 | 10634 | /** |
| 10635 | - * Counts all hours by a ident/callsign |
|
| 10636 | - * |
|
| 10637 | - * @return Array the hour list |
|
| 10638 | - * |
|
| 10639 | - */ |
|
| 10635 | + * Counts all hours by a ident/callsign |
|
| 10636 | + * |
|
| 10637 | + * @return Array the hour list |
|
| 10638 | + * |
|
| 10639 | + */ |
|
| 10640 | 10640 | public function countAllHoursByIdent($ident, $filters = array()) |
| 10641 | 10641 | { |
| 10642 | 10642 | global $globalTimezone, $globalDBdriver; |
@@ -10679,11 +10679,11 @@ discard block |
||
| 10679 | 10679 | } |
| 10680 | 10680 | |
| 10681 | 10681 | /** |
| 10682 | - * Counts all hours by a owner |
|
| 10683 | - * |
|
| 10684 | - * @return Array the hour list |
|
| 10685 | - * |
|
| 10686 | - */ |
|
| 10682 | + * Counts all hours by a owner |
|
| 10683 | + * |
|
| 10684 | + * @return Array the hour list |
|
| 10685 | + * |
|
| 10686 | + */ |
|
| 10687 | 10687 | public function countAllHoursByOwner($owner, $filters = array()) |
| 10688 | 10688 | { |
| 10689 | 10689 | global $globalTimezone, $globalDBdriver; |
@@ -10726,11 +10726,11 @@ discard block |
||
| 10726 | 10726 | } |
| 10727 | 10727 | |
| 10728 | 10728 | /** |
| 10729 | - * Counts all hours by a pilot |
|
| 10730 | - * |
|
| 10731 | - * @return Array the hour list |
|
| 10732 | - * |
|
| 10733 | - */ |
|
| 10729 | + * Counts all hours by a pilot |
|
| 10730 | + * |
|
| 10731 | + * @return Array the hour list |
|
| 10732 | + * |
|
| 10733 | + */ |
|
| 10734 | 10734 | public function countAllHoursByPilot($pilot, $filters = array()) |
| 10735 | 10735 | { |
| 10736 | 10736 | global $globalTimezone, $globalDBdriver; |
@@ -10775,11 +10775,11 @@ discard block |
||
| 10775 | 10775 | |
| 10776 | 10776 | |
| 10777 | 10777 | /** |
| 10778 | - * Counts all hours by route |
|
| 10779 | - * |
|
| 10780 | - * @return Array the hour list |
|
| 10781 | - * |
|
| 10782 | - */ |
|
| 10778 | + * Counts all hours by route |
|
| 10779 | + * |
|
| 10780 | + * @return Array the hour list |
|
| 10781 | + * |
|
| 10782 | + */ |
|
| 10783 | 10783 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
| 10784 | 10784 | { |
| 10785 | 10785 | global $globalTimezone, $globalDBdriver; |
@@ -10823,11 +10823,11 @@ discard block |
||
| 10823 | 10823 | |
| 10824 | 10824 | |
| 10825 | 10825 | /** |
| 10826 | - * Counts all hours by country |
|
| 10827 | - * |
|
| 10828 | - * @return Array the hour list |
|
| 10829 | - * |
|
| 10830 | - */ |
|
| 10826 | + * Counts all hours by country |
|
| 10827 | + * |
|
| 10828 | + * @return Array the hour list |
|
| 10829 | + * |
|
| 10830 | + */ |
|
| 10831 | 10831 | public function countAllHoursByCountry($country, $filters = array()) |
| 10832 | 10832 | { |
| 10833 | 10833 | global $globalTimezone, $globalDBdriver; |
@@ -10872,11 +10872,11 @@ discard block |
||
| 10872 | 10872 | |
| 10873 | 10873 | |
| 10874 | 10874 | /** |
| 10875 | - * Counts all aircraft that have flown over |
|
| 10876 | - * |
|
| 10877 | - * @return Integer the number of aircrafts |
|
| 10878 | - * |
|
| 10879 | - */ |
|
| 10875 | + * Counts all aircraft that have flown over |
|
| 10876 | + * |
|
| 10877 | + * @return Integer the number of aircrafts |
|
| 10878 | + * |
|
| 10879 | + */ |
|
| 10880 | 10880 | public function countOverallAircrafts($filters = array(),$year = '',$month = '') |
| 10881 | 10881 | { |
| 10882 | 10882 | global $globalDBdriver; |
@@ -10909,11 +10909,11 @@ discard block |
||
| 10909 | 10909 | } |
| 10910 | 10910 | |
| 10911 | 10911 | /** |
| 10912 | - * Counts all flight that really arrival |
|
| 10913 | - * |
|
| 10914 | - * @return Integer the number of aircrafts |
|
| 10915 | - * |
|
| 10916 | - */ |
|
| 10912 | + * Counts all flight that really arrival |
|
| 10913 | + * |
|
| 10914 | + * @return Integer the number of aircrafts |
|
| 10915 | + * |
|
| 10916 | + */ |
|
| 10917 | 10917 | public function countOverallArrival($filters = array(),$year = '',$month = '') |
| 10918 | 10918 | { |
| 10919 | 10919 | global $globalDBdriver; |
@@ -10946,11 +10946,11 @@ discard block |
||
| 10946 | 10946 | } |
| 10947 | 10947 | |
| 10948 | 10948 | /** |
| 10949 | - * Counts all pilots that have flown over |
|
| 10950 | - * |
|
| 10951 | - * @return Integer the number of pilots |
|
| 10952 | - * |
|
| 10953 | - */ |
|
| 10949 | + * Counts all pilots that have flown over |
|
| 10950 | + * |
|
| 10951 | + * @return Integer the number of pilots |
|
| 10952 | + * |
|
| 10953 | + */ |
|
| 10954 | 10954 | public function countOverallPilots($filters = array(),$year = '',$month = '') |
| 10955 | 10955 | { |
| 10956 | 10956 | global $globalDBdriver; |
@@ -10982,11 +10982,11 @@ discard block |
||
| 10982 | 10982 | } |
| 10983 | 10983 | |
| 10984 | 10984 | /** |
| 10985 | - * Counts all owners that have flown over |
|
| 10986 | - * |
|
| 10987 | - * @return Integer the number of owners |
|
| 10988 | - * |
|
| 10989 | - */ |
|
| 10985 | + * Counts all owners that have flown over |
|
| 10986 | + * |
|
| 10987 | + * @return Integer the number of owners |
|
| 10988 | + * |
|
| 10989 | + */ |
|
| 10990 | 10990 | public function countOverallOwners($filters = array(),$year = '',$month = '') |
| 10991 | 10991 | { |
| 10992 | 10992 | global $globalDBdriver; |
@@ -11019,11 +11019,11 @@ discard block |
||
| 11019 | 11019 | |
| 11020 | 11020 | |
| 11021 | 11021 | /** |
| 11022 | - * Counts all flights that have flown over |
|
| 11023 | - * |
|
| 11024 | - * @return Integer the number of flights |
|
| 11025 | - * |
|
| 11026 | - */ |
|
| 11022 | + * Counts all flights that have flown over |
|
| 11023 | + * |
|
| 11024 | + * @return Integer the number of flights |
|
| 11025 | + * |
|
| 11026 | + */ |
|
| 11027 | 11027 | public function countOverallFlights($filters = array(),$year = '',$month = '') |
| 11028 | 11028 | { |
| 11029 | 11029 | global $globalDBdriver; |
@@ -11057,11 +11057,11 @@ discard block |
||
| 11057 | 11057 | } |
| 11058 | 11058 | |
| 11059 | 11059 | /** |
| 11060 | - * Counts all military flights that have flown over |
|
| 11061 | - * |
|
| 11062 | - * @return Integer the number of flights |
|
| 11063 | - * |
|
| 11064 | - */ |
|
| 11060 | + * Counts all military flights that have flown over |
|
| 11061 | + * |
|
| 11062 | + * @return Integer the number of flights |
|
| 11063 | + * |
|
| 11064 | + */ |
|
| 11065 | 11065 | public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '') |
| 11066 | 11066 | { |
| 11067 | 11067 | global $globalDBdriver; |
@@ -11096,11 +11096,11 @@ discard block |
||
| 11096 | 11096 | |
| 11097 | 11097 | |
| 11098 | 11098 | /** |
| 11099 | - * Counts all airlines that have flown over |
|
| 11100 | - * |
|
| 11101 | - * @return Integer the number of airlines |
|
| 11102 | - * |
|
| 11103 | - */ |
|
| 11099 | + * Counts all airlines that have flown over |
|
| 11100 | + * |
|
| 11101 | + * @return Integer the number of airlines |
|
| 11102 | + * |
|
| 11103 | + */ |
|
| 11104 | 11104 | public function countOverallAirlines($filters = array(),$year = '',$month = '') |
| 11105 | 11105 | { |
| 11106 | 11106 | global $globalDBdriver; |
@@ -11127,8 +11127,8 @@ discard block |
||
| 11127 | 11127 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11128 | 11128 | } |
| 11129 | 11129 | } |
| 11130 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11131 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11130 | + if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11131 | + else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11132 | 11132 | |
| 11133 | 11133 | |
| 11134 | 11134 | $sth = $this->db->prepare($queryi); |
@@ -11138,11 +11138,11 @@ discard block |
||
| 11138 | 11138 | |
| 11139 | 11139 | |
| 11140 | 11140 | /** |
| 11141 | - * Counts all hours of today |
|
| 11142 | - * |
|
| 11143 | - * @return Array the hour list |
|
| 11144 | - * |
|
| 11145 | - */ |
|
| 11141 | + * Counts all hours of today |
|
| 11142 | + * |
|
| 11143 | + * @return Array the hour list |
|
| 11144 | + * |
|
| 11145 | + */ |
|
| 11146 | 11146 | public function countAllHoursFromToday($filters = array()) |
| 11147 | 11147 | { |
| 11148 | 11148 | global $globalTimezone, $globalDBdriver; |
@@ -11182,11 +11182,11 @@ discard block |
||
| 11182 | 11182 | } |
| 11183 | 11183 | |
| 11184 | 11184 | /** |
| 11185 | - * Gets all the spotter information based on calculated upcoming flights |
|
| 11186 | - * |
|
| 11187 | - * @return Array the spotter information |
|
| 11188 | - * |
|
| 11189 | - */ |
|
| 11185 | + * Gets all the spotter information based on calculated upcoming flights |
|
| 11186 | + * |
|
| 11187 | + * @return Array the spotter information |
|
| 11188 | + * |
|
| 11189 | + */ |
|
| 11190 | 11190 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 11191 | 11191 | { |
| 11192 | 11192 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -11261,12 +11261,12 @@ discard block |
||
| 11261 | 11261 | } |
| 11262 | 11262 | |
| 11263 | 11263 | |
| 11264 | - /** |
|
| 11265 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 11266 | - * |
|
| 11267 | - * @return Integer the Barrie Spotter ID |
|
| 11264 | + /** |
|
| 11265 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 11266 | + * |
|
| 11267 | + * @return Integer the Barrie Spotter ID |
|
| 11268 | 11268 | q * |
| 11269 | - */ |
|
| 11269 | + */ |
|
| 11270 | 11270 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 11271 | 11271 | { |
| 11272 | 11272 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -11287,13 +11287,13 @@ discard block |
||
| 11287 | 11287 | |
| 11288 | 11288 | |
| 11289 | 11289 | /** |
| 11290 | - * Parses a date string |
|
| 11291 | - * |
|
| 11292 | - * @param String $dateString the date string |
|
| 11293 | - * @param String $timezone the timezone of a user |
|
| 11294 | - * @return Array the time information |
|
| 11295 | - * |
|
| 11296 | - */ |
|
| 11290 | + * Parses a date string |
|
| 11291 | + * |
|
| 11292 | + * @param String $dateString the date string |
|
| 11293 | + * @param String $timezone the timezone of a user |
|
| 11294 | + * @return Array the time information |
|
| 11295 | + * |
|
| 11296 | + */ |
|
| 11297 | 11297 | public function parseDateString($dateString, $timezone = '') |
| 11298 | 11298 | { |
| 11299 | 11299 | $time_array = array(); |
@@ -11329,12 +11329,12 @@ discard block |
||
| 11329 | 11329 | |
| 11330 | 11330 | |
| 11331 | 11331 | /** |
| 11332 | - * Parses the direction degrees to working |
|
| 11333 | - * |
|
| 11334 | - * @param Float $direction the direction in degrees |
|
| 11335 | - * @return Array the direction information |
|
| 11336 | - * |
|
| 11337 | - */ |
|
| 11332 | + * Parses the direction degrees to working |
|
| 11333 | + * |
|
| 11334 | + * @param Float $direction the direction in degrees |
|
| 11335 | + * @return Array the direction information |
|
| 11336 | + * |
|
| 11337 | + */ |
|
| 11338 | 11338 | public function parseDirection($direction = 0) |
| 11339 | 11339 | { |
| 11340 | 11340 | if ($direction == '') $direction = 0; |
@@ -11413,12 +11413,12 @@ discard block |
||
| 11413 | 11413 | |
| 11414 | 11414 | |
| 11415 | 11415 | /** |
| 11416 | - * Gets the aircraft registration |
|
| 11417 | - * |
|
| 11418 | - * @param String $flightaware_id the flight aware id |
|
| 11419 | - * @return String the aircraft registration |
|
| 11420 | - * |
|
| 11421 | - */ |
|
| 11416 | + * Gets the aircraft registration |
|
| 11417 | + * |
|
| 11418 | + * @param String $flightaware_id the flight aware id |
|
| 11419 | + * @return String the aircraft registration |
|
| 11420 | + * |
|
| 11421 | + */ |
|
| 11422 | 11422 | |
| 11423 | 11423 | public function getAircraftRegistration($flightaware_id) |
| 11424 | 11424 | { |
@@ -11447,12 +11447,12 @@ discard block |
||
| 11447 | 11447 | |
| 11448 | 11448 | |
| 11449 | 11449 | /** |
| 11450 | - * Gets the aircraft registration from ModeS |
|
| 11451 | - * |
|
| 11452 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 11453 | - * @return String the aircraft registration |
|
| 11454 | - * |
|
| 11455 | - */ |
|
| 11450 | + * Gets the aircraft registration from ModeS |
|
| 11451 | + * |
|
| 11452 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 11453 | + * @return String the aircraft registration |
|
| 11454 | + * |
|
| 11455 | + */ |
|
| 11456 | 11456 | public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '') |
| 11457 | 11457 | { |
| 11458 | 11458 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -11468,8 +11468,8 @@ discard block |
||
| 11468 | 11468 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11469 | 11469 | $sth->closeCursor(); |
| 11470 | 11470 | if (count($row) > 0) { |
| 11471 | - //return $row['Registration']; |
|
| 11472 | - return $row['registration']; |
|
| 11471 | + //return $row['Registration']; |
|
| 11472 | + return $row['registration']; |
|
| 11473 | 11473 | } elseif ($source_type == 'flarm') { |
| 11474 | 11474 | return $this->getAircraftRegistrationBymodeS($aircraft_modes); |
| 11475 | 11475 | } else return ''; |
@@ -11477,12 +11477,12 @@ discard block |
||
| 11477 | 11477 | } |
| 11478 | 11478 | |
| 11479 | 11479 | /** |
| 11480 | - * Gets the aircraft type from ModeS |
|
| 11481 | - * |
|
| 11482 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 11483 | - * @return String the aircraft type |
|
| 11484 | - * |
|
| 11485 | - */ |
|
| 11480 | + * Gets the aircraft type from ModeS |
|
| 11481 | + * |
|
| 11482 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 11483 | + * @return String the aircraft type |
|
| 11484 | + * |
|
| 11485 | + */ |
|
| 11486 | 11486 | public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '') |
| 11487 | 11487 | { |
| 11488 | 11488 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -11508,12 +11508,12 @@ discard block |
||
| 11508 | 11508 | } |
| 11509 | 11509 | |
| 11510 | 11510 | /** |
| 11511 | - * Gets Country from latitude/longitude |
|
| 11512 | - * |
|
| 11513 | - * @param Float $latitude latitute of the flight |
|
| 11514 | - * @param Float $longitude longitute of the flight |
|
| 11515 | - * @return String the countrie |
|
| 11516 | - */ |
|
| 11511 | + * Gets Country from latitude/longitude |
|
| 11512 | + * |
|
| 11513 | + * @param Float $latitude latitute of the flight |
|
| 11514 | + * @param Float $longitude longitute of the flight |
|
| 11515 | + * @return String the countrie |
|
| 11516 | + */ |
|
| 11517 | 11517 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 11518 | 11518 | { |
| 11519 | 11519 | global $globalDBdriver, $globalDebug; |
@@ -11550,11 +11550,11 @@ discard block |
||
| 11550 | 11550 | } |
| 11551 | 11551 | |
| 11552 | 11552 | /** |
| 11553 | - * Gets Country from iso2 |
|
| 11554 | - * |
|
| 11555 | - * @param String $iso2 ISO2 country code |
|
| 11556 | - * @return String the countrie |
|
| 11557 | - */ |
|
| 11553 | + * Gets Country from iso2 |
|
| 11554 | + * |
|
| 11555 | + * @param String $iso2 ISO2 country code |
|
| 11556 | + * @return String the countrie |
|
| 11557 | + */ |
|
| 11558 | 11558 | public function getCountryFromISO2($iso2) |
| 11559 | 11559 | { |
| 11560 | 11560 | global $globalDBdriver, $globalDebug; |
@@ -11582,12 +11582,12 @@ discard block |
||
| 11582 | 11582 | } |
| 11583 | 11583 | |
| 11584 | 11584 | /** |
| 11585 | - * converts the registration code using the country prefix |
|
| 11586 | - * |
|
| 11587 | - * @param String $registration the aircraft registration |
|
| 11588 | - * @return String the aircraft registration |
|
| 11589 | - * |
|
| 11590 | - */ |
|
| 11585 | + * converts the registration code using the country prefix |
|
| 11586 | + * |
|
| 11587 | + * @param String $registration the aircraft registration |
|
| 11588 | + * @return String the aircraft registration |
|
| 11589 | + * |
|
| 11590 | + */ |
|
| 11591 | 11591 | public function convertAircraftRegistration($registration) |
| 11592 | 11592 | { |
| 11593 | 11593 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11639,12 +11639,12 @@ discard block |
||
| 11639 | 11639 | } |
| 11640 | 11640 | |
| 11641 | 11641 | /** |
| 11642 | - * Country from the registration code |
|
| 11643 | - * |
|
| 11644 | - * @param String $registration the aircraft registration |
|
| 11645 | - * @return String the country |
|
| 11646 | - * |
|
| 11647 | - */ |
|
| 11642 | + * Country from the registration code |
|
| 11643 | + * |
|
| 11644 | + * @param String $registration the aircraft registration |
|
| 11645 | + * @return String the country |
|
| 11646 | + * |
|
| 11647 | + */ |
|
| 11648 | 11648 | public function countryFromAircraftRegistration($registration) |
| 11649 | 11649 | { |
| 11650 | 11650 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11663,8 +11663,8 @@ discard block |
||
| 11663 | 11663 | $country = $row['country']; |
| 11664 | 11664 | } |
| 11665 | 11665 | } else { |
| 11666 | - $registration_1 = substr($registration, 0, 1); |
|
| 11667 | - $registration_2 = substr($registration, 0, 2); |
|
| 11666 | + $registration_1 = substr($registration, 0, 1); |
|
| 11667 | + $registration_2 = substr($registration, 0, 2); |
|
| 11668 | 11668 | |
| 11669 | 11669 | $country = ''; |
| 11670 | 11670 | //first get the prefix based on two characters |
@@ -11700,12 +11700,12 @@ discard block |
||
| 11700 | 11700 | } |
| 11701 | 11701 | |
| 11702 | 11702 | /** |
| 11703 | - * Registration prefix from the registration code |
|
| 11704 | - * |
|
| 11705 | - * @param String $registration the aircraft registration |
|
| 11706 | - * @return String the registration prefix |
|
| 11707 | - * |
|
| 11708 | - */ |
|
| 11703 | + * Registration prefix from the registration code |
|
| 11704 | + * |
|
| 11705 | + * @param String $registration the aircraft registration |
|
| 11706 | + * @return String the registration prefix |
|
| 11707 | + * |
|
| 11708 | + */ |
|
| 11709 | 11709 | public function registrationPrefixFromAircraftRegistration($registration) |
| 11710 | 11710 | { |
| 11711 | 11711 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11724,8 +11724,8 @@ discard block |
||
| 11724 | 11724 | //$country = $row['country']; |
| 11725 | 11725 | } |
| 11726 | 11726 | } else { |
| 11727 | - $registration_1 = substr($registration, 0, 1); |
|
| 11728 | - $registration_2 = substr($registration, 0, 2); |
|
| 11727 | + $registration_1 = substr($registration, 0, 1); |
|
| 11728 | + $registration_2 = substr($registration, 0, 2); |
|
| 11729 | 11729 | |
| 11730 | 11730 | //first get the prefix based on two characters |
| 11731 | 11731 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
@@ -11761,12 +11761,12 @@ discard block |
||
| 11761 | 11761 | |
| 11762 | 11762 | |
| 11763 | 11763 | /** |
| 11764 | - * Country from the registration code |
|
| 11765 | - * |
|
| 11766 | - * @param String $registration the aircraft registration |
|
| 11767 | - * @return String the country |
|
| 11768 | - * |
|
| 11769 | - */ |
|
| 11764 | + * Country from the registration code |
|
| 11765 | + * |
|
| 11766 | + * @param String $registration the aircraft registration |
|
| 11767 | + * @return String the country |
|
| 11768 | + * |
|
| 11769 | + */ |
|
| 11770 | 11770 | public function countryFromAircraftRegistrationCode($registration) |
| 11771 | 11771 | { |
| 11772 | 11772 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11783,11 +11783,11 @@ discard block |
||
| 11783 | 11783 | } |
| 11784 | 11784 | |
| 11785 | 11785 | /** |
| 11786 | - * Set a new highlight value for a flight |
|
| 11787 | - * |
|
| 11788 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 11789 | - * @param String $highlight New highlight value |
|
| 11790 | - */ |
|
| 11786 | + * Set a new highlight value for a flight |
|
| 11787 | + * |
|
| 11788 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 11789 | + * @param String $highlight New highlight value |
|
| 11790 | + */ |
|
| 11791 | 11791 | public function setHighlightFlight($flightaware_id,$highlight) { |
| 11792 | 11792 | |
| 11793 | 11793 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -11796,12 +11796,12 @@ discard block |
||
| 11796 | 11796 | } |
| 11797 | 11797 | |
| 11798 | 11798 | /** |
| 11799 | - * Set a new highlight value for a flight by Registration |
|
| 11800 | - * |
|
| 11801 | - * @param String $registration Registration of the aircraft |
|
| 11802 | - * @param String $date Date of spotted aircraft |
|
| 11803 | - * @param String $highlight New highlight value |
|
| 11804 | - */ |
|
| 11799 | + * Set a new highlight value for a flight by Registration |
|
| 11800 | + * |
|
| 11801 | + * @param String $registration Registration of the aircraft |
|
| 11802 | + * @param String $date Date of spotted aircraft |
|
| 11803 | + * @param String $highlight New highlight value |
|
| 11804 | + */ |
|
| 11805 | 11805 | public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
| 11806 | 11806 | if ($date == '') { |
| 11807 | 11807 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
@@ -11815,12 +11815,12 @@ discard block |
||
| 11815 | 11815 | } |
| 11816 | 11816 | |
| 11817 | 11817 | /** |
| 11818 | - * Gets the short url from bit.ly |
|
| 11819 | - * |
|
| 11820 | - * @param String $url the full url |
|
| 11821 | - * @return String the bit.ly url |
|
| 11822 | - * |
|
| 11823 | - */ |
|
| 11818 | + * Gets the short url from bit.ly |
|
| 11819 | + * |
|
| 11820 | + * @param String $url the full url |
|
| 11821 | + * @return String the bit.ly url |
|
| 11822 | + * |
|
| 11823 | + */ |
|
| 11824 | 11824 | public function getBitlyURL($url) |
| 11825 | 11825 | { |
| 11826 | 11826 | global $globalBitlyAccessToken; |
@@ -12109,11 +12109,11 @@ discard block |
||
| 12109 | 12109 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 12110 | 12110 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 12111 | 12111 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 12112 | - } else { |
|
| 12112 | + } else { |
|
| 12113 | 12113 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
| 12114 | 12114 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 12115 | 12115 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 12116 | - } |
|
| 12116 | + } |
|
| 12117 | 12117 | $sth = $this->db->prepare($query); |
| 12118 | 12118 | $sth->execute(); |
| 12119 | 12119 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -72,7 +72,9 @@ discard block |
||
| 72 | 72 | if (isset($filter[0]['source'])) { |
| 73 | 73 | $filters = array_merge($filters,$filter); |
| 74 | 74 | } |
| 75 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 75 | + if (is_array($globalFilter)) { |
|
| 76 | + $filter = array_merge($filter,$globalFilter); |
|
| 77 | + } |
|
| 76 | 78 | $filter_query_join = ''; |
| 77 | 79 | $filter_query_where = ''; |
| 78 | 80 | foreach($filters as $flt) { |
@@ -156,8 +158,11 @@ discard block |
||
| 156 | 158 | $filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 157 | 159 | } |
| 158 | 160 | } |
| 159 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 160 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 161 | + if ($filter_query_where == '' && $where) { |
|
| 162 | + $filter_query_where = ' WHERE'; |
|
| 163 | + } elseif ($filter_query_where != '' && $and) { |
|
| 164 | + $filter_query_where .= ' AND'; |
|
| 165 | + } |
|
| 161 | 166 | if ($filter_query_where != '') { |
| 162 | 167 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 163 | 168 | } |
@@ -180,10 +185,18 @@ discard block |
||
| 180 | 185 | $Image = new Image($this->db); |
| 181 | 186 | $Schedule = new Schedule($this->db); |
| 182 | 187 | $ACARS = new ACARS($this->db); |
| 183 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 184 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 185 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 186 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 188 | + if (!isset($globalIVAO)) { |
|
| 189 | + $globalIVAO = FALSE; |
|
| 190 | + } |
|
| 191 | + if (!isset($globalVATSIM)) { |
|
| 192 | + $globalVATSIM = FALSE; |
|
| 193 | + } |
|
| 194 | + if (!isset($globalphpVMS)) { |
|
| 195 | + $globalphpVMS = FALSE; |
|
| 196 | + } |
|
| 197 | + if (!isset($globalVAM)) { |
|
| 198 | + $globalVAM = FALSE; |
|
| 199 | + } |
|
| 187 | 200 | date_default_timezone_set('UTC'); |
| 188 | 201 | |
| 189 | 202 | if (!is_string($query)) |
@@ -230,21 +243,35 @@ discard block |
||
| 230 | 243 | } else { |
| 231 | 244 | $temp_array['spotter_id'] = ''; |
| 232 | 245 | } |
| 233 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 234 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 246 | + if (isset($row['flightaware_id'])) { |
|
| 247 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 248 | + } |
|
| 249 | + if (isset($row['modes'])) { |
|
| 250 | + $temp_array['modes'] = $row['modes']; |
|
| 251 | + } |
|
| 235 | 252 | $temp_array['ident'] = $row['ident']; |
| 236 | 253 | if (isset($row['registration']) && $row['registration'] != '') { |
| 237 | 254 | $temp_array['registration'] = $row['registration']; |
| 238 | 255 | } elseif (isset($temp_array['modes'])) { |
| 239 | 256 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 240 | - } else $temp_array['registration'] = ''; |
|
| 241 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 257 | + } else { |
|
| 258 | + $temp_array['registration'] = ''; |
|
| 259 | + } |
|
| 260 | + if (isset($row['aircraft_icao'])) { |
|
| 261 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 262 | + } |
|
| 242 | 263 | |
| 243 | 264 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 244 | 265 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 245 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 246 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 247 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 266 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 267 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 268 | + } |
|
| 269 | + if (isset($row['latitude'])) { |
|
| 270 | + $temp_array['latitude'] = $row['latitude']; |
|
| 271 | + } |
|
| 272 | + if (isset($row['longitude'])) { |
|
| 273 | + $temp_array['longitude'] = $row['longitude']; |
|
| 274 | + } |
|
| 248 | 275 | /* |
| 249 | 276 | if (Connection->tableExists('countries')) { |
| 250 | 277 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -254,8 +281,12 @@ discard block |
||
| 254 | 281 | } |
| 255 | 282 | } |
| 256 | 283 | */ |
| 257 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 258 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 284 | + if (isset($row['waypoints'])) { |
|
| 285 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 286 | + } |
|
| 287 | + if (isset($row['format_source'])) { |
|
| 288 | + $temp_array['format_source'] = $row['format_source']; |
|
| 289 | + } |
|
| 259 | 290 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
| 260 | 291 | $temp_array['route_stop'] = $row['route_stop']; |
| 261 | 292 | $allroute = explode(' ',$row['route_stop']); |
@@ -271,13 +302,19 @@ discard block |
||
| 271 | 302 | } |
| 272 | 303 | } |
| 273 | 304 | } |
| 274 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 305 | + if (isset($row['altitude'])) { |
|
| 306 | + $temp_array['altitude'] = $row['altitude']; |
|
| 307 | + } |
|
| 275 | 308 | if (isset($row['heading'])) { |
| 276 | 309 | $temp_array['heading'] = $row['heading']; |
| 277 | 310 | $heading_direction = $this->parseDirection($row['heading']); |
| 278 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 311 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 312 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + if (isset($row['ground_speed'])) { |
|
| 316 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 279 | 317 | } |
| 280 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 281 | 318 | $temp_array['image'] = ""; |
| 282 | 319 | $temp_array['image_thumbnail'] = ""; |
| 283 | 320 | $temp_array['image_source'] = ""; |
@@ -285,7 +322,9 @@ discard block |
||
| 285 | 322 | |
| 286 | 323 | if (isset($row['highlight'])) { |
| 287 | 324 | $temp_array['highlight'] = $row['highlight']; |
| 288 | - } else $temp_array['highlight'] = ''; |
|
| 325 | + } else { |
|
| 326 | + $temp_array['highlight'] = ''; |
|
| 327 | + } |
|
| 289 | 328 | |
| 290 | 329 | if (isset($row['date'])) { |
| 291 | 330 | $dateArray = $this->parseDateString($row['date']); |
@@ -341,7 +380,9 @@ discard block |
||
| 341 | 380 | |
| 342 | 381 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 343 | 382 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 344 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 383 | + } else { |
|
| 384 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 385 | + } |
|
| 345 | 386 | } else { |
| 346 | 387 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 347 | 388 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -349,11 +390,17 @@ discard block |
||
| 349 | 390 | } |
| 350 | 391 | } |
| 351 | 392 | $fromsource = NULL; |
| 352 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 353 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 354 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 355 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 356 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 393 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 394 | + $fromsource = $globalAirlinesSource; |
|
| 395 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 396 | + $fromsource = 'vatsim'; |
|
| 397 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 398 | + $fromsource = 'ivao'; |
|
| 399 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 400 | + $fromsource = 'vatsim'; |
|
| 401 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 402 | + $fromsource = 'ivao'; |
|
| 403 | + } |
|
| 357 | 404 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 358 | 405 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 359 | 406 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -376,12 +423,18 @@ discard block |
||
| 376 | 423 | } |
| 377 | 424 | } else { |
| 378 | 425 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 379 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 380 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 426 | + if (isset($row['airline_iata'])) { |
|
| 427 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 428 | + } else { |
|
| 429 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 430 | + } |
|
| 381 | 431 | $temp_array['airline_name'] = $row['airline_name']; |
| 382 | 432 | $temp_array['airline_country'] = $row['airline_country']; |
| 383 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 384 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 433 | + if (isset($row['airline_callsign'])) { |
|
| 434 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 435 | + } else { |
|
| 436 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 437 | + } |
|
| 385 | 438 | $temp_array['airline_type'] = $row['airline_type']; |
| 386 | 439 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 387 | 440 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -408,7 +461,9 @@ discard block |
||
| 408 | 461 | } |
| 409 | 462 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 410 | 463 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 411 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 464 | + if ($owner_info['owner'] != '') { |
|
| 465 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 466 | + } |
|
| 412 | 467 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 413 | 468 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 414 | 469 | } |
@@ -416,9 +471,14 @@ discard block |
||
| 416 | 471 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 417 | 472 | { |
| 418 | 473 | if ($globalIVAO) { |
| 419 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 420 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 421 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 474 | + if (isset($temp_array['airline_icao'])) { |
|
| 475 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 476 | + } else { |
|
| 477 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 478 | + } |
|
| 479 | + } else { |
|
| 480 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 481 | + } |
|
| 422 | 482 | if (count($image_array) > 0) { |
| 423 | 483 | $temp_array['image'] = $image_array[0]['image']; |
| 424 | 484 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -470,7 +530,9 @@ discard block |
||
| 470 | 530 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 471 | 531 | if ($row['departure_airport_icao'] != '') { |
| 472 | 532 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 473 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 533 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 534 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 535 | + } |
|
| 474 | 536 | /* |
| 475 | 537 | } elseif ($row['departure_airport_name'] != '') { |
| 476 | 538 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -478,7 +540,9 @@ discard block |
||
| 478 | 540 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 479 | 541 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 480 | 542 | */ |
| 481 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 543 | + } else { |
|
| 544 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 545 | + } |
|
| 482 | 546 | if (isset($departure_airport_array[0]['name'])) { |
| 483 | 547 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 484 | 548 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -498,8 +562,12 @@ discard block |
||
| 498 | 562 | |
| 499 | 563 | if ($row['arrival_airport_icao'] != '') { |
| 500 | 564 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 501 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 502 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 565 | + if (count($arrival_airport_array) == 0) { |
|
| 566 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 567 | + } |
|
| 568 | + } else { |
|
| 569 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 570 | + } |
|
| 503 | 571 | if (isset($arrival_airport_array[0]['name'])) { |
| 504 | 572 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 505 | 573 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -515,27 +583,45 @@ discard block |
||
| 515 | 583 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 516 | 584 | } |
| 517 | 585 | */ |
| 518 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 519 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 520 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 521 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 522 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 586 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 587 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 588 | + } |
|
| 589 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 590 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 591 | + } |
|
| 592 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 593 | + $temp_array['source_name'] = $row['source_name']; |
|
| 594 | + } |
|
| 595 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 596 | + $temp_array['over_country'] = $row['over_country']; |
|
| 597 | + } |
|
| 598 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 599 | + $temp_array['distance'] = $row['distance']; |
|
| 600 | + } |
|
| 523 | 601 | if (isset($row['squawk'])) { |
| 524 | 602 | $temp_array['squawk'] = $row['squawk']; |
| 525 | 603 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 526 | 604 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 527 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 605 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 606 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 607 | + } |
|
| 528 | 608 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 529 | 609 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 530 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 531 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 610 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 611 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 612 | + } |
|
| 613 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 614 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 615 | + } |
|
| 532 | 616 | } |
| 533 | 617 | |
| 534 | 618 | $temp_array['query_number_rows'] = $num_rows; |
| 535 | 619 | |
| 536 | 620 | $spotter_array[] = $temp_array; |
| 537 | 621 | } |
| 538 | - if ($num_rows == 0) return array(); |
|
| 622 | + if ($num_rows == 0) { |
|
| 623 | + return array(); |
|
| 624 | + } |
|
| 539 | 625 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 540 | 626 | return $spotter_array; |
| 541 | 627 | } |
@@ -568,7 +654,9 @@ discard block |
||
| 568 | 654 | foreach ($q_array as $q_item){ |
| 569 | 655 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 570 | 656 | $additional_query .= " AND ("; |
| 571 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 657 | + if (is_int($q_item)) { |
|
| 658 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 659 | + } |
|
| 572 | 660 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 573 | 661 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 574 | 662 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -589,7 +677,9 @@ discard block |
||
| 589 | 677 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 590 | 678 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 591 | 679 | $translate = $Translation->ident2icao($q_item); |
| 592 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 680 | + if ($translate != $q_item) { |
|
| 681 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 682 | + } |
|
| 593 | 683 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 594 | 684 | $additional_query .= ")"; |
| 595 | 685 | } |
@@ -816,7 +906,9 @@ discard block |
||
| 816 | 906 | date_default_timezone_set($globalTimezone); |
| 817 | 907 | $datetime = new DateTime(); |
| 818 | 908 | $offset = $datetime->format('P'); |
| 819 | - } else $offset = '+00:00'; |
|
| 909 | + } else { |
|
| 910 | + $offset = '+00:00'; |
|
| 911 | + } |
|
| 820 | 912 | |
| 821 | 913 | if ($date_array[1] != "") |
| 822 | 914 | { |
@@ -848,8 +940,12 @@ discard block |
||
| 848 | 940 | { |
| 849 | 941 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 850 | 942 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 851 | - } else $limit_query = ""; |
|
| 852 | - } else $limit_query = ""; |
|
| 943 | + } else { |
|
| 944 | + $limit_query = ""; |
|
| 945 | + } |
|
| 946 | + } else { |
|
| 947 | + $limit_query = ""; |
|
| 948 | + } |
|
| 853 | 949 | |
| 854 | 950 | |
| 855 | 951 | if ($sort != "") |
@@ -917,8 +1013,12 @@ discard block |
||
| 917 | 1013 | { |
| 918 | 1014 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 919 | 1015 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 920 | - } else $limit_query = ""; |
|
| 921 | - } else $limit_query = ""; |
|
| 1016 | + } else { |
|
| 1017 | + $limit_query = ""; |
|
| 1018 | + } |
|
| 1019 | + } else { |
|
| 1020 | + $limit_query = ""; |
|
| 1021 | + } |
|
| 922 | 1022 | |
| 923 | 1023 | if ($sort != "") |
| 924 | 1024 | { |
@@ -1242,7 +1342,9 @@ discard block |
||
| 1242 | 1342 | global $global_query; |
| 1243 | 1343 | |
| 1244 | 1344 | date_default_timezone_set('UTC'); |
| 1245 | - if ($id == '') return array(); |
|
| 1345 | + if ($id == '') { |
|
| 1346 | + return array(); |
|
| 1347 | + } |
|
| 1246 | 1348 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1247 | 1349 | $query_values = array(':id' => $id); |
| 1248 | 1350 | |
@@ -1357,8 +1459,11 @@ discard block |
||
| 1357 | 1459 | if ($sort != "") |
| 1358 | 1460 | { |
| 1359 | 1461 | $search_orderby_array = $this->getOrderBy(); |
| 1360 | - if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1361 | - else $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1462 | + if (isset($search_orderby_array[$sort]['sql'])) { |
|
| 1463 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1464 | + } else { |
|
| 1465 | + $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1466 | + } |
|
| 1362 | 1467 | } else { |
| 1363 | 1468 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1364 | 1469 | } |
@@ -1983,7 +2088,9 @@ discard block |
||
| 1983 | 2088 | { |
| 1984 | 2089 | $highlight = $row['highlight']; |
| 1985 | 2090 | } |
| 1986 | - if (isset($highlight)) return $highlight; |
|
| 2091 | + if (isset($highlight)) { |
|
| 2092 | + return $highlight; |
|
| 2093 | + } |
|
| 1987 | 2094 | } |
| 1988 | 2095 | |
| 1989 | 2096 | |
@@ -2011,7 +2118,9 @@ discard block |
||
| 2011 | 2118 | $sth->closeCursor(); |
| 2012 | 2119 | if (count($row) > 0) { |
| 2013 | 2120 | return $row['usage']; |
| 2014 | - } else return ''; |
|
| 2121 | + } else { |
|
| 2122 | + return ''; |
|
| 2123 | + } |
|
| 2015 | 2124 | } |
| 2016 | 2125 | |
| 2017 | 2126 | /** |
@@ -2036,7 +2145,9 @@ discard block |
||
| 2036 | 2145 | $sth->closeCursor(); |
| 2037 | 2146 | if (count($row) > 0) { |
| 2038 | 2147 | return $row['icao']; |
| 2039 | - } else return ''; |
|
| 2148 | + } else { |
|
| 2149 | + return ''; |
|
| 2150 | + } |
|
| 2040 | 2151 | } |
| 2041 | 2152 | |
| 2042 | 2153 | /** |
@@ -2064,7 +2175,9 @@ discard block |
||
| 2064 | 2175 | $airport_longitude = $row['longitude']; |
| 2065 | 2176 | $Common = new Common(); |
| 2066 | 2177 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 2067 | - } else return ''; |
|
| 2178 | + } else { |
|
| 2179 | + return ''; |
|
| 2180 | + } |
|
| 2068 | 2181 | } |
| 2069 | 2182 | |
| 2070 | 2183 | /** |
@@ -2176,7 +2289,9 @@ discard block |
||
| 2176 | 2289 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2177 | 2290 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2178 | 2291 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2179 | - } else return array(); |
|
| 2292 | + } else { |
|
| 2293 | + return array(); |
|
| 2294 | + } |
|
| 2180 | 2295 | if ($globalDBdriver == 'mysql') { |
| 2181 | 2296 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2182 | 2297 | } else { |
@@ -2211,7 +2326,9 @@ discard block |
||
| 2211 | 2326 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2212 | 2327 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2213 | 2328 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2214 | - } else return array(); |
|
| 2329 | + } else { |
|
| 2330 | + return array(); |
|
| 2331 | + } |
|
| 2215 | 2332 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2216 | 2333 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 2217 | 2334 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2246,7 +2363,9 @@ discard block |
||
| 2246 | 2363 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2247 | 2364 | { |
| 2248 | 2365 | global $globalUseRealAirlines; |
| 2249 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2366 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2367 | + $fromsource = NULL; |
|
| 2368 | + } |
|
| 2250 | 2369 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2251 | 2370 | if ($airline_icao == 'NA') { |
| 2252 | 2371 | $airline_array = array(); |
@@ -2315,7 +2434,9 @@ discard block |
||
| 2315 | 2434 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2316 | 2435 | { |
| 2317 | 2436 | global $globalUseRealAirlines; |
| 2318 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2437 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2438 | + $fromsource = NULL; |
|
| 2439 | + } |
|
| 2319 | 2440 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2320 | 2441 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
| 2321 | 2442 | $sth = $this->db->prepare($query); |
@@ -2331,7 +2452,9 @@ discard block |
||
| 2331 | 2452 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2332 | 2453 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2333 | 2454 | $sth->closeCursor(); |
| 2334 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2455 | + if ($row['nb'] == 0) { |
|
| 2456 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2457 | + } |
|
| 2335 | 2458 | } |
| 2336 | 2459 | return $result; |
| 2337 | 2460 | } |
@@ -2394,15 +2517,20 @@ discard block |
||
| 2394 | 2517 | 'A320-211' => 'A320', |
| 2395 | 2518 | '747-8i' => 'B748', |
| 2396 | 2519 | 'A380' => 'A388'); |
| 2397 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2520 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2521 | + return $all_aircraft[$aircraft_type]; |
|
| 2522 | + } |
|
| 2398 | 2523 | |
| 2399 | 2524 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2400 | 2525 | $aircraft_type = strtoupper($aircraft_type); |
| 2401 | 2526 | $sth = $this->db->prepare($query); |
| 2402 | 2527 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2403 | 2528 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2404 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2405 | - else return ''; |
|
| 2529 | + if (isset($result[0]['icao'])) { |
|
| 2530 | + return $result[0]['icao']; |
|
| 2531 | + } else { |
|
| 2532 | + return ''; |
|
| 2533 | + } |
|
| 2406 | 2534 | } |
| 2407 | 2535 | |
| 2408 | 2536 | /** |
@@ -2430,11 +2558,15 @@ discard block |
||
| 2430 | 2558 | $sth->closeCursor(); |
| 2431 | 2559 | if (isset($row['icaotypecode'])) { |
| 2432 | 2560 | $icao = $row['icaotypecode']; |
| 2433 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2561 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2562 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2563 | + } |
|
| 2434 | 2564 | return $icao; |
| 2435 | 2565 | } elseif ($source_type == 'flarm') { |
| 2436 | 2566 | return $this->getAllAircraftType($aircraft_modes); |
| 2437 | - } else return ''; |
|
| 2567 | + } else { |
|
| 2568 | + return ''; |
|
| 2569 | + } |
|
| 2438 | 2570 | } |
| 2439 | 2571 | |
| 2440 | 2572 | /** |
@@ -2457,7 +2589,9 @@ discard block |
||
| 2457 | 2589 | $sth->closeCursor(); |
| 2458 | 2590 | if (isset($row['icaotypecode'])) { |
| 2459 | 2591 | return $row['icaotypecode']; |
| 2460 | - } else return ''; |
|
| 2592 | + } else { |
|
| 2593 | + return ''; |
|
| 2594 | + } |
|
| 2461 | 2595 | } |
| 2462 | 2596 | |
| 2463 | 2597 | /** |
@@ -2503,7 +2637,9 @@ discard block |
||
| 2503 | 2637 | $sth->closeCursor(); |
| 2504 | 2638 | if (isset($row['operator_correct'])) { |
| 2505 | 2639 | return $row['operator_correct']; |
| 2506 | - } else return $operator; |
|
| 2640 | + } else { |
|
| 2641 | + return $operator; |
|
| 2642 | + } |
|
| 2507 | 2643 | } |
| 2508 | 2644 | |
| 2509 | 2645 | /** |
@@ -2516,7 +2652,9 @@ discard block |
||
| 2516 | 2652 | public function getRouteInfo($callsign) |
| 2517 | 2653 | { |
| 2518 | 2654 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2519 | - if ($callsign == '') return array(); |
|
| 2655 | + if ($callsign == '') { |
|
| 2656 | + return array(); |
|
| 2657 | + } |
|
| 2520 | 2658 | $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 | 2659 | |
| 2522 | 2660 | $sth = $this->db->prepare($query); |
@@ -2526,7 +2664,9 @@ discard block |
||
| 2526 | 2664 | $sth->closeCursor(); |
| 2527 | 2665 | if (count($row) > 0) { |
| 2528 | 2666 | return $row; |
| 2529 | - } else return array(); |
|
| 2667 | + } else { |
|
| 2668 | + return array(); |
|
| 2669 | + } |
|
| 2530 | 2670 | } |
| 2531 | 2671 | |
| 2532 | 2672 | /** |
@@ -2579,7 +2719,9 @@ discard block |
||
| 2579 | 2719 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2580 | 2720 | $sth->closeCursor(); |
| 2581 | 2721 | return $result; |
| 2582 | - } else return array(); |
|
| 2722 | + } else { |
|
| 2723 | + return array(); |
|
| 2724 | + } |
|
| 2583 | 2725 | } |
| 2584 | 2726 | |
| 2585 | 2727 | |
@@ -2738,8 +2880,11 @@ discard block |
||
| 2738 | 2880 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2739 | 2881 | |
| 2740 | 2882 | $sth = $this->db->prepare($query); |
| 2741 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2742 | - else $sth->execute(); |
|
| 2883 | + if (!empty($query_values)) { |
|
| 2884 | + $sth->execute($query_values); |
|
| 2885 | + } else { |
|
| 2886 | + $sth->execute(); |
|
| 2887 | + } |
|
| 2743 | 2888 | |
| 2744 | 2889 | $source_array = array(); |
| 2745 | 2890 | $temp_array = array(); |
@@ -2772,9 +2917,13 @@ discard block |
||
| 2772 | 2917 | WHERE spotter_output.airline_icao <> '' |
| 2773 | 2918 | ORDER BY spotter_output.airline_name ASC"; |
| 2774 | 2919 | */ |
| 2775 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2776 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2777 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2920 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2921 | + $forsource = $globalAirlinesSource; |
|
| 2922 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2923 | + $forsource = 'vatsim'; |
|
| 2924 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2925 | + $forsource = 'ivao'; |
|
| 2926 | + } |
|
| 2778 | 2927 | if ($forsource === NULL) { |
| 2779 | 2928 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
| 2780 | 2929 | $query_data = array(); |
@@ -2817,9 +2966,13 @@ discard block |
||
| 2817 | 2966 | { |
| 2818 | 2967 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2819 | 2968 | $filter_query = $this->getFilter($filters,true,true); |
| 2820 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2821 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2822 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2969 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2970 | + $forsource = $globalAirlinesSource; |
|
| 2971 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2972 | + $forsource = 'vatsim'; |
|
| 2973 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2974 | + $forsource = 'ivao'; |
|
| 2975 | + } |
|
| 2823 | 2976 | if ($forsource === NULL) { |
| 2824 | 2977 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2825 | 2978 | $query_data = array(); |
@@ -3130,7 +3283,9 @@ discard block |
||
| 3130 | 3283 | date_default_timezone_set($globalTimezone); |
| 3131 | 3284 | $datetime = new DateTime(); |
| 3132 | 3285 | $offset = $datetime->format('P'); |
| 3133 | - } else $offset = '+00:00'; |
|
| 3286 | + } else { |
|
| 3287 | + $offset = '+00:00'; |
|
| 3288 | + } |
|
| 3134 | 3289 | if ($airport_icao == '') { |
| 3135 | 3290 | if ($globalDBdriver == 'mysql') { |
| 3136 | 3291 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3162,7 +3317,9 @@ discard block |
||
| 3162 | 3317 | date_default_timezone_set($globalTimezone); |
| 3163 | 3318 | $datetime = new DateTime(); |
| 3164 | 3319 | $offset = $datetime->format('P'); |
| 3165 | - } else $offset = '+00:00'; |
|
| 3320 | + } else { |
|
| 3321 | + $offset = '+00:00'; |
|
| 3322 | + } |
|
| 3166 | 3323 | if ($airport_icao == '') { |
| 3167 | 3324 | if ($globalDBdriver == 'mysql') { |
| 3168 | 3325 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3195,7 +3352,9 @@ discard block |
||
| 3195 | 3352 | date_default_timezone_set($globalTimezone); |
| 3196 | 3353 | $datetime = new DateTime(); |
| 3197 | 3354 | $offset = $datetime->format('P'); |
| 3198 | - } else $offset = '+00:00'; |
|
| 3355 | + } else { |
|
| 3356 | + $offset = '+00:00'; |
|
| 3357 | + } |
|
| 3199 | 3358 | if ($airport_icao == '') { |
| 3200 | 3359 | if ($globalDBdriver == 'mysql') { |
| 3201 | 3360 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3234,7 +3393,9 @@ discard block |
||
| 3234 | 3393 | date_default_timezone_set($globalTimezone); |
| 3235 | 3394 | $datetime = new DateTime(); |
| 3236 | 3395 | $offset = $datetime->format('P'); |
| 3237 | - } else $offset = '+00:00'; |
|
| 3396 | + } else { |
|
| 3397 | + $offset = '+00:00'; |
|
| 3398 | + } |
|
| 3238 | 3399 | if ($airport_icao == '') { |
| 3239 | 3400 | if ($globalDBdriver == 'mysql') { |
| 3240 | 3401 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3279,7 +3440,9 @@ discard block |
||
| 3279 | 3440 | date_default_timezone_set($globalTimezone); |
| 3280 | 3441 | $datetime = new DateTime(); |
| 3281 | 3442 | $offset = $datetime->format('P'); |
| 3282 | - } else $offset = '+00:00'; |
|
| 3443 | + } else { |
|
| 3444 | + $offset = '+00:00'; |
|
| 3445 | + } |
|
| 3283 | 3446 | if ($airport_icao == '') { |
| 3284 | 3447 | if ($globalDBdriver == 'mysql') { |
| 3285 | 3448 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3314,7 +3477,9 @@ discard block |
||
| 3314 | 3477 | date_default_timezone_set($globalTimezone); |
| 3315 | 3478 | $datetime = new DateTime(); |
| 3316 | 3479 | $offset = $datetime->format('P'); |
| 3317 | - } else $offset = '+00:00'; |
|
| 3480 | + } else { |
|
| 3481 | + $offset = '+00:00'; |
|
| 3482 | + } |
|
| 3318 | 3483 | if ($airport_icao == '') { |
| 3319 | 3484 | if ($globalDBdriver == 'mysql') { |
| 3320 | 3485 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3356,7 +3521,9 @@ discard block |
||
| 3356 | 3521 | date_default_timezone_set($globalTimezone); |
| 3357 | 3522 | $datetime = new DateTime(); |
| 3358 | 3523 | $offset = $datetime->format('P'); |
| 3359 | - } else $offset = '+00:00'; |
|
| 3524 | + } else { |
|
| 3525 | + $offset = '+00:00'; |
|
| 3526 | + } |
|
| 3360 | 3527 | if ($airport_icao == '') { |
| 3361 | 3528 | if ($globalDBdriver == 'mysql') { |
| 3362 | 3529 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3390,7 +3557,9 @@ discard block |
||
| 3390 | 3557 | date_default_timezone_set($globalTimezone); |
| 3391 | 3558 | $datetime = new DateTime(); |
| 3392 | 3559 | $offset = $datetime->format('P'); |
| 3393 | - } else $offset = '+00:00'; |
|
| 3560 | + } else { |
|
| 3561 | + $offset = '+00:00'; |
|
| 3562 | + } |
|
| 3394 | 3563 | if ($airport_icao == '') { |
| 3395 | 3564 | if ($globalDBdriver == 'mysql') { |
| 3396 | 3565 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3438,7 +3607,9 @@ discard block |
||
| 3438 | 3607 | date_default_timezone_set($globalTimezone); |
| 3439 | 3608 | $datetime = new DateTime(); |
| 3440 | 3609 | $offset = $datetime->format('P'); |
| 3441 | - } else $offset = '+00:00'; |
|
| 3610 | + } else { |
|
| 3611 | + $offset = '+00:00'; |
|
| 3612 | + } |
|
| 3442 | 3613 | |
| 3443 | 3614 | if ($globalDBdriver == 'mysql') { |
| 3444 | 3615 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3558,7 +3729,9 @@ discard block |
||
| 3558 | 3729 | */ |
| 3559 | 3730 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3560 | 3731 | { |
| 3561 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3732 | + if ($groundspeed == '') { |
|
| 3733 | + $groundspeed = NULL; |
|
| 3734 | + } |
|
| 3562 | 3735 | $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 | 3736 | $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 | 3737 | |
@@ -3608,10 +3781,18 @@ discard block |
||
| 3608 | 3781 | $Image = new Image($this->db); |
| 3609 | 3782 | $Common = new Common(); |
| 3610 | 3783 | |
| 3611 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3612 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3613 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3614 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3784 | + if (!isset($globalIVAO)) { |
|
| 3785 | + $globalIVAO = FALSE; |
|
| 3786 | + } |
|
| 3787 | + if (!isset($globalVATSIM)) { |
|
| 3788 | + $globalVATSIM = FALSE; |
|
| 3789 | + } |
|
| 3790 | + if (!isset($globalphpVMS)) { |
|
| 3791 | + $globalphpVMS = FALSE; |
|
| 3792 | + } |
|
| 3793 | + if (!isset($globalVAM)) { |
|
| 3794 | + $globalVAM = FALSE; |
|
| 3795 | + } |
|
| 3615 | 3796 | date_default_timezone_set('UTC'); |
| 3616 | 3797 | |
| 3617 | 3798 | //getting the registration |
@@ -3624,23 +3805,33 @@ discard block |
||
| 3624 | 3805 | if ($ModeS != '') { |
| 3625 | 3806 | $timeelapsed = microtime(true); |
| 3626 | 3807 | $registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type); |
| 3627 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3808 | + if ($globalDebugTimeElapsed) { |
|
| 3809 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3810 | + } |
|
| 3628 | 3811 | } else { |
| 3629 | 3812 | $myhex = explode('-',$flightaware_id); |
| 3630 | 3813 | if (count($myhex) > 0) { |
| 3631 | 3814 | $timeelapsed = microtime(true); |
| 3632 | 3815 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type); |
| 3633 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3816 | + if ($globalDebugTimeElapsed) { |
|
| 3817 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3818 | + } |
|
| 3634 | 3819 | } |
| 3635 | 3820 | } |
| 3636 | 3821 | } |
| 3637 | 3822 | } |
| 3638 | 3823 | $fromsource = NULL; |
| 3639 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3640 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3641 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3642 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3643 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3824 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3825 | + $fromsource = $globalAirlinesSource; |
|
| 3826 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3827 | + $fromsource = 'vatsim'; |
|
| 3828 | + } elseif ($format_source == 'whazzup') { |
|
| 3829 | + $fromsource = 'ivao'; |
|
| 3830 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3831 | + $fromsource = 'vatsim'; |
|
| 3832 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3833 | + $fromsource = 'ivao'; |
|
| 3834 | + } |
|
| 3644 | 3835 | //getting the airline information |
| 3645 | 3836 | if ($ident != "") |
| 3646 | 3837 | { |
@@ -3664,15 +3855,21 @@ discard block |
||
| 3664 | 3855 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3665 | 3856 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3666 | 3857 | } |
| 3667 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3858 | + if ($globalDebugTimeElapsed) { |
|
| 3859 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3860 | + } |
|
| 3668 | 3861 | |
| 3669 | 3862 | } else { |
| 3670 | 3863 | $timeelapsed = microtime(true); |
| 3671 | 3864 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3672 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3865 | + if ($globalDebugTimeElapsed) { |
|
| 3866 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3867 | + } |
|
| 3673 | 3868 | } |
| 3674 | 3869 | } |
| 3675 | - } else $airline_array = array(); |
|
| 3870 | + } else { |
|
| 3871 | + $airline_array = array(); |
|
| 3872 | + } |
|
| 3676 | 3873 | |
| 3677 | 3874 | //getting the aircraft information |
| 3678 | 3875 | $aircraft_array = array(); |
@@ -3686,27 +3883,37 @@ discard block |
||
| 3686 | 3883 | { |
| 3687 | 3884 | $timeelapsed = microtime(true); |
| 3688 | 3885 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3689 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3886 | + if ($globalDebugTimeElapsed) { |
|
| 3887 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3888 | + } |
|
| 3690 | 3889 | } else { |
| 3691 | 3890 | $timeelapsed = microtime(true); |
| 3692 | 3891 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3693 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3892 | + if ($globalDebugTimeElapsed) { |
|
| 3893 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3894 | + } |
|
| 3694 | 3895 | } |
| 3695 | 3896 | } |
| 3696 | 3897 | } else { |
| 3697 | 3898 | if ($ModeS != '') { |
| 3698 | 3899 | $timeelapsed = microtime(true); |
| 3699 | 3900 | $aircraft_icao = $this->getAllAircraftType($ModeS,$source_type); |
| 3700 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3901 | + if ($globalDebugTimeElapsed) { |
|
| 3902 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3903 | + } |
|
| 3701 | 3904 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3702 | 3905 | { |
| 3703 | 3906 | $timeelapsed = microtime(true); |
| 3704 | 3907 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3705 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3908 | + if ($globalDebugTimeElapsed) { |
|
| 3909 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3910 | + } |
|
| 3706 | 3911 | } else { |
| 3707 | 3912 | $timeelapsed = microtime(true); |
| 3708 | 3913 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3709 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3914 | + if ($globalDebugTimeElapsed) { |
|
| 3915 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3916 | + } |
|
| 3710 | 3917 | } |
| 3711 | 3918 | } |
| 3712 | 3919 | } |
@@ -3722,7 +3929,9 @@ discard block |
||
| 3722 | 3929 | } else { |
| 3723 | 3930 | $timeelapsed = microtime(true); |
| 3724 | 3931 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3725 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3932 | + if ($globalDebugTimeElapsed) { |
|
| 3933 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3934 | + } |
|
| 3726 | 3935 | } |
| 3727 | 3936 | } |
| 3728 | 3937 | |
@@ -3737,7 +3946,9 @@ discard block |
||
| 3737 | 3946 | } else { |
| 3738 | 3947 | $timeelapsed = microtime(true); |
| 3739 | 3948 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3740 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3949 | + if ($globalDebugTimeElapsed) { |
|
| 3950 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3951 | + } |
|
| 3741 | 3952 | } |
| 3742 | 3953 | } |
| 3743 | 3954 | |
@@ -3771,7 +3982,9 @@ discard block |
||
| 3771 | 3982 | { |
| 3772 | 3983 | return false; |
| 3773 | 3984 | } |
| 3774 | - } else $altitude = 0; |
|
| 3985 | + } else { |
|
| 3986 | + $altitude = 0; |
|
| 3987 | + } |
|
| 3775 | 3988 | |
| 3776 | 3989 | if ($heading != "") |
| 3777 | 3990 | { |
@@ -3800,7 +4013,9 @@ discard block |
||
| 3800 | 4013 | { |
| 3801 | 4014 | $timeelapsed = microtime(true); |
| 3802 | 4015 | $image_array = $Image->getSpotterImage($registration); |
| 3803 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4016 | + if ($globalDebugTimeElapsed) { |
|
| 4017 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4018 | + } |
|
| 3804 | 4019 | if (!isset($image_array[0]['registration'])) |
| 3805 | 4020 | { |
| 3806 | 4021 | //echo "Add image !!!! \n"; |
@@ -3808,14 +4023,21 @@ discard block |
||
| 3808 | 4023 | } |
| 3809 | 4024 | $timeelapsed = microtime(true); |
| 3810 | 4025 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3811 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3812 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4026 | + if ($globalDebugTimeElapsed) { |
|
| 4027 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4028 | + } |
|
| 4029 | + if ($owner_info['owner'] != '') { |
|
| 4030 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4031 | + } |
|
| 3813 | 4032 | } |
| 3814 | 4033 | |
| 3815 | 4034 | if ($globalIVAO && $aircraft_icao != '') |
| 3816 | 4035 | { |
| 3817 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3818 | - else $airline_icao = ''; |
|
| 4036 | + if (isset($airline_array[0]['icao'])) { |
|
| 4037 | + $airline_icao = $airline_array[0]['icao']; |
|
| 4038 | + } else { |
|
| 4039 | + $airline_icao = ''; |
|
| 4040 | + } |
|
| 3819 | 4041 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3820 | 4042 | if (!isset($image_array[0]['registration'])) |
| 3821 | 4043 | { |
@@ -3860,16 +4082,28 @@ discard block |
||
| 3860 | 4082 | { |
| 3861 | 4083 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3862 | 4084 | } |
| 3863 | - if ($registration == '') $registration = 'NA'; |
|
| 4085 | + if ($registration == '') { |
|
| 4086 | + $registration = 'NA'; |
|
| 4087 | + } |
|
| 3864 | 4088 | if ($latitude == '' && $longitude == '') { |
| 3865 | 4089 | $latitude = 0; |
| 3866 | 4090 | $longitude = 0; |
| 3867 | 4091 | } |
| 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; |
|
| 4092 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 4093 | + $squawk = NULL; |
|
| 4094 | + } |
|
| 4095 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 4096 | + $verticalrate = NULL; |
|
| 4097 | + } |
|
| 4098 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 4099 | + $heading = 0; |
|
| 4100 | + } |
|
| 4101 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 4102 | + $groundspeed = 0; |
|
| 4103 | + } |
|
| 4104 | + if (!isset($aircraft_owner)) { |
|
| 4105 | + $aircraft_owner = NULL; |
|
| 4106 | + } |
|
| 3873 | 4107 | $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 | 4108 | 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 | 4109 | |
@@ -3880,9 +4114,13 @@ discard block |
||
| 3880 | 4114 | if ($airline_type == '') { |
| 3881 | 4115 | $timeelapsed = microtime(true); |
| 3882 | 4116 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3883 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4117 | + if ($globalDebugTimeElapsed) { |
|
| 4118 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4119 | + } |
|
| 4120 | + } |
|
| 4121 | + if ($airline_type == null) { |
|
| 4122 | + $airline_type = ''; |
|
| 3884 | 4123 | } |
| 3885 | - if ($airline_type == null) $airline_type = ''; |
|
| 3886 | 4124 | $aircraft_type = $aircraft_array[0]['type']; |
| 3887 | 4125 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3888 | 4126 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -4046,7 +4284,9 @@ discard block |
||
| 4046 | 4284 | } |
| 4047 | 4285 | } |
| 4048 | 4286 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 4049 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4287 | + if ($limit) { |
|
| 4288 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4289 | + } |
|
| 4050 | 4290 | |
| 4051 | 4291 | $sth = $this->db->prepare($query); |
| 4052 | 4292 | $sth->execute($query_values); |
@@ -4119,7 +4359,9 @@ discard block |
||
| 4119 | 4359 | } |
| 4120 | 4360 | |
| 4121 | 4361 | $query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4122 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4362 | + if ($limit) { |
|
| 4363 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4364 | + } |
|
| 4123 | 4365 | |
| 4124 | 4366 | |
| 4125 | 4367 | $sth = $this->db->prepare($query); |
@@ -4163,7 +4405,9 @@ discard block |
||
| 4163 | 4405 | } |
| 4164 | 4406 | } |
| 4165 | 4407 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4166 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4408 | + if ($limit) { |
|
| 4409 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4410 | + } |
|
| 4167 | 4411 | |
| 4168 | 4412 | |
| 4169 | 4413 | $sth = $this->db->prepare($query); |
@@ -4239,7 +4483,9 @@ discard block |
||
| 4239 | 4483 | } |
| 4240 | 4484 | } |
| 4241 | 4485 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4242 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4486 | + if ($limit) { |
|
| 4487 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4488 | + } |
|
| 4243 | 4489 | |
| 4244 | 4490 | $sth = $this->db->prepare($query); |
| 4245 | 4491 | $sth->execute($query_values); |
@@ -4281,7 +4527,9 @@ discard block |
||
| 4281 | 4527 | } |
| 4282 | 4528 | } |
| 4283 | 4529 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4284 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4530 | + if ($limit) { |
|
| 4531 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4532 | + } |
|
| 4285 | 4533 | |
| 4286 | 4534 | |
| 4287 | 4535 | $sth = $this->db->prepare($query); |
@@ -4525,7 +4773,9 @@ discard block |
||
| 4525 | 4773 | date_default_timezone_set($globalTimezone); |
| 4526 | 4774 | $datetime = new DateTime($date); |
| 4527 | 4775 | $offset = $datetime->format('P'); |
| 4528 | - } else $offset = '+00:00'; |
|
| 4776 | + } else { |
|
| 4777 | + $offset = '+00:00'; |
|
| 4778 | + } |
|
| 4529 | 4779 | |
| 4530 | 4780 | if ($globalDBdriver == 'mysql') { |
| 4531 | 4781 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4573,7 +4823,9 @@ discard block |
||
| 4573 | 4823 | date_default_timezone_set($globalTimezone); |
| 4574 | 4824 | $datetime = new DateTime($date); |
| 4575 | 4825 | $offset = $datetime->format('P'); |
| 4576 | - } else $offset = '+00:00'; |
|
| 4826 | + } else { |
|
| 4827 | + $offset = '+00:00'; |
|
| 4828 | + } |
|
| 4577 | 4829 | |
| 4578 | 4830 | if ($globalDBdriver == 'mysql') { |
| 4579 | 4831 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4693,9 +4945,13 @@ discard block |
||
| 4693 | 4945 | $sth = $this->db->prepare($query); |
| 4694 | 4946 | $sth->execute($query_values); |
| 4695 | 4947 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4696 | - if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4697 | - elseif ($result[0]['duration'] == '') return 0; |
|
| 4698 | - else return $result[0]['duration']; |
|
| 4948 | + if (is_numeric($result[0]['duration'])) { |
|
| 4949 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 4950 | + } elseif ($result[0]['duration'] == '') { |
|
| 4951 | + return 0; |
|
| 4952 | + } else { |
|
| 4953 | + return $result[0]['duration']; |
|
| 4954 | + } |
|
| 4699 | 4955 | } |
| 4700 | 4956 | |
| 4701 | 4957 | /** |
@@ -4784,8 +5040,11 @@ discard block |
||
| 4784 | 5040 | $sth = $this->db->prepare($query); |
| 4785 | 5041 | $sth->execute($query_values); |
| 4786 | 5042 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4787 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4788 | - else return $result[0]['duration']; |
|
| 5043 | + if (is_int($result[0]['duration'])) { |
|
| 5044 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 5045 | + } else { |
|
| 5046 | + return $result[0]['duration']; |
|
| 5047 | + } |
|
| 4789 | 5048 | } |
| 4790 | 5049 | |
| 4791 | 5050 | /** |
@@ -4990,7 +5249,9 @@ discard block |
||
| 4990 | 5249 | } |
| 4991 | 5250 | $query .= " GROUP BY spotter_output.airline_country, countries.iso3 |
| 4992 | 5251 | ORDER BY airline_country_count DESC"; |
| 4993 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5252 | + if ($limit) { |
|
| 5253 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5254 | + } |
|
| 4994 | 5255 | |
| 4995 | 5256 | $sth = $this->db->prepare($query); |
| 4996 | 5257 | $sth->execute($query_values); |
@@ -5019,7 +5280,9 @@ discard block |
||
| 5019 | 5280 | global $globalDBdriver; |
| 5020 | 5281 | //$filter_query = $this->getFilter($filters,true,true); |
| 5021 | 5282 | $Connection= new Connection($this->db); |
| 5022 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 5283 | + if (!$Connection->tableExists('countries')) { |
|
| 5284 | + return array(); |
|
| 5285 | + } |
|
| 5023 | 5286 | /* |
| 5024 | 5287 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 5025 | 5288 | FROM countries c, spotter_output s |
@@ -5051,7 +5314,9 @@ discard block |
||
| 5051 | 5314 | } |
| 5052 | 5315 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
| 5053 | 5316 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 5054 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5317 | + if ($limit) { |
|
| 5318 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5319 | + } |
|
| 5055 | 5320 | |
| 5056 | 5321 | |
| 5057 | 5322 | $sth = $this->db->prepare($query); |
@@ -5128,7 +5393,9 @@ discard block |
||
| 5128 | 5393 | } |
| 5129 | 5394 | |
| 5130 | 5395 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5131 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5396 | + if ($limit) { |
|
| 5397 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5398 | + } |
|
| 5132 | 5399 | |
| 5133 | 5400 | $sth = $this->db->prepare($query); |
| 5134 | 5401 | $sth->execute($query_values); |
@@ -5202,7 +5469,9 @@ discard block |
||
| 5202 | 5469 | } |
| 5203 | 5470 | |
| 5204 | 5471 | $query .= " GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5205 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5472 | + if ($limit) { |
|
| 5473 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5474 | + } |
|
| 5206 | 5475 | |
| 5207 | 5476 | $sth = $this->db->prepare($query); |
| 5208 | 5477 | $sth->execute($query_values); |
@@ -5249,7 +5518,9 @@ discard block |
||
| 5249 | 5518 | } |
| 5250 | 5519 | |
| 5251 | 5520 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5252 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5521 | + if ($limit) { |
|
| 5522 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5523 | + } |
|
| 5253 | 5524 | |
| 5254 | 5525 | $sth = $this->db->prepare($query); |
| 5255 | 5526 | $sth->execute(); |
@@ -5302,7 +5573,9 @@ discard block |
||
| 5302 | 5573 | if($row['registration'] != "") |
| 5303 | 5574 | { |
| 5304 | 5575 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5305 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5576 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5577 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5578 | + } |
|
| 5306 | 5579 | } |
| 5307 | 5580 | $temp_array['registration_count'] = $row['registration_count']; |
| 5308 | 5581 | |
@@ -5377,7 +5650,9 @@ discard block |
||
| 5377 | 5650 | if($row['registration'] != "") |
| 5378 | 5651 | { |
| 5379 | 5652 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5380 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5653 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5654 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5655 | + } |
|
| 5381 | 5656 | } |
| 5382 | 5657 | $temp_array['registration_count'] = $row['registration_count']; |
| 5383 | 5658 | |
@@ -5484,7 +5759,9 @@ discard block |
||
| 5484 | 5759 | if($row['registration'] != "") |
| 5485 | 5760 | { |
| 5486 | 5761 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5487 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5762 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5763 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5764 | + } |
|
| 5488 | 5765 | } |
| 5489 | 5766 | $temp_array['registration_count'] = $row['registration_count']; |
| 5490 | 5767 | $aircraft_array[] = $temp_array; |
@@ -5609,7 +5886,9 @@ discard block |
||
| 5609 | 5886 | date_default_timezone_set($globalTimezone); |
| 5610 | 5887 | $datetime = new DateTime($date); |
| 5611 | 5888 | $offset = $datetime->format('P'); |
| 5612 | - } else $offset = '+00:00'; |
|
| 5889 | + } else { |
|
| 5890 | + $offset = '+00:00'; |
|
| 5891 | + } |
|
| 5613 | 5892 | |
| 5614 | 5893 | if ($globalDBdriver == 'mysql') { |
| 5615 | 5894 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5656,7 +5935,9 @@ discard block |
||
| 5656 | 5935 | date_default_timezone_set($globalTimezone); |
| 5657 | 5936 | $datetime = new DateTime($date); |
| 5658 | 5937 | $offset = $datetime->format('P'); |
| 5659 | - } else $offset = '+00:00'; |
|
| 5938 | + } else { |
|
| 5939 | + $offset = '+00:00'; |
|
| 5940 | + } |
|
| 5660 | 5941 | |
| 5661 | 5942 | if ($globalDBdriver == 'mysql') { |
| 5662 | 5943 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
@@ -5685,7 +5966,9 @@ discard block |
||
| 5685 | 5966 | if($row['registration'] != "") |
| 5686 | 5967 | { |
| 5687 | 5968 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5688 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5969 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5970 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5971 | + } |
|
| 5689 | 5972 | } |
| 5690 | 5973 | $temp_array['registration_count'] = $row['registration_count']; |
| 5691 | 5974 | |
@@ -5710,7 +5993,9 @@ discard block |
||
| 5710 | 5993 | date_default_timezone_set($globalTimezone); |
| 5711 | 5994 | $datetime = new DateTime($date); |
| 5712 | 5995 | $offset = $datetime->format('P'); |
| 5713 | - } else $offset = '+00:00'; |
|
| 5996 | + } else { |
|
| 5997 | + $offset = '+00:00'; |
|
| 5998 | + } |
|
| 5714 | 5999 | |
| 5715 | 6000 | if ($globalDBdriver == 'mysql') { |
| 5716 | 6001 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5906,8 +6191,11 @@ discard block |
||
| 5906 | 6191 | if($row['registration'] != "") |
| 5907 | 6192 | { |
| 5908 | 6193 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5909 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5910 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6194 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6195 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6196 | + } else { |
|
| 6197 | + $temp_array['image_thumbnail'] = ''; |
|
| 6198 | + } |
|
| 5911 | 6199 | } |
| 5912 | 6200 | $temp_array['registration_count'] = $row['registration_count']; |
| 5913 | 6201 | $aircraft_array[] = $temp_array; |
@@ -5981,8 +6269,11 @@ discard block |
||
| 5981 | 6269 | if($row['registration'] != "") |
| 5982 | 6270 | { |
| 5983 | 6271 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5984 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5985 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6272 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6273 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6274 | + } else { |
|
| 6275 | + $temp_array['image_thumbnail'] = ''; |
|
| 6276 | + } |
|
| 5986 | 6277 | } |
| 5987 | 6278 | $temp_array['registration_count'] = $row['registration_count']; |
| 5988 | 6279 | $aircraft_array[] = $temp_array; |
@@ -6056,8 +6347,11 @@ discard block |
||
| 6056 | 6347 | if($row['registration'] != "") |
| 6057 | 6348 | { |
| 6058 | 6349 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6059 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6060 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6350 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6351 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6352 | + } else { |
|
| 6353 | + $temp_array['image_thumbnail'] = ''; |
|
| 6354 | + } |
|
| 6061 | 6355 | } |
| 6062 | 6356 | $temp_array['registration_count'] = $row['registration_count']; |
| 6063 | 6357 | $aircraft_array[] = $temp_array; |
@@ -6268,7 +6562,9 @@ discard block |
||
| 6268 | 6562 | if($row['registration'] != "") |
| 6269 | 6563 | { |
| 6270 | 6564 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6271 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6565 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6566 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6567 | + } |
|
| 6272 | 6568 | } |
| 6273 | 6569 | $temp_array['registration_count'] = $row['registration_count']; |
| 6274 | 6570 | |
@@ -6385,7 +6681,9 @@ discard block |
||
| 6385 | 6681 | if($row['registration'] != "") |
| 6386 | 6682 | { |
| 6387 | 6683 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6388 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6684 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6685 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6686 | + } |
|
| 6389 | 6687 | } |
| 6390 | 6688 | $temp_array['registration_count'] = $row['registration_count']; |
| 6391 | 6689 | |
@@ -6551,7 +6849,9 @@ discard block |
||
| 6551 | 6849 | } |
| 6552 | 6850 | } |
| 6553 | 6851 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6554 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6852 | + if ($limit) { |
|
| 6853 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6854 | + } |
|
| 6555 | 6855 | |
| 6556 | 6856 | $sth = $this->db->prepare($query); |
| 6557 | 6857 | $sth->execute($query_values); |
@@ -6570,7 +6870,9 @@ discard block |
||
| 6570 | 6870 | if($row['registration'] != "") |
| 6571 | 6871 | { |
| 6572 | 6872 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6573 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6873 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6874 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6875 | + } |
|
| 6574 | 6876 | } |
| 6575 | 6877 | |
| 6576 | 6878 | $aircraft_array[] = $temp_array; |
@@ -6611,7 +6913,9 @@ discard block |
||
| 6611 | 6913 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6612 | 6914 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6613 | 6915 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6614 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6916 | + if ($limit) { |
|
| 6917 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6918 | + } |
|
| 6615 | 6919 | |
| 6616 | 6920 | $sth = $this->db->prepare($query); |
| 6617 | 6921 | $sth->execute(); |
@@ -6631,7 +6935,9 @@ discard block |
||
| 6631 | 6935 | if($row['registration'] != "") |
| 6632 | 6936 | { |
| 6633 | 6937 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6634 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6938 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6939 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6940 | + } |
|
| 6635 | 6941 | } |
| 6636 | 6942 | |
| 6637 | 6943 | $aircraft_array[] = $temp_array; |
@@ -6697,7 +7003,9 @@ discard block |
||
| 6697 | 7003 | } |
| 6698 | 7004 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
| 6699 | 7005 | ORDER BY airport_departure_icao_count DESC"; |
| 6700 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7006 | + if ($limit) { |
|
| 7007 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7008 | + } |
|
| 6701 | 7009 | |
| 6702 | 7010 | $sth = $this->db->prepare($query); |
| 6703 | 7011 | $sth->execute($query_values); |
@@ -6749,7 +7057,9 @@ discard block |
||
| 6749 | 7057 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6750 | 7058 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6751 | 7059 | ORDER BY airport_departure_icao_count DESC"; |
| 6752 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7060 | + if ($limit) { |
|
| 7061 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7062 | + } |
|
| 6753 | 7063 | |
| 6754 | 7064 | $sth = $this->db->prepare($query); |
| 6755 | 7065 | $sth->execute(); |
@@ -6827,7 +7137,9 @@ discard block |
||
| 6827 | 7137 | } |
| 6828 | 7138 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
| 6829 | 7139 | ORDER BY airport_departure_icao_count DESC"; |
| 6830 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7140 | + if ($limit) { |
|
| 7141 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7142 | + } |
|
| 6831 | 7143 | //echo $query; |
| 6832 | 7144 | $sth = $this->db->prepare($query); |
| 6833 | 7145 | $sth->execute($query_values); |
@@ -6881,7 +7193,9 @@ discard block |
||
| 6881 | 7193 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6882 | 7194 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6883 | 7195 | ORDER BY airport_departure_icao_count DESC"; |
| 6884 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7196 | + if ($limit) { |
|
| 7197 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7198 | + } |
|
| 6885 | 7199 | |
| 6886 | 7200 | $sth = $this->db->prepare($query); |
| 6887 | 7201 | $sth->execute(); |
@@ -7274,7 +7588,9 @@ discard block |
||
| 7274 | 7588 | date_default_timezone_set($globalTimezone); |
| 7275 | 7589 | $datetime = new DateTime($date); |
| 7276 | 7590 | $offset = $datetime->format('P'); |
| 7277 | - } else $offset = '+00:00'; |
|
| 7591 | + } else { |
|
| 7592 | + $offset = '+00:00'; |
|
| 7593 | + } |
|
| 7278 | 7594 | |
| 7279 | 7595 | if ($globalDBdriver == 'mysql') { |
| 7280 | 7596 | $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 |
@@ -7324,7 +7640,9 @@ discard block |
||
| 7324 | 7640 | date_default_timezone_set($globalTimezone); |
| 7325 | 7641 | $datetime = new DateTime($date); |
| 7326 | 7642 | $offset = $datetime->format('P'); |
| 7327 | - } else $offset = '+00:00'; |
|
| 7643 | + } else { |
|
| 7644 | + $offset = '+00:00'; |
|
| 7645 | + } |
|
| 7328 | 7646 | |
| 7329 | 7647 | if ($globalDBdriver == 'mysql') { |
| 7330 | 7648 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -7673,7 +7991,9 @@ discard block |
||
| 7673 | 7991 | } |
| 7674 | 7992 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude |
| 7675 | 7993 | ORDER BY airport_arrival_icao_count DESC"; |
| 7676 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7994 | + if ($limit) { |
|
| 7995 | + $query .= " LIMIT 10"; |
|
| 7996 | + } |
|
| 7677 | 7997 | |
| 7678 | 7998 | |
| 7679 | 7999 | $sth = $this->db->prepare($query); |
@@ -7695,7 +8015,9 @@ discard block |
||
| 7695 | 8015 | if ($icaoaskey) { |
| 7696 | 8016 | $icao = $row['arrival_airport_icao']; |
| 7697 | 8017 | $airport_array[$icao] = $temp_array; |
| 7698 | - } else $airport_array[] = $temp_array; |
|
| 8018 | + } else { |
|
| 8019 | + $airport_array[] = $temp_array; |
|
| 8020 | + } |
|
| 7699 | 8021 | } |
| 7700 | 8022 | |
| 7701 | 8023 | return $airport_array; |
@@ -7732,7 +8054,9 @@ discard block |
||
| 7732 | 8054 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7733 | 8055 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, countries.iso3 |
| 7734 | 8056 | ORDER BY airport_arrival_icao_count DESC"; |
| 7735 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8057 | + if ($limit) { |
|
| 8058 | + $query .= " LIMIT 10"; |
|
| 8059 | + } |
|
| 7736 | 8060 | |
| 7737 | 8061 | |
| 7738 | 8062 | $sth = $this->db->prepare($query); |
@@ -7754,7 +8078,9 @@ discard block |
||
| 7754 | 8078 | if ($icaoaskey) { |
| 7755 | 8079 | $icao = $row['arrival_airport_icao']; |
| 7756 | 8080 | $airport_array[$icao] = $temp_array; |
| 7757 | - } else $airport_array[] = $temp_array; |
|
| 8081 | + } else { |
|
| 8082 | + $airport_array[] = $temp_array; |
|
| 8083 | + } |
|
| 7758 | 8084 | } |
| 7759 | 8085 | |
| 7760 | 8086 | return $airport_array; |
@@ -7817,7 +8143,9 @@ discard block |
||
| 7817 | 8143 | } |
| 7818 | 8144 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
| 7819 | 8145 | ORDER BY airport_arrival_icao_count DESC"; |
| 7820 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8146 | + if ($limit) { |
|
| 8147 | + $query .= " LIMIT 10"; |
|
| 8148 | + } |
|
| 7821 | 8149 | |
| 7822 | 8150 | |
| 7823 | 8151 | $sth = $this->db->prepare($query); |
@@ -7836,7 +8164,9 @@ discard block |
||
| 7836 | 8164 | if ($icaoaskey) { |
| 7837 | 8165 | $icao = $row['arrival_airport_icao']; |
| 7838 | 8166 | $airport_array[$icao] = $temp_array; |
| 7839 | - } else $airport_array[] = $temp_array; |
|
| 8167 | + } else { |
|
| 8168 | + $airport_array[] = $temp_array; |
|
| 8169 | + } |
|
| 7840 | 8170 | } |
| 7841 | 8171 | |
| 7842 | 8172 | return $airport_array; |
@@ -7873,7 +8203,9 @@ discard block |
||
| 7873 | 8203 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7874 | 8204 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7875 | 8205 | ORDER BY airport_arrival_icao_count DESC"; |
| 7876 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8206 | + if ($limit) { |
|
| 8207 | + $query .= " LIMIT 10"; |
|
| 8208 | + } |
|
| 7877 | 8209 | |
| 7878 | 8210 | |
| 7879 | 8211 | $sth = $this->db->prepare($query); |
@@ -7894,7 +8226,9 @@ discard block |
||
| 7894 | 8226 | if ($icaoaskey) { |
| 7895 | 8227 | $icao = $row['arrival_airport_icao']; |
| 7896 | 8228 | $airport_array[$icao] = $temp_array; |
| 7897 | - } else $airport_array[] = $temp_array; |
|
| 8229 | + } else { |
|
| 8230 | + $airport_array[] = $temp_array; |
|
| 8231 | + } |
|
| 7898 | 8232 | } |
| 7899 | 8233 | |
| 7900 | 8234 | return $airport_array; |
@@ -8274,7 +8608,9 @@ discard block |
||
| 8274 | 8608 | date_default_timezone_set($globalTimezone); |
| 8275 | 8609 | $datetime = new DateTime($date); |
| 8276 | 8610 | $offset = $datetime->format('P'); |
| 8277 | - } else $offset = '+00:00'; |
|
| 8611 | + } else { |
|
| 8612 | + $offset = '+00:00'; |
|
| 8613 | + } |
|
| 8278 | 8614 | |
| 8279 | 8615 | if ($globalDBdriver == 'mysql') { |
| 8280 | 8616 | $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 |
@@ -8324,7 +8660,9 @@ discard block |
||
| 8324 | 8660 | date_default_timezone_set($globalTimezone); |
| 8325 | 8661 | $datetime = new DateTime($date); |
| 8326 | 8662 | $offset = $datetime->format('P'); |
| 8327 | - } else $offset = '+00:00'; |
|
| 8663 | + } else { |
|
| 8664 | + $offset = '+00:00'; |
|
| 8665 | + } |
|
| 8328 | 8666 | |
| 8329 | 8667 | if ($globalDBdriver == 'mysql') { |
| 8330 | 8668 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -8715,7 +9053,9 @@ discard block |
||
| 8715 | 9053 | } |
| 8716 | 9054 | $query .= " GROUP BY spotter_output.arrival_airport_country, countries.iso3 |
| 8717 | 9055 | ORDER BY airport_arrival_country_count DESC"; |
| 8718 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9056 | + if ($limit) { |
|
| 9057 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9058 | + } |
|
| 8719 | 9059 | |
| 8720 | 9060 | |
| 8721 | 9061 | $sth = $this->db->prepare($query); |
@@ -9003,7 +9343,9 @@ discard block |
||
| 9003 | 9343 | date_default_timezone_set($globalTimezone); |
| 9004 | 9344 | $datetime = new DateTime($date); |
| 9005 | 9345 | $offset = $datetime->format('P'); |
| 9006 | - } else $offset = '+00:00'; |
|
| 9346 | + } else { |
|
| 9347 | + $offset = '+00:00'; |
|
| 9348 | + } |
|
| 9007 | 9349 | |
| 9008 | 9350 | if ($globalDBdriver == 'mysql') { |
| 9009 | 9351 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
@@ -9259,12 +9601,18 @@ discard block |
||
| 9259 | 9601 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 9260 | 9602 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9261 | 9603 | if ($olderthanmonths > 0) { |
| 9262 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9263 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9604 | + if ($globalDBdriver == 'mysql') { |
|
| 9605 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9606 | + } else { |
|
| 9607 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9608 | + } |
|
| 9264 | 9609 | } |
| 9265 | 9610 | if ($sincedate != '') { |
| 9266 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9267 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9611 | + if ($globalDBdriver == 'mysql') { |
|
| 9612 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9613 | + } else { |
|
| 9614 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9615 | + } |
|
| 9268 | 9616 | } |
| 9269 | 9617 | $query_values = array(); |
| 9270 | 9618 | if ($year != '') { |
@@ -9295,7 +9643,9 @@ discard block |
||
| 9295 | 9643 | } |
| 9296 | 9644 | } |
| 9297 | 9645 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9298 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9646 | + if ($limit) { |
|
| 9647 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9648 | + } |
|
| 9299 | 9649 | |
| 9300 | 9650 | $sth = $this->db->prepare($query); |
| 9301 | 9651 | $sth->execute($query_values); |
@@ -9329,15 +9679,23 @@ discard block |
||
| 9329 | 9679 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 9330 | 9680 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 9331 | 9681 | if ($olderthanmonths > 0) { |
| 9332 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9333 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9682 | + if ($globalDBdriver == 'mysql') { |
|
| 9683 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9684 | + } else { |
|
| 9685 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9686 | + } |
|
| 9334 | 9687 | } |
| 9335 | 9688 | if ($sincedate != '') { |
| 9336 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9337 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9689 | + if ($globalDBdriver == 'mysql') { |
|
| 9690 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9691 | + } else { |
|
| 9692 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9693 | + } |
|
| 9338 | 9694 | } |
| 9339 | 9695 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9340 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9696 | + if ($limit) { |
|
| 9697 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9698 | + } |
|
| 9341 | 9699 | |
| 9342 | 9700 | $sth = $this->db->prepare($query); |
| 9343 | 9701 | $sth->execute(); |
@@ -9374,7 +9732,9 @@ discard block |
||
| 9374 | 9732 | date_default_timezone_set($globalTimezone); |
| 9375 | 9733 | $datetime = new DateTime(); |
| 9376 | 9734 | $offset = $datetime->format('P'); |
| 9377 | - } else $offset = '+00:00'; |
|
| 9735 | + } else { |
|
| 9736 | + $offset = '+00:00'; |
|
| 9737 | + } |
|
| 9378 | 9738 | |
| 9379 | 9739 | if ($globalDBdriver == 'mysql') { |
| 9380 | 9740 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9423,7 +9783,9 @@ discard block |
||
| 9423 | 9783 | date_default_timezone_set($globalTimezone); |
| 9424 | 9784 | $datetime = new DateTime(); |
| 9425 | 9785 | $offset = $datetime->format('P'); |
| 9426 | - } else $offset = '+00:00'; |
|
| 9786 | + } else { |
|
| 9787 | + $offset = '+00:00'; |
|
| 9788 | + } |
|
| 9427 | 9789 | $filter_query = $this->getFilter($filters,true,true); |
| 9428 | 9790 | if ($globalDBdriver == 'mysql') { |
| 9429 | 9791 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9472,7 +9834,9 @@ discard block |
||
| 9472 | 9834 | date_default_timezone_set($globalTimezone); |
| 9473 | 9835 | $datetime = new DateTime(); |
| 9474 | 9836 | $offset = $datetime->format('P'); |
| 9475 | - } else $offset = '+00:00'; |
|
| 9837 | + } else { |
|
| 9838 | + $offset = '+00:00'; |
|
| 9839 | + } |
|
| 9476 | 9840 | $filter_query = $this->getFilter($filters,true,true); |
| 9477 | 9841 | if ($globalDBdriver == 'mysql') { |
| 9478 | 9842 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9518,7 +9882,9 @@ discard block |
||
| 9518 | 9882 | date_default_timezone_set($globalTimezone); |
| 9519 | 9883 | $datetime = new DateTime(); |
| 9520 | 9884 | $offset = $datetime->format('P'); |
| 9521 | - } else $offset = '+00:00'; |
|
| 9885 | + } else { |
|
| 9886 | + $offset = '+00:00'; |
|
| 9887 | + } |
|
| 9522 | 9888 | $filter_query = $this->getFilter($filters,true,true); |
| 9523 | 9889 | if ($globalDBdriver == 'mysql') { |
| 9524 | 9890 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9566,7 +9932,9 @@ discard block |
||
| 9566 | 9932 | date_default_timezone_set($globalTimezone); |
| 9567 | 9933 | $datetime = new DateTime(); |
| 9568 | 9934 | $offset = $datetime->format('P'); |
| 9569 | - } else $offset = '+00:00'; |
|
| 9935 | + } else { |
|
| 9936 | + $offset = '+00:00'; |
|
| 9937 | + } |
|
| 9570 | 9938 | |
| 9571 | 9939 | if ($globalDBdriver == 'mysql') { |
| 9572 | 9940 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9614,7 +9982,9 @@ discard block |
||
| 9614 | 9982 | date_default_timezone_set($globalTimezone); |
| 9615 | 9983 | $datetime = new DateTime(); |
| 9616 | 9984 | $offset = $datetime->format('P'); |
| 9617 | - } else $offset = '+00:00'; |
|
| 9985 | + } else { |
|
| 9986 | + $offset = '+00:00'; |
|
| 9987 | + } |
|
| 9618 | 9988 | |
| 9619 | 9989 | if ($globalDBdriver == 'mysql') { |
| 9620 | 9990 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9661,7 +10031,9 @@ discard block |
||
| 9661 | 10031 | date_default_timezone_set($globalTimezone); |
| 9662 | 10032 | $datetime = new DateTime(); |
| 9663 | 10033 | $offset = $datetime->format('P'); |
| 9664 | - } else $offset = '+00:00'; |
|
| 10034 | + } else { |
|
| 10035 | + $offset = '+00:00'; |
|
| 10036 | + } |
|
| 9665 | 10037 | |
| 9666 | 10038 | if ($globalDBdriver == 'mysql') { |
| 9667 | 10039 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9709,7 +10081,9 @@ discard block |
||
| 9709 | 10081 | date_default_timezone_set($globalTimezone); |
| 9710 | 10082 | $datetime = new DateTime(); |
| 9711 | 10083 | $offset = $datetime->format('P'); |
| 9712 | - } else $offset = '+00:00'; |
|
| 10084 | + } else { |
|
| 10085 | + $offset = '+00:00'; |
|
| 10086 | + } |
|
| 9713 | 10087 | $filter_query = $this->getFilter($filters,true,true); |
| 9714 | 10088 | if ($globalDBdriver == 'mysql') { |
| 9715 | 10089 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9754,7 +10128,9 @@ discard block |
||
| 9754 | 10128 | date_default_timezone_set($globalTimezone); |
| 9755 | 10129 | $datetime = new DateTime(); |
| 9756 | 10130 | $offset = $datetime->format('P'); |
| 9757 | - } else $offset = '+00:00'; |
|
| 10131 | + } else { |
|
| 10132 | + $offset = '+00:00'; |
|
| 10133 | + } |
|
| 9758 | 10134 | $filter_query = $this->getFilter($filters,true,true); |
| 9759 | 10135 | |
| 9760 | 10136 | if ($globalDBdriver == 'mysql') { |
@@ -9801,7 +10177,9 @@ discard block |
||
| 9801 | 10177 | date_default_timezone_set($globalTimezone); |
| 9802 | 10178 | $datetime = new DateTime(); |
| 9803 | 10179 | $offset = $datetime->format('P'); |
| 9804 | - } else $offset = '+00:00'; |
|
| 10180 | + } else { |
|
| 10181 | + $offset = '+00:00'; |
|
| 10182 | + } |
|
| 9805 | 10183 | |
| 9806 | 10184 | if ($globalDBdriver == 'mysql') { |
| 9807 | 10185 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
@@ -9847,7 +10225,9 @@ discard block |
||
| 9847 | 10225 | date_default_timezone_set($globalTimezone); |
| 9848 | 10226 | $datetime = new DateTime(); |
| 9849 | 10227 | $offset = $datetime->format('P'); |
| 9850 | - } else $offset = '+00:00'; |
|
| 10228 | + } else { |
|
| 10229 | + $offset = '+00:00'; |
|
| 10230 | + } |
|
| 9851 | 10231 | $filter_query = $this->getFilter($filters,true,true); |
| 9852 | 10232 | |
| 9853 | 10233 | if ($globalDBdriver == 'mysql') { |
@@ -9894,7 +10274,9 @@ discard block |
||
| 9894 | 10274 | date_default_timezone_set($globalTimezone); |
| 9895 | 10275 | $datetime = new DateTime(); |
| 9896 | 10276 | $offset = $datetime->format('P'); |
| 9897 | - } else $offset = '+00:00'; |
|
| 10277 | + } else { |
|
| 10278 | + $offset = '+00:00'; |
|
| 10279 | + } |
|
| 9898 | 10280 | |
| 9899 | 10281 | if ($globalDBdriver == 'mysql') { |
| 9900 | 10282 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
@@ -9941,7 +10323,9 @@ discard block |
||
| 9941 | 10323 | date_default_timezone_set($globalTimezone); |
| 9942 | 10324 | $datetime = new DateTime(); |
| 9943 | 10325 | $offset = $datetime->format('P'); |
| 9944 | - } else $offset = '+00:00'; |
|
| 10326 | + } else { |
|
| 10327 | + $offset = '+00:00'; |
|
| 10328 | + } |
|
| 9945 | 10329 | |
| 9946 | 10330 | if ($globalDBdriver == 'mysql') { |
| 9947 | 10331 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
@@ -9986,7 +10370,9 @@ discard block |
||
| 9986 | 10370 | date_default_timezone_set($globalTimezone); |
| 9987 | 10371 | $datetime = new DateTime(); |
| 9988 | 10372 | $offset = $datetime->format('P'); |
| 9989 | - } else $offset = '+00:00'; |
|
| 10373 | + } else { |
|
| 10374 | + $offset = '+00:00'; |
|
| 10375 | + } |
|
| 9990 | 10376 | $filter_query = $this->getFilter($filters,true,true); |
| 9991 | 10377 | |
| 9992 | 10378 | if ($globalDBdriver == 'mysql') { |
@@ -10034,7 +10420,9 @@ discard block |
||
| 10034 | 10420 | date_default_timezone_set($globalTimezone); |
| 10035 | 10421 | $datetime = new DateTime(); |
| 10036 | 10422 | $offset = $datetime->format('P'); |
| 10037 | - } else $offset = '+00:00'; |
|
| 10423 | + } else { |
|
| 10424 | + $offset = '+00:00'; |
|
| 10425 | + } |
|
| 10038 | 10426 | |
| 10039 | 10427 | if ($globalDBdriver == 'mysql') { |
| 10040 | 10428 | $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
@@ -10080,7 +10468,9 @@ discard block |
||
| 10080 | 10468 | date_default_timezone_set($globalTimezone); |
| 10081 | 10469 | $datetime = new DateTime(); |
| 10082 | 10470 | $offset = $datetime->format('P'); |
| 10083 | - } else $offset = '+00:00'; |
|
| 10471 | + } else { |
|
| 10472 | + $offset = '+00:00'; |
|
| 10473 | + } |
|
| 10084 | 10474 | $filter_query = $this->getFilter($filters,true,true); |
| 10085 | 10475 | |
| 10086 | 10476 | if ($globalDBdriver == 'mysql') { |
@@ -10128,7 +10518,9 @@ discard block |
||
| 10128 | 10518 | date_default_timezone_set($globalTimezone); |
| 10129 | 10519 | $datetime = new DateTime(); |
| 10130 | 10520 | $offset = $datetime->format('P'); |
| 10131 | - } else $offset = '+00:00'; |
|
| 10521 | + } else { |
|
| 10522 | + $offset = '+00:00'; |
|
| 10523 | + } |
|
| 10132 | 10524 | |
| 10133 | 10525 | if ($globalDBdriver == 'mysql') { |
| 10134 | 10526 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
@@ -10175,7 +10567,9 @@ discard block |
||
| 10175 | 10567 | date_default_timezone_set($globalTimezone); |
| 10176 | 10568 | $datetime = new DateTime(); |
| 10177 | 10569 | $offset = $datetime->format('P'); |
| 10178 | - } else $offset = '+00:00'; |
|
| 10570 | + } else { |
|
| 10571 | + $offset = '+00:00'; |
|
| 10572 | + } |
|
| 10179 | 10573 | $filter_query = $this->getFilter($filters,true,true); |
| 10180 | 10574 | if ($globalDBdriver == 'mysql') { |
| 10181 | 10575 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -10224,7 +10618,9 @@ discard block |
||
| 10224 | 10618 | date_default_timezone_set($globalTimezone); |
| 10225 | 10619 | $datetime = new DateTime(); |
| 10226 | 10620 | $offset = $datetime->format('P'); |
| 10227 | - } else $offset = '+00:00'; |
|
| 10621 | + } else { |
|
| 10622 | + $offset = '+00:00'; |
|
| 10623 | + } |
|
| 10228 | 10624 | |
| 10229 | 10625 | $orderby_sql = ''; |
| 10230 | 10626 | if ($orderby == "hour") |
@@ -10290,7 +10686,9 @@ discard block |
||
| 10290 | 10686 | date_default_timezone_set($globalTimezone); |
| 10291 | 10687 | $datetime = new DateTime(); |
| 10292 | 10688 | $offset = $datetime->format('P'); |
| 10293 | - } else $offset = '+00:00'; |
|
| 10689 | + } else { |
|
| 10690 | + $offset = '+00:00'; |
|
| 10691 | + } |
|
| 10294 | 10692 | |
| 10295 | 10693 | $orderby_sql = ''; |
| 10296 | 10694 | if ($orderby == "hour") |
@@ -10357,7 +10755,9 @@ discard block |
||
| 10357 | 10755 | date_default_timezone_set($globalTimezone); |
| 10358 | 10756 | $datetime = new DateTime(); |
| 10359 | 10757 | $offset = $datetime->format('P'); |
| 10360 | - } else $offset = '+00:00'; |
|
| 10758 | + } else { |
|
| 10759 | + $offset = '+00:00'; |
|
| 10760 | + } |
|
| 10361 | 10761 | |
| 10362 | 10762 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 10363 | 10763 | |
@@ -10408,7 +10808,9 @@ discard block |
||
| 10408 | 10808 | date_default_timezone_set($globalTimezone); |
| 10409 | 10809 | $datetime = new DateTime(); |
| 10410 | 10810 | $offset = $datetime->format('P'); |
| 10411 | - } else $offset = '+00:00'; |
|
| 10811 | + } else { |
|
| 10812 | + $offset = '+00:00'; |
|
| 10813 | + } |
|
| 10412 | 10814 | |
| 10413 | 10815 | if ($globalDBdriver == 'mysql') { |
| 10414 | 10816 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10455,7 +10857,9 @@ discard block |
||
| 10455 | 10857 | date_default_timezone_set($globalTimezone); |
| 10456 | 10858 | $datetime = new DateTime(); |
| 10457 | 10859 | $offset = $datetime->format('P'); |
| 10458 | - } else $offset = '+00:00'; |
|
| 10860 | + } else { |
|
| 10861 | + $offset = '+00:00'; |
|
| 10862 | + } |
|
| 10459 | 10863 | |
| 10460 | 10864 | if ($globalDBdriver == 'mysql') { |
| 10461 | 10865 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10502,7 +10906,9 @@ discard block |
||
| 10502 | 10906 | date_default_timezone_set($globalTimezone); |
| 10503 | 10907 | $datetime = new DateTime(); |
| 10504 | 10908 | $offset = $datetime->format('P'); |
| 10505 | - } else $offset = '+00:00'; |
|
| 10909 | + } else { |
|
| 10910 | + $offset = '+00:00'; |
|
| 10911 | + } |
|
| 10506 | 10912 | |
| 10507 | 10913 | if ($globalDBdriver == 'mysql') { |
| 10508 | 10914 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10550,7 +10956,9 @@ discard block |
||
| 10550 | 10956 | date_default_timezone_set($globalTimezone); |
| 10551 | 10957 | $datetime = new DateTime(); |
| 10552 | 10958 | $offset = $datetime->format('P'); |
| 10553 | - } else $offset = '+00:00'; |
|
| 10959 | + } else { |
|
| 10960 | + $offset = '+00:00'; |
|
| 10961 | + } |
|
| 10554 | 10962 | |
| 10555 | 10963 | if ($globalDBdriver == 'mysql') { |
| 10556 | 10964 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10598,7 +11006,9 @@ discard block |
||
| 10598 | 11006 | date_default_timezone_set($globalTimezone); |
| 10599 | 11007 | $datetime = new DateTime($date); |
| 10600 | 11008 | $offset = $datetime->format('P'); |
| 10601 | - } else $offset = '+00:00'; |
|
| 11009 | + } else { |
|
| 11010 | + $offset = '+00:00'; |
|
| 11011 | + } |
|
| 10602 | 11012 | |
| 10603 | 11013 | if ($globalDBdriver == 'mysql') { |
| 10604 | 11014 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10646,7 +11056,9 @@ discard block |
||
| 10646 | 11056 | date_default_timezone_set($globalTimezone); |
| 10647 | 11057 | $datetime = new DateTime(); |
| 10648 | 11058 | $offset = $datetime->format('P'); |
| 10649 | - } else $offset = '+00:00'; |
|
| 11059 | + } else { |
|
| 11060 | + $offset = '+00:00'; |
|
| 11061 | + } |
|
| 10650 | 11062 | |
| 10651 | 11063 | if ($globalDBdriver == 'mysql') { |
| 10652 | 11064 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10693,7 +11105,9 @@ discard block |
||
| 10693 | 11105 | date_default_timezone_set($globalTimezone); |
| 10694 | 11106 | $datetime = new DateTime(); |
| 10695 | 11107 | $offset = $datetime->format('P'); |
| 10696 | - } else $offset = '+00:00'; |
|
| 11108 | + } else { |
|
| 11109 | + $offset = '+00:00'; |
|
| 11110 | + } |
|
| 10697 | 11111 | |
| 10698 | 11112 | if ($globalDBdriver == 'mysql') { |
| 10699 | 11113 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10740,7 +11154,9 @@ discard block |
||
| 10740 | 11154 | date_default_timezone_set($globalTimezone); |
| 10741 | 11155 | $datetime = new DateTime(); |
| 10742 | 11156 | $offset = $datetime->format('P'); |
| 10743 | - } else $offset = '+00:00'; |
|
| 11157 | + } else { |
|
| 11158 | + $offset = '+00:00'; |
|
| 11159 | + } |
|
| 10744 | 11160 | |
| 10745 | 11161 | if ($globalDBdriver == 'mysql') { |
| 10746 | 11162 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10790,7 +11206,9 @@ discard block |
||
| 10790 | 11206 | date_default_timezone_set($globalTimezone); |
| 10791 | 11207 | $datetime = new DateTime(); |
| 10792 | 11208 | $offset = $datetime->format('P'); |
| 10793 | - } else $offset = '+00:00'; |
|
| 11209 | + } else { |
|
| 11210 | + $offset = '+00:00'; |
|
| 11211 | + } |
|
| 10794 | 11212 | |
| 10795 | 11213 | if ($globalDBdriver == 'mysql') { |
| 10796 | 11214 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10837,7 +11255,9 @@ discard block |
||
| 10837 | 11255 | date_default_timezone_set($globalTimezone); |
| 10838 | 11256 | $datetime = new DateTime(); |
| 10839 | 11257 | $offset = $datetime->format('P'); |
| 10840 | - } else $offset = '+00:00'; |
|
| 11258 | + } else { |
|
| 11259 | + $offset = '+00:00'; |
|
| 11260 | + } |
|
| 10841 | 11261 | |
| 10842 | 11262 | if ($globalDBdriver == 'mysql') { |
| 10843 | 11263 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11048,8 +11468,11 @@ discard block |
||
| 11048 | 11468 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11049 | 11469 | } |
| 11050 | 11470 | } |
| 11051 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 11052 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11471 | + if (empty($query_values)) { |
|
| 11472 | + $queryi .= $this->getFilter($filters); |
|
| 11473 | + } else { |
|
| 11474 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11475 | + } |
|
| 11053 | 11476 | |
| 11054 | 11477 | $sth = $this->db->prepare($queryi); |
| 11055 | 11478 | $sth->execute($query_values); |
@@ -11127,8 +11550,11 @@ discard block |
||
| 11127 | 11550 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11128 | 11551 | } |
| 11129 | 11552 | } |
| 11130 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11131 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11553 | + if ($query == '') { |
|
| 11554 | + $queryi .= $this->getFilter($filters); |
|
| 11555 | + } else { |
|
| 11556 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11557 | + } |
|
| 11132 | 11558 | |
| 11133 | 11559 | |
| 11134 | 11560 | $sth = $this->db->prepare($queryi); |
@@ -11151,7 +11577,9 @@ discard block |
||
| 11151 | 11577 | date_default_timezone_set($globalTimezone); |
| 11152 | 11578 | $datetime = new DateTime(); |
| 11153 | 11579 | $offset = $datetime->format('P'); |
| 11154 | - } else $offset = '+00:00'; |
|
| 11580 | + } else { |
|
| 11581 | + $offset = '+00:00'; |
|
| 11582 | + } |
|
| 11155 | 11583 | |
| 11156 | 11584 | if ($globalDBdriver == 'mysql') { |
| 11157 | 11585 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11337,7 +11765,9 @@ discard block |
||
| 11337 | 11765 | */ |
| 11338 | 11766 | public function parseDirection($direction = 0) |
| 11339 | 11767 | { |
| 11340 | - if ($direction == '') $direction = 0; |
|
| 11768 | + if ($direction == '') { |
|
| 11769 | + $direction = 0; |
|
| 11770 | + } |
|
| 11341 | 11771 | $direction_array = array(); |
| 11342 | 11772 | $temp_array = array(); |
| 11343 | 11773 | |
@@ -11438,7 +11868,9 @@ discard block |
||
| 11438 | 11868 | if (isset($result->AirlineFlightInfoResult)) |
| 11439 | 11869 | { |
| 11440 | 11870 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 11441 | - } else return ''; |
|
| 11871 | + } else { |
|
| 11872 | + return ''; |
|
| 11873 | + } |
|
| 11442 | 11874 | |
| 11443 | 11875 | $registration = $this->convertAircraftRegistration($registration); |
| 11444 | 11876 | |
@@ -11472,7 +11904,9 @@ discard block |
||
| 11472 | 11904 | return $row['registration']; |
| 11473 | 11905 | } elseif ($source_type == 'flarm') { |
| 11474 | 11906 | return $this->getAircraftRegistrationBymodeS($aircraft_modes); |
| 11475 | - } else return ''; |
|
| 11907 | + } else { |
|
| 11908 | + return ''; |
|
| 11909 | + } |
|
| 11476 | 11910 | |
| 11477 | 11911 | } |
| 11478 | 11912 | |
@@ -11499,11 +11933,16 @@ discard block |
||
| 11499 | 11933 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11500 | 11934 | $sth->closeCursor(); |
| 11501 | 11935 | if (count($row) > 0) { |
| 11502 | - if ($row['type_flight'] == null) return ''; |
|
| 11503 | - else return $row['type_flight']; |
|
| 11936 | + if ($row['type_flight'] == null) { |
|
| 11937 | + return ''; |
|
| 11938 | + } else { |
|
| 11939 | + return $row['type_flight']; |
|
| 11940 | + } |
|
| 11504 | 11941 | } elseif ($source_type == 'flarm') { |
| 11505 | 11942 | return $this->getAircraftTypeBymodeS($aircraft_modes); |
| 11506 | - } else return ''; |
|
| 11943 | + } else { |
|
| 11944 | + return ''; |
|
| 11945 | + } |
|
| 11507 | 11946 | |
| 11508 | 11947 | } |
| 11509 | 11948 | |
@@ -11521,7 +11960,9 @@ discard block |
||
| 11521 | 11960 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 11522 | 11961 | |
| 11523 | 11962 | $Connection = new Connection($this->db); |
| 11524 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11963 | + if (!$Connection->tableExists('countries')) { |
|
| 11964 | + return ''; |
|
| 11965 | + } |
|
| 11525 | 11966 | |
| 11526 | 11967 | try { |
| 11527 | 11968 | /* |
@@ -11541,9 +11982,13 @@ discard block |
||
| 11541 | 11982 | $sth->closeCursor(); |
| 11542 | 11983 | if (count($row) > 0) { |
| 11543 | 11984 | return $row; |
| 11544 | - } else return ''; |
|
| 11985 | + } else { |
|
| 11986 | + return ''; |
|
| 11987 | + } |
|
| 11545 | 11988 | } catch (PDOException $e) { |
| 11546 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11989 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11990 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11991 | + } |
|
| 11547 | 11992 | return ''; |
| 11548 | 11993 | } |
| 11549 | 11994 | |
@@ -11561,7 +12006,9 @@ discard block |
||
| 11561 | 12006 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 11562 | 12007 | |
| 11563 | 12008 | $Connection = new Connection($this->db); |
| 11564 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 12009 | + if (!$Connection->tableExists('countries')) { |
|
| 12010 | + return ''; |
|
| 12011 | + } |
|
| 11565 | 12012 | |
| 11566 | 12013 | try { |
| 11567 | 12014 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -11573,9 +12020,13 @@ discard block |
||
| 11573 | 12020 | $sth->closeCursor(); |
| 11574 | 12021 | if (count($row) > 0) { |
| 11575 | 12022 | return $row; |
| 11576 | - } else return ''; |
|
| 12023 | + } else { |
|
| 12024 | + return ''; |
|
| 12025 | + } |
|
| 11577 | 12026 | } catch (PDOException $e) { |
| 11578 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 12027 | + if (isset($globalDebug) && $globalDebug) { |
|
| 12028 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 12029 | + } |
|
| 11579 | 12030 | return ''; |
| 11580 | 12031 | } |
| 11581 | 12032 | |
@@ -11825,7 +12276,9 @@ discard block |
||
| 11825 | 12276 | { |
| 11826 | 12277 | global $globalBitlyAccessToken; |
| 11827 | 12278 | |
| 11828 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 12279 | + if ($globalBitlyAccessToken == '') { |
|
| 12280 | + return $url; |
|
| 12281 | + } |
|
| 11829 | 12282 | |
| 11830 | 12283 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 11831 | 12284 | |
@@ -11974,7 +12427,9 @@ discard block |
||
| 11974 | 12427 | |
| 11975 | 12428 | |
| 11976 | 12429 | // routes |
| 11977 | - if ($globalDebug) print "Routes...\n"; |
|
| 12430 | + if ($globalDebug) { |
|
| 12431 | + print "Routes...\n"; |
|
| 12432 | + } |
|
| 11978 | 12433 | if ($globalDBdriver == 'mysql') { |
| 11979 | 12434 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
| 11980 | 12435 | } else { |
@@ -11993,7 +12448,9 @@ discard block |
||
| 11993 | 12448 | } |
| 11994 | 12449 | } |
| 11995 | 12450 | |
| 11996 | - if ($globalDebug) print "Airlines...\n"; |
|
| 12451 | + if ($globalDebug) { |
|
| 12452 | + print "Airlines...\n"; |
|
| 12453 | + } |
|
| 11997 | 12454 | //airlines |
| 11998 | 12455 | if ($globalDBdriver == 'mysql') { |
| 11999 | 12456 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -12007,10 +12464,15 @@ discard block |
||
| 12007 | 12464 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 12008 | 12465 | { |
| 12009 | 12466 | $fromsource = NULL; |
| 12010 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 12011 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 12012 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 12013 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 12467 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 12468 | + $fromsource = 'vatsim'; |
|
| 12469 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 12470 | + $fromsource = 'ivao'; |
|
| 12471 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 12472 | + $fromsource = 'vatsim'; |
|
| 12473 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 12474 | + $fromsource = 'ivao'; |
|
| 12475 | + } |
|
| 12014 | 12476 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 12015 | 12477 | if (isset($airline_array[0]['name'])) { |
| 12016 | 12478 | $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
@@ -12020,13 +12482,17 @@ discard block |
||
| 12020 | 12482 | } |
| 12021 | 12483 | } |
| 12022 | 12484 | |
| 12023 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12485 | + if ($globalDebug) { |
|
| 12486 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12487 | + } |
|
| 12024 | 12488 | //duplicate modes |
| 12025 | 12489 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
| 12026 | 12490 | $sth = $this->db->prepare($query); |
| 12027 | 12491 | $sth->execute(); |
| 12028 | 12492 | |
| 12029 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 12493 | + if ($globalDebug) { |
|
| 12494 | + print "Aircraft...\n"; |
|
| 12495 | + } |
|
| 12030 | 12496 | //aircraft |
| 12031 | 12497 | if ($globalDBdriver == 'mysql') { |
| 12032 | 12498 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -12069,26 +12535,38 @@ discard block |
||
| 12069 | 12535 | if (isset($closestAirports[0])) { |
| 12070 | 12536 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 12071 | 12537 | $airport_icao = $closestAirports[0]['icao']; |
| 12072 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12538 | + if ($globalDebug) { |
|
| 12539 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12540 | + } |
|
| 12073 | 12541 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 12074 | 12542 | foreach ($closestAirports as $airport) { |
| 12075 | 12543 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 12076 | 12544 | $airport_icao = $airport['icao']; |
| 12077 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12545 | + if ($globalDebug) { |
|
| 12546 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12547 | + } |
|
| 12078 | 12548 | break; |
| 12079 | 12549 | } |
| 12080 | 12550 | } |
| 12081 | 12551 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 12082 | 12552 | $airport_icao = $closestAirports[0]['icao']; |
| 12083 | - if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12553 | + if ($globalDebug) { |
|
| 12554 | + echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12555 | + } |
|
| 12084 | 12556 | } else { |
| 12085 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12557 | + if ($globalDebug) { |
|
| 12558 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12559 | + } |
|
| 12086 | 12560 | } |
| 12087 | 12561 | } else { |
| 12088 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12562 | + if ($globalDebug) { |
|
| 12563 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12564 | + } |
|
| 12089 | 12565 | } |
| 12090 | 12566 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 12091 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12567 | + if ($globalDebug) { |
|
| 12568 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12569 | + } |
|
| 12092 | 12570 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 12093 | 12571 | $sthu = $this->db->prepare($update_query); |
| 12094 | 12572 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -8,20 +8,20 @@ discard block |
||
| 8 | 8 | require_once(dirname(__FILE__).'/class.Stats.php'); |
| 9 | 9 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 10 | 10 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 11 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 11 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | class SpotterImport { |
| 15 | - private $all_flights = array(); |
|
| 16 | - private $last_delete_hourly = 0; |
|
| 17 | - private $last_delete = 0; |
|
| 18 | - private $stats = array(); |
|
| 19 | - private $tmd = 0; |
|
| 20 | - private $source_location = array(); |
|
| 21 | - public $db = null; |
|
| 22 | - public $nb = 0; |
|
| 23 | - |
|
| 24 | - public function __construct($dbc = null) { |
|
| 15 | + private $all_flights = array(); |
|
| 16 | + private $last_delete_hourly = 0; |
|
| 17 | + private $last_delete = 0; |
|
| 18 | + private $stats = array(); |
|
| 19 | + private $tmd = 0; |
|
| 20 | + private $source_location = array(); |
|
| 21 | + public $db = null; |
|
| 22 | + public $nb = 0; |
|
| 23 | + |
|
| 24 | + public function __construct($dbc = null) { |
|
| 25 | 25 | global $globalBeta, $globalServerAPRS, $APRSSpotter, $globalNoDB; |
| 26 | 26 | if (!(isset($globalNoDB) && $globalNoDB)) { |
| 27 | 27 | $Connection = new Connection($dbc); |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | $currentdate = date('Y-m-d'); |
| 34 | 34 | $sourcestat = $Stats->getStatsSource($currentdate); |
| 35 | 35 | if (!empty($sourcestat)) { |
| 36 | - foreach($sourcestat as $srcst) { |
|
| 37 | - $type = $srcst['stats_type']; |
|
| 36 | + foreach($sourcestat as $srcst) { |
|
| 37 | + $type = $srcst['stats_type']; |
|
| 38 | 38 | if ($type == 'polar' || $type == 'hist') { |
| 39 | - $source = $srcst['source_name']; |
|
| 40 | - $data = $srcst['source_data']; |
|
| 41 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 42 | - } |
|
| 43 | - } |
|
| 39 | + $source = $srcst['source_name']; |
|
| 40 | + $data = $srcst['source_data']; |
|
| 41 | + $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | //$APRSSpotter->connect(); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function get_Schedule($id,$ident) { |
|
| 53 | + public function get_Schedule($id,$ident) { |
|
| 54 | 54 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 55 | 55 | // Get schedule here, so it's done only one time |
| 56 | 56 | |
@@ -70,42 +70,42 @@ discard block |
||
| 70 | 70 | $operator = $Spotter->getOperator($ident); |
| 71 | 71 | $scheduleexist = false; |
| 72 | 72 | if ($Schedule->checkSchedule($operator) == 0) { |
| 73 | - $operator = $Translation->checkTranslation($ident); |
|
| 74 | - if ($Schedule->checkSchedule($operator) == 0) { |
|
| 73 | + $operator = $Translation->checkTranslation($ident); |
|
| 74 | + if ($Schedule->checkSchedule($operator) == 0) { |
|
| 75 | 75 | $schedule = $Schedule->fetchSchedule($operator); |
| 76 | 76 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 77 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 78 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 79 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 80 | - // Should also check if route schedule = route from DB |
|
| 81 | - if ($schedule['DepartureAirportIATA'] != '') { |
|
| 77 | + if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 78 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 79 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 80 | + // Should also check if route schedule = route from DB |
|
| 81 | + if ($schedule['DepartureAirportIATA'] != '') { |
|
| 82 | 82 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
| 83 | - $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 84 | - if (trim($airport_icao) != '') { |
|
| 83 | + $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 84 | + if (trim($airport_icao) != '') { |
|
| 85 | 85 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 86 | 86 | if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
| 87 | - } |
|
| 87 | + } |
|
| 88 | + } |
|
| 88 | 89 | } |
| 89 | - } |
|
| 90 | - if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 90 | + if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 91 | 91 | if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) { |
| 92 | - $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 93 | - if (trim($airport_icao) != '') { |
|
| 92 | + $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 93 | + if (trim($airport_icao) != '') { |
|
| 94 | 94 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 95 | 95 | if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
| 96 | - } |
|
| 96 | + } |
|
| 97 | 97 | } |
| 98 | - } |
|
| 99 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 98 | + } |
|
| 99 | + $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 100 | 100 | } |
| 101 | - } else $scheduleexist = true; |
|
| 101 | + } else $scheduleexist = true; |
|
| 102 | 102 | } else $scheduleexist = true; |
| 103 | 103 | // close connection, at least one way will work ? |
| 104 | - if ($scheduleexist) { |
|
| 104 | + if ($scheduleexist) { |
|
| 105 | 105 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
| 106 | - $sch = $Schedule->getSchedule($operator); |
|
| 106 | + $sch = $Schedule->getSchedule($operator); |
|
| 107 | 107 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
| 108 | - } |
|
| 108 | + } |
|
| 109 | 109 | $Spotter->db = null; |
| 110 | 110 | $Schedule->db = null; |
| 111 | 111 | $Translation->db = null; |
@@ -120,96 +120,96 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | */ |
| 122 | 122 | } |
| 123 | - } |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - public function checkAll() { |
|
| 125 | + public function checkAll() { |
|
| 126 | 126 | global $globalDebug, $globalNoImport; |
| 127 | 127 | if ($globalDebug) echo "Update last seen flights data...\n"; |
| 128 | 128 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 129 | - foreach ($this->all_flights as $key => $flight) { |
|
| 129 | + foreach ($this->all_flights as $key => $flight) { |
|
| 130 | 130 | if (isset($this->all_flights[$key]['id'])) { |
| 131 | - //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
|
| 132 | - $Spotter = new Spotter($this->db); |
|
| 133 | - $real_arrival = $this->arrival($key); |
|
| 134 | - if (isset($this->all_flights[$key]['altitude'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 135 | - } |
|
| 136 | - } |
|
| 131 | + //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
|
| 132 | + $Spotter = new Spotter($this->db); |
|
| 133 | + $real_arrival = $this->arrival($key); |
|
| 134 | + if (isset($this->all_flights[$key]['altitude'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + } |
|
| 137 | 138 | } |
| 138 | - } |
|
| 139 | 139 | |
| 140 | - public function arrival($key) { |
|
| 140 | + public function arrival($key) { |
|
| 141 | 141 | global $globalClosestMinDist, $globalDebug; |
| 142 | 142 | if ($globalDebug) echo 'Update arrival...'."\n"; |
| 143 | 143 | $Spotter = new Spotter($this->db); |
| 144 | - $airport_icao = ''; |
|
| 145 | - $airport_time = ''; |
|
| 146 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 144 | + $airport_icao = ''; |
|
| 145 | + $airport_time = ''; |
|
| 146 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 147 | 147 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 148 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 149 | - if (isset($closestAirports[0])) { |
|
| 150 | - if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 151 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 152 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 153 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 154 | - } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 155 | - foreach ($closestAirports as $airport) { |
|
| 156 | - if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 157 | - $airport_icao = $airport['icao']; |
|
| 158 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 159 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 160 | - break; |
|
| 161 | - } |
|
| 162 | - } |
|
| 163 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 164 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 165 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 166 | - } else { |
|
| 167 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 168 | - } |
|
| 169 | - } else { |
|
| 170 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - } else { |
|
| 174 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 175 | - } |
|
| 176 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - |
|
| 180 | - |
|
| 181 | - public function del() { |
|
| 148 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 149 | + if (isset($closestAirports[0])) { |
|
| 150 | + if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 151 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 152 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 153 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 154 | + } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 155 | + foreach ($closestAirports as $airport) { |
|
| 156 | + if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 157 | + $airport_icao = $airport['icao']; |
|
| 158 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 159 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 160 | + break; |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 164 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 165 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 166 | + } else { |
|
| 167 | + if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 168 | + } |
|
| 169 | + } else { |
|
| 170 | + if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + } else { |
|
| 174 | + if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 175 | + } |
|
| 176 | + return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + |
|
| 180 | + |
|
| 181 | + public function del() { |
|
| 182 | 182 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 183 | 183 | // Delete old infos |
| 184 | 184 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 185 | 185 | foreach ($this->all_flights as $key => $flight) { |
| 186 | - if (isset($flight['lastupdate'])) { |
|
| 187 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 188 | - if (isset($this->all_flights[$key]['id'])) { |
|
| 189 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 186 | + if (isset($flight['lastupdate'])) { |
|
| 187 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 188 | + if (isset($this->all_flights[$key]['id'])) { |
|
| 189 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 190 | 190 | /* |
| 191 | 191 | $SpotterLive = new SpotterLive(); |
| 192 | 192 | $SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']); |
| 193 | 193 | $SpotterLive->db = null; |
| 194 | 194 | */ |
| 195 | 195 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 196 | - $real_arrival = $this->arrival($key); |
|
| 197 | - $Spotter = new Spotter($this->db); |
|
| 198 | - if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
| 196 | + $real_arrival = $this->arrival($key); |
|
| 197 | + $Spotter = new Spotter($this->db); |
|
| 198 | + if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
| 199 | 199 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
| 200 | 200 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 201 | - } |
|
| 201 | + } |
|
| 202 | 202 | // Put in archive |
| 203 | 203 | // $Spotter->db = null; |
| 204 | 204 | } |
| 205 | - } |
|
| 206 | - unset($this->all_flights[$key]); |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - } |
|
| 210 | - } |
|
| 205 | + } |
|
| 206 | + unset($this->all_flights[$key]); |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - public function add($line) { |
|
| 212 | + public function add($line) { |
|
| 213 | 213 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB; |
| 214 | 214 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 215 | 215 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
@@ -234,18 +234,18 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // SBS format is CSV format |
| 236 | 236 | if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
| 237 | - //print_r($line); |
|
| 238 | - if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
| 237 | + //print_r($line); |
|
| 238 | + if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
| 239 | 239 | |
| 240 | 240 | // Increment message number |
| 241 | 241 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 242 | - $current_date = date('Y-m-d'); |
|
| 243 | - $source = $line['source_name']; |
|
| 244 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 245 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 246 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 247 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 248 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 242 | + $current_date = date('Y-m-d'); |
|
| 243 | + $source = $line['source_name']; |
|
| 244 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 245 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 246 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 247 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 248 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /* |
@@ -261,49 +261,49 @@ discard block |
||
| 261 | 261 | //$this->db = $dbc; |
| 262 | 262 | |
| 263 | 263 | //$hex = trim($line['hex']); |
| 264 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 265 | - else $id = trim($line['id']); |
|
| 264 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 265 | + else $id = trim($line['id']); |
|
| 266 | 266 | |
| 267 | 267 | if (!isset($this->all_flights[$id])) { |
| 268 | - $this->all_flights[$id] = array(); |
|
| 269 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 270 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
| 271 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 272 | - if (!isset($line['id'])) { |
|
| 268 | + $this->all_flights[$id] = array(); |
|
| 269 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 270 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
| 271 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 272 | + if (!isset($line['id'])) { |
|
| 273 | 273 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 274 | 274 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
| 275 | 275 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 276 | 276 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 277 | - //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 278 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 279 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 277 | + //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 278 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 279 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 280 | 280 | } |
| 281 | 281 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 282 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 282 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | //print_r($this->all_flights); |
| 286 | 286 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
| 287 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 288 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 287 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 288 | + //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 289 | 289 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 290 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 291 | - if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') { |
|
| 290 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 291 | + if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') { |
|
| 292 | 292 | $timeelapsed = microtime(true); |
| 293 | 293 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 294 | - $Spotter = new Spotter($this->db); |
|
| 295 | - if (isset($this->all_flights[$id]['source_type'])) { |
|
| 294 | + $Spotter = new Spotter($this->db); |
|
| 295 | + if (isset($this->all_flights[$id]['source_type'])) { |
|
| 296 | 296 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
| 297 | - } else { |
|
| 297 | + } else { |
|
| 298 | 298 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 299 | - } |
|
| 300 | - $Spotter->db = null; |
|
| 301 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 302 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 299 | + } |
|
| 300 | + $Spotter->db = null; |
|
| 301 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 302 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 303 | 303 | } |
| 304 | - } |
|
| 305 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 306 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 304 | + } |
|
| 305 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 306 | + if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 307 | 307 | } |
| 308 | 308 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
| 309 | 309 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
@@ -329,9 +329,9 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 331 | 331 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) { |
| 332 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 332 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 333 | 333 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 334 | - } else { |
|
| 334 | + } else { |
|
| 335 | 335 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 336 | 336 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 337 | 337 | /* |
@@ -340,43 +340,43 @@ discard block |
||
| 340 | 340 | print_r($line); |
| 341 | 341 | */ |
| 342 | 342 | return ''; |
| 343 | - } |
|
| 343 | + } |
|
| 344 | 344 | } else { |
| 345 | 345 | date_default_timezone_set('UTC'); |
| 346 | 346 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
| 350 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 350 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 351 | 351 | } |
| 352 | 352 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 353 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 353 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 354 | 354 | } |
| 355 | 355 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 356 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
| 356 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
| 357 | 357 | } |
| 358 | 358 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 359 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
| 359 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
| 363 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 364 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 363 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 364 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 365 | 365 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 366 | - $timeelapsed = microtime(true); |
|
| 367 | - $Spotter = new Spotter($this->db); |
|
| 368 | - $fromsource = NULL; |
|
| 369 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 370 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 371 | - elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 372 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 373 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 374 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 375 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 376 | - $Spotter->db = null; |
|
| 377 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 378 | - } |
|
| 379 | - } |
|
| 366 | + $timeelapsed = microtime(true); |
|
| 367 | + $Spotter = new Spotter($this->db); |
|
| 368 | + $fromsource = NULL; |
|
| 369 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 370 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 371 | + elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 372 | + elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 373 | + elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 374 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 375 | + if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 376 | + $Spotter->db = null; |
|
| 377 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 378 | + } |
|
| 379 | + } |
|
| 380 | 380 | |
| 381 | 381 | /* |
| 382 | 382 | if (!isset($line['id'])) { |
@@ -386,104 +386,104 @@ discard block |
||
| 386 | 386 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 387 | 387 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 388 | 388 | */ |
| 389 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 389 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 390 | 390 | |
| 391 | - //$putinarchive = true; |
|
| 392 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 391 | + //$putinarchive = true; |
|
| 392 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 393 | 393 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
| 394 | - } |
|
| 395 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 394 | + } |
|
| 395 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 396 | 396 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
| 397 | - } |
|
| 398 | - if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 399 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 400 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 397 | + } |
|
| 398 | + if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 399 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 400 | + } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 401 | 401 | $timeelapsed = microtime(true); |
| 402 | 402 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 403 | 403 | $Spotter = new Spotter($this->db); |
| 404 | 404 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 405 | 405 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 406 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 406 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 407 | 407 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 408 | - } |
|
| 409 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 408 | + } |
|
| 409 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 410 | 410 | $timeelapsed = microtime(true); |
| 411 | 411 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 412 | - $Spotter = new Spotter($this->db); |
|
| 413 | - $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
| 414 | - if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
| 412 | + $Spotter = new Spotter($this->db); |
|
| 413 | + $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
| 414 | + if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
| 415 | 415 | $Translation = new Translation($this->db); |
| 416 | 416 | $ident = $Translation->checkTranslation(trim($line['ident'])); |
| 417 | 417 | $route = $Spotter->getRouteInfo($ident); |
| 418 | 418 | $Translation->db = null; |
| 419 | - } |
|
| 420 | - $Spotter->db = null; |
|
| 421 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 422 | - } |
|
| 419 | + } |
|
| 420 | + $Spotter->db = null; |
|
| 421 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 422 | + } |
|
| 423 | 423 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 424 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 425 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 424 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 425 | + if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 426 | 426 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
| 427 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 428 | - } |
|
| 427 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 428 | + } |
|
| 429 | 429 | } |
| 430 | 430 | if (!isset($globalFork)) $globalFork = TRUE; |
| 431 | 431 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 432 | 432 | if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
| 433 | 433 | } |
| 434 | - } |
|
| 434 | + } |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | if (isset($line['speed']) && $line['speed'] != '') { |
| 438 | 438 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 439 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 440 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 441 | - //$dataFound = true; |
|
| 439 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 440 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 441 | + //$dataFound = true; |
|
| 442 | 442 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 443 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 444 | - if ($distance > 1000 && $distance < 10000) { |
|
| 445 | - // use datetime |
|
| 443 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 444 | + if ($distance > 1000 && $distance < 10000) { |
|
| 445 | + // use datetime |
|
| 446 | 446 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 447 | 447 | $speed = $speed*3.6; |
| 448 | 448 | if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
| 449 | 449 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
| 450 | - } |
|
| 450 | + } |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | |
| 454 | 454 | |
| 455 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 456 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 457 | - else unset($timediff); |
|
| 458 | - if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
| 455 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 456 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 457 | + else unset($timediff); |
|
| 458 | + if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
| 459 | 459 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
| 460 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 460 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 461 | 461 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 462 | 462 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 463 | 463 | $this->all_flights[$id]['putinarchive'] = true; |
| 464 | 464 | $this->tmd = 0; |
| 465 | 465 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 466 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 467 | - $timeelapsed = microtime(true); |
|
| 468 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 466 | + if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 467 | + $timeelapsed = microtime(true); |
|
| 468 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 469 | 469 | $Spotter = new Spotter($this->db); |
| 470 | 470 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 471 | 471 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
| 472 | 472 | $Spotter->db = null; |
| 473 | 473 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 474 | 474 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 475 | - } |
|
| 475 | + } |
|
| 476 | + } |
|
| 476 | 477 | } |
| 477 | - } |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 481 | - //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 481 | + //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 482 | 482 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 483 | 483 | if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 484 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 485 | - $dataFound = true; |
|
| 486 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 484 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 485 | + $dataFound = true; |
|
| 486 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 487 | 487 | } |
| 488 | 488 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 489 | 489 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -494,20 +494,20 @@ discard block |
||
| 494 | 494 | //$putinarchive = true; |
| 495 | 495 | } |
| 496 | 496 | */ |
| 497 | - /* |
|
| 497 | + /* |
|
| 498 | 498 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
| 499 | 499 | if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n"; |
| 500 | 500 | } |
| 501 | 501 | */ |
| 502 | 502 | } |
| 503 | 503 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 504 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 505 | - //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 504 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 505 | + //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 506 | 506 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 507 | 507 | if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 508 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 509 | - $dataFound = true; |
|
| 510 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 508 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 509 | + $dataFound = true; |
|
| 510 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 511 | 511 | } |
| 512 | 512 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 513 | 513 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -525,95 +525,95 @@ discard block |
||
| 525 | 525 | */ |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | - } else if ($globalDebug && $timediff > 30) { |
|
| 528 | + } else if ($globalDebug && $timediff > 30) { |
|
| 529 | 529 | $this->tmd = $this->tmd + 1; |
| 530 | 530 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 531 | 531 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
| 532 | 532 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 533 | 533 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 534 | - } |
|
| 534 | + } |
|
| 535 | 535 | } |
| 536 | 536 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 537 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 538 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 537 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 538 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 539 | 539 | } |
| 540 | 540 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 541 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 542 | - //$dataFound = true; |
|
| 541 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 542 | + //$dataFound = true; |
|
| 543 | 543 | } |
| 544 | 544 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 545 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 545 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 546 | 546 | } |
| 547 | 547 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 548 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 548 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 549 | 549 | } |
| 550 | 550 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 551 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 552 | - //$dataFound = true; |
|
| 551 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 552 | + //$dataFound = true; |
|
| 553 | 553 | } |
| 554 | 554 | if (isset($line['ground']) && $line['ground'] != '') { |
| 555 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 555 | + if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 556 | 556 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 557 | 557 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 558 | 558 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 559 | 559 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
| 560 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 560 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 561 | 561 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 562 | - } |
|
| 563 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 564 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 565 | - //$dataFound = true; |
|
| 562 | + } |
|
| 563 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 564 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 565 | + //$dataFound = true; |
|
| 566 | 566 | } |
| 567 | 567 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 568 | - if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
| 569 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 570 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 571 | - $highlight = ''; |
|
| 572 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 573 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 574 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 575 | - if ($highlight != '') { |
|
| 568 | + if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
| 569 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 570 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 571 | + $highlight = ''; |
|
| 572 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 573 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 574 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 575 | + if ($highlight != '') { |
|
| 576 | 576 | $timeelapsed = microtime(true); |
| 577 | 577 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 578 | - $Spotter = new Spotter($this->db); |
|
| 579 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 580 | - $Spotter->db = null; |
|
| 581 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 578 | + $Spotter = new Spotter($this->db); |
|
| 579 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 580 | + $Spotter->db = null; |
|
| 581 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 582 | 582 | } |
| 583 | 583 | //$putinarchive = true; |
| 584 | 584 | //$highlight = ''; |
| 585 | - } |
|
| 585 | + } |
|
| 586 | 586 | |
| 587 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 588 | - //$dataFound = true; |
|
| 587 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 588 | + //$dataFound = true; |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 592 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 592 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 593 | 593 | if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
| 594 | 594 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 595 | 595 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 596 | 596 | //$dataFound = true; |
| 597 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 597 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 601 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 601 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | if (isset($line['heading']) && $line['heading'] != '') { |
| 605 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 606 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 607 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 608 | - //$dataFound = true; |
|
| 605 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 606 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 607 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 608 | + //$dataFound = true; |
|
| 609 | 609 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 610 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 611 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 612 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 613 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 610 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 611 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 612 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 613 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 614 | 614 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 615 | - // If not enough messages and ACARS set heading to 0 |
|
| 616 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 615 | + // If not enough messages and ACARS set heading to 0 |
|
| 616 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 617 | 617 | } |
| 618 | 618 | if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 619 | 619 | elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -624,125 +624,125 @@ discard block |
||
| 624 | 624 | //if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 625 | 625 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 626 | 626 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
| 627 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
| 628 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 629 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 630 | - //print_r($this->all_flights); |
|
| 631 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 632 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 633 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 627 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
| 628 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 629 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 630 | + //print_r($this->all_flights); |
|
| 631 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 632 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 633 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 634 | 634 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 635 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 636 | - $timeelapsed = microtime(true); |
|
| 637 | - $SpotterLive = new SpotterLive($this->db); |
|
| 638 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
|
| 635 | + if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 636 | + $timeelapsed = microtime(true); |
|
| 637 | + $SpotterLive = new SpotterLive($this->db); |
|
| 638 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
|
| 639 | 639 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 640 | 640 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 641 | - } elseif (isset($line['id'])) { |
|
| 641 | + } elseif (isset($line['id'])) { |
|
| 642 | 642 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 643 | 643 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 644 | - } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
| 644 | + } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
| 645 | 645 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 646 | 646 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 647 | - } else $recent_ident = ''; |
|
| 648 | - $SpotterLive->db=null; |
|
| 649 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 650 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 647 | + } else $recent_ident = ''; |
|
| 648 | + $SpotterLive->db=null; |
|
| 649 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 650 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 651 | 651 | } else $recent_ident = ''; |
| 652 | - } else { |
|
| 652 | + } else { |
|
| 653 | 653 | $recent_ident = ''; |
| 654 | 654 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
| 655 | - } |
|
| 656 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 657 | - if($recent_ident == "") |
|
| 658 | - { |
|
| 655 | + } |
|
| 656 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 657 | + if($recent_ident == "") |
|
| 658 | + { |
|
| 659 | 659 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 660 | 660 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 661 | 661 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 662 | 662 | //adds the spotter data for the archive |
| 663 | 663 | $ignoreImport = false; |
| 664 | 664 | foreach($globalAirportIgnore as $airportIgnore) { |
| 665 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 665 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 666 | 666 | $ignoreImport = true; |
| 667 | - } |
|
| 667 | + } |
|
| 668 | 668 | } |
| 669 | 669 | if (count($globalAirportAccept) > 0) { |
| 670 | - $ignoreImport = true; |
|
| 671 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 670 | + $ignoreImport = true; |
|
| 671 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 672 | 672 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 673 | - $ignoreImport = false; |
|
| 673 | + $ignoreImport = false; |
|
| 674 | + } |
|
| 674 | 675 | } |
| 675 | - } |
|
| 676 | 676 | } |
| 677 | 677 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 678 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 678 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 679 | 679 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
| 680 | - $ignoreImport = true; |
|
| 680 | + $ignoreImport = true; |
|
| 681 | + } |
|
| 681 | 682 | } |
| 682 | - } |
|
| 683 | 683 | } |
| 684 | 684 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 685 | - $ignoreImport = true; |
|
| 686 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 685 | + $ignoreImport = true; |
|
| 686 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
| 687 | 687 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
| 688 | - $ignoreImport = false; |
|
| 688 | + $ignoreImport = false; |
|
| 689 | + } |
|
| 689 | 690 | } |
| 690 | - } |
|
| 691 | 691 | } |
| 692 | 692 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 693 | - $ignoreImport = true; |
|
| 694 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 693 | + $ignoreImport = true; |
|
| 694 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 695 | 695 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 696 | - $ignoreImport = false; |
|
| 696 | + $ignoreImport = false; |
|
| 697 | + } |
|
| 697 | 698 | } |
| 698 | - } |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | if (!$ignoreImport) { |
| 702 | - $highlight = ''; |
|
| 703 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 704 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 705 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 706 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 707 | - $timeelapsed = microtime(true); |
|
| 708 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 702 | + $highlight = ''; |
|
| 703 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 704 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 705 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 706 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 707 | + $timeelapsed = microtime(true); |
|
| 708 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 709 | 709 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 710 | - $Spotter = new Spotter($this->db); |
|
| 711 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
| 712 | - $Spotter->db = null; |
|
| 713 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 710 | + $Spotter = new Spotter($this->db); |
|
| 711 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
| 712 | + $Spotter->db = null; |
|
| 713 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 714 | + } |
|
| 714 | 715 | } |
| 715 | - } |
|
| 716 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 717 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 716 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 717 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 718 | 718 | |
| 719 | - // Add source stat in DB |
|
| 720 | - $Stats = new Stats($this->db); |
|
| 721 | - if (!empty($this->stats)) { |
|
| 719 | + // Add source stat in DB |
|
| 720 | + $Stats = new Stats($this->db); |
|
| 721 | + if (!empty($this->stats)) { |
|
| 722 | 722 | if ($globalDebug) echo 'Add source stats : '; |
| 723 | - foreach($this->stats as $date => $data) { |
|
| 724 | - foreach($data as $source => $sourced) { |
|
| 725 | - //print_r($sourced); |
|
| 726 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 727 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 728 | - if (isset($sourced['msg'])) { |
|
| 729 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 730 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 731 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 732 | - unset($this->stats[$date][$source]['msg']); |
|
| 733 | - } |
|
| 734 | - } |
|
| 735 | - } |
|
| 736 | - if ($date != date('Y-m-d')) { |
|
| 737 | - unset($this->stats[$date]); |
|
| 738 | - } |
|
| 739 | - } |
|
| 740 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 741 | - |
|
| 742 | - } |
|
| 743 | - $Stats->db = null; |
|
| 744 | - } |
|
| 745 | - $this->del(); |
|
| 723 | + foreach($this->stats as $date => $data) { |
|
| 724 | + foreach($data as $source => $sourced) { |
|
| 725 | + //print_r($sourced); |
|
| 726 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 727 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 728 | + if (isset($sourced['msg'])) { |
|
| 729 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 730 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 731 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 732 | + unset($this->stats[$date][$source]['msg']); |
|
| 733 | + } |
|
| 734 | + } |
|
| 735 | + } |
|
| 736 | + if ($date != date('Y-m-d')) { |
|
| 737 | + unset($this->stats[$date]); |
|
| 738 | + } |
|
| 739 | + } |
|
| 740 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 741 | + |
|
| 742 | + } |
|
| 743 | + $Stats->db = null; |
|
| 744 | + } |
|
| 745 | + $this->del(); |
|
| 746 | 746 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
| 747 | 747 | //$ignoreImport = false; |
| 748 | 748 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -760,41 +760,41 @@ discard block |
||
| 760 | 760 | */ |
| 761 | 761 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 762 | 762 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 763 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 764 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 765 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 763 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 764 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 765 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 766 | 766 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 767 | - $SpotterLive = new SpotterLive($this->db); |
|
| 768 | - $SpotterLive->deleteLiveSpotterData(); |
|
| 769 | - $SpotterLive->db=null; |
|
| 767 | + $SpotterLive = new SpotterLive($this->db); |
|
| 768 | + $SpotterLive->deleteLiveSpotterData(); |
|
| 769 | + $SpotterLive->db=null; |
|
| 770 | + } |
|
| 770 | 771 | } |
| 771 | - } |
|
| 772 | - if ($globalDebug) echo " Done\n"; |
|
| 773 | - $this->last_delete = time(); |
|
| 772 | + if ($globalDebug) echo " Done\n"; |
|
| 773 | + $this->last_delete = time(); |
|
| 774 | 774 | } |
| 775 | - } else { |
|
| 775 | + } else { |
|
| 776 | 776 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
| 777 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
| 778 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 777 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
| 778 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 779 | 779 | } |
| 780 | 780 | if (isset($globalDaemon) && !$globalDaemon) { |
| 781 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 781 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 782 | 782 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 783 | - $Spotter = new Spotter($this->db); |
|
| 784 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
| 785 | - $Spotter->db = null; |
|
| 783 | + $Spotter = new Spotter($this->db); |
|
| 784 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
| 785 | + $Spotter->db = null; |
|
| 786 | + } |
|
| 786 | 787 | } |
| 787 | - } |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | - } |
|
| 790 | + } |
|
| 791 | + } |
|
| 791 | 792 | } |
| 792 | - } |
|
| 793 | - //adds the spotter LIVE data |
|
| 794 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 795 | - //echo "\nAdd in Live !! \n"; |
|
| 796 | - //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 797 | - if ($globalDebug) { |
|
| 793 | + //adds the spotter LIVE data |
|
| 794 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 795 | + //echo "\nAdd in Live !! \n"; |
|
| 796 | + //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 797 | + if ($globalDebug) { |
|
| 798 | 798 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 799 | 799 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
| 800 | 800 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
@@ -802,60 +802,60 @@ discard block |
||
| 802 | 802 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
| 803 | 803 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
| 804 | 804 | } |
| 805 | - } |
|
| 806 | - $ignoreImport = false; |
|
| 807 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 808 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 805 | + } |
|
| 806 | + $ignoreImport = false; |
|
| 807 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 808 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 809 | 809 | |
| 810 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 811 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 812 | - $ignoreImport = true; |
|
| 810 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 811 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 812 | + $ignoreImport = true; |
|
| 813 | 813 | } |
| 814 | - } |
|
| 815 | - if (count($globalAirportAccept) > 0) { |
|
| 816 | - $ignoreImport = true; |
|
| 817 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 818 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 814 | + } |
|
| 815 | + if (count($globalAirportAccept) > 0) { |
|
| 816 | + $ignoreImport = true; |
|
| 817 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 818 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 819 | 819 | $ignoreImport = false; |
| 820 | - } |
|
| 820 | + } |
|
| 821 | + } |
|
| 821 | 822 | } |
| 822 | - } |
|
| 823 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 823 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 824 | 824 | foreach($globalAirlineIgnore as $airlineIgnore) { |
| 825 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 825 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 826 | 826 | $ignoreImport = true; |
| 827 | - } |
|
| 827 | + } |
|
| 828 | 828 | } |
| 829 | - } |
|
| 830 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 829 | + } |
|
| 830 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 831 | 831 | $ignoreImport = true; |
| 832 | 832 | foreach($globalAirlineAccept as $airlineAccept) { |
| 833 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 833 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 834 | 834 | $ignoreImport = false; |
| 835 | - } |
|
| 835 | + } |
|
| 836 | + } |
|
| 836 | 837 | } |
| 837 | - } |
|
| 838 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 838 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 839 | 839 | $ignoreImport = true; |
| 840 | 840 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
| 841 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 842 | - $ignoreImport = false; |
|
| 843 | - } |
|
| 841 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 842 | + $ignoreImport = false; |
|
| 843 | + } |
|
| 844 | + } |
|
| 844 | 845 | } |
| 845 | - } |
|
| 846 | 846 | |
| 847 | - if (!$ignoreImport) { |
|
| 847 | + if (!$ignoreImport) { |
|
| 848 | 848 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 849 | 849 | if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 850 | 850 | $timeelapsed = microtime(true); |
| 851 | 851 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 852 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 852 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 853 | 853 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 854 | 854 | $SpotterLive = new SpotterLive($this->db); |
| 855 | 855 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 856 | 856 | $SpotterLive->db = null; |
| 857 | 857 | if ($globalDebug) echo $result."\n"; |
| 858 | - } |
|
| 858 | + } |
|
| 859 | 859 | } |
| 860 | 860 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 861 | 861 | $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | //if ($line['format_source'] != 'aprs') { |
| 868 | 868 | //if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) { |
| 869 | 869 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 870 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
| 870 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
| 871 | 871 | $source = $this->all_flights[$id]['source_name']; |
| 872 | 872 | if ($source == '') $source = $this->all_flights[$id]['format_source']; |
| 873 | 873 | if (!isset($this->source_location[$source])) { |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | if ($stats_heading == 16) $stats_heading = 0; |
| 894 | 894 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 895 | 895 | for ($i=0;$i<=15;$i++) { |
| 896 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 896 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 897 | 897 | } |
| 898 | 898 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 899 | 899 | } else { |
@@ -906,17 +906,17 @@ discard block |
||
| 906 | 906 | //var_dump($this->stats); |
| 907 | 907 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 908 | 908 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 909 | - end($this->stats[$current_date][$source]['hist']); |
|
| 910 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 909 | + end($this->stats[$current_date][$source]['hist']); |
|
| 910 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 911 | 911 | } else $mini = 0; |
| 912 | 912 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 913 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 913 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 914 | 914 | } |
| 915 | 915 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 916 | 916 | } else { |
| 917 | 917 | $this->stats[$current_date][$source]['hist'][$distance] += 1; |
| 918 | 918 | } |
| 919 | - } |
|
| 919 | + } |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | $this->all_flights[$id]['lastupdate'] = time(); |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | //$this->del(); |
| 927 | 927 | |
| 928 | 928 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 929 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 929 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 930 | 930 | if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
| 931 | 931 | $SpotterLive = new SpotterLive($this->db); |
| 932 | 932 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
@@ -934,19 +934,19 @@ discard block |
||
| 934 | 934 | //SpotterLive->deleteLiveSpotterData(); |
| 935 | 935 | if ($globalDebug) echo " Done\n"; |
| 936 | 936 | $this->last_delete_hourly = time(); |
| 937 | - } else { |
|
| 937 | + } else { |
|
| 938 | 938 | $this->del(); |
| 939 | 939 | $this->last_delete_hourly = time(); |
| 940 | - } |
|
| 940 | + } |
|
| 941 | 941 | } |
| 942 | 942 | |
| 943 | - } |
|
| 944 | - //$ignoreImport = false; |
|
| 943 | + } |
|
| 944 | + //$ignoreImport = false; |
|
| 945 | 945 | } |
| 946 | 946 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 947 | 947 | if ($send) return $this->all_flights[$id]; |
| 948 | - } |
|
| 948 | + } |
|
| 949 | + } |
|
| 949 | 950 | } |
| 950 | - } |
|
| 951 | 951 | } |
| 952 | 952 | ?> |
@@ -63,7 +63,9 @@ discard block |
||
| 63 | 63 | $dbc = $this->db; |
| 64 | 64 | $this->all_flights[$id]['schedule_check'] = true; |
| 65 | 65 | if ($globalSchedulesFetch) { |
| 66 | - if ($globalDebug) echo 'Getting schedule info...'."\n"; |
|
| 66 | + if ($globalDebug) { |
|
| 67 | + echo 'Getting schedule info...'."\n"; |
|
| 68 | + } |
|
| 67 | 69 | $Spotter = new Spotter($dbc); |
| 68 | 70 | $Schedule = new Schedule($dbc); |
| 69 | 71 | $Translation = new Translation($dbc); |
@@ -74,7 +76,9 @@ discard block |
||
| 74 | 76 | if ($Schedule->checkSchedule($operator) == 0) { |
| 75 | 77 | $schedule = $Schedule->fetchSchedule($operator); |
| 76 | 78 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 77 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 79 | + if ($globalDebug) { |
|
| 80 | + echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 81 | + } |
|
| 78 | 82 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
| 79 | 83 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
| 80 | 84 | // Should also check if route schedule = route from DB |
@@ -83,7 +87,9 @@ discard block |
||
| 83 | 87 | $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
| 84 | 88 | if (trim($airport_icao) != '') { |
| 85 | 89 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 86 | - if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 90 | + if ($globalDebug) { |
|
| 91 | + echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 92 | + } |
|
| 87 | 93 | } |
| 88 | 94 | } |
| 89 | 95 | } |
@@ -92,17 +98,25 @@ discard block |
||
| 92 | 98 | $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
| 93 | 99 | if (trim($airport_icao) != '') { |
| 94 | 100 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 95 | - if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 101 | + if ($globalDebug) { |
|
| 102 | + echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 103 | + } |
|
| 96 | 104 | } |
| 97 | 105 | } |
| 98 | 106 | } |
| 99 | 107 | $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
| 100 | 108 | } |
| 101 | - } else $scheduleexist = true; |
|
| 102 | - } else $scheduleexist = true; |
|
| 109 | + } else { |
|
| 110 | + $scheduleexist = true; |
|
| 111 | + } |
|
| 112 | + } else { |
|
| 113 | + $scheduleexist = true; |
|
| 114 | + } |
|
| 103 | 115 | // close connection, at least one way will work ? |
| 104 | 116 | if ($scheduleexist) { |
| 105 | - if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 117 | + if ($globalDebug) { |
|
| 118 | + echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 119 | + } |
|
| 106 | 120 | $sch = $Schedule->getSchedule($operator); |
| 107 | 121 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
| 108 | 122 | } |
@@ -124,14 +138,18 @@ discard block |
||
| 124 | 138 | |
| 125 | 139 | public function checkAll() { |
| 126 | 140 | global $globalDebug, $globalNoImport; |
| 127 | - if ($globalDebug) echo "Update last seen flights data...\n"; |
|
| 141 | + if ($globalDebug) { |
|
| 142 | + echo "Update last seen flights data...\n"; |
|
| 143 | + } |
|
| 128 | 144 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 129 | 145 | foreach ($this->all_flights as $key => $flight) { |
| 130 | 146 | if (isset($this->all_flights[$key]['id'])) { |
| 131 | 147 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 132 | 148 | $Spotter = new Spotter($this->db); |
| 133 | 149 | $real_arrival = $this->arrival($key); |
| 134 | - if (isset($this->all_flights[$key]['altitude'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 150 | + if (isset($this->all_flights[$key]['altitude'])) { |
|
| 151 | + $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']); |
|
| 152 | + } |
|
| 135 | 153 | } |
| 136 | 154 | } |
| 137 | 155 | } |
@@ -139,24 +157,32 @@ discard block |
||
| 139 | 157 | |
| 140 | 158 | public function arrival($key) { |
| 141 | 159 | global $globalClosestMinDist, $globalDebug; |
| 142 | - if ($globalDebug) echo 'Update arrival...'."\n"; |
|
| 160 | + if ($globalDebug) { |
|
| 161 | + echo 'Update arrival...'."\n"; |
|
| 162 | + } |
|
| 143 | 163 | $Spotter = new Spotter($this->db); |
| 144 | 164 | $airport_icao = ''; |
| 145 | 165 | $airport_time = ''; |
| 146 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 166 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') { |
|
| 167 | + $globalClosestMinDist = 50; |
|
| 168 | + } |
|
| 147 | 169 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 148 | 170 | $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
| 149 | 171 | if (isset($closestAirports[0])) { |
| 150 | 172 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 151 | 173 | $airport_icao = $closestAirports[0]['icao']; |
| 152 | 174 | $airport_time = $this->all_flights[$key]['datetime']; |
| 153 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 175 | + if ($globalDebug) { |
|
| 176 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 177 | + } |
|
| 154 | 178 | } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
| 155 | 179 | foreach ($closestAirports as $airport) { |
| 156 | 180 | if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
| 157 | 181 | $airport_icao = $airport['icao']; |
| 158 | 182 | $airport_time = $this->all_flights[$key]['datetime']; |
| 159 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 183 | + if ($globalDebug) { |
|
| 184 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 185 | + } |
|
| 160 | 186 | break; |
| 161 | 187 | } |
| 162 | 188 | } |
@@ -164,14 +190,20 @@ discard block |
||
| 164 | 190 | $airport_icao = $closestAirports[0]['icao']; |
| 165 | 191 | $airport_time = $this->all_flights[$key]['datetime']; |
| 166 | 192 | } else { |
| 167 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 193 | + if ($globalDebug) { |
|
| 194 | + echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 195 | + } |
|
| 168 | 196 | } |
| 169 | 197 | } else { |
| 170 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 198 | + if ($globalDebug) { |
|
| 199 | + echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 200 | + } |
|
| 171 | 201 | } |
| 172 | 202 | |
| 173 | 203 | } else { |
| 174 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 204 | + if ($globalDebug) { |
|
| 205 | + echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 206 | + } |
|
| 175 | 207 | } |
| 176 | 208 | return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
| 177 | 209 | } |
@@ -181,12 +213,16 @@ discard block |
||
| 181 | 213 | public function del() { |
| 182 | 214 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 183 | 215 | // Delete old infos |
| 184 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
| 216 | + if ($globalDebug) { |
|
| 217 | + echo 'Delete old values and update latest data...'."\n"; |
|
| 218 | + } |
|
| 185 | 219 | foreach ($this->all_flights as $key => $flight) { |
| 186 | 220 | if (isset($flight['lastupdate'])) { |
| 187 | 221 | if ($flight['lastupdate'] < (time()-3000)) { |
| 188 | 222 | if (isset($this->all_flights[$key]['id'])) { |
| 189 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 223 | + if ($globalDebug) { |
|
| 224 | + echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 225 | + } |
|
| 190 | 226 | /* |
| 191 | 227 | $SpotterLive = new SpotterLive(); |
| 192 | 228 | $SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']); |
@@ -197,7 +233,9 @@ discard block |
||
| 197 | 233 | $Spotter = new Spotter($this->db); |
| 198 | 234 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 199 | 235 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
| 200 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 236 | + if ($globalDebug && $result != 'success') { |
|
| 237 | + echo '!!! ERROR : '.$result."\n"; |
|
| 238 | + } |
|
| 201 | 239 | } |
| 202 | 240 | // Put in archive |
| 203 | 241 | // $Spotter->db = null; |
@@ -212,8 +250,10 @@ discard block |
||
| 212 | 250 | public function add($line) { |
| 213 | 251 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB; |
| 214 | 252 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 215 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
| 216 | -/* |
|
| 253 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
| 254 | + $globalCoordMinChange = '0.02'; |
|
| 255 | + } |
|
| 256 | + /* |
|
| 217 | 257 | $Spotter = new Spotter(); |
| 218 | 258 | $dbc = $Spotter->db; |
| 219 | 259 | $SpotterLive = new SpotterLive($dbc); |
@@ -241,11 +281,15 @@ discard block |
||
| 241 | 281 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 242 | 282 | $current_date = date('Y-m-d'); |
| 243 | 283 | $source = $line['source_name']; |
| 244 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 284 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
| 285 | + $source = $line['format_source']; |
|
| 286 | + } |
|
| 245 | 287 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
| 246 | 288 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
| 247 | 289 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
| 248 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 290 | + } else { |
|
| 291 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 292 | + } |
|
| 249 | 293 | } |
| 250 | 294 | |
| 251 | 295 | /* |
@@ -261,22 +305,35 @@ discard block |
||
| 261 | 305 | //$this->db = $dbc; |
| 262 | 306 | |
| 263 | 307 | //$hex = trim($line['hex']); |
| 264 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 265 | - else $id = trim($line['id']); |
|
| 308 | + if (!isset($line['id'])) { |
|
| 309 | + $id = trim($line['hex']); |
|
| 310 | + } else { |
|
| 311 | + $id = trim($line['id']); |
|
| 312 | + } |
|
| 266 | 313 | |
| 267 | 314 | if (!isset($this->all_flights[$id])) { |
| 268 | 315 | $this->all_flights[$id] = array(); |
| 269 | 316 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 270 | 317 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
| 271 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 318 | + if (isset($globalDaemon) && $globalDaemon === FALSE) { |
|
| 319 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 320 | + } |
|
| 272 | 321 | if (!isset($line['id'])) { |
| 273 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 274 | -// if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 322 | + if (!isset($globalDaemon)) { |
|
| 323 | + $globalDaemon = TRUE; |
|
| 324 | + } |
|
| 325 | + // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 275 | 326 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 276 | - 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'))); |
|
| 327 | + 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')) { |
|
| 328 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 329 | + } |
|
| 277 | 330 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 278 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 279 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 331 | + } else { |
|
| 332 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 333 | + } |
|
| 334 | + if ($globalAllFlights !== FALSE) { |
|
| 335 | + $dataFound = true; |
|
| 336 | + } |
|
| 280 | 337 | } |
| 281 | 338 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 282 | 339 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
@@ -298,12 +355,20 @@ discard block |
||
| 298 | 355 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 299 | 356 | } |
| 300 | 357 | $Spotter->db = null; |
| 301 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 302 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 358 | + if ($globalDebugTimeElapsed) { |
|
| 359 | + echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 360 | + } |
|
| 361 | + if ($aircraft_icao != '') { |
|
| 362 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 363 | + } |
|
| 303 | 364 | } |
| 304 | 365 | } |
| 305 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 306 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 366 | + if ($globalAllFlights !== FALSE) { |
|
| 367 | + $dataFound = true; |
|
| 368 | + } |
|
| 369 | + if ($globalDebug) { |
|
| 370 | + echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 371 | + } |
|
| 307 | 372 | } |
| 308 | 373 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
| 309 | 374 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
@@ -314,15 +379,24 @@ discard block |
||
| 314 | 379 | $Spotter = new Spotter($this->db); |
| 315 | 380 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 316 | 381 | $Spotter->db = null; |
| 317 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 382 | + if ($aircraft_icao != '') { |
|
| 383 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 384 | + } |
|
| 318 | 385 | } |
| 319 | 386 | } |
| 320 | 387 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
| 321 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 322 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 323 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 324 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 325 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 388 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
| 389 | + $aircraft_icao = 'GLID'; |
|
| 390 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
| 391 | + $aircraft_icao = 'UHEL'; |
|
| 392 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
| 393 | + $aircraft_icao = 'TOWPLANE'; |
|
| 394 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
| 395 | + $aircraft_icao = 'POWAIRC'; |
|
| 396 | + } |
|
| 397 | + if (isset($aircraft_icao)) { |
|
| 398 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 399 | + } |
|
| 326 | 400 | } |
| 327 | 401 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
| 328 | 402 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
@@ -332,8 +406,11 @@ discard block |
||
| 332 | 406 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 333 | 407 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 334 | 408 | } else { |
| 335 | - if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 336 | - 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"; |
|
| 409 | + if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 410 | + echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 411 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 412 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 413 | + } |
|
| 337 | 414 | /* |
| 338 | 415 | echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']); |
| 339 | 416 | print_r($this->all_flights[$id]); |
@@ -366,15 +443,25 @@ discard block |
||
| 366 | 443 | $timeelapsed = microtime(true); |
| 367 | 444 | $Spotter = new Spotter($this->db); |
| 368 | 445 | $fromsource = NULL; |
| 369 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 370 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 371 | - elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 372 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 373 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 446 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 447 | + $fromsource = $globalAirlinesSource; |
|
| 448 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') { |
|
| 449 | + $fromsource = 'vatsim'; |
|
| 450 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') { |
|
| 451 | + $fromsource = 'ivao'; |
|
| 452 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 453 | + $fromsource = 'vatsim'; |
|
| 454 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 455 | + $fromsource = 'ivao'; |
|
| 456 | + } |
|
| 374 | 457 | $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
| 375 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 458 | + if ($globalDebug && $result != 'success') { |
|
| 459 | + echo '!!! ERROR : '.$result."\n"; |
|
| 460 | + } |
|
| 376 | 461 | $Spotter->db = null; |
| 377 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 462 | + if ($globalDebugTimeElapsed) { |
|
| 463 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 464 | + } |
|
| 378 | 465 | } |
| 379 | 466 | } |
| 380 | 467 | |
@@ -386,7 +473,9 @@ discard block |
||
| 386 | 473 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 387 | 474 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 388 | 475 | */ |
| 389 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 476 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 477 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 478 | + } |
|
| 390 | 479 | |
| 391 | 480 | //$putinarchive = true; |
| 392 | 481 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
@@ -404,7 +493,9 @@ discard block |
||
| 404 | 493 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 405 | 494 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 406 | 495 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
| 407 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 496 | + if ($globalDebugTimeElapsed) { |
|
| 497 | + echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 498 | + } |
|
| 408 | 499 | } |
| 409 | 500 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 410 | 501 | $timeelapsed = microtime(true); |
@@ -418,7 +509,9 @@ discard block |
||
| 418 | 509 | $Translation->db = null; |
| 419 | 510 | } |
| 420 | 511 | $Spotter->db = null; |
| 421 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 512 | + if ($globalDebugTimeElapsed) { |
|
| 513 | + echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 514 | + } |
|
| 422 | 515 | } |
| 423 | 516 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 424 | 517 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
@@ -427,9 +520,13 @@ discard block |
||
| 427 | 520 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
| 428 | 521 | } |
| 429 | 522 | } |
| 430 | - if (!isset($globalFork)) $globalFork = TRUE; |
|
| 523 | + if (!isset($globalFork)) { |
|
| 524 | + $globalFork = TRUE; |
|
| 525 | + } |
|
| 431 | 526 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 432 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 527 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) { |
|
| 528 | + $this->get_Schedule($id,trim($line['ident'])); |
|
| 529 | + } |
|
| 433 | 530 | } |
| 434 | 531 | } |
| 435 | 532 | } |
@@ -445,16 +542,23 @@ discard block |
||
| 445 | 542 | // use datetime |
| 446 | 543 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 447 | 544 | $speed = $speed*3.6; |
| 448 | - if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 449 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 545 | + if ($speed < 1000) { |
|
| 546 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 547 | + } |
|
| 548 | + if ($globalDebug) { |
|
| 549 | + echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 550 | + } |
|
| 450 | 551 | } |
| 451 | 552 | } |
| 452 | 553 | |
| 453 | 554 | |
| 454 | 555 | |
| 455 | 556 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 456 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 457 | - else unset($timediff); |
|
| 557 | + if (isset($this->all_flights[$id]['time_last_coord'])) { |
|
| 558 | + $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 559 | + } else { |
|
| 560 | + unset($timediff); |
|
| 561 | + } |
|
| 458 | 562 | if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
| 459 | 563 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
| 460 | 564 | 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'])) { |
@@ -463,15 +567,23 @@ discard block |
||
| 463 | 567 | $this->all_flights[$id]['putinarchive'] = true; |
| 464 | 568 | $this->tmd = 0; |
| 465 | 569 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 466 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 570 | + if ($globalDebug) { |
|
| 571 | + echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 572 | + } |
|
| 467 | 573 | $timeelapsed = microtime(true); |
| 468 | 574 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 469 | 575 | $Spotter = new Spotter($this->db); |
| 470 | 576 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 471 | - if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 577 | + if (!empty($all_country)) { |
|
| 578 | + $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 579 | + } |
|
| 472 | 580 | $Spotter->db = null; |
| 473 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 474 | - if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 581 | + if ($globalDebugTimeElapsed) { |
|
| 582 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 583 | + } |
|
| 584 | + if ($globalDebug) { |
|
| 585 | + echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 586 | + } |
|
| 475 | 587 | } |
| 476 | 588 | } |
| 477 | 589 | } |
@@ -479,7 +591,9 @@ discard block |
||
| 479 | 591 | |
| 480 | 592 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 481 | 593 | //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 482 | - if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
|
| 594 | + if (!isset($this->all_flights[$id]['archive_latitude'])) { |
|
| 595 | + $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
|
| 596 | + } |
|
| 483 | 597 | if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 484 | 598 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
| 485 | 599 | $dataFound = true; |
@@ -501,9 +615,13 @@ discard block |
||
| 501 | 615 | */ |
| 502 | 616 | } |
| 503 | 617 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 504 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 618 | + if ($line['longitude'] > 180) { |
|
| 619 | + $line['longitude'] = $line['longitude'] - 360; |
|
| 620 | + } |
|
| 505 | 621 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 506 | - if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
|
| 622 | + if (!isset($this->all_flights[$id]['archive_longitude'])) { |
|
| 623 | + $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
|
| 624 | + } |
|
| 507 | 625 | if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 508 | 626 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
| 509 | 627 | $dataFound = true; |
@@ -534,7 +652,9 @@ discard block |
||
| 534 | 652 | } |
| 535 | 653 | } |
| 536 | 654 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 537 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 655 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) { |
|
| 656 | + $dataFound = true; |
|
| 657 | + } |
|
| 538 | 658 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
| 539 | 659 | } |
| 540 | 660 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
@@ -556,41 +676,61 @@ discard block |
||
| 556 | 676 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 557 | 677 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 558 | 678 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 559 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
| 560 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 561 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 679 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) { |
|
| 680 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
| 681 | + } elseif (isset($line['id'])) { |
|
| 682 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 683 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 684 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 685 | + } |
|
| 686 | + } |
|
| 687 | + if ($line['ground'] != 1) { |
|
| 688 | + $line['ground'] = 0; |
|
| 562 | 689 | } |
| 563 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 564 | 690 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
| 565 | 691 | //$dataFound = true; |
| 566 | 692 | } |
| 567 | 693 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 568 | 694 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 569 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 695 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) { |
|
| 696 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 697 | + } |
|
| 570 | 698 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
| 571 | 699 | $highlight = ''; |
| 572 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 573 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 574 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 700 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 701 | + $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 702 | + } |
|
| 703 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 704 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 705 | + } |
|
| 706 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 707 | + $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 708 | + } |
|
| 575 | 709 | if ($highlight != '') { |
| 576 | 710 | $timeelapsed = microtime(true); |
| 577 | 711 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 578 | 712 | $Spotter = new Spotter($this->db); |
| 579 | 713 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
| 580 | 714 | $Spotter->db = null; |
| 581 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 715 | + if ($globalDebugTimeElapsed) { |
|
| 716 | + echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 717 | + } |
|
| 582 | 718 | } |
| 583 | 719 | //$putinarchive = true; |
| 584 | 720 | //$highlight = ''; |
| 585 | 721 | } |
| 586 | 722 | |
| 587 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 723 | + } else { |
|
| 724 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 725 | + } |
|
| 588 | 726 | //$dataFound = true; |
| 589 | 727 | } |
| 590 | 728 | |
| 591 | 729 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 592 | 730 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 593 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 731 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) { |
|
| 732 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 733 | + } |
|
| 594 | 734 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 595 | 735 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 596 | 736 | //$dataFound = true; |
@@ -602,21 +742,30 @@ discard block |
||
| 602 | 742 | } |
| 603 | 743 | |
| 604 | 744 | if (isset($line['heading']) && $line['heading'] != '') { |
| 605 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 745 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) { |
|
| 746 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 747 | + } |
|
| 606 | 748 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
| 607 | 749 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
| 608 | 750 | //$dataFound = true; |
| 609 | 751 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 610 | 752 | $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 611 | 753 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
| 612 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 613 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 754 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) { |
|
| 755 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 756 | + } |
|
| 757 | + if ($globalDebug) { |
|
| 758 | + echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 759 | + } |
|
| 614 | 760 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 615 | 761 | // If not enough messages and ACARS set heading to 0 |
| 616 | 762 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
| 617 | 763 | } |
| 618 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 619 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 764 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) { |
|
| 765 | + $dataFound = false; |
|
| 766 | + } elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) { |
|
| 767 | + $dataFound = false; |
|
| 768 | + } |
|
| 620 | 769 | |
| 621 | 770 | // print_r($this->all_flights[$id]); |
| 622 | 771 | //gets the callsign from the last hour |
@@ -632,23 +781,38 @@ discard block |
||
| 632 | 781 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
| 633 | 782 | if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
| 634 | 783 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 635 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 784 | + if ($globalDebug) { |
|
| 785 | + echo "Check if aircraft is already in DB..."; |
|
| 786 | + } |
|
| 636 | 787 | $timeelapsed = microtime(true); |
| 637 | 788 | $SpotterLive = new SpotterLive($this->db); |
| 638 | 789 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
| 639 | 790 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 640 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 791 | + if ($globalDebugTimeElapsed) { |
|
| 792 | + echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 793 | + } |
|
| 641 | 794 | } elseif (isset($line['id'])) { |
| 642 | 795 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 643 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 796 | + if ($globalDebugTimeElapsed) { |
|
| 797 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 798 | + } |
|
| 644 | 799 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 645 | 800 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 646 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 647 | - } else $recent_ident = ''; |
|
| 801 | + if ($globalDebugTimeElapsed) { |
|
| 802 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 803 | + } |
|
| 804 | + } else { |
|
| 805 | + $recent_ident = ''; |
|
| 806 | + } |
|
| 648 | 807 | $SpotterLive->db=null; |
| 649 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 650 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 651 | - } else $recent_ident = ''; |
|
| 808 | + if ($globalDebug && $recent_ident == '') { |
|
| 809 | + echo " Not in DB.\n"; |
|
| 810 | + } elseif ($globalDebug && $recent_ident != '') { |
|
| 811 | + echo " Already in DB.\n"; |
|
| 812 | + } |
|
| 813 | + } else { |
|
| 814 | + $recent_ident = ''; |
|
| 815 | + } |
|
| 652 | 816 | } else { |
| 653 | 817 | $recent_ident = ''; |
| 654 | 818 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
@@ -656,7 +820,9 @@ discard block |
||
| 656 | 820 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 657 | 821 | if($recent_ident == "") |
| 658 | 822 | { |
| 659 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 823 | + if ($globalDebug) { |
|
| 824 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 825 | + } |
|
| 660 | 826 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 661 | 827 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 662 | 828 | //adds the spotter data for the archive |
@@ -700,31 +866,49 @@ discard block |
||
| 700 | 866 | |
| 701 | 867 | if (!$ignoreImport) { |
| 702 | 868 | $highlight = ''; |
| 703 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 704 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 705 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 706 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 869 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 870 | + $highlight = 'Squawk 7500 : Hijack'; |
|
| 871 | + } |
|
| 872 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 873 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 874 | + } |
|
| 875 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 876 | + $highlight = 'Squawk 7700 : Emergency'; |
|
| 877 | + } |
|
| 878 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 879 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 880 | + } |
|
| 707 | 881 | $timeelapsed = microtime(true); |
| 708 | 882 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 709 | 883 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 710 | 884 | $Spotter = new Spotter($this->db); |
| 711 | 885 | $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
| 712 | 886 | $Spotter->db = null; |
| 713 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 887 | + if ($globalDebug && isset($result)) { |
|
| 888 | + echo $result."\n"; |
|
| 889 | + } |
|
| 714 | 890 | } |
| 715 | 891 | } |
| 716 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 892 | + if ($globalDebugTimeElapsed) { |
|
| 893 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 894 | + } |
|
| 717 | 895 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 718 | 896 | |
| 719 | 897 | // Add source stat in DB |
| 720 | 898 | $Stats = new Stats($this->db); |
| 721 | 899 | if (!empty($this->stats)) { |
| 722 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 900 | + if ($globalDebug) { |
|
| 901 | + echo 'Add source stats : '; |
|
| 902 | + } |
|
| 723 | 903 | foreach($this->stats as $date => $data) { |
| 724 | 904 | foreach($data as $source => $sourced) { |
| 725 | 905 | //print_r($sourced); |
| 726 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 727 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 906 | + if (isset($sourced['polar'])) { |
|
| 907 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 908 | + } |
|
| 909 | + if (isset($sourced['hist'])) { |
|
| 910 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 911 | + } |
|
| 728 | 912 | if (isset($sourced['msg'])) { |
| 729 | 913 | if (time() - $sourced['msg']['date'] > 10) { |
| 730 | 914 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -737,13 +921,17 @@ discard block |
||
| 737 | 921 | unset($this->stats[$date]); |
| 738 | 922 | } |
| 739 | 923 | } |
| 740 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 924 | + if ($globalDebug) { |
|
| 925 | + echo 'Done'."\n"; |
|
| 926 | + } |
|
| 741 | 927 | |
| 742 | 928 | } |
| 743 | 929 | $Stats->db = null; |
| 744 | 930 | } |
| 745 | 931 | $this->del(); |
| 746 | - } elseif ($globalDebug) echo 'Ignore data'."\n"; |
|
| 932 | + } elseif ($globalDebug) { |
|
| 933 | + echo 'Ignore data'."\n"; |
|
| 934 | + } |
|
| 747 | 935 | //$ignoreImport = false; |
| 748 | 936 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 749 | 937 | //print_r($this->all_flights[$id]); |
@@ -760,7 +948,9 @@ discard block |
||
| 760 | 948 | */ |
| 761 | 949 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 762 | 950 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 763 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 951 | + if ($globalDebug) { |
|
| 952 | + echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 953 | + } |
|
| 764 | 954 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 765 | 955 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 766 | 956 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -769,7 +959,9 @@ discard block |
||
| 769 | 959 | $SpotterLive->db=null; |
| 770 | 960 | } |
| 771 | 961 | } |
| 772 | - if ($globalDebug) echo " Done\n"; |
|
| 962 | + if ($globalDebug) { |
|
| 963 | + echo " Done\n"; |
|
| 964 | + } |
|
| 773 | 965 | $this->last_delete = time(); |
| 774 | 966 | } |
| 775 | 967 | } else { |
@@ -796,11 +988,17 @@ discard block |
||
| 796 | 988 | //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
| 797 | 989 | if ($globalDebug) { |
| 798 | 990 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 799 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 800 | - 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"; |
|
| 991 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 992 | + 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"; |
|
| 993 | + } else { |
|
| 994 | + 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"; |
|
| 995 | + } |
|
| 801 | 996 | } else { |
| 802 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 803 | - 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"; |
|
| 997 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 998 | + 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"; |
|
| 999 | + } else { |
|
| 1000 | + 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"; |
|
| 1001 | + } |
|
| 804 | 1002 | } |
| 805 | 1003 | } |
| 806 | 1004 | $ignoreImport = false; |
@@ -846,22 +1044,30 @@ discard block |
||
| 846 | 1044 | |
| 847 | 1045 | if (!$ignoreImport) { |
| 848 | 1046 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 849 | - 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'))); |
|
| 1047 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 1048 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1049 | + } |
|
| 850 | 1050 | $timeelapsed = microtime(true); |
| 851 | 1051 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 852 | 1052 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 853 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 1053 | + if ($globalDebug) { |
|
| 1054 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 1055 | + } |
|
| 854 | 1056 | $SpotterLive = new SpotterLive($this->db); |
| 855 | 1057 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 856 | 1058 | $SpotterLive->db = null; |
| 857 | - if ($globalDebug) echo $result."\n"; |
|
| 1059 | + if ($globalDebug) { |
|
| 1060 | + echo $result."\n"; |
|
| 1061 | + } |
|
| 858 | 1062 | } |
| 859 | 1063 | } |
| 860 | 1064 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 861 | 1065 | $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 862 | 1066 | } |
| 863 | 1067 | $this->all_flights[$id]['putinarchive'] = false; |
| 864 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1068 | + if ($globalDebugTimeElapsed) { |
|
| 1069 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1070 | + } |
|
| 865 | 1071 | |
| 866 | 1072 | // Put statistics in $this->stats variable |
| 867 | 1073 | //if ($line['format_source'] != 'aprs') { |
@@ -869,7 +1075,9 @@ discard block |
||
| 869 | 1075 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 870 | 1076 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 871 | 1077 | $source = $this->all_flights[$id]['source_name']; |
| 872 | - if ($source == '') $source = $this->all_flights[$id]['format_source']; |
|
| 1078 | + if ($source == '') { |
|
| 1079 | + $source = $this->all_flights[$id]['format_source']; |
|
| 1080 | + } |
|
| 873 | 1081 | if (!isset($this->source_location[$source])) { |
| 874 | 1082 | $Location = new Source(); |
| 875 | 1083 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -890,7 +1098,9 @@ discard block |
||
| 890 | 1098 | $stats_heading = round($stats_heading/22.5); |
| 891 | 1099 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 892 | 1100 | $current_date = date('Y-m-d'); |
| 893 | - if ($stats_heading == 16) $stats_heading = 0; |
|
| 1101 | + if ($stats_heading == 16) { |
|
| 1102 | + $stats_heading = 0; |
|
| 1103 | + } |
|
| 894 | 1104 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 895 | 1105 | for ($i=0;$i<=15;$i++) { |
| 896 | 1106 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -908,7 +1118,9 @@ discard block |
||
| 908 | 1118 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 909 | 1119 | end($this->stats[$current_date][$source]['hist']); |
| 910 | 1120 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
| 911 | - } else $mini = 0; |
|
| 1121 | + } else { |
|
| 1122 | + $mini = 0; |
|
| 1123 | + } |
|
| 912 | 1124 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 913 | 1125 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 914 | 1126 | } |
@@ -920,19 +1132,27 @@ discard block |
||
| 920 | 1132 | } |
| 921 | 1133 | |
| 922 | 1134 | $this->all_flights[$id]['lastupdate'] = time(); |
| 923 | - if ($this->all_flights[$id]['putinarchive']) $send = true; |
|
| 1135 | + if ($this->all_flights[$id]['putinarchive']) { |
|
| 1136 | + $send = true; |
|
| 1137 | + } |
|
| 924 | 1138 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 925 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1139 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
| 1140 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1141 | + } |
|
| 926 | 1142 | //$this->del(); |
| 927 | 1143 | |
| 928 | 1144 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 929 | 1145 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 930 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1146 | + if ($globalDebug) { |
|
| 1147 | + echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1148 | + } |
|
| 931 | 1149 | $SpotterLive = new SpotterLive($this->db); |
| 932 | 1150 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 933 | 1151 | $SpotterLive->db = null; |
| 934 | 1152 | //SpotterLive->deleteLiveSpotterData(); |
| 935 | - if ($globalDebug) echo " Done\n"; |
|
| 1153 | + if ($globalDebug) { |
|
| 1154 | + echo " Done\n"; |
|
| 1155 | + } |
|
| 936 | 1156 | $this->last_delete_hourly = time(); |
| 937 | 1157 | } else { |
| 938 | 1158 | $this->del(); |
@@ -944,7 +1164,9 @@ discard block |
||
| 944 | 1164 | //$ignoreImport = false; |
| 945 | 1165 | } |
| 946 | 1166 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 947 | - if ($send) return $this->all_flights[$id]; |
|
| 1167 | + if ($send) { |
|
| 1168 | + return $this->all_flights[$id]; |
|
| 1169 | + } |
|
| 948 | 1170 | } |
| 949 | 1171 | } |
| 950 | 1172 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | require_once('require/class.Stats.php'); |
| 5 | 5 | require_once('require/class.Language.php'); |
| 6 | 6 | if (!isset($_GET['airline'])) { |
| 7 | - header('Location: '.$globalURL.'/airline'); |
|
| 8 | - die(); |
|
| 7 | + header('Location: '.$globalURL.'/airline'); |
|
| 8 | + die(); |
|
| 9 | 9 | } |
| 10 | 10 | $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 11 | 11 | $Spotter = new Spotter(); |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | $country_data = substr($country_data, 0, -1); |
| 78 | 78 | print $country_data; |
| 79 | - print '];'; |
|
| 80 | - print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 81 | - print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
| 82 | - print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
| 83 | - print 'new Datamap({ |
|
| 79 | + print '];'; |
|
| 80 | + print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 81 | + print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
| 82 | + print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
| 83 | + print 'new Datamap({ |
|
| 84 | 84 | element: document.getElementById("chartCountry"), |
| 85 | 85 | projection: "mercator", // big world map |
| 86 | 86 | fills: { defaultFill: "#F5F5F5" }, |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | require_once('require/class.Stats.php'); |
| 5 | 5 | require_once('require/class.Language.php'); |
| 6 | 6 | if (!isset($_GET['airline'])) { |
| 7 | - header('Location: '.$globalURL.'/airline'); |
|
| 8 | - die(); |
|
| 7 | + header('Location: '.$globalURL.'/airline'); |
|
| 8 | + die(); |
|
| 9 | 9 | } |
| 10 | 10 | $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 11 | 11 | $Spotter = new Spotter(); |