@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | require_once(dirname(__FILE__).'/class.create_db.php'); |
| 11 | 11 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
| 12 | 12 | require_once(dirname(__FILE__).'/class.settings.php'); |
| 13 | -$title="Install"; |
|
| 13 | +$title = "Install"; |
|
| 14 | 14 | require(dirname(__FILE__).'/../require/settings.php'); |
| 15 | 15 | require(dirname(__FILE__).'/header.php'); |
| 16 | 16 | |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | if (!extension_loaded('curl')) { |
| 70 | 70 | $error[] = "Curl is not loaded."; |
| 71 | 71 | } |
| 72 | -if(function_exists('apache_get_modules') ){ |
|
| 73 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
| 72 | +if (function_exists('apache_get_modules')) { |
|
| 73 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
| 74 | 74 | $error[] = "mod_rewrite is not available."; |
| 75 | 75 | } |
| 76 | 76 | /* |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
| 87 | 87 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
| 88 | 88 | if (function_exists('get_headers')) { |
| 89 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
| 90 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
| 89 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
| 90 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
| 91 | 91 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -442,13 +442,13 @@ discard block |
||
| 442 | 442 | ?> |
| 443 | 443 | <tr> |
| 444 | 444 | <?php |
| 445 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
| 445 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
| 446 | 446 | ?> |
| 447 | 447 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 448 | 448 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
| 449 | 449 | <?php |
| 450 | 450 | } else { |
| 451 | - $hostport = explode(':',$source['host']); |
|
| 451 | + $hostport = explode(':', $source['host']); |
|
| 452 | 452 | if (isset($hostport[1])) { |
| 453 | 453 | $host = $hostport[0]; |
| 454 | 454 | $port = $hostport[1]; |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | <br /> |
| 803 | 803 | <p> |
| 804 | 804 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 805 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 805 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
| 806 | 806 | </p> |
| 807 | 807 | <br /> |
| 808 | 808 | <p> |
@@ -858,14 +858,14 @@ discard block |
||
| 858 | 858 | $error = ''; |
| 859 | 859 | |
| 860 | 860 | if (isset($_POST['dbtype'])) { |
| 861 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
| 862 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
| 863 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
| 864 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
| 865 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
| 866 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
| 867 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
| 868 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
| 861 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
| 862 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
| 863 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
| 864 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
| 865 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
| 866 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
| 867 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
| 868 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
| 869 | 869 | |
| 870 | 870 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
| 871 | 871 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -885,48 +885,48 @@ discard block |
||
| 885 | 885 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
| 886 | 886 | */ |
| 887 | 887 | |
| 888 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
| 888 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
| 889 | 889 | |
| 890 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
| 891 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
| 892 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
| 893 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
| 894 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
| 890 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
| 891 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
| 892 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
| 893 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
| 894 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
| 895 | 895 | |
| 896 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
| 897 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
| 898 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
| 899 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
| 900 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
| 901 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
| 902 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
| 903 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
| 904 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey)); |
|
| 896 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
| 897 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
| 898 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
| 899 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
| 900 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
| 901 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
| 902 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
| 903 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
| 904 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey)); |
|
| 905 | 905 | |
| 906 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
| 907 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
| 908 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
| 909 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
| 910 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 911 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
| 906 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
| 907 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
| 908 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
| 909 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
| 910 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 911 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
| 912 | 912 | |
| 913 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
| 914 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
| 913 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
| 914 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
| 915 | 915 | |
| 916 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
| 917 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
| 918 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
| 916 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
| 917 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
| 918 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
| 919 | 919 | |
| 920 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
| 920 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
| 921 | 921 | if ($acars == 'acars') { |
| 922 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
| 922 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
| 923 | 923 | } else { |
| 924 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
| 924 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
| 925 | 925 | } |
| 926 | 926 | |
| 927 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
| 928 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
| 929 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 927 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
| 928 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
| 929 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 930 | 930 | |
| 931 | 931 | $source_name = $_POST['source_name']; |
| 932 | 932 | $source_latitude = $_POST['source_latitude']; |
@@ -940,8 +940,8 @@ discard block |
||
| 940 | 940 | |
| 941 | 941 | $sources = array(); |
| 942 | 942 | foreach ($source_name as $keys => $name) { |
| 943 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 944 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 943 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
| 944 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
| 945 | 945 | } |
| 946 | 946 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
| 947 | 947 | |
@@ -954,24 +954,24 @@ discard block |
||
| 954 | 954 | $sbsurl = $_POST['sbsurl']; |
| 955 | 955 | */ |
| 956 | 956 | |
| 957 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
| 958 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
| 959 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
| 960 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
| 961 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
| 962 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
| 963 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
| 964 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
| 957 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
| 958 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
| 959 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
| 960 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
| 961 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
| 962 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
| 963 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
| 964 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
| 965 | 965 | |
| 966 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
| 967 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 968 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 969 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
| 970 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 971 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 972 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
| 973 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 974 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 966 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
| 967 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
| 968 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
| 969 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
| 970 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
| 971 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
| 972 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
| 973 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
| 974 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
| 975 | 975 | |
| 976 | 976 | /* |
| 977 | 977 | $globalSBS1Hosts = array(); |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | } |
| 988 | 988 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
| 989 | 989 | */ |
| 990 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
| 990 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
| 991 | 991 | $host = $_POST['host']; |
| 992 | 992 | $port = $_POST['port']; |
| 993 | 993 | $name = $_POST['name']; |
@@ -1003,100 +1003,100 @@ discard block |
||
| 1003 | 1003 | else $cov = 'FALSE'; |
| 1004 | 1004 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
| 1005 | 1005 | else $arch = 'FALSE'; |
| 1006 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch); |
|
| 1006 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch); |
|
| 1007 | 1007 | if ($format[$key] == 'airwhere') $forcepilots = true; |
| 1008 | 1008 | } |
| 1009 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
| 1009 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
| 1010 | 1010 | |
| 1011 | 1011 | /* |
| 1012 | 1012 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
| 1013 | 1013 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
| 1014 | 1014 | */ |
| 1015 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
| 1016 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
| 1017 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
| 1015 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
| 1016 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
| 1017 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
| 1018 | 1018 | |
| 1019 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
| 1020 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
| 1019 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
| 1020 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
| 1021 | 1021 | |
| 1022 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
| 1023 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
| 1022 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
| 1023 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
| 1024 | 1024 | |
| 1025 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
| 1026 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
| 1027 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
| 1028 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
| 1025 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
| 1026 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
| 1027 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
| 1028 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
| 1029 | 1029 | |
| 1030 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
| 1031 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
| 1032 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
| 1030 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
| 1031 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
| 1032 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
| 1033 | 1033 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1034 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
| 1035 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1034 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
| 1035 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
| 1036 | 1036 | |
| 1037 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 1038 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
| 1039 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 1040 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
| 1041 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
| 1042 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
| 1043 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
| 1044 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
| 1037 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 1038 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
| 1039 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 1040 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
| 1041 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
| 1042 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
| 1043 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
| 1044 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
| 1045 | 1045 | |
| 1046 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
| 1047 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
| 1046 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
| 1047 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
| 1048 | 1048 | |
| 1049 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1050 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
| 1049 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1050 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
| 1051 | 1051 | |
| 1052 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
| 1052 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
| 1053 | 1053 | if ($archiveyear == "archiveyear") { |
| 1054 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
| 1054 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
| 1055 | 1055 | } else { |
| 1056 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
| 1056 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
| 1057 | 1057 | } |
| 1058 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1059 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1060 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1061 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1058 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1059 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1060 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1061 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1062 | 1062 | |
| 1063 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
| 1064 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1065 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
| 1066 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
| 1063 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
| 1064 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1065 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
| 1066 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
| 1067 | 1067 | |
| 1068 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
| 1069 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
| 1070 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
| 1068 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
| 1069 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
| 1070 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
| 1071 | 1071 | |
| 1072 | 1072 | // Create in settings.php keys not yet configurable if not already here |
| 1073 | 1073 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1074 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1074 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
| 1075 | 1075 | |
| 1076 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
| 1076 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
| 1077 | 1077 | if ($resetyearstats == 'resetyearstats') { |
| 1078 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
| 1078 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
| 1079 | 1079 | } else { |
| 1080 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
| 1080 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
| 1083 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
| 1084 | 1084 | if ($archive == 'archive') { |
| 1085 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
| 1085 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
| 1086 | 1086 | } else { |
| 1087 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
| 1087 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
| 1088 | 1088 | } |
| 1089 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
| 1089 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
| 1090 | 1090 | if ($daemon == 'daemon') { |
| 1091 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
| 1091 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
| 1092 | 1092 | } else { |
| 1093 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
| 1093 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
| 1094 | 1094 | } |
| 1095 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
| 1095 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
| 1096 | 1096 | if ($schedules == 'schedules') { |
| 1097 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
| 1097 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
| 1098 | 1098 | } else { |
| 1099 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
| 1099 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | /* |
@@ -1107,212 +1107,212 @@ discard block |
||
| 1107 | 1107 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
| 1108 | 1108 | } |
| 1109 | 1109 | */ |
| 1110 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
| 1111 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1112 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1113 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1114 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1110 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
| 1111 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
| 1112 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
| 1113 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
| 1114 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
| 1115 | 1115 | $va = false; |
| 1116 | 1116 | if ($globalivao == 'ivao') { |
| 1117 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
| 1117 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
| 1118 | 1118 | $va = true; |
| 1119 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1119 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
| 1120 | 1120 | if ($globalvatsim == 'vatsim') { |
| 1121 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
| 1121 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
| 1122 | 1122 | $va = true; |
| 1123 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1123 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
| 1124 | 1124 | if ($globalphpvms == 'phpvms') { |
| 1125 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
| 1125 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
| 1126 | 1126 | $va = true; |
| 1127 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1127 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
| 1128 | 1128 | if ($globalvam == 'vam') { |
| 1129 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
| 1129 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
| 1130 | 1130 | $va = true; |
| 1131 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1131 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
| 1132 | 1132 | if ($va) { |
| 1133 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
| 1134 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1133 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
| 1134 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
| 1135 | 1135 | if ($globalva == 'va' || $va) { |
| 1136 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
| 1137 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1136 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
| 1137 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
| 1138 | 1138 | } else { |
| 1139 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
| 1140 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1141 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1139 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
| 1140 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
| 1141 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | 1144 | |
| 1145 | 1145 | |
| 1146 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
| 1146 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
| 1147 | 1147 | if ($notam == 'notam') { |
| 1148 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
| 1148 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
| 1149 | 1149 | } else { |
| 1150 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
| 1150 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
| 1151 | 1151 | } |
| 1152 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
| 1152 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
| 1153 | 1153 | if ($owner == 'owner') { |
| 1154 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
| 1154 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
| 1155 | 1155 | } else { |
| 1156 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
| 1156 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
| 1157 | 1157 | } |
| 1158 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
| 1158 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
| 1159 | 1159 | if ($map3d == 'map3d') { |
| 1160 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
| 1160 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
| 1161 | 1161 | } else { |
| 1162 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
| 1162 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
| 1163 | 1163 | } |
| 1164 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
| 1164 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
| 1165 | 1165 | if ($crash == 'crash') { |
| 1166 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
| 1166 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
| 1167 | 1167 | } else { |
| 1168 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
| 1168 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
| 1169 | 1169 | } |
| 1170 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
| 1170 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
| 1171 | 1171 | if ($mapsatellites == 'mapsatellites') { |
| 1172 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
| 1172 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
| 1173 | 1173 | } else { |
| 1174 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
| 1174 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
| 1175 | 1175 | } |
| 1176 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
| 1176 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
| 1177 | 1177 | if ($map3ddefault == 'map3ddefault') { |
| 1178 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
| 1178 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
| 1179 | 1179 | } else { |
| 1180 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
| 1180 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
| 1181 | 1181 | } |
| 1182 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
| 1182 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
| 1183 | 1183 | if ($translate == 'translate') { |
| 1184 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
| 1184 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
| 1185 | 1185 | } else { |
| 1186 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
| 1186 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
| 1187 | 1187 | } |
| 1188 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
| 1188 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
| 1189 | 1189 | if ($realairlines == 'realairlines') { |
| 1190 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
| 1190 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
| 1191 | 1191 | } else { |
| 1192 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
| 1192 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
| 1193 | 1193 | } |
| 1194 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
| 1194 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
| 1195 | 1195 | if ($estimation == 'estimation') { |
| 1196 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
| 1196 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
| 1197 | 1197 | } else { |
| 1198 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
| 1198 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
| 1199 | 1199 | } |
| 1200 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
| 1200 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
| 1201 | 1201 | if ($metar == 'metar') { |
| 1202 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
| 1202 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
| 1203 | 1203 | } else { |
| 1204 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
| 1204 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
| 1205 | 1205 | } |
| 1206 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
| 1206 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
| 1207 | 1207 | if ($metarcycle == 'metarcycle') { |
| 1208 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
| 1208 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
| 1209 | 1209 | } else { |
| 1210 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
| 1210 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
| 1211 | 1211 | } |
| 1212 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
| 1212 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
| 1213 | 1213 | if ($fork == 'fork') { |
| 1214 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
| 1214 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
| 1215 | 1215 | } else { |
| 1216 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
| 1216 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
| 1219 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
| 1220 | 1220 | if ($colormap == 'colormap') { |
| 1221 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1221 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1222 | 1222 | } else { |
| 1223 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1223 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | 1226 | if (isset($_POST['aircrafticoncolor'])) { |
| 1227 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
| 1228 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
| 1227 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
| 1228 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
| 1229 | 1229 | } |
| 1230 | 1230 | |
| 1231 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 1232 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
| 1231 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 1232 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
| 1233 | 1233 | |
| 1234 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
| 1235 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
| 1236 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
| 1237 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
| 1238 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
| 1239 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
| 1234 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
| 1235 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
| 1236 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
| 1237 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
| 1238 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
| 1239 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
| 1240 | 1240 | |
| 1241 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
| 1241 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
| 1242 | 1242 | if ($mappopup == 'mappopup') { |
| 1243 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
| 1243 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
| 1244 | 1244 | } else { |
| 1245 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
| 1245 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
| 1246 | 1246 | } |
| 1247 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
| 1247 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
| 1248 | 1248 | if ($airportpopup == 'airportpopup') { |
| 1249 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
| 1249 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
| 1250 | 1250 | } else { |
| 1251 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
| 1251 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
| 1252 | 1252 | } |
| 1253 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
| 1253 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
| 1254 | 1254 | if ($maphistory == 'maphistory') { |
| 1255 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
| 1255 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
| 1256 | 1256 | } else { |
| 1257 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
| 1257 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
| 1258 | 1258 | } |
| 1259 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
| 1259 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
| 1260 | 1260 | if ($maptooltip == 'maptooltip') { |
| 1261 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
| 1261 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
| 1262 | 1262 | } else { |
| 1263 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
| 1263 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
| 1264 | 1264 | } |
| 1265 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
| 1265 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
| 1266 | 1266 | if ($flightroute == 'flightroute') { |
| 1267 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
| 1267 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
| 1268 | 1268 | } else { |
| 1269 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
| 1269 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
| 1270 | 1270 | } |
| 1271 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
| 1271 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
| 1272 | 1272 | if ($flightremainingroute == 'flightremainingroute') { |
| 1273 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
| 1273 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
| 1274 | 1274 | } else { |
| 1275 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
| 1275 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
| 1276 | 1276 | } |
| 1277 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
| 1277 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
| 1278 | 1278 | if ($allflights == 'allflights') { |
| 1279 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
| 1279 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
| 1280 | 1280 | } else { |
| 1281 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
| 1281 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
| 1282 | 1282 | } |
| 1283 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
| 1283 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
| 1284 | 1284 | if ($bbox == 'bbox') { |
| 1285 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
| 1285 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
| 1286 | 1286 | } else { |
| 1287 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
| 1287 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
| 1288 | 1288 | } |
| 1289 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
| 1289 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
| 1290 | 1290 | if ($waypoints == 'waypoints') { |
| 1291 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
| 1291 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
| 1292 | 1292 | } else { |
| 1293 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
| 1293 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
| 1294 | 1294 | } |
| 1295 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
| 1295 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
| 1296 | 1296 | if ($noairlines == 'noairlines') { |
| 1297 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
| 1297 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
| 1298 | 1298 | } else { |
| 1299 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
| 1299 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1302 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
| 1303 | 1303 | |
| 1304 | 1304 | // Set some defaults values... |
| 1305 | 1305 | if (!isset($globalAircraftImageSources)) { |
| 1306 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 1307 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1306 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
| 1307 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | if (!isset($globalSchedulesSources)) { |
| 1311 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1312 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1311 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
| 1312 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
| 1315 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
| 1316 | 1316 | |
| 1317 | 1317 | if ($error == '') settings::modify_settings($settings); |
| 1318 | 1318 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -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,78 +120,78 @@ 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'])) { |
|
| 186 | + if (isset($flight['lastupdate'])) { |
|
| 187 | 187 | if ($flight['lastupdate'] < (time()-5900)) { |
| 188 | - $this->delKey($key); |
|
| 188 | + $this->delKey($key); |
|
| 189 | + } |
|
| 189 | 190 | } |
| 190 | - } |
|
| 191 | 191 | } |
| 192 | - } |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - public function delKey($key) { |
|
| 194 | + public function delKey($key) { |
|
| 195 | 195 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 196 | 196 | // Delete old infos |
| 197 | 197 | if (isset($this->all_flights[$key]['id'])) { |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | unset($this->all_flights[$key]); |
| 209 | - } |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | - public function add($line) { |
|
| 211 | + public function add($line) { |
|
| 212 | 212 | 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, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate; |
| 213 | 213 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 214 | 214 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
@@ -234,20 +234,20 @@ 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['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
| 239 | - 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['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
| 239 | + 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)) { |
|
| 240 | 240 | |
| 241 | 241 | // Increment message number |
| 242 | 242 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
| 243 | - $current_date = date('Y-m-d'); |
|
| 244 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 245 | - else $source = ''; |
|
| 246 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 247 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 248 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 249 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 250 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 243 | + $current_date = date('Y-m-d'); |
|
| 244 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 245 | + else $source = ''; |
|
| 246 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 247 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 248 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 249 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 250 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /* |
@@ -263,53 +263,53 @@ discard block |
||
| 263 | 263 | //$this->db = $dbc; |
| 264 | 264 | |
| 265 | 265 | //$hex = trim($line['hex']); |
| 266 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 267 | - else $id = trim($line['id']); |
|
| 266 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 267 | + else $id = trim($line['id']); |
|
| 268 | 268 | |
| 269 | 269 | if (!isset($this->all_flights[$id])) { |
| 270 | - $this->all_flights[$id] = array(); |
|
| 271 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 272 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', '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' => '')); |
|
| 273 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 274 | - if (!isset($line['id'])) { |
|
| 270 | + $this->all_flights[$id] = array(); |
|
| 271 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 272 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', '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' => '')); |
|
| 273 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 274 | + if (!isset($line['id'])) { |
|
| 275 | 275 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 276 | 276 | // 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'))); |
| 277 | 277 | // 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'))); |
| 278 | 278 | 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 279 | - //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 280 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 281 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 279 | + //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 280 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 281 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 282 | 282 | } |
| 283 | 283 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 284 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 284 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | //print_r($this->all_flights); |
| 288 | 288 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
| 289 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 290 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 289 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 290 | + //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 291 | 291 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 292 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 293 | - 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 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 293 | + 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') { |
|
| 294 | 294 | $timeelapsed = microtime(true); |
| 295 | 295 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 296 | - $Spotter = new Spotter($this->db); |
|
| 297 | - if (isset($this->all_flights[$id]['source_type'])) { |
|
| 296 | + $Spotter = new Spotter($this->db); |
|
| 297 | + if (isset($this->all_flights[$id]['source_type'])) { |
|
| 298 | 298 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
| 299 | - } else { |
|
| 299 | + } else { |
|
| 300 | 300 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 301 | - } |
|
| 302 | - $Spotter->db = null; |
|
| 303 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 304 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 301 | + } |
|
| 302 | + $Spotter->db = null; |
|
| 303 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 304 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 305 | + } |
|
| 305 | 306 | } |
| 306 | - } |
|
| 307 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 308 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 307 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 308 | + if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 309 | 309 | } |
| 310 | - if (isset($line['id']) && !isset($line['hex'])) { |
|
| 311 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
| 312 | - } |
|
| 310 | + if (isset($line['id']) && !isset($line['hex'])) { |
|
| 311 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
| 312 | + } |
|
| 313 | 313 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
| 314 | 314 | $icao = $line['aircraft_icao']; |
| 315 | 315 | $Spotter = new Spotter($this->db); |
@@ -338,9 +338,9 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 340 | 340 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
| 341 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 341 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 342 | 342 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 343 | - } else { |
|
| 343 | + } else { |
|
| 344 | 344 | 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"; |
| 345 | 345 | 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"; |
| 346 | 346 | /* |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | print_r($line); |
| 350 | 350 | */ |
| 351 | 351 | return ''; |
| 352 | - } |
|
| 352 | + } |
|
| 353 | 353 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
| 354 | 354 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
| 355 | 355 | return ''; |
@@ -366,21 +366,21 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
| 369 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 369 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 370 | 370 | } |
| 371 | 371 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 372 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 372 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 373 | 373 | } |
| 374 | 374 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 375 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
| 375 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
| 376 | 376 | } |
| 377 | 377 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 378 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
| 378 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | 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'])) { |
| 382 | 382 | |
| 383 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 383 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 384 | 384 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 385 | 385 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
| 386 | 386 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
@@ -389,23 +389,23 @@ discard block |
||
| 389 | 389 | elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 390 | 390 | 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'])); |
| 391 | 391 | } else { |
| 392 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 393 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 392 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 393 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 394 | 394 | $timeelapsed = microtime(true); |
| 395 | - $Spotter = new Spotter($this->db); |
|
| 396 | - $fromsource = NULL; |
|
| 397 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 398 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 395 | + $Spotter = new Spotter($this->db); |
|
| 396 | + $fromsource = NULL; |
|
| 397 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 398 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 399 | 399 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 400 | 400 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 401 | 401 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 402 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 402 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 403 | 403 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 404 | 404 | $Spotter->db = null; |
| 405 | 405 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 406 | - } |
|
| 406 | + } |
|
| 407 | 407 | } |
| 408 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 408 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 409 | 409 | |
| 410 | 410 | /* |
| 411 | 411 | if (!isset($line['id'])) { |
@@ -415,90 +415,90 @@ discard block |
||
| 415 | 415 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 416 | 416 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 417 | 417 | */ |
| 418 | - 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'])); |
|
| 418 | + 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'])); |
|
| 419 | 419 | |
| 420 | - //$putinarchive = true; |
|
| 421 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 420 | + //$putinarchive = true; |
|
| 421 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 422 | 422 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
| 423 | - } |
|
| 424 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 423 | + } |
|
| 424 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 425 | 425 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
| 426 | - } |
|
| 427 | - if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 428 | - $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' => '')); |
|
| 429 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 426 | + } |
|
| 427 | + if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 428 | + $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' => '')); |
|
| 429 | + } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 430 | 430 | $timeelapsed = microtime(true); |
| 431 | 431 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 432 | 432 | $Spotter = new Spotter($this->db); |
| 433 | 433 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 434 | 434 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 435 | - $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' => '')); |
|
| 435 | + $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' => '')); |
|
| 436 | 436 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 437 | - } |
|
| 438 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 437 | + } |
|
| 438 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 439 | 439 | $timeelapsed = microtime(true); |
| 440 | 440 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 441 | - $Spotter = new Spotter($this->db); |
|
| 442 | - $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
| 443 | - if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
| 441 | + $Spotter = new Spotter($this->db); |
|
| 442 | + $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
| 443 | + if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
| 444 | 444 | $Translation = new Translation($this->db); |
| 445 | 445 | $ident = $Translation->checkTranslation(trim($line['ident'])); |
| 446 | 446 | $route = $Spotter->getRouteInfo($ident); |
| 447 | 447 | $Translation->db = null; |
| 448 | - } |
|
| 449 | - $Spotter->db = null; |
|
| 450 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 451 | - } |
|
| 448 | + } |
|
| 449 | + $Spotter->db = null; |
|
| 450 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 451 | + } |
|
| 452 | 452 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 453 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 454 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 453 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 454 | + if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 455 | 455 | // $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'])); |
| 456 | - $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'])); |
|
| 457 | - } |
|
| 456 | + $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'])); |
|
| 457 | + } |
|
| 458 | 458 | } |
| 459 | 459 | if (!isset($globalFork)) $globalFork = TRUE; |
| 460 | 460 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 461 | 461 | if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
| 462 | 462 | } |
| 463 | - } |
|
| 463 | + } |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | if (isset($line['speed']) && $line['speed'] != '') { |
| 467 | 467 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 468 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 469 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 470 | - //$dataFound = true; |
|
| 468 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 469 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 470 | + //$dataFound = true; |
|
| 471 | 471 | } 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'])) { |
| 472 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 473 | - if ($distance > 1000 && $distance < 10000) { |
|
| 474 | - // use datetime |
|
| 472 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 473 | + if ($distance > 1000 && $distance < 10000) { |
|
| 474 | + // use datetime |
|
| 475 | 475 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 476 | 476 | $speed = $speed*3.6; |
| 477 | 477 | if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
| 478 | 478 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
| 479 | - } |
|
| 479 | + } |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | |
| 483 | 483 | |
| 484 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude']) && !is_int($line['latitude']) && !is_int($line['longitude'])) { |
|
| 485 | - if (is_int($line['latitude']) || is_int($line['longitude'])) { |
|
| 486 | - if ($globalDebug) echo "/!\ Invalide latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 487 | - return false; |
|
| 488 | - } |
|
| 489 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 490 | - else unset($timediff); |
|
| 491 | - if ($this->tmd > 5 || isset($line['format_source']) && $line['format_source'] == 'airwhere' && ((!isset($this->all_flights[$id]['latitude']) || !isset($this->all_flights[$id]['longitude'])) || (isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $this->all_flights[$id]['latitude'] != $line['latitude'] && $this->all_flights[$id]['longitude'] != $line['longitude'])) || (isset($globalVA) && $globalVA) || (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')))) { |
|
| 484 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude']) && !is_int($line['latitude']) && !is_int($line['longitude'])) { |
|
| 485 | + if (is_int($line['latitude']) || is_int($line['longitude'])) { |
|
| 486 | + if ($globalDebug) echo "/!\ Invalide latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 487 | + return false; |
|
| 488 | + } |
|
| 489 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 490 | + else unset($timediff); |
|
| 491 | + if ($this->tmd > 5 || isset($line['format_source']) && $line['format_source'] == 'airwhere' && ((!isset($this->all_flights[$id]['latitude']) || !isset($this->all_flights[$id]['longitude'])) || (isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $this->all_flights[$id]['latitude'] != $line['latitude'] && $this->all_flights[$id]['longitude'] != $line['longitude'])) || (isset($globalVA) && $globalVA) || (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')))) { |
|
| 492 | 492 | 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'])) { |
| 493 | - if ((isset($timediff) && $timediff > $globalAircraftMaxUpdate) || isset($line['format_source']) && $line['format_source'] == 'airwhere' || !$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'])) { |
|
| 493 | + if ((isset($timediff) && $timediff > $globalAircraftMaxUpdate) || isset($line['format_source']) && $line['format_source'] == 'airwhere' || !$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'])) { |
|
| 494 | 494 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 495 | 495 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 496 | 496 | $this->all_flights[$id]['putinarchive'] = true; |
| 497 | 497 | $this->tmd = 0; |
| 498 | 498 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 499 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 500 | - $timeelapsed = microtime(true); |
|
| 501 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 499 | + if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 500 | + $timeelapsed = microtime(true); |
|
| 501 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 502 | 502 | $Spotter = new Spotter($this->db); |
| 503 | 503 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 504 | 504 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
@@ -506,18 +506,18 @@ discard block |
||
| 506 | 506 | $Spotter->db = null; |
| 507 | 507 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 508 | 508 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 509 | - } |
|
| 509 | + } |
|
| 510 | + } |
|
| 510 | 511 | } |
| 511 | - } |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 515 | - //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) { |
|
| 515 | + //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) { |
|
| 516 | 516 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 517 | 517 | 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' || $this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0005) { |
| 518 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 519 | - $dataFound = true; |
|
| 520 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 518 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 519 | + $dataFound = true; |
|
| 520 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 521 | 521 | } |
| 522 | 522 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 523 | 523 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -528,20 +528,20 @@ discard block |
||
| 528 | 528 | //$putinarchive = true; |
| 529 | 529 | } |
| 530 | 530 | */ |
| 531 | - /* |
|
| 531 | + /* |
|
| 532 | 532 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
| 533 | 533 | 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"; |
| 534 | 534 | } |
| 535 | 535 | */ |
| 536 | 536 | } |
| 537 | 537 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 538 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 539 | - //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) { |
|
| 538 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 539 | + //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) { |
|
| 540 | 540 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 541 | 541 | 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' || $this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0005) { |
| 542 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 543 | - $dataFound = true; |
|
| 544 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 542 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 543 | + $dataFound = true; |
|
| 544 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 545 | 545 | } |
| 546 | 546 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 547 | 547 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -559,77 +559,77 @@ discard block |
||
| 559 | 559 | */ |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - } else if ($globalDebug && $timediff > 30) { |
|
| 562 | + } else if ($globalDebug && $timediff > 30) { |
|
| 563 | 563 | $this->tmd = $this->tmd + 1; |
| 564 | 564 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 565 | 565 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
| 566 | 566 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 567 | 567 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 568 | - } |
|
| 568 | + } |
|
| 569 | 569 | } |
| 570 | 570 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 571 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 572 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 571 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 572 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 573 | 573 | } |
| 574 | 574 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 575 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 576 | - //$dataFound = true; |
|
| 575 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 576 | + //$dataFound = true; |
|
| 577 | 577 | } |
| 578 | 578 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 579 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 579 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 580 | 580 | } |
| 581 | 581 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 582 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 582 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 583 | 583 | } |
| 584 | 584 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 585 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 586 | - //$dataFound = true; |
|
| 585 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 586 | + //$dataFound = true; |
|
| 587 | 587 | } |
| 588 | 588 | if (isset($line['ground']) && $line['ground'] != '') { |
| 589 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 589 | + if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 590 | 590 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 591 | 591 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 592 | 592 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 593 | 593 | 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 594 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 594 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 595 | 595 | 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'])); |
| 596 | - } |
|
| 597 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 598 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 599 | - //$dataFound = true; |
|
| 596 | + } |
|
| 597 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 598 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 599 | + //$dataFound = true; |
|
| 600 | 600 | } |
| 601 | 601 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 602 | - 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'])) { |
|
| 603 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 604 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 605 | - $highlight = ''; |
|
| 606 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 607 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 608 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 609 | - if ($highlight != '') { |
|
| 602 | + 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'])) { |
|
| 603 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 604 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 605 | + $highlight = ''; |
|
| 606 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 607 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 608 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 609 | + if ($highlight != '') { |
|
| 610 | 610 | $timeelapsed = microtime(true); |
| 611 | 611 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 612 | - $Spotter = new Spotter($this->db); |
|
| 613 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 614 | - $Spotter->db = null; |
|
| 615 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 612 | + $Spotter = new Spotter($this->db); |
|
| 613 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 614 | + $Spotter->db = null; |
|
| 615 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 616 | 616 | } |
| 617 | 617 | //$putinarchive = true; |
| 618 | 618 | //$highlight = ''; |
| 619 | - } |
|
| 619 | + } |
|
| 620 | 620 | |
| 621 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 622 | - //$dataFound = true; |
|
| 621 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 622 | + //$dataFound = true; |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 626 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 626 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 627 | 627 | 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; |
| 628 | 628 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 629 | 629 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 630 | 630 | //$dataFound = true; |
| 631 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 632 | - if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
|
| 631 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 632 | + if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
|
| 633 | 633 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 634 | 634 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
| 635 | 635 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
@@ -638,27 +638,27 @@ discard block |
||
| 638 | 638 | elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 639 | 639 | 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'])); |
| 640 | 640 | } |
| 641 | - } |
|
| 642 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
| 641 | + } |
|
| 642 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 646 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 646 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | if (isset($line['heading']) && $line['heading'] != '') { |
| 650 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 651 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 652 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 653 | - //$dataFound = true; |
|
| 650 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 651 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 652 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 653 | + //$dataFound = true; |
|
| 654 | 654 | } 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']) { |
| 655 | - $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']); |
|
| 656 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 657 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 658 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['id']." : ".$heading."\n"; |
|
| 655 | + $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']); |
|
| 656 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 657 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 658 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['id']." : ".$heading."\n"; |
|
| 659 | 659 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 660 | - // If not enough messages and ACARS set heading to 0 |
|
| 661 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 660 | + // If not enough messages and ACARS set heading to 0 |
|
| 661 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 662 | 662 | } |
| 663 | 663 | if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 664 | 664 | elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -671,125 +671,125 @@ discard block |
||
| 671 | 671 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 672 | 672 | //if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
| 673 | 673 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
| 674 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
| 675 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 676 | - 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'])) { |
|
| 677 | - //print_r($this->all_flights); |
|
| 678 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 679 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 680 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 674 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
| 675 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 676 | + 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'])) { |
|
| 677 | + //print_r($this->all_flights); |
|
| 678 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 679 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 680 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 681 | 681 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 682 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 683 | - $timeelapsed = microtime(true); |
|
| 684 | - $SpotterLive = new SpotterLive($this->db); |
|
| 685 | - 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' || $line['format_source'] === 'famaprs')) { |
|
| 682 | + if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 683 | + $timeelapsed = microtime(true); |
|
| 684 | + $SpotterLive = new SpotterLive($this->db); |
|
| 685 | + 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' || $line['format_source'] === 'famaprs')) { |
|
| 686 | 686 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 687 | 687 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 688 | - } elseif (isset($line['id'])) { |
|
| 688 | + } elseif (isset($line['id'])) { |
|
| 689 | 689 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 690 | 690 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 691 | - } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
| 691 | + } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
| 692 | 692 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 693 | 693 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 694 | - } else $recent_ident = ''; |
|
| 695 | - $SpotterLive->db=null; |
|
| 696 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 697 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 694 | + } else $recent_ident = ''; |
|
| 695 | + $SpotterLive->db=null; |
|
| 696 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 697 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 698 | 698 | } else $recent_ident = ''; |
| 699 | - } else { |
|
| 699 | + } else { |
|
| 700 | 700 | $recent_ident = ''; |
| 701 | 701 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
| 702 | - } |
|
| 703 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 704 | - if($recent_ident == "") |
|
| 705 | - { |
|
| 702 | + } |
|
| 703 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 704 | + if($recent_ident == "") |
|
| 705 | + { |
|
| 706 | 706 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 707 | 707 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 708 | 708 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 709 | 709 | //adds the spotter data for the archive |
| 710 | 710 | $ignoreImport = false; |
| 711 | 711 | foreach($globalAirportIgnore as $airportIgnore) { |
| 712 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 712 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 713 | 713 | $ignoreImport = true; |
| 714 | - } |
|
| 714 | + } |
|
| 715 | 715 | } |
| 716 | 716 | if (count($globalAirportAccept) > 0) { |
| 717 | - $ignoreImport = true; |
|
| 718 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 717 | + $ignoreImport = true; |
|
| 718 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 719 | 719 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 720 | - $ignoreImport = false; |
|
| 720 | + $ignoreImport = false; |
|
| 721 | + } |
|
| 721 | 722 | } |
| 722 | - } |
|
| 723 | 723 | } |
| 724 | 724 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 725 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 725 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 726 | 726 | 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)) { |
| 727 | - $ignoreImport = true; |
|
| 727 | + $ignoreImport = true; |
|
| 728 | + } |
|
| 728 | 729 | } |
| 729 | - } |
|
| 730 | 730 | } |
| 731 | 731 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 732 | - $ignoreImport = true; |
|
| 733 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 732 | + $ignoreImport = true; |
|
| 733 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
| 734 | 734 | 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)) { |
| 735 | - $ignoreImport = false; |
|
| 735 | + $ignoreImport = false; |
|
| 736 | + } |
|
| 736 | 737 | } |
| 737 | - } |
|
| 738 | 738 | } |
| 739 | 739 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 740 | - $ignoreImport = true; |
|
| 741 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 740 | + $ignoreImport = true; |
|
| 741 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 742 | 742 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 743 | - $ignoreImport = false; |
|
| 743 | + $ignoreImport = false; |
|
| 744 | + } |
|
| 744 | 745 | } |
| 745 | - } |
|
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | if (!$ignoreImport) { |
| 749 | - $highlight = ''; |
|
| 750 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 751 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 752 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 753 | - 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'))); |
|
| 754 | - $timeelapsed = microtime(true); |
|
| 755 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 749 | + $highlight = ''; |
|
| 750 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 751 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 752 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 753 | + 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'))); |
|
| 754 | + $timeelapsed = microtime(true); |
|
| 755 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 756 | 756 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 757 | - $Spotter = new Spotter($this->db); |
|
| 758 | - $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']); |
|
| 759 | - $Spotter->db = null; |
|
| 760 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 757 | + $Spotter = new Spotter($this->db); |
|
| 758 | + $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']); |
|
| 759 | + $Spotter->db = null; |
|
| 760 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 761 | 761 | } |
| 762 | - } |
|
| 763 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 764 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 762 | + } |
|
| 763 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 764 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 765 | 765 | |
| 766 | - // Add source stat in DB |
|
| 767 | - $Stats = new Stats($this->db); |
|
| 768 | - if (!empty($this->stats)) { |
|
| 766 | + // Add source stat in DB |
|
| 767 | + $Stats = new Stats($this->db); |
|
| 768 | + if (!empty($this->stats)) { |
|
| 769 | 769 | if ($globalDebug) echo 'Add source stats : '; |
| 770 | - foreach($this->stats as $date => $data) { |
|
| 771 | - foreach($data as $source => $sourced) { |
|
| 772 | - //print_r($sourced); |
|
| 773 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 774 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 775 | - if (isset($sourced['msg'])) { |
|
| 776 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 777 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 778 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 779 | - unset($this->stats[$date][$source]['msg']); |
|
| 780 | - } |
|
| 781 | - } |
|
| 782 | - } |
|
| 783 | - if ($date != date('Y-m-d')) { |
|
| 784 | - unset($this->stats[$date]); |
|
| 785 | - } |
|
| 786 | - } |
|
| 787 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 788 | - |
|
| 789 | - } |
|
| 790 | - $Stats->db = null; |
|
| 791 | - } |
|
| 792 | - $this->del(); |
|
| 770 | + foreach($this->stats as $date => $data) { |
|
| 771 | + foreach($data as $source => $sourced) { |
|
| 772 | + //print_r($sourced); |
|
| 773 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 774 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 775 | + if (isset($sourced['msg'])) { |
|
| 776 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 777 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 778 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 779 | + unset($this->stats[$date][$source]['msg']); |
|
| 780 | + } |
|
| 781 | + } |
|
| 782 | + } |
|
| 783 | + if ($date != date('Y-m-d')) { |
|
| 784 | + unset($this->stats[$date]); |
|
| 785 | + } |
|
| 786 | + } |
|
| 787 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 788 | + |
|
| 789 | + } |
|
| 790 | + $Stats->db = null; |
|
| 791 | + } |
|
| 792 | + $this->del(); |
|
| 793 | 793 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
| 794 | 794 | //$ignoreImport = false; |
| 795 | 795 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -807,41 +807,41 @@ discard block |
||
| 807 | 807 | */ |
| 808 | 808 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 809 | 809 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 810 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 811 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 812 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 810 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 811 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 812 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 813 | 813 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 814 | - $SpotterLive = new SpotterLive($this->db); |
|
| 815 | - $SpotterLive->deleteLiveSpotterData(); |
|
| 816 | - $SpotterLive->db=null; |
|
| 814 | + $SpotterLive = new SpotterLive($this->db); |
|
| 815 | + $SpotterLive->deleteLiveSpotterData(); |
|
| 816 | + $SpotterLive->db=null; |
|
| 817 | + } |
|
| 817 | 818 | } |
| 818 | - } |
|
| 819 | - if ($globalDebug) echo " Done\n"; |
|
| 820 | - $this->last_delete = time(); |
|
| 819 | + if ($globalDebug) echo " Done\n"; |
|
| 820 | + $this->last_delete = time(); |
|
| 821 | 821 | } |
| 822 | - } else { |
|
| 822 | + } else { |
|
| 823 | 823 | 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'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
| 824 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
| 825 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 824 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
| 825 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 826 | 826 | } |
| 827 | 827 | if (isset($globalDaemon) && !$globalDaemon) { |
| 828 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 828 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 829 | 829 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 830 | - $Spotter = new Spotter($this->db); |
|
| 831 | - $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']); |
|
| 832 | - $Spotter->db = null; |
|
| 830 | + $Spotter = new Spotter($this->db); |
|
| 831 | + $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']); |
|
| 832 | + $Spotter->db = null; |
|
| 833 | + } |
|
| 833 | 834 | } |
| 834 | - } |
|
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - } |
|
| 837 | + } |
|
| 838 | + } |
|
| 838 | 839 | } |
| 839 | - } |
|
| 840 | - //adds the spotter LIVE data |
|
| 841 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 842 | - //echo "\nAdd in Live !! \n"; |
|
| 843 | - //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"; |
|
| 844 | - if ($globalDebug) { |
|
| 840 | + //adds the spotter LIVE data |
|
| 841 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 842 | + //echo "\nAdd in Live !! \n"; |
|
| 843 | + //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"; |
|
| 844 | + if ($globalDebug) { |
|
| 845 | 845 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 846 | 846 | 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"; |
| 847 | 847 | 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"; |
@@ -849,60 +849,60 @@ discard block |
||
| 849 | 849 | 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"; |
| 850 | 850 | 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"; |
| 851 | 851 | } |
| 852 | - } |
|
| 853 | - $ignoreImport = false; |
|
| 854 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 855 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 852 | + } |
|
| 853 | + $ignoreImport = false; |
|
| 854 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 855 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 856 | 856 | |
| 857 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 858 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 859 | - $ignoreImport = true; |
|
| 857 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 858 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 859 | + $ignoreImport = true; |
|
| 860 | 860 | } |
| 861 | - } |
|
| 862 | - if (count($globalAirportAccept) > 0) { |
|
| 863 | - $ignoreImport = true; |
|
| 864 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 865 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 861 | + } |
|
| 862 | + if (count($globalAirportAccept) > 0) { |
|
| 863 | + $ignoreImport = true; |
|
| 864 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 865 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 866 | 866 | $ignoreImport = false; |
| 867 | - } |
|
| 867 | + } |
|
| 868 | + } |
|
| 868 | 869 | } |
| 869 | - } |
|
| 870 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 870 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 871 | 871 | foreach($globalAirlineIgnore as $airlineIgnore) { |
| 872 | - 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)) { |
|
| 872 | + 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)) { |
|
| 873 | 873 | $ignoreImport = true; |
| 874 | - } |
|
| 874 | + } |
|
| 875 | 875 | } |
| 876 | - } |
|
| 877 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 876 | + } |
|
| 877 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 878 | 878 | $ignoreImport = true; |
| 879 | 879 | foreach($globalAirlineAccept as $airlineAccept) { |
| 880 | - 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)) { |
|
| 880 | + 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)) { |
|
| 881 | 881 | $ignoreImport = false; |
| 882 | - } |
|
| 882 | + } |
|
| 883 | + } |
|
| 883 | 884 | } |
| 884 | - } |
|
| 885 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 885 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 886 | 886 | $ignoreImport = true; |
| 887 | 887 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
| 888 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 889 | - $ignoreImport = false; |
|
| 890 | - } |
|
| 888 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 889 | + $ignoreImport = false; |
|
| 890 | + } |
|
| 891 | + } |
|
| 891 | 892 | } |
| 892 | - } |
|
| 893 | 893 | |
| 894 | - if (!$ignoreImport) { |
|
| 894 | + if (!$ignoreImport) { |
|
| 895 | 895 | 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'])) { |
| 896 | 896 | 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'))); |
| 897 | 897 | $timeelapsed = microtime(true); |
| 898 | 898 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 899 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 899 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 900 | 900 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 901 | 901 | $SpotterLive = new SpotterLive($this->db); |
| 902 | 902 | $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']); |
| 903 | 903 | $SpotterLive->db = null; |
| 904 | 904 | if ($globalDebug) echo $result."\n"; |
| 905 | - } |
|
| 905 | + } |
|
| 906 | 906 | } |
| 907 | 907 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 908 | 908 | $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']); |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | //if ($line['format_source'] != 'aprs') { |
| 915 | 915 | //if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) { |
| 916 | 916 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 917 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
| 917 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
| 918 | 918 | $source = $this->all_flights[$id]['source_name']; |
| 919 | 919 | if ($source == '') $source = $this->all_flights[$id]['format_source']; |
| 920 | 920 | if (!isset($this->source_location[$source])) { |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | if ($stats_heading == 16) $stats_heading = 0; |
| 941 | 941 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 942 | 942 | for ($i=0;$i<=15;$i++) { |
| 943 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 943 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 944 | 944 | } |
| 945 | 945 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 946 | 946 | } else { |
@@ -953,17 +953,17 @@ discard block |
||
| 953 | 953 | //var_dump($this->stats); |
| 954 | 954 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 955 | 955 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 956 | - end($this->stats[$current_date][$source]['hist']); |
|
| 957 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 956 | + end($this->stats[$current_date][$source]['hist']); |
|
| 957 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 958 | 958 | } else $mini = 0; |
| 959 | 959 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 960 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 960 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 961 | 961 | } |
| 962 | 962 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 963 | 963 | } else { |
| 964 | 964 | $this->stats[$current_date][$source]['hist'][$distance] += 1; |
| 965 | 965 | } |
| 966 | - } |
|
| 966 | + } |
|
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | $this->all_flights[$id]['lastupdate'] = time(); |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | //$this->del(); |
| 974 | 974 | |
| 975 | 975 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 976 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 976 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 977 | 977 | if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
| 978 | 978 | $SpotterLive = new SpotterLive($this->db); |
| 979 | 979 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
@@ -981,19 +981,19 @@ discard block |
||
| 981 | 981 | //SpotterLive->deleteLiveSpotterData(); |
| 982 | 982 | if ($globalDebug) echo " Done\n"; |
| 983 | 983 | $this->last_delete_hourly = time(); |
| 984 | - } else { |
|
| 984 | + } else { |
|
| 985 | 985 | $this->del(); |
| 986 | 986 | $this->last_delete_hourly = time(); |
| 987 | - } |
|
| 987 | + } |
|
| 988 | 988 | } |
| 989 | 989 | |
| 990 | - } |
|
| 991 | - //$ignoreImport = false; |
|
| 990 | + } |
|
| 991 | + //$ignoreImport = false; |
|
| 992 | 992 | } |
| 993 | 993 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 994 | 994 | if ($send) return $this->all_flights[$id]; |
| 995 | - } |
|
| 995 | + } |
|
| 996 | + } |
|
| 996 | 997 | } |
| 997 | - } |
|
| 998 | 998 | } |
| 999 | 999 | ?> |
@@ -33,12 +33,12 @@ 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) { |
|
| 36 | + foreach ($sourcestat as $srcst) { |
|
| 37 | 37 | $type = $srcst['stats_type']; |
| 38 | 38 | if ($type == 'polar' || $type == 'hist') { |
| 39 | 39 | $source = $srcst['source_name']; |
| 40 | 40 | $data = $srcst['source_data']; |
| 41 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 41 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 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 | |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | $schedule = $Schedule->fetchSchedule($operator); |
| 76 | 76 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 77 | 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'])); |
|
| 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 | 80 | // Should also check if route schedule = route from DB |
| 81 | 81 | if ($schedule['DepartureAirportIATA'] != '') { |
| 82 | 82 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 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']); |
|
| 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 | 101 | } else $scheduleexist = true; |
| 102 | 102 | } else $scheduleexist = true; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | if ($scheduleexist) { |
| 105 | 105 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
| 106 | 106 | $sch = $Schedule->getSchedule($operator); |
| 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'])); |
|
| 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; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 132 | 132 | $Spotter = new Spotter($this->db); |
| 133 | 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']); |
|
| 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 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $airport_time = ''; |
| 146 | 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); |
|
| 148 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
| 149 | 149 | if (isset($closestAirports[0])) { |
| 150 | 150 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 151 | 151 | $airport_icao = $closestAirports[0]['icao']; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | break; |
| 161 | 161 | } |
| 162 | 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))) { |
|
| 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 | 164 | $airport_icao = $closestAirports[0]['icao']; |
| 165 | 165 | $airport_time = $this->all_flights[$key]['datetime']; |
| 166 | 166 | } else { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } else { |
| 174 | 174 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
| 175 | 175 | } |
| 176 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 176 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 185 | 185 | foreach ($this->all_flights as $key => $flight) { |
| 186 | 186 | if (isset($flight['lastupdate'])) { |
| 187 | - if ($flight['lastupdate'] < (time()-5900)) { |
|
| 187 | + if ($flight['lastupdate'] < (time() - 5900)) { |
|
| 188 | 188 | $this->delKey($key); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $real_arrival = $this->arrival($key); |
| 201 | 201 | $Spotter = new Spotter($this->db); |
| 202 | 202 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 203 | - $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']); |
|
| 203 | + $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']); |
|
| 204 | 204 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 205 | 205 | } |
| 206 | 206 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $send = false; |
| 234 | 234 | |
| 235 | 235 | // SBS format is CSV format |
| 236 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
| 236 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
| 237 | 237 | //print_r($line); |
| 238 | 238 | if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
| 239 | 239 | 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)) { |
@@ -268,25 +268,25 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | if (!isset($this->all_flights[$id])) { |
| 270 | 270 | $this->all_flights[$id] = array(); |
| 271 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 272 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', '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' => '')); |
|
| 273 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 271 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 272 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'altitude_previous' => '', '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' => '')); |
|
| 273 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
| 274 | 274 | if (!isset($line['id'])) { |
| 275 | 275 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 276 | 276 | // 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'))); |
| 277 | 277 | // 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'))); |
| 278 | - 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 278 | + 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 279 | 279 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 280 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 280 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 281 | 281 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 282 | 282 | } |
| 283 | 283 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 284 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 284 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type'])); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | //print_r($this->all_flights); |
| 288 | 288 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
| 289 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 289 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
| 290 | 290 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 291 | 291 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 292 | 292 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -295,27 +295,27 @@ discard block |
||
| 295 | 295 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 296 | 296 | $Spotter = new Spotter($this->db); |
| 297 | 297 | if (isset($this->all_flights[$id]['source_type'])) { |
| 298 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
| 298 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
| 299 | 299 | } else { |
| 300 | 300 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 301 | 301 | } |
| 302 | 302 | $Spotter->db = null; |
| 303 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 304 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 303 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 304 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 308 | 308 | if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
| 309 | 309 | } |
| 310 | 310 | if (isset($line['id']) && !isset($line['hex'])) { |
| 311 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
| 311 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => '')); |
|
| 312 | 312 | } |
| 313 | 313 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
| 314 | 314 | $icao = $line['aircraft_icao']; |
| 315 | 315 | $Spotter = new Spotter($this->db); |
| 316 | 316 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
| 317 | 317 | $Spotter->db = null; |
| 318 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
| 318 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
| 319 | 319 | } |
| 320 | 320 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
| 321 | 321 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $Spotter = new Spotter($this->db); |
| 324 | 324 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 325 | 325 | $Spotter->db = null; |
| 326 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 326 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -331,15 +331,15 @@ discard block |
||
| 331 | 331 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
| 332 | 332 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
| 333 | 333 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
| 334 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 334 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 335 | 335 | } |
| 336 | 336 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
| 337 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
| 337 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
| 338 | 338 | } |
| 339 | 339 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 340 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
| 340 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
| 341 | 341 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 342 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
| 342 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
| 343 | 343 | } else { |
| 344 | 344 | 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"; |
| 345 | 345 | 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"; |
@@ -350,32 +350,32 @@ discard block |
||
| 350 | 350 | */ |
| 351 | 351 | return ''; |
| 352 | 352 | } |
| 353 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
| 353 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
| 354 | 354 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
| 355 | 355 | return ''; |
| 356 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
| 356 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
| 357 | 357 | if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n |
| 358 | 358 | "; |
| 359 | 359 | return ''; |
| 360 | 360 | } elseif (!isset($line['datetime'])) { |
| 361 | 361 | date_default_timezone_set('UTC'); |
| 362 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 362 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 363 | 363 | } else { |
| 364 | 364 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
| 365 | 365 | return ''; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
| 369 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 369 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
| 370 | 370 | } |
| 371 | 371 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 372 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 372 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
| 373 | 373 | } |
| 374 | 374 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 375 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
| 375 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id']))); |
|
| 376 | 376 | } |
| 377 | 377 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 378 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
| 378 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name']))); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | 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'])) { |
@@ -383,13 +383,13 @@ discard block |
||
| 383 | 383 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
| 384 | 384 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 385 | 385 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
| 386 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 387 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 388 | - 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 389 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 390 | - 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'])); |
|
| 386 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 387 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 388 | + 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 389 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 390 | + 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'])); |
|
| 391 | 391 | } else { |
| 392 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 392 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 393 | 393 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 394 | 394 | $timeelapsed = microtime(true); |
| 395 | 395 | $Spotter = new Spotter($this->db); |
@@ -399,13 +399,13 @@ discard block |
||
| 399 | 399 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 400 | 400 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 401 | 401 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 402 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 402 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
| 403 | 403 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 404 | 404 | $Spotter->db = null; |
| 405 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 405 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 408 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 409 | 409 | |
| 410 | 410 | /* |
| 411 | 411 | if (!isset($line['id'])) { |
@@ -415,25 +415,25 @@ discard block |
||
| 415 | 415 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 416 | 416 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 417 | 417 | */ |
| 418 | - 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'])); |
|
| 418 | + 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'])); |
|
| 419 | 419 | |
| 420 | 420 | //$putinarchive = true; |
| 421 | 421 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
| 422 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 422 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 423 | 423 | } |
| 424 | 424 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
| 425 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 425 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 426 | 426 | } |
| 427 | 427 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
| 428 | - $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' => '')); |
|
| 428 | + $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' => '')); |
|
| 429 | 429 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
| 430 | 430 | $timeelapsed = microtime(true); |
| 431 | 431 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 432 | 432 | $Spotter = new Spotter($this->db); |
| 433 | 433 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 434 | 434 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 435 | - $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' => '')); |
|
| 436 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 435 | + $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' => '')); |
|
| 436 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 437 | 437 | } |
| 438 | 438 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 439 | 439 | $timeelapsed = microtime(true); |
@@ -447,34 +447,34 @@ discard block |
||
| 447 | 447 | $Translation->db = null; |
| 448 | 448 | } |
| 449 | 449 | $Spotter->db = null; |
| 450 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 450 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 451 | 451 | } |
| 452 | 452 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 453 | 453 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
| 454 | 454 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
| 455 | 455 | // $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'])); |
| 456 | - $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'])); |
|
| 456 | + $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'])); |
|
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 | if (!isset($globalFork)) $globalFork = TRUE; |
| 460 | 460 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 461 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 461 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | if (isset($line['speed']) && $line['speed'] != '') { |
| 467 | 467 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 468 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 469 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 468 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
| 469 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
| 470 | 470 | //$dataFound = true; |
| 471 | 471 | } 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'])) { |
| 472 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 472 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
| 473 | 473 | if ($distance > 1000 && $distance < 10000) { |
| 474 | 474 | // use datetime |
| 475 | 475 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 476 | 476 | $speed = $speed*3.6; |
| 477 | - if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 477 | + if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
| 478 | 478 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
| 479 | 479 | } |
| 480 | 480 | } |
@@ -486,11 +486,11 @@ discard block |
||
| 486 | 486 | if ($globalDebug) echo "/!\ Invalide latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
| 487 | 487 | return false; |
| 488 | 488 | } |
| 489 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 489 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
| 490 | 490 | else unset($timediff); |
| 491 | - if ($this->tmd > 5 || isset($line['format_source']) && $line['format_source'] == 'airwhere' && ((!isset($this->all_flights[$id]['latitude']) || !isset($this->all_flights[$id]['longitude'])) || (isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $this->all_flights[$id]['latitude'] != $line['latitude'] && $this->all_flights[$id]['longitude'] != $line['longitude'])) || (isset($globalVA) && $globalVA) || (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')))) { |
|
| 491 | + if ($this->tmd > 5 || isset($line['format_source']) && $line['format_source'] == 'airwhere' && ((!isset($this->all_flights[$id]['latitude']) || !isset($this->all_flights[$id]['longitude'])) || (isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $this->all_flights[$id]['latitude'] != $line['latitude'] && $this->all_flights[$id]['longitude'] != $line['longitude'])) || (isset($globalVA) && $globalVA) || (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')))) { |
|
| 492 | 492 | 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'])) { |
| 493 | - if ((isset($timediff) && $timediff > $globalAircraftMaxUpdate) || isset($line['format_source']) && $line['format_source'] == 'airwhere' || !$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'])) { |
|
| 493 | + if ((isset($timediff) && $timediff > $globalAircraftMaxUpdate) || isset($line['format_source']) && $line['format_source'] == 'airwhere' || !$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'])) { |
|
| 494 | 494 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 495 | 495 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 496 | 496 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -500,11 +500,11 @@ discard block |
||
| 500 | 500 | $timeelapsed = microtime(true); |
| 501 | 501 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 502 | 502 | $Spotter = new Spotter($this->db); |
| 503 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 503 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 504 | 504 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
| 505 | 505 | else $this->all_flights[$id]['over_country'] = ''; |
| 506 | 506 | $Spotter->db = null; |
| 507 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 507 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 508 | 508 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 509 | 509 | } |
| 510 | 510 | } |
@@ -514,13 +514,13 @@ discard block |
||
| 514 | 514 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 515 | 515 | //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) { |
| 516 | 516 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 517 | - 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' || $this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0005) { |
|
| 517 | + 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' || $this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.0005) { |
|
| 518 | 518 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
| 519 | 519 | $dataFound = true; |
| 520 | 520 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 521 | 521 | } |
| 522 | 522 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 523 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
| 523 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
| 524 | 524 | /* |
| 525 | 525 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
| 526 | 526 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -538,13 +538,13 @@ discard block |
||
| 538 | 538 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
| 539 | 539 | //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) { |
| 540 | 540 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 541 | - 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' || $this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0005) { |
|
| 541 | + 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' || $this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > 0.0005) { |
|
| 542 | 542 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
| 543 | 543 | $dataFound = true; |
| 544 | 544 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 545 | 545 | } |
| 546 | 546 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 547 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
| 547 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
| 548 | 548 | /* |
| 549 | 549 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
| 550 | 550 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -562,46 +562,46 @@ discard block |
||
| 562 | 562 | } else if ($globalDebug && $timediff > 30) { |
| 563 | 563 | $this->tmd = $this->tmd + 1; |
| 564 | 564 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 565 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
| 566 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 565 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
| 566 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 567 | 567 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 571 | 571 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 572 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 572 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
| 573 | 573 | } |
| 574 | 574 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 575 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 575 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
| 576 | 576 | //$dataFound = true; |
| 577 | 577 | } |
| 578 | 578 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 579 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 579 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
| 580 | 580 | } |
| 581 | 581 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 582 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 582 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
| 583 | 583 | } |
| 584 | 584 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 585 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 585 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
| 586 | 586 | //$dataFound = true; |
| 587 | 587 | } |
| 588 | 588 | if (isset($line['ground']) && $line['ground'] != '') { |
| 589 | 589 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
| 590 | 590 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 591 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 592 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 593 | - 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 594 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 595 | - 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'])); |
|
| 591 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 592 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 593 | + 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 594 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 595 | + 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'])); |
|
| 596 | 596 | } |
| 597 | 597 | if ($line['ground'] != 1) $line['ground'] = 0; |
| 598 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 598 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
| 599 | 599 | //$dataFound = true; |
| 600 | 600 | } |
| 601 | 601 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 602 | 602 | 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'])) { |
| 603 | 603 | if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
| 604 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 604 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 605 | 605 | $highlight = ''; |
| 606 | 606 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
| 607 | 607 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -610,59 +610,59 @@ discard block |
||
| 610 | 610 | $timeelapsed = microtime(true); |
| 611 | 611 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 612 | 612 | $Spotter = new Spotter($this->db); |
| 613 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 613 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
| 614 | 614 | $Spotter->db = null; |
| 615 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 615 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 616 | 616 | } |
| 617 | 617 | //$putinarchive = true; |
| 618 | 618 | //$highlight = ''; |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 621 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 622 | 622 | //$dataFound = true; |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 626 | 626 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 627 | - 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; |
|
| 628 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
| 629 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
| 627 | + 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; |
|
| 628 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
| 629 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
| 630 | 630 | //$dataFound = true; |
| 631 | 631 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 632 | 632 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
| 633 | 633 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 634 | 634 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
| 635 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 636 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 637 | - 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 638 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 639 | - 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'])); |
|
| 635 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 636 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 637 | + 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' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 638 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 639 | + 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'])); |
|
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
| 642 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude'])); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 646 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 646 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | if (isset($line['heading']) && $line['heading'] != '') { |
| 650 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 651 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 652 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 650 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 651 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
| 652 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
| 653 | 653 | //$dataFound = true; |
| 654 | 654 | } 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']) { |
| 655 | - $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']); |
|
| 656 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 657 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 655 | + $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']); |
|
| 656 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
| 657 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 658 | 658 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['id']." : ".$heading."\n"; |
| 659 | 659 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 660 | 660 | // If not enough messages and ACARS set heading to 0 |
| 661 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 661 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
| 662 | 662 | } |
| 663 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 664 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 665 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalMinupdate) $dataFound = false; |
|
| 663 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 664 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 665 | + elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalMinupdate) $dataFound = false; |
|
| 666 | 666 | |
| 667 | 667 | // print_r($this->all_flights[$id]); |
| 668 | 668 | //gets the callsign from the last hour |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
| 674 | 674 | $this->all_flights[$id]['lastupdate'] = time(); |
| 675 | 675 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
| 676 | - 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'])) { |
|
| 676 | + 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'])) { |
|
| 677 | 677 | //print_r($this->all_flights); |
| 678 | 678 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
| 679 | 679 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -684,61 +684,61 @@ discard block |
||
| 684 | 684 | $SpotterLive = new SpotterLive($this->db); |
| 685 | 685 | 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' || $line['format_source'] === 'famaprs')) { |
| 686 | 686 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 687 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 687 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 688 | 688 | } elseif (isset($line['id'])) { |
| 689 | 689 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 690 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 690 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 691 | 691 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 692 | 692 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 693 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 693 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 694 | 694 | } else $recent_ident = ''; |
| 695 | - $SpotterLive->db=null; |
|
| 695 | + $SpotterLive->db = null; |
|
| 696 | 696 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 697 | 697 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 698 | 698 | } else $recent_ident = ''; |
| 699 | 699 | } else { |
| 700 | 700 | $recent_ident = ''; |
| 701 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
| 701 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
| 702 | 702 | } |
| 703 | 703 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 704 | - if($recent_ident == "") |
|
| 704 | + if ($recent_ident == "") |
|
| 705 | 705 | { |
| 706 | 706 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 707 | 707 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 708 | 708 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 709 | 709 | //adds the spotter data for the archive |
| 710 | 710 | $ignoreImport = false; |
| 711 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 711 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 712 | 712 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 713 | 713 | $ignoreImport = true; |
| 714 | 714 | } |
| 715 | 715 | } |
| 716 | 716 | if (count($globalAirportAccept) > 0) { |
| 717 | 717 | $ignoreImport = true; |
| 718 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 718 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 719 | 719 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 720 | 720 | $ignoreImport = false; |
| 721 | 721 | } |
| 722 | 722 | } |
| 723 | 723 | } |
| 724 | 724 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 725 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 726 | - 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)) { |
|
| 725 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 726 | + 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)) { |
|
| 727 | 727 | $ignoreImport = true; |
| 728 | 728 | } |
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 732 | 732 | $ignoreImport = true; |
| 733 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 734 | - 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)) { |
|
| 733 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 734 | + 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)) { |
|
| 735 | 735 | $ignoreImport = false; |
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | } |
| 739 | 739 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 740 | 740 | $ignoreImport = true; |
| 741 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 741 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 742 | 742 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 743 | 743 | $ignoreImport = false; |
| 744 | 744 | } |
@@ -750,32 +750,32 @@ discard block |
||
| 750 | 750 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
| 751 | 751 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
| 752 | 752 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
| 753 | - 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'))); |
|
| 753 | + 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'))); |
|
| 754 | 754 | $timeelapsed = microtime(true); |
| 755 | 755 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 756 | 756 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 757 | 757 | $Spotter = new Spotter($this->db); |
| 758 | - $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']); |
|
| 758 | + $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']); |
|
| 759 | 759 | $Spotter->db = null; |
| 760 | 760 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 761 | 761 | } |
| 762 | 762 | } |
| 763 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 763 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 764 | 764 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 765 | 765 | |
| 766 | 766 | // Add source stat in DB |
| 767 | 767 | $Stats = new Stats($this->db); |
| 768 | 768 | if (!empty($this->stats)) { |
| 769 | 769 | if ($globalDebug) echo 'Add source stats : '; |
| 770 | - foreach($this->stats as $date => $data) { |
|
| 771 | - foreach($data as $source => $sourced) { |
|
| 770 | + foreach ($this->stats as $date => $data) { |
|
| 771 | + foreach ($data as $source => $sourced) { |
|
| 772 | 772 | //print_r($sourced); |
| 773 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 774 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 773 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
| 774 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
| 775 | 775 | if (isset($sourced['msg'])) { |
| 776 | 776 | if (time() - $sourced['msg']['date'] > 10) { |
| 777 | 777 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
| 778 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 778 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
| 779 | 779 | unset($this->stats[$date][$source]['msg']); |
| 780 | 780 | } |
| 781 | 781 | } |
@@ -813,14 +813,14 @@ discard block |
||
| 813 | 813 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 814 | 814 | $SpotterLive = new SpotterLive($this->db); |
| 815 | 815 | $SpotterLive->deleteLiveSpotterData(); |
| 816 | - $SpotterLive->db=null; |
|
| 816 | + $SpotterLive->db = null; |
|
| 817 | 817 | } |
| 818 | 818 | } |
| 819 | 819 | if ($globalDebug) echo " Done\n"; |
| 820 | 820 | $this->last_delete = time(); |
| 821 | 821 | } |
| 822 | 822 | } else { |
| 823 | - 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'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
| 823 | + 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'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
| 824 | 824 | $this->all_flights[$id]['id'] = $recent_ident; |
| 825 | 825 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 826 | 826 | } |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 829 | 829 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 830 | 830 | $Spotter = new Spotter($this->db); |
| 831 | - $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']); |
|
| 831 | + $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']); |
|
| 832 | 832 | $Spotter->db = null; |
| 833 | 833 | } |
| 834 | 834 | } |
@@ -854,37 +854,37 @@ discard block |
||
| 854 | 854 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 855 | 855 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 856 | 856 | |
| 857 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 857 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 858 | 858 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 859 | 859 | $ignoreImport = true; |
| 860 | 860 | } |
| 861 | 861 | } |
| 862 | 862 | if (count($globalAirportAccept) > 0) { |
| 863 | 863 | $ignoreImport = true; |
| 864 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 864 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 865 | 865 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 866 | 866 | $ignoreImport = false; |
| 867 | 867 | } |
| 868 | 868 | } |
| 869 | 869 | } |
| 870 | 870 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 871 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 872 | - 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)) { |
|
| 871 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 872 | + 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)) { |
|
| 873 | 873 | $ignoreImport = true; |
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 878 | 878 | $ignoreImport = true; |
| 879 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 880 | - 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)) { |
|
| 879 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 880 | + 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)) { |
|
| 881 | 881 | $ignoreImport = false; |
| 882 | 882 | } |
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | 885 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 886 | 886 | $ignoreImport = true; |
| 887 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 887 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 888 | 888 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 889 | 889 | $ignoreImport = false; |
| 890 | 890 | } |
@@ -892,23 +892,23 @@ discard block |
||
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | if (!$ignoreImport) { |
| 895 | - 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'])) { |
|
| 896 | - 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'))); |
|
| 895 | + 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'])) { |
|
| 896 | + 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'))); |
|
| 897 | 897 | $timeelapsed = microtime(true); |
| 898 | 898 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 899 | 899 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 900 | 900 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 901 | 901 | $SpotterLive = new SpotterLive($this->db); |
| 902 | - $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']); |
|
| 902 | + $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']); |
|
| 903 | 903 | $SpotterLive->db = null; |
| 904 | 904 | if ($globalDebug) echo $result."\n"; |
| 905 | 905 | } |
| 906 | 906 | } |
| 907 | 907 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 908 | - $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']); |
|
| 908 | + $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']); |
|
| 909 | 909 | } |
| 910 | 910 | $this->all_flights[$id]['putinarchive'] = false; |
| 911 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 911 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 912 | 912 | |
| 913 | 913 | // Put statistics in $this->stats variable |
| 914 | 914 | //if ($line['format_source'] != 'aprs') { |
@@ -927,19 +927,19 @@ discard block |
||
| 927 | 927 | $latitude = $globalCenterLatitude; |
| 928 | 928 | $longitude = $globalCenterLongitude; |
| 929 | 929 | } |
| 930 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
| 930 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
| 931 | 931 | } else { |
| 932 | 932 | $latitude = $this->source_location[$source]['latitude']; |
| 933 | 933 | $longitude = $this->source_location[$source]['longitude']; |
| 934 | 934 | } |
| 935 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 935 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 936 | 936 | //$stats_heading = $stats_heading%22.5; |
| 937 | 937 | $stats_heading = round($stats_heading/22.5); |
| 938 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 938 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 939 | 939 | $current_date = date('Y-m-d'); |
| 940 | 940 | if ($stats_heading == 16) $stats_heading = 0; |
| 941 | 941 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 942 | - for ($i=0;$i<=15;$i++) { |
|
| 942 | + for ($i = 0; $i <= 15; $i++) { |
|
| 943 | 943 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
| 944 | 944 | } |
| 945 | 945 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -954,9 +954,9 @@ discard block |
||
| 954 | 954 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 955 | 955 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 956 | 956 | end($this->stats[$current_date][$source]['hist']); |
| 957 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 957 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
| 958 | 958 | } else $mini = 0; |
| 959 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
| 959 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
| 960 | 960 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 961 | 961 | } |
| 962 | 962 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | $this->all_flights[$id]['lastupdate'] = time(); |
| 970 | 970 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
| 971 | 971 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 972 | - } 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"; |
|
| 972 | + } 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"; |
|
| 973 | 973 | //$this->del(); |
| 974 | 974 | |
| 975 | 975 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |