@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | require_once(dirname(__FILE__).'/class.create_db.php'); |
12 | 12 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
13 | 13 | require_once(dirname(__FILE__).'/class.settings.php'); |
14 | -$title="Install"; |
|
14 | +$title = "Install"; |
|
15 | 15 | require(dirname(__FILE__).'/../require/settings.php'); |
16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
17 | 17 | require(dirname(__FILE__).'/header.php'); |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | if (!extension_loaded('curl')) { |
81 | 81 | $error[] = "Curl is not loaded."; |
82 | 82 | } |
83 | - if(function_exists('apache_get_modules') ){ |
|
84 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
83 | + if (function_exists('apache_get_modules')) { |
|
84 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
85 | 85 | $error[] = "mod_rewrite is not available."; |
86 | 86 | } |
87 | 87 | /* |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | 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>'; |
98 | 98 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
99 | 99 | if (function_exists('get_headers')) { |
100 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
101 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
100 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
101 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
102 | 102 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
103 | 103 | } |
104 | 104 | } |
@@ -469,13 +469,13 @@ discard block |
||
469 | 469 | ?> |
470 | 470 | <tr> |
471 | 471 | <?php |
472 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
472 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
473 | 473 | ?> |
474 | 474 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
475 | 475 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
476 | 476 | <?php |
477 | 477 | } else { |
478 | - $hostport = explode(':',$source['host']); |
|
478 | + $hostport = explode(':', $source['host']); |
|
479 | 479 | if (isset($hostport[1])) { |
480 | 480 | $host = $hostport[0]; |
481 | 481 | $port = $hostport[1]; |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | <select name="timezones[]" id="timezones"> |
523 | 523 | <?php |
524 | 524 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
525 | - foreach($timezonelist as $timezones){ |
|
525 | + foreach ($timezonelist as $timezones) { |
|
526 | 526 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
527 | 527 | print '<option selected>'.$timezones.'</option>'; |
528 | 528 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | <select name="timezones[]" id="timezones"> |
575 | 575 | <?php |
576 | 576 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
577 | - foreach($timezonelist as $timezones){ |
|
577 | + foreach ($timezonelist as $timezones) { |
|
578 | 578 | if ($timezones == 'UTC') { |
579 | 579 | print '<option selected>'.$timezones.'</option>'; |
580 | 580 | } else print '<option>'.$timezones.'</option>'; |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | <br /> |
897 | 897 | <p> |
898 | 898 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
899 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
899 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
900 | 900 | </p> |
901 | 901 | <br /> |
902 | 902 | <p> |
@@ -952,14 +952,14 @@ discard block |
||
952 | 952 | $error = ''; |
953 | 953 | |
954 | 954 | if (isset($_POST['dbtype'])) { |
955 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
956 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
957 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
958 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
959 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
960 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
961 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
962 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
955 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
956 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
957 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
958 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
959 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
960 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
961 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
962 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
963 | 963 | |
964 | 964 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
965 | 965 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -979,49 +979,49 @@ discard block |
||
979 | 979 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
980 | 980 | */ |
981 | 981 | |
982 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
982 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
983 | 983 | |
984 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
985 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
986 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
987 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
988 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
984 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
985 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
986 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
987 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
988 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
989 | 989 | |
990 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
991 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
992 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
993 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
994 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
995 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
996 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
997 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
998 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
999 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
990 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
991 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
992 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
993 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
994 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
995 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
996 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
997 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
998 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
999 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1000 | 1000 | |
1001 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1002 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1003 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1004 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1005 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1006 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1001 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1002 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1003 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1004 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1005 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1006 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1007 | 1007 | |
1008 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1009 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1008 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1009 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1010 | 1010 | |
1011 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1012 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1013 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1011 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1012 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1013 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1014 | 1014 | |
1015 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1015 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1016 | 1016 | if ($acars == 'acars') { |
1017 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1017 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1018 | 1018 | } else { |
1019 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1019 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1020 | 1020 | } |
1021 | 1021 | |
1022 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1023 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1024 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1022 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1023 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1024 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1025 | 1025 | |
1026 | 1026 | $source_name = $_POST['source_name']; |
1027 | 1027 | $source_latitude = $_POST['source_latitude']; |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | |
1036 | 1036 | $sources = array(); |
1037 | 1037 | foreach ($source_name as $keys => $name) { |
1038 | - 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]); |
|
1039 | - 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]); |
|
1038 | + 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]); |
|
1039 | + 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]); |
|
1040 | 1040 | } |
1041 | 1041 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1042 | 1042 | |
@@ -1049,27 +1049,27 @@ discard block |
||
1049 | 1049 | $sbsurl = $_POST['sbsurl']; |
1050 | 1050 | */ |
1051 | 1051 | |
1052 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1053 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1054 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1055 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1056 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1057 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1058 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1059 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1052 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1053 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1054 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1055 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1056 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1057 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1058 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1059 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1060 | 1060 | |
1061 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1062 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1063 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1064 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1065 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1066 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1067 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1068 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1069 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1070 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1071 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1072 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1061 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1062 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1063 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1064 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1065 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1066 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1067 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1068 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1069 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1070 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1071 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1072 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1073 | 1073 | |
1074 | 1074 | /* |
1075 | 1075 | $globalSBS1Hosts = array(); |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | } |
1086 | 1086 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1087 | 1087 | */ |
1088 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1088 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1089 | 1089 | $host = $_POST['host']; |
1090 | 1090 | $port = $_POST['port']; |
1091 | 1091 | $name = $_POST['name']; |
@@ -1102,107 +1102,107 @@ discard block |
||
1102 | 1102 | else $cov = 'FALSE'; |
1103 | 1103 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1104 | 1104 | else $arch = 'FALSE'; |
1105 | - if (strpos($format[$key],'_callback')) { |
|
1106 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1105 | + if (strpos($format[$key], '_callback')) { |
|
1106 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1107 | 1107 | } elseif ($h != '' || $name[$key] != '') { |
1108 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1108 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1109 | 1109 | } |
1110 | 1110 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1111 | 1111 | } |
1112 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1112 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1113 | 1113 | |
1114 | 1114 | /* |
1115 | 1115 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1116 | 1116 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1117 | 1117 | */ |
1118 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1119 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1120 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1118 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1119 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1120 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1121 | 1121 | |
1122 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1123 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1122 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1123 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1124 | 1124 | |
1125 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1126 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1125 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1126 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1127 | 1127 | |
1128 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1129 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1128 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1129 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1130 | 1130 | |
1131 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1132 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1133 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1134 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1131 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1132 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1133 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1134 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1135 | 1135 | |
1136 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1137 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1138 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1136 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1137 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1138 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1139 | 1139 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1140 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1141 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1140 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1141 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1142 | 1142 | |
1143 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1144 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1145 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1146 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1147 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1148 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1149 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1150 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1143 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1144 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1145 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1146 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1147 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1148 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1149 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1150 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1151 | 1151 | |
1152 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1153 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1152 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1153 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1154 | 1154 | |
1155 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1156 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1155 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1156 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1157 | 1157 | |
1158 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1158 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1159 | 1159 | if ($archiveyear == "archiveyear") { |
1160 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1160 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1161 | 1161 | } else { |
1162 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1162 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1163 | 1163 | } |
1164 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1165 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1166 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1167 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1164 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1165 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1166 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1167 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1168 | 1168 | |
1169 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1170 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1171 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1172 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1169 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1170 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1171 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1172 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1173 | 1173 | |
1174 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1175 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1176 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1174 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1175 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1176 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1177 | 1177 | |
1178 | 1178 | // Create in settings.php keys not yet configurable if not already here |
1179 | 1179 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1180 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1180 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1181 | 1181 | |
1182 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1182 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1183 | 1183 | if ($resetyearstats == 'resetyearstats') { |
1184 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1184 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1185 | 1185 | } else { |
1186 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1186 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1187 | 1187 | } |
1188 | 1188 | |
1189 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1189 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1190 | 1190 | if ($archive == 'archive') { |
1191 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1191 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1192 | 1192 | } else { |
1193 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1193 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1194 | 1194 | } |
1195 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1195 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1196 | 1196 | if ($daemon == 'daemon') { |
1197 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1197 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1198 | 1198 | } else { |
1199 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1199 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1200 | 1200 | } |
1201 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1201 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1202 | 1202 | if ($schedules == 'schedules') { |
1203 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1203 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1204 | 1204 | } else { |
1205 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1205 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1206 | 1206 | } |
1207 | 1207 | |
1208 | 1208 | /* |
@@ -1213,227 +1213,227 @@ discard block |
||
1213 | 1213 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1214 | 1214 | } |
1215 | 1215 | */ |
1216 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1217 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1218 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1219 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1220 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1216 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1217 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1218 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1219 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1220 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1221 | 1221 | $va = false; |
1222 | 1222 | if ($globalivao == 'ivao') { |
1223 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1223 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1224 | 1224 | $va = true; |
1225 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1225 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1226 | 1226 | if ($globalvatsim == 'vatsim') { |
1227 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1227 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1228 | 1228 | $va = true; |
1229 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1229 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1230 | 1230 | if ($globalphpvms == 'phpvms') { |
1231 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1231 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1232 | 1232 | $va = true; |
1233 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1233 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1234 | 1234 | if ($globalvam == 'vam') { |
1235 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1235 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1236 | 1236 | $va = true; |
1237 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1237 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1238 | 1238 | if ($va) { |
1239 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1240 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1239 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1240 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1241 | 1241 | if ($globalva == 'va' || $va) { |
1242 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1243 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1242 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1243 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1244 | 1244 | } else { |
1245 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1246 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1247 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1245 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1246 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1247 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | 1250 | |
1251 | 1251 | |
1252 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1252 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1253 | 1253 | if ($notam == 'notam') { |
1254 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1254 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1255 | 1255 | } else { |
1256 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1256 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1257 | 1257 | } |
1258 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1258 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1259 | 1259 | if ($owner == 'owner') { |
1260 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1260 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1261 | 1261 | } else { |
1262 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1262 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1263 | 1263 | } |
1264 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1264 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1265 | 1265 | if ($map3d == 'map3d') { |
1266 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1266 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1267 | 1267 | } else { |
1268 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1268 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1269 | 1269 | } |
1270 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1270 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1271 | 1271 | if ($crash == 'crash') { |
1272 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1272 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1273 | 1273 | } else { |
1274 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1274 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1275 | 1275 | } |
1276 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1276 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1277 | 1277 | if ($mapsatellites == 'mapsatellites') { |
1278 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1278 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1279 | 1279 | } else { |
1280 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1280 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1281 | 1281 | } |
1282 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1282 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1283 | 1283 | if ($map3ddefault == 'map3ddefault') { |
1284 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1284 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1285 | 1285 | } else { |
1286 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1286 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1287 | 1287 | } |
1288 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1288 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1289 | 1289 | if ($translate == 'translate') { |
1290 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1290 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1291 | 1291 | } else { |
1292 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1292 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1293 | 1293 | } |
1294 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1294 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1295 | 1295 | if ($realairlines == 'realairlines') { |
1296 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1296 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1297 | 1297 | } else { |
1298 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1298 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1299 | 1299 | } |
1300 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1300 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1301 | 1301 | if ($estimation == 'estimation') { |
1302 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1302 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1303 | 1303 | } else { |
1304 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1304 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1305 | 1305 | } |
1306 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1306 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1307 | 1307 | if ($metar == 'metar') { |
1308 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1308 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1309 | 1309 | } else { |
1310 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1310 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1311 | 1311 | } |
1312 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1312 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1313 | 1313 | if ($metarcycle == 'metarcycle') { |
1314 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1314 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1315 | 1315 | } else { |
1316 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1316 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1317 | 1317 | } |
1318 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1318 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1319 | 1319 | if ($fork == 'fork') { |
1320 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1320 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1321 | 1321 | } else { |
1322 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1322 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1323 | 1323 | } |
1324 | 1324 | |
1325 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1325 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1326 | 1326 | if ($colormap == 'colormap') { |
1327 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1327 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1328 | 1328 | } else { |
1329 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1329 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | if (isset($_POST['aircrafticoncolor'])) { |
1333 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1334 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1333 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1334 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1335 | 1335 | } |
1336 | 1336 | |
1337 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1338 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1337 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1338 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1339 | 1339 | |
1340 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1341 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1342 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1343 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1344 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1345 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1340 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1341 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1342 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1343 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1344 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1345 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1346 | 1346 | |
1347 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1347 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1348 | 1348 | if ($mappopup == 'mappopup') { |
1349 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1349 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1350 | 1350 | } else { |
1351 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1351 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1352 | 1352 | } |
1353 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1353 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1354 | 1354 | if ($airportpopup == 'airportpopup') { |
1355 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1355 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1356 | 1356 | } else { |
1357 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1357 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1358 | 1358 | } |
1359 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1359 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1360 | 1360 | if ($maphistory == 'maphistory') { |
1361 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1361 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1362 | 1362 | } else { |
1363 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1363 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1364 | 1364 | } |
1365 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1365 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1366 | 1366 | if ($maptooltip == 'maptooltip') { |
1367 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1367 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1368 | 1368 | } else { |
1369 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1369 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1370 | 1370 | } |
1371 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1371 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1372 | 1372 | if ($flightroute == 'flightroute') { |
1373 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1373 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1374 | 1374 | } else { |
1375 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1375 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1376 | 1376 | } |
1377 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1377 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1378 | 1378 | if ($flightremainingroute == 'flightremainingroute') { |
1379 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1379 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1380 | 1380 | } else { |
1381 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1381 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1382 | 1382 | } |
1383 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1383 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1384 | 1384 | if ($allflights == 'allflights') { |
1385 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1385 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1386 | 1386 | } else { |
1387 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1387 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1388 | 1388 | } |
1389 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1389 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1390 | 1390 | if ($bbox == 'bbox') { |
1391 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1391 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1392 | 1392 | } else { |
1393 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1393 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1394 | 1394 | } |
1395 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1395 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1396 | 1396 | if ($groundaltitude == 'groundaltitude') { |
1397 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1397 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1398 | 1398 | } else { |
1399 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1399 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1400 | 1400 | } |
1401 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1401 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1402 | 1402 | if ($waypoints == 'waypoints') { |
1403 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1403 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1404 | 1404 | } else { |
1405 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1405 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1406 | 1406 | } |
1407 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1407 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1408 | 1408 | if ($geoid == 'geoid') { |
1409 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1409 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1410 | 1410 | } else { |
1411 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1411 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1412 | 1412 | } |
1413 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1414 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1413 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1414 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1415 | 1415 | |
1416 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1416 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1417 | 1417 | if ($noairlines == 'noairlines') { |
1418 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1418 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1419 | 1419 | } else { |
1420 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1420 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1421 | 1421 | } |
1422 | 1422 | |
1423 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1423 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1424 | 1424 | |
1425 | 1425 | // Set some defaults values... |
1426 | 1426 | if (!isset($globalAircraftImageSources)) { |
1427 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1428 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1427 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1428 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | if (!isset($globalSchedulesSources)) { |
1432 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1433 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1432 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1433 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1434 | 1434 | } |
1435 | 1435 | |
1436 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1436 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1437 | 1437 | |
1438 | 1438 | if ($error == '') settings::modify_settings($settings); |
1439 | 1439 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * @param Array $headers header to submit with the form |
15 | 15 | * @return String the result |
16 | 16 | */ |
17 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
|
17 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') { |
|
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
20 | 20 | curl_setopt($ch, CURLOPT_URL, $url); |
21 | 21 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
22 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
22 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
23 | 23 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
24 | 24 | } |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
30 | 30 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
31 | 31 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
32 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
32 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
33 | 33 | //curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
34 | 34 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
35 | 35 | if ($useragent == '') { |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | } |
40 | 40 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
41 | 41 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
42 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
42 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
43 | 43 | if ($type == 'post') { |
44 | 44 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
45 | 45 | if (is_array($data)) { |
46 | 46 | curl_setopt($ch, CURLOPT_POST, count($data)); |
47 | 47 | $data_string = ''; |
48 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
48 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
49 | 49 | rtrim($data_string, '&'); |
50 | 50 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
51 | 51 | } else { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | if ($cookie != '') { |
59 | 59 | if (is_array($cookie)) { |
60 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
60 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
61 | 61 | } else { |
62 | 62 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
63 | 63 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | $info = curl_getinfo($ch); |
70 | 70 | //var_dump($info); |
71 | 71 | curl_close($ch); |
72 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
72 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
73 | 73 | echo "Cloudflare Detected\n"; |
74 | 74 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
75 | 75 | $useragent = UAgent::random(); |
76 | 76 | cloudflare::useUserAgent($useragent); |
77 | 77 | if ($clearanceCookie = cloudflare::bypass($url)) { |
78 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
78 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
79 | 79 | } |
80 | 80 | } else { |
81 | 81 | return $result; |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | fclose($fp); |
107 | 107 | } |
108 | 108 | |
109 | - public static function gunzip($in_file,$out_file_name = '') { |
|
109 | + public static function gunzip($in_file, $out_file_name = '') { |
|
110 | 110 | //echo $in_file.' -> '.$out_file_name."\n"; |
111 | 111 | $buffer_size = 4096; // read 4kb at a time |
112 | 112 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
113 | 113 | if ($in_file != '' && file_exists($in_file)) { |
114 | 114 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
115 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
116 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
115 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
116 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
117 | 117 | else { |
118 | 118 | echo 'gzopen not available'; |
119 | 119 | die; |
120 | 120 | } |
121 | 121 | $out_file = fopen($out_file_name, 'wb'); |
122 | - while(!gzeof($file)) { |
|
122 | + while (!gzeof($file)) { |
|
123 | 123 | fwrite($out_file, gzread($file, $buffer_size)); |
124 | 124 | } |
125 | 125 | fclose($out_file); |
@@ -127,19 +127,19 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - public static function bunzip2($in_file,$out_file_name = '') { |
|
130 | + public static function bunzip2($in_file, $out_file_name = '') { |
|
131 | 131 | //echo $in_file.' -> '.$out_file_name."\n"; |
132 | 132 | $buffer_size = 4096; // read 4kb at a time |
133 | 133 | if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
134 | 134 | if ($in_file != '' && file_exists($in_file)) { |
135 | 135 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
136 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
136 | + if (function_exists('bzopen')) $file = bzopen($in_file, 'rb'); |
|
137 | 137 | else { |
138 | 138 | echo 'bzopen not available'; |
139 | 139 | die; |
140 | 140 | } |
141 | 141 | $out_file = fopen($out_file_name, 'wb'); |
142 | - while(!feof($file)) { |
|
142 | + while (!feof($file)) { |
|
143 | 143 | fwrite($out_file, bzread($file, $buffer_size)); |
144 | 144 | } |
145 | 145 | fclose($out_file); |
@@ -157,27 +157,27 @@ discard block |
||
157 | 157 | if ($data == '') return array(); |
158 | 158 | $html = str_get_html($data); |
159 | 159 | if ($html === false) return array(); |
160 | - $tabledata=array(); |
|
161 | - foreach($html->find('tr') as $element) |
|
160 | + $tabledata = array(); |
|
161 | + foreach ($html->find('tr') as $element) |
|
162 | 162 | { |
163 | 163 | $td = array(); |
164 | - foreach( $element->find('th') as $row) |
|
164 | + foreach ($element->find('th') as $row) |
|
165 | 165 | { |
166 | 166 | $td [] = trim($row->plaintext); |
167 | 167 | } |
168 | - $td=array_filter($td); |
|
168 | + $td = array_filter($td); |
|
169 | 169 | $tabledata[] = $td; |
170 | 170 | |
171 | 171 | $td = array(); |
172 | 172 | $tdi = array(); |
173 | - foreach( $element->find('td') as $row) |
|
173 | + foreach ($element->find('td') as $row) |
|
174 | 174 | { |
175 | 175 | $td [] = trim($row->plaintext); |
176 | 176 | $tdi [] = trim($row->innertext); |
177 | 177 | } |
178 | - $td=array_filter($td); |
|
179 | - $tdi=array_filter($tdi); |
|
180 | - $tabledata[]=array_merge($td,$tdi); |
|
178 | + $td = array_filter($td); |
|
179 | + $tdi = array_filter($tdi); |
|
180 | + $tabledata[] = array_merge($td, $tdi); |
|
181 | 181 | } |
182 | 182 | $html->clear(); |
183 | 183 | unset($html); |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | public function text2array($data) { |
193 | 193 | $html = str_get_html($data); |
194 | 194 | if ($html === false) return array(); |
195 | - $tabledata=array(); |
|
196 | - foreach($html->find('p') as $element) |
|
195 | + $tabledata = array(); |
|
196 | + foreach ($html->find('p') as $element) |
|
197 | 197 | { |
198 | 198 | $tabledata [] = trim($element->plaintext); |
199 | 199 | } |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
215 | 215 | if ($lat == $latc && $lon == $lonc) return 0; |
216 | - $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
|
216 | + $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515; |
|
217 | 217 | if ($unit == "km") { |
218 | - return round($dist * 1.609344); |
|
218 | + return round($dist*1.609344); |
|
219 | 219 | } elseif ($unit == "m") { |
220 | - return round($dist * 1.609344 * 1000); |
|
220 | + return round($dist*1.609344*1000); |
|
221 | 221 | } elseif ($unit == "mile" || $unit == "mi") { |
222 | 222 | return round($dist); |
223 | 223 | } elseif ($unit == "nm") { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param float $distance distance covered |
234 | 234 | * @return whether distance is realistic |
235 | 235 | */ |
236 | - public function withinThreshold ($timeDifference, $distance) { |
|
236 | + public function withinThreshold($timeDifference, $distance) { |
|
237 | 237 | $x = abs($timeDifference); |
238 | 238 | $d = abs($distance); |
239 | 239 | if ($x == 0 || $d == 0) return true; |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | return ($array !== array_values($array)); |
250 | 250 | } |
251 | 251 | |
252 | - public function isInteger($input){ |
|
252 | + public function isInteger($input) { |
|
253 | 253 | return(ctype_digit(strval($input))); |
254 | 254 | } |
255 | 255 | |
256 | 256 | |
257 | - public function convertDec($dms,$latlong) { |
|
257 | + public function convertDec($dms, $latlong) { |
|
258 | 258 | if ($latlong == 'latitude') { |
259 | 259 | $deg = substr($dms, 0, 2); |
260 | 260 | $min = substr($dms, 2, 4); |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | $deg = substr($dms, 0, 3); |
263 | 263 | $min = substr($dms, 3, 5); |
264 | 264 | } |
265 | - return $deg+(($min*60)/3600); |
|
265 | + return $deg + (($min*60)/3600); |
|
266 | 266 | } |
267 | 267 | |
268 | - public function convertDM($coord,$latlong) { |
|
268 | + public function convertDM($coord, $latlong) { |
|
269 | 269 | if ($latlong == 'latitude') { |
270 | 270 | if ($coord < 0) $NSEW = 'S'; |
271 | 271 | else $NSEW = 'N'; |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | } |
276 | 276 | $coord = abs($coord); |
277 | 277 | $deg = floor($coord); |
278 | - $coord = ($coord-$deg)*60; |
|
278 | + $coord = ($coord - $deg)*60; |
|
279 | 279 | $min = $coord; |
280 | - return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW); |
|
280 | + return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -289,8 +289,8 @@ discard block |
||
289 | 289 | public function xcopy($source, $dest) |
290 | 290 | { |
291 | 291 | $files = glob($source.'*.*'); |
292 | - foreach($files as $file){ |
|
293 | - $file_to_go = str_replace($source,$dest,$file); |
|
292 | + foreach ($files as $file) { |
|
293 | + $file_to_go = str_replace($source, $dest, $file); |
|
294 | 294 | copy($file, $file_to_go); |
295 | 295 | } |
296 | 296 | return true; |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | * @param String $url url to check |
302 | 302 | * @return bool Return true on succes false on failure |
303 | 303 | */ |
304 | - public function urlexist($url){ |
|
305 | - $headers=get_headers($url); |
|
306 | - return stripos($headers[0],"200 OK")?true:false; |
|
304 | + public function urlexist($url) { |
|
305 | + $headers = get_headers($url); |
|
306 | + return stripos($headers[0], "200 OK") ? true : false; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | public function hex2str($hex) { |
315 | 315 | $str = ''; |
316 | 316 | $hexln = strlen($hex); |
317 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
317 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
318 | 318 | return $str; |
319 | 319 | } |
320 | 320 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return String Return result |
325 | 325 | */ |
326 | 326 | public function hex2rgb($hex) { |
327 | - $hex = str_replace('#','',$hex); |
|
327 | + $hex = str_replace('#', '', $hex); |
|
328 | 328 | return sscanf($hex, "%02x%02x%02x"); |
329 | 329 | } |
330 | 330 | |
@@ -332,33 +332,33 @@ discard block |
||
332 | 332 | //difference in longitudinal coordinates |
333 | 333 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
334 | 334 | //difference in the phi of latitudinal coordinates |
335 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
335 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
336 | 336 | //we need to recalculate $dLon if it is greater than pi |
337 | - if(abs($dLon) > pi()) { |
|
338 | - if($dLon > 0) { |
|
339 | - $dLon = (2 * pi() - $dLon) * -1; |
|
337 | + if (abs($dLon) > pi()) { |
|
338 | + if ($dLon > 0) { |
|
339 | + $dLon = (2*pi() - $dLon)*-1; |
|
340 | 340 | } else { |
341 | - $dLon = 2 * pi() + $dLon; |
|
341 | + $dLon = 2*pi() + $dLon; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | //return the angle, normalized |
345 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
345 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
346 | 346 | } |
347 | 347 | |
348 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.2) { |
|
348 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.2) { |
|
349 | 349 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
350 | - $a = -($lon2-$lon1); |
|
350 | + $a = -($lon2 - $lon1); |
|
351 | 351 | $b = $lat2 - $lat1; |
352 | - $c = -($a*$lat1+$b*$lon1); |
|
353 | - $d = $a*$lat3+$b*$lon3+$c; |
|
352 | + $c = -($a*$lat1 + $b*$lon1); |
|
353 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
354 | 354 | if ($d > -$approx && $d < $approx) return true; |
355 | 355 | else return false; |
356 | 356 | } |
357 | 357 | |
358 | 358 | public function array_merge_noappend() { |
359 | 359 | $output = array(); |
360 | - foreach(func_get_args() as $array) { |
|
361 | - foreach($array as $key => $value) { |
|
360 | + foreach (func_get_args() as $array) { |
|
361 | + foreach ($array as $key => $value) { |
|
362 | 362 | $output[$key] = isset($output[$key]) ? |
363 | 363 | array_merge($output[$key], $value) : $value; |
364 | 364 | } |
@@ -422,34 +422,34 @@ discard block |
||
422 | 422 | return $result; |
423 | 423 | } |
424 | 424 | |
425 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){ |
|
425 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) { |
|
426 | 426 | global $globalMapRefresh; |
427 | 427 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
428 | 428 | $r = 6378; |
429 | 429 | $latitude = deg2rad($latitude); |
430 | 430 | $longitude = deg2rad($longitude); |
431 | 431 | $bearing = deg2rad($heading); |
432 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
433 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
434 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
432 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
433 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
434 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
435 | 435 | } |
436 | 436 | |
437 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
437 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
438 | 438 | // distance in meter |
439 | 439 | $R = 6378.14; |
440 | - $latitude1 = $latitude * (M_PI/180); |
|
441 | - $longitude1 = $longitude * (M_PI/180); |
|
442 | - $brng = $bearing * (M_PI/180); |
|
440 | + $latitude1 = $latitude*(M_PI/180); |
|
441 | + $longitude1 = $longitude*(M_PI/180); |
|
442 | + $brng = $bearing*(M_PI/180); |
|
443 | 443 | $d = $distance; |
444 | 444 | |
445 | 445 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
446 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
446 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
447 | 447 | |
448 | - $latitude2 = $latitude2 * (180/M_PI); |
|
449 | - $longitude2 = $longitude2 * (180/M_PI); |
|
448 | + $latitude2 = $latitude2*(180/M_PI); |
|
449 | + $longitude2 = $longitude2*(180/M_PI); |
|
450 | 450 | |
451 | - $flat = round ($latitude2,6); |
|
452 | - $flong = round ($longitude2,6); |
|
451 | + $flat = round($latitude2, 6); |
|
452 | + $flong = round($longitude2, 6); |
|
453 | 453 | /* |
454 | 454 | $dx = $distance*cos($bearing); |
455 | 455 | $dy = $distance*sin($bearing); |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $flong = $longitude + $dlong; |
459 | 459 | $flat = $latitude + $dlat; |
460 | 460 | */ |
461 | - return array('latitude' => $flat,'longitude' => $flong); |
|
461 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -472,14 +472,14 @@ discard block |
||
472 | 472 | * @param integer $level GZIP compression level (default: 9) |
473 | 473 | * @return string New filename (with .gz appended) if success, or false if operation fails |
474 | 474 | */ |
475 | - public function gzCompressFile($source, $level = 9){ |
|
476 | - $dest = $source . '.gz'; |
|
477 | - $mode = 'wb' . $level; |
|
475 | + public function gzCompressFile($source, $level = 9) { |
|
476 | + $dest = $source.'.gz'; |
|
477 | + $mode = 'wb'.$level; |
|
478 | 478 | $error = false; |
479 | 479 | if ($fp_out = gzopen($dest, $mode)) { |
480 | - if ($fp_in = fopen($source,'rb')) { |
|
480 | + if ($fp_in = fopen($source, 'rb')) { |
|
481 | 481 | while (!feof($fp_in)) |
482 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
482 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
483 | 483 | fclose($fp_in); |
484 | 484 | } else { |
485 | 485 | $error = true; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | } |
496 | 496 | |
497 | 497 | public function remove_accents($string) { |
498 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
498 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
499 | 499 | $chars = array( |
500 | 500 | // Decompositions for Latin-1 Supplement |
501 | 501 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
553 | 553 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
554 | 554 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
555 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
555 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
556 | 556 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
557 | 557 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
558 | 558 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
569 | 569 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
570 | 570 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
571 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
572 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
573 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
574 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
575 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
576 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
577 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
571 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
572 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
573 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
574 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
575 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
576 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
577 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
578 | 578 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
579 | 579 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
580 | 580 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) { |
609 | 609 | if (is_numeric($string[$i]) && $concat_flag) { |
610 | 610 | $int .= $string[$i]; |
611 | - } elseif(!$concat && $concat_flag && strlen($int) > 0) { |
|
611 | + } elseif (!$concat && $concat_flag && strlen($int) > 0) { |
|
612 | 612 | $concat_flag = false; |
613 | 613 | } |
614 | 614 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | $slice = array_slice($arr, $offset + 1, $length); |
655 | 655 | return implode("", $slice); |
656 | 656 | } else { |
657 | - return mb_substr($string,$offset,$length,'UTF-8'); |
|
657 | + return mb_substr($string, $offset, $length, 'UTF-8'); |
|
658 | 658 | } |
659 | 659 | } |
660 | 660 | |
@@ -664,14 +664,14 @@ discard block |
||
664 | 664 | //NOTE: use a trailing slash for folders!!! |
665 | 665 | //see http://bugs.php.net/bug.php?id=27609 |
666 | 666 | //see http://bugs.php.net/bug.php?id=30931 |
667 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
667 | + if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path |
|
668 | 668 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
669 | 669 | else if (is_dir($path)) |
670 | 670 | return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
671 | 671 | // check tmp file for read/write capabilities |
672 | 672 | $rm = file_exists($path); |
673 | 673 | $f = @fopen($path, 'a'); |
674 | - if ($f===false) |
|
674 | + if ($f === false) |
|
675 | 675 | return false; |
676 | 676 | fclose($f); |
677 | 677 | if (!$rm) |
@@ -18,22 +18,22 @@ discard block |
||
18 | 18 | * @return Array the images list |
19 | 19 | * |
20 | 20 | */ |
21 | - public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
21 | + public function getSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
22 | 22 | { |
23 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
24 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
25 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
23 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
24 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
25 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
26 | 26 | $reg = $registration; |
27 | 27 | if ($reg == '' && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
28 | 28 | $reg = trim($reg); |
29 | - $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
29 | + $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
30 | 30 | FROM spotter_image |
31 | 31 | WHERE spotter_image.registration = :registration LIMIT 1"; |
32 | 32 | $sth = $this->db->prepare($query); |
33 | 33 | $sth->execute(array(':registration' => $reg)); |
34 | 34 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
35 | 35 | if (!empty($result)) return $result; |
36 | - elseif ($registration != '') return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
36 | + elseif ($registration != '') return $this->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
37 | 37 | else return array(); |
38 | 38 | } |
39 | 39 | |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | * @return Array the images list |
44 | 44 | * |
45 | 45 | */ |
46 | - public function getMarineImage($mmsi,$imo = '',$name = '') |
|
46 | + public function getMarineImage($mmsi, $imo = '', $name = '') |
|
47 | 47 | { |
48 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
49 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
50 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
48 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
49 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
50 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
51 | 51 | $name = trim($name); |
52 | - $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
52 | + $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
53 | 53 | FROM marine_image |
54 | 54 | WHERE marine_image.mmsi = :mmsi"; |
55 | 55 | $query_data = array(':mmsi' => $mmsi); |
56 | 56 | if ($imo != '') { |
57 | 57 | $query .= " AND marine_image.imo = :imo"; |
58 | - $query_data = array_merge($query_data,array(':imo' => $imo)); |
|
58 | + $query_data = array_merge($query_data, array(':imo' => $imo)); |
|
59 | 59 | } |
60 | 60 | if ($name != '') { |
61 | 61 | $query .= " AND marine_image.name = :name"; |
62 | - $query_data = array_merge($query_data,array(':name' => $name)); |
|
62 | + $query_data = array_merge($query_data, array(':name' => $name)); |
|
63 | 63 | } |
64 | 64 | $query .= " LIMIT 1"; |
65 | 65 | $sth = $this->db->prepare($query); |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
81 | 81 | elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
82 | 82 | if ($copyright != '') { |
83 | - $copyright = str_replace('Copyright ','',$copyright); |
|
84 | - $copyright = str_replace('© ','',$copyright); |
|
85 | - $copyright = str_replace('(c) ','',$copyright); |
|
83 | + $copyright = str_replace('Copyright ', '', $copyright); |
|
84 | + $copyright = str_replace('© ', '', $copyright); |
|
85 | + $copyright = str_replace('(c) ', '', $copyright); |
|
86 | 86 | } |
87 | 87 | return $copyright; |
88 | 88 | } |
@@ -93,25 +93,25 @@ discard block |
||
93 | 93 | * @return String either success or error |
94 | 94 | * |
95 | 95 | */ |
96 | - public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
96 | + public function addSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
97 | 97 | { |
98 | - global $globalDebug,$globalAircraftImageFetch; |
|
98 | + global $globalDebug, $globalAircraftImageFetch; |
|
99 | 99 | if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return ''; |
100 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
100 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
101 | 101 | $registration = trim($registration); |
102 | 102 | //getting the aircraft image |
103 | 103 | if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
104 | 104 | elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
105 | 105 | elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
106 | - $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
|
106 | + $image_url = $this->findAircraftImage($registration, $aircraft_icao, $airline_icao); |
|
107 | 107 | if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
108 | 108 | if ($image_url['original'] != '') { |
109 | 109 | if ($globalDebug) echo 'Found !'."\n"; |
110 | - $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
110 | + $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
111 | 111 | try { |
112 | 112 | $sth = $this->db->prepare($query); |
113 | - $sth->execute(array(':registration' => $registration,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
114 | - } catch(PDOException $e) { |
|
113 | + $sth->execute(array(':registration' => $registration, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
114 | + } catch (PDOException $e) { |
|
115 | 115 | echo $e->getMessage()."\n"; |
116 | 116 | return "error"; |
117 | 117 | } |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | * @return String either success or error |
126 | 126 | * |
127 | 127 | */ |
128 | - public function addMarineImage($mmsi,$imo = '',$name = '') |
|
128 | + public function addMarineImage($mmsi, $imo = '', $name = '') |
|
129 | 129 | { |
130 | - global $globalDebug,$globalMarineImageFetch; |
|
130 | + global $globalDebug, $globalMarineImageFetch; |
|
131 | 131 | if (isset($globalMarineImageFetch) && !$globalMarineImageFetch) return ''; |
132 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
133 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
134 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
132 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
133 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
134 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
135 | 135 | $name = trim($name); |
136 | 136 | $Marine = new Marine($this->db); |
137 | 137 | if ($imo == '' || $name == '') { |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | |
146 | 146 | //getting the aircraft image |
147 | 147 | if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...'; |
148 | - $image_url = $this->findMarineImage($mmsi,$imo,$name); |
|
148 | + $image_url = $this->findMarineImage($mmsi, $imo, $name); |
|
149 | 149 | if ($image_url['original'] != '') { |
150 | 150 | if ($globalDebug) echo 'Found !'."\n"; |
151 | - $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
151 | + $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
152 | 152 | try { |
153 | 153 | $sth = $this->db->prepare($query); |
154 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':name' => $name,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
155 | - } catch(PDOException $e) { |
|
154 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':name' => $name, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
155 | + } catch (PDOException $e) { |
|
156 | 156 | echo $e->getMessage()."\n"; |
157 | 157 | return "error"; |
158 | 158 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
173 | 173 | $Spotter = new Spotter($this->db); |
174 | 174 | if (!isset($globalIVAO)) $globalIVAO = FALSE; |
175 | - $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
|
175 | + $aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING); |
|
176 | 176 | if ($aircraft_registration != '' && (!isset($globalVA) || $globalVA !== TRUE)) { |
177 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
177 | + if (strpos($aircraft_registration, '/') !== false) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
178 | 178 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
179 | 179 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
180 | 180 | if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
@@ -188,25 +188,25 @@ discard block |
||
188 | 188 | if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
189 | 189 | else $aircraft_name = ''; |
190 | 190 | $aircraft_registration = $aircraft_icao; |
191 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
191 | + } else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
192 | 192 | unset($Spotter); |
193 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
193 | + if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
194 | 194 | foreach ($globalAircraftImageSources as $source) { |
195 | 195 | $source = strtolower($source); |
196 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
197 | - if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
198 | - if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
199 | - if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
200 | - if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
201 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
202 | - if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
203 | - if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
204 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
205 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
196 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft', $aircraft_icao, $airline_icao); |
|
197 | + if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft', $aircraft_registration, $aircraft_name); |
|
198 | + if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft', $aircraft_registration, $aircraft_name); |
|
199 | + if ($source == 'bing') $images_array = $this->fromBing('aircraft', $aircraft_registration, $aircraft_name); |
|
200 | + if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft', $aircraft_registration, $aircraft_name); |
|
201 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft', $aircraft_registration, $aircraft_name); |
|
202 | + if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft', $aircraft_registration, $aircraft_name); |
|
203 | + if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft', $aircraft_registration, $aircraft_name); |
|
204 | + if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft', $aircraft_registration, $aircraft_name); |
|
205 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft', $aircraft_registration, $aircraft_name); |
|
206 | 206 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
207 | 207 | } |
208 | 208 | if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
209 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
209 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | * @return Array the aircraft thumbnail, orignal url and copyright |
219 | 219 | * |
220 | 220 | */ |
221 | - public function findMarineImage($mmsi,$imo = '',$name = '') |
|
221 | + public function findMarineImage($mmsi, $imo = '', $name = '') |
|
222 | 222 | { |
223 | 223 | global $globalMarineImageSources; |
224 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
224 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
225 | 225 | //$imo = filter_var($imo,FILTER_SANITIZE_STRING); |
226 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
226 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
227 | 227 | $name = trim($name); |
228 | - if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
228 | + if (strlen($name) < 4) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
229 | 229 | /* |
230 | 230 | $Marine = new Marine($this->db); |
231 | 231 | if ($imo == '' || $name == '') { |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | } |
238 | 238 | unset($Marine); |
239 | 239 | */ |
240 | - if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
240 | + if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia', 'deviantart', 'flickr', 'bing'); |
|
241 | 241 | foreach ($globalMarineImageSources as $source) { |
242 | 242 | $source = strtolower($source); |
243 | - if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
244 | - if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name); |
|
245 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
246 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
247 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
243 | + if ($source == 'flickr') $images_array = $this->fromFlickr('marine', $mmsi, $name); |
|
244 | + if ($source == 'bing') $images_array = $this->fromBing('marine', $mmsi, $name); |
|
245 | + if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine', $mmsi, $name); |
|
246 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine', $mmsi, $name); |
|
247 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('marine', $mmsi, $name); |
|
248 | 248 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
249 | 249 | } |
250 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
250 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -258,25 +258,25 @@ discard block |
||
258 | 258 | * @return Array the aircraft thumbnail, orignal url and copyright |
259 | 259 | * |
260 | 260 | */ |
261 | - public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') { |
|
261 | + public function fromPlanespotters($type, $aircraft_registration, $aircraft_name = '') { |
|
262 | 262 | $Common = new Common(); |
263 | 263 | // If aircraft registration is only number, also check with aircraft model |
264 | - if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') { |
|
265 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
264 | + if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') { |
|
265 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
266 | 266 | } else { |
267 | 267 | //$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss'; |
268 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
268 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
269 | 269 | } |
270 | 270 | $data = $Common->getData($url); |
271 | 271 | if (substr($data, 0, 5) != "<?xml") return false; |
272 | 272 | if ($xml = simplexml_load_string($data)) { |
273 | 273 | if (isset($xml->channel->item)) { |
274 | 274 | $image_url = array(); |
275 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
275 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
276 | 276 | $image_url['thumbnail'] = $thumbnail_url; |
277 | - $image_url['original'] = str_replace('thumbnail','original',$thumbnail_url); |
|
278 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
279 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
277 | + $image_url['original'] = str_replace('thumbnail', 'original', $thumbnail_url); |
|
278 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
279 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
280 | 280 | $image_url['source'] = 'planespotters'; |
281 | 281 | return $image_url; |
282 | 282 | } |
@@ -292,31 +292,31 @@ discard block |
||
292 | 292 | * @return Array the aircraft thumbnail, orignal url and copyright |
293 | 293 | * |
294 | 294 | */ |
295 | - public function fromDeviantart($type,$registration, $name='') { |
|
295 | + public function fromDeviantart($type, $registration, $name = '') { |
|
296 | 296 | $Common = new Common(); |
297 | 297 | if ($type == 'aircraft') { |
298 | 298 | // If aircraft registration is only number, also check with aircraft model |
299 | - if (preg_match('/^[[:digit]]+$/',$registration) && $name != '') { |
|
300 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
299 | + if (preg_match('/^[[:digit]]+$/', $registration) && $name != '') { |
|
300 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
301 | 301 | } else { |
302 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
302 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
303 | 303 | } |
304 | 304 | } elseif ($type == 'marine') { |
305 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
305 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
306 | 306 | } else { |
307 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
307 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
308 | 308 | } |
309 | 309 | $data = $Common->getData($url); |
310 | 310 | if (substr($data, 0, 5) != "<?xml") return false; |
311 | 311 | if ($xml = simplexml_load_string($data)) { |
312 | 312 | if (isset($xml->channel->item->link)) { |
313 | 313 | $image_url = array(); |
314 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
314 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
315 | 315 | $image_url['thumbnail'] = $thumbnail_url; |
316 | - $original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
316 | + $original_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
317 | 317 | $image_url['original'] = $original_url; |
318 | - $image_url['copyright'] = str_replace('Copyright ','',trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
319 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
318 | + $image_url['copyright'] = str_replace('Copyright ', '', trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
319 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
320 | 320 | $image_url['source'] = 'deviantart'; |
321 | 321 | return $image_url; |
322 | 322 | } |
@@ -332,32 +332,32 @@ discard block |
||
332 | 332 | * @return Array the aircraft thumbnail, orignal url and copyright |
333 | 333 | * |
334 | 334 | */ |
335 | - public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') { |
|
335 | + public function fromJetPhotos($type, $aircraft_registration, $aircraft_name = '') { |
|
336 | 336 | $Common = new Common(); |
337 | - $url= 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
337 | + $url = 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
338 | 338 | $data = $Common->getData($url); |
339 | 339 | $dom = new DOMDocument(); |
340 | 340 | @$dom->loadHTML($data); |
341 | 341 | $all_pics = array(); |
342 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
342 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
343 | 343 | if ($image->getAttribute('itemprop') == "http://schema.org/image") { |
344 | 344 | $all_pics[] = $image->getAttribute('src'); |
345 | 345 | } |
346 | 346 | } |
347 | 347 | $all_authors = array(); |
348 | - foreach($dom->getElementsByTagName('meta') as $author) { |
|
348 | + foreach ($dom->getElementsByTagName('meta') as $author) { |
|
349 | 349 | if ($author->getAttribute('itemprop') == "http://schema.org/author") { |
350 | 350 | $all_authors[] = $author->getAttribute('content'); |
351 | 351 | } |
352 | 352 | } |
353 | 353 | $all_ref = array(); |
354 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
354 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
355 | 355 | $all_ref[] = $link->getAttribute('href'); |
356 | 356 | } |
357 | 357 | if (isset($all_pics[0])) { |
358 | 358 | $image_url = array(); |
359 | 359 | $image_url['thumbnail'] = $all_pics[0]; |
360 | - $image_url['original'] = str_replace('_tb','',$all_pics[0]); |
|
360 | + $image_url['original'] = str_replace('_tb', '', $all_pics[0]); |
|
361 | 361 | $image_url['copyright'] = $all_authors[0]; |
362 | 362 | $image_url['source_website'] = 'http://jetphotos.net'.$all_ref[8]; |
363 | 363 | $image_url['source'] = 'JetPhotos'; |
@@ -374,24 +374,24 @@ discard block |
||
374 | 374 | * @return Array the aircraft thumbnail, orignal url and copyright |
375 | 375 | * |
376 | 376 | */ |
377 | - public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') { |
|
377 | + public function fromPlanePictures($type, $aircraft_registration, $aircraft_name = '') { |
|
378 | 378 | $Common = new Common(); |
379 | - $url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
379 | + $url = 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
380 | 380 | $data = $Common->getData($url); |
381 | 381 | $dom = new DOMDocument(); |
382 | 382 | @$dom->loadHTML($data); |
383 | 383 | $all_pics = array(); |
384 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
384 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
385 | 385 | $all_pics[] = $image->getAttribute('src'); |
386 | 386 | } |
387 | 387 | $all_links = array(); |
388 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
389 | - $all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href')); |
|
388 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
389 | + $all_links[] = array('text' => $link->textContent, 'href' => $link->getAttribute('href')); |
|
390 | 390 | } |
391 | - if (isset($all_pics[1]) && !preg_match('/bit.ly/',$all_pics[1]) && !preg_match('/flagge/',$all_pics[1])) { |
|
391 | + if (isset($all_pics[1]) && !preg_match('/bit.ly/', $all_pics[1]) && !preg_match('/flagge/', $all_pics[1])) { |
|
392 | 392 | $image_url = array(); |
393 | 393 | $image_url['thumbnail'] = 'http://www.planepictures.net/'.$all_pics[1]; |
394 | - $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN','',$all_pics[1]); |
|
394 | + $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN', '', $all_pics[1]); |
|
395 | 395 | $image_url['copyright'] = $all_links[6]['text']; |
396 | 396 | $image_url['source_website'] = 'http://www.planepictures.net/'.$all_links[2]['href']; |
397 | 397 | $image_url['source'] = 'PlanePictures'; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @return Array the aircraft thumbnail, orignal url and copyright |
409 | 409 | * |
410 | 410 | */ |
411 | - public function fromFlickr($type,$registration,$name='') { |
|
411 | + public function fromFlickr($type, $registration, $name = '') { |
|
412 | 412 | $Common = new Common(); |
413 | 413 | if ($type == 'aircraft') { |
414 | 414 | if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
@@ -421,12 +421,12 @@ discard block |
||
421 | 421 | if (substr($data, 0, 5) != "<?xml") return false; |
422 | 422 | if ($xml = simplexml_load_string($data)) { |
423 | 423 | if (isset($xml->channel->item)) { |
424 | - $original_url = trim((string)$xml->channel->item->enclosure->attributes()->url); |
|
424 | + $original_url = trim((string) $xml->channel->item->enclosure->attributes()->url); |
|
425 | 425 | $image_url = array(); |
426 | 426 | $image_url['thumbnail'] = $original_url; |
427 | 427 | $image_url['original'] = $original_url; |
428 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
429 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
428 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
429 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
430 | 430 | $image_url['source'] = 'flickr'; |
431 | 431 | return $image_url; |
432 | 432 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | return false; |
435 | 435 | } |
436 | 436 | |
437 | - public function fromIvaoMtl($type,$aircraft_icao,$airline_icao) { |
|
437 | + public function fromIvaoMtl($type, $aircraft_icao, $airline_icao) { |
|
438 | 438 | $Common = new Common(); |
439 | 439 | //echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg'; |
440 | 440 | if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) { |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | * @return Array the aircraft thumbnail, orignal url and copyright |
459 | 459 | * |
460 | 460 | */ |
461 | - public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
|
461 | + public function fromBing($type, $aircraft_registration, $aircraft_name = '') { |
|
462 | 462 | global $globalImageBingKey; |
463 | 463 | $Common = new Common(); |
464 | 464 | if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
470 | 470 | else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
471 | 471 | } |
472 | - $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
|
473 | - $data = $Common->getData($url,'get','',$headers); |
|
472 | + $headers = array("Authorization: Basic ".base64_encode("ignored:".$globalImageBingKey)); |
|
473 | + $data = $Common->getData($url, 'get', '', $headers); |
|
474 | 474 | $result = json_decode($data); |
475 | 475 | if (isset($result->d->results[0]->MediaUrl)) { |
476 | 476 | $image_url = array(); |
@@ -495,14 +495,14 @@ discard block |
||
495 | 495 | * @return Array the aircraft thumbnail, orignal url and copyright |
496 | 496 | * |
497 | 497 | */ |
498 | - public function fromAirportData($type,$aircraft_registration,$aircraft_name='') { |
|
498 | + public function fromAirportData($type, $aircraft_registration, $aircraft_name = '') { |
|
499 | 499 | $Common = new Common(); |
500 | 500 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration; |
501 | 501 | $data = $Common->getData($url); |
502 | 502 | $result = json_decode($data); |
503 | 503 | if (isset($result->count) && $result->count > 0) { |
504 | 504 | $image_url = array(); |
505 | - $image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image); |
|
505 | + $image_url['original'] = str_replace('thumbnails', 'large', $result->data[0]->image); |
|
506 | 506 | $image_url['source_website'] = $result->data[0]->link; |
507 | 507 | $image_url['thumbnail'] = $result->data[0]->image; |
508 | 508 | $image_url['copyright'] = $result->data[0]->photographer; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | * @return Array the aircraft thumbnail, orignal url and copyright |
521 | 521 | * |
522 | 522 | */ |
523 | - public function fromWikimedia($type,$registration,$name='') { |
|
523 | + public function fromWikimedia($type, $registration, $name = '') { |
|
524 | 524 | $Common = new Common(); |
525 | 525 | if ($type == 'aircraft') { |
526 | 526 | if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $result = json_decode($data); |
534 | 534 | if (isset($result->query->search[0]->title)) { |
535 | 535 | $fileo = $result->query->search[0]->title; |
536 | - if (substr($fileo,-3) == 'pdf') return false; |
|
536 | + if (substr($fileo, -3) == 'pdf') return false; |
|
537 | 537 | $file = urlencode($fileo); |
538 | 538 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
539 | 539 | $data2 = $Common->getData($url2); |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | if (isset($result2->query->pages)) { |
559 | 559 | foreach ($result2->query->pages as $page) { |
560 | 560 | if (isset($page->imageinfo[0]->extmetadata->Artist)) { |
561 | - $image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
561 | + $image_url['copyright'] = preg_replace('/ from(.*)/', '', strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
562 | 562 | if (isset($page->imageinfo[0]->extmetadata->License->value)) { |
563 | 563 | $image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')'; |
564 | 564 | } |
565 | - $image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright'])); |
|
565 | + $image_url['copyright'] = trim(str_replace('\n', '', $image_url['copyright'])); |
|
566 | 566 | return $image_url; |
567 | 567 | } |
568 | 568 | } |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @return Array the aircraft thumbnail, orignal url and copyright |
582 | 582 | * |
583 | 583 | */ |
584 | - public function fromCustomSource($type,$registration,$name='') { |
|
584 | + public function fromCustomSource($type, $registration, $name = '') { |
|
585 | 585 | global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug; |
586 | 586 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
587 | 587 | if (!empty($globalAircraftImageCustomSources) && $type == 'aircraft') { |
@@ -598,15 +598,15 @@ discard block |
||
598 | 598 | print_r($source); |
599 | 599 | print_r($customsources); |
600 | 600 | } |
601 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
602 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
601 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
602 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
603 | 603 | if ($Common->urlexist($url)) { |
604 | 604 | $image_url = array(); |
605 | 605 | $image_url['thumbnail'] = $url_thumbnail; |
606 | 606 | $image_url['original'] = $url; |
607 | 607 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
608 | 608 | else $exifCopyright = ''; |
609 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
609 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
610 | 610 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
611 | 611 | else $image_url['copyright'] = $source['source_website']; |
612 | 612 | $image_url['source_website'] = $source['source_website']; |
@@ -630,19 +630,19 @@ discard block |
||
630 | 630 | print_r($source); |
631 | 631 | print_r($customsources); |
632 | 632 | } |
633 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
634 | - $url = str_replace('{mmsi}',$registration,$url); |
|
635 | - $url = str_replace('{name}',$name,$url); |
|
636 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
637 | - $url_thumbnail = str_replace('{mmsi}',$registration,$url_thumbnail); |
|
638 | - $url_thumbnail = str_replace('{name}',$name,$url_thumbnail); |
|
633 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
634 | + $url = str_replace('{mmsi}', $registration, $url); |
|
635 | + $url = str_replace('{name}', $name, $url); |
|
636 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
637 | + $url_thumbnail = str_replace('{mmsi}', $registration, $url_thumbnail); |
|
638 | + $url_thumbnail = str_replace('{name}', $name, $url_thumbnail); |
|
639 | 639 | if ($Common->urlexist($url)) { |
640 | 640 | $image_url = array(); |
641 | 641 | $image_url['thumbnail'] = $url_thumbnail; |
642 | 642 | $image_url['original'] = $url; |
643 | 643 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
644 | 644 | else $exifCopyright = ''; |
645 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
645 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
646 | 646 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
647 | 647 | else $image_url['copyright'] = $source['source_website']; |
648 | 648 | $image_url['source_website'] = $source['source_website']; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once(dirname(__FILE__).'/class.Image.php'); |
3 | 3 | $global_query = "SELECT marine_output.* FROM marine_output"; |
4 | 4 | |
5 | -class Marine{ |
|
5 | +class Marine { |
|
6 | 6 | public $db; |
7 | 7 | |
8 | 8 | public function __construct($dbc = null) { |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | 19 | |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
73 | 73 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
74 | 74 | if ($filter_query_where != '') { |
75 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
75 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
76 | 76 | } |
77 | 77 | $filter_query = $filter_query_join.$filter_query_where; |
78 | 78 | return $filter_query; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return Array the spotter information |
88 | 88 | * |
89 | 89 | */ |
90 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
90 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
91 | 91 | { |
92 | 92 | date_default_timezone_set('UTC'); |
93 | 93 | if (!is_string($query)) |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | $sth = $this->db->prepare($query.$limitQuery); |
108 | 108 | $sth->execute($params); |
109 | 109 | } catch (PDOException $e) { |
110 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
110 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
111 | 111 | exit(); |
112 | 112 | } |
113 | 113 | |
114 | 114 | $num_rows = 0; |
115 | 115 | $spotter_array = array(); |
116 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
116 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
117 | 117 | { |
118 | 118 | $num_rows++; |
119 | 119 | $temp_array = array(); |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | } |
146 | 146 | if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
147 | 147 | |
148 | - if($temp_array['mmsi'] != "") |
|
148 | + if ($temp_array['mmsi'] != "") |
|
149 | 149 | { |
150 | 150 | $Image = new Image($this->db); |
151 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
151 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']); |
|
152 | 152 | else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
153 | 153 | unset($Image); |
154 | 154 | if (count($image_array) > 0) { |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | { |
185 | 185 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
186 | 186 | } else { |
187 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
187 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
188 | 188 | } |
189 | 189 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
190 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
191 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
190 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
191 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
192 | 192 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
193 | 193 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
194 | 194 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
195 | 195 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
196 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
197 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
196 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
197 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
198 | 198 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
199 | 199 | } |
200 | 200 | } |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | if ($limit != "") |
228 | 228 | { |
229 | 229 | $limit_array = explode(",", $limit); |
230 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
231 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
230 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
231 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
232 | 232 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
233 | 233 | { |
234 | 234 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | } else { |
243 | 243 | $orderby_query = " ORDER BY marine_output.date DESC"; |
244 | 244 | } |
245 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
246 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
245 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
246 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
247 | 247 | return $spotter_array; |
248 | 248 | } |
249 | 249 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | if ($id == '') return array(); |
262 | 262 | $additional_query = "marine_output.fammarine_id = :id"; |
263 | 263 | $query_values = array(':id' => $id); |
264 | - $query = $global_query." WHERE ".$additional_query." "; |
|
265 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
264 | + $query = $global_query." WHERE ".$additional_query." "; |
|
265 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
266 | 266 | return $spotter_array; |
267 | 267 | } |
268 | 268 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $query_values = array(); |
282 | 282 | $limit_query = ''; |
283 | 283 | $additional_query = ''; |
284 | - $filter_query = $this->getFilter($filter,true,true); |
|
284 | + $filter_query = $this->getFilter($filter, true, true); |
|
285 | 285 | if ($ident != "") |
286 | 286 | { |
287 | 287 | if (!is_string($ident)) |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | { |
298 | 298 | $limit_array = explode(",", $limit); |
299 | 299 | |
300 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
301 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
300 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
301 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
302 | 302 | |
303 | 303 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
304 | 304 | { |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | return $spotter_array; |
323 | 323 | } |
324 | 324 | |
325 | - public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
325 | + public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
326 | 326 | { |
327 | 327 | global $global_query, $globalTimezone, $globalDBdriver; |
328 | 328 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $limit_query = ''; |
331 | 331 | $additional_query = ''; |
332 | 332 | |
333 | - $filter_query = $this->getFilter($filter,true,true); |
|
333 | + $filter_query = $this->getFilter($filter, true, true); |
|
334 | 334 | |
335 | 335 | if ($date != "") |
336 | 336 | { |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | { |
357 | 357 | $limit_array = explode(",", $limit); |
358 | 358 | |
359 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
360 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
359 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
360 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
361 | 361 | |
362 | 362 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
363 | 363 | { |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | * @return Array list of source name |
389 | 389 | * |
390 | 390 | */ |
391 | - public function getAllSourceName($type = '',$filters = array()) |
|
391 | + public function getAllSourceName($type = '', $filters = array()) |
|
392 | 392 | { |
393 | - $filter_query = $this->getFilter($filters,true,true); |
|
393 | + $filter_query = $this->getFilter($filters, true, true); |
|
394 | 394 | $query_values = array(); |
395 | - $query = "SELECT DISTINCT marine_output.source_name |
|
395 | + $query = "SELECT DISTINCT marine_output.source_name |
|
396 | 396 | FROM marine_output".$filter_query." marine_output.source_name <> ''"; |
397 | 397 | if ($type != '') { |
398 | 398 | $query_values = array(':type' => $type); |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $source_array = array(); |
408 | 408 | $temp_array = array(); |
409 | 409 | |
410 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
410 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
411 | 411 | { |
412 | 412 | $temp_array['source_name'] = $row['source_name']; |
413 | 413 | $source_array[] = $temp_array; |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | */ |
425 | 425 | public function getAllIdents($filters = array()) |
426 | 426 | { |
427 | - $filter_query = $this->getFilter($filters,true,true); |
|
428 | - $query = "SELECT DISTINCT marine_output.ident |
|
427 | + $filter_query = $this->getFilter($filters, true, true); |
|
428 | + $query = "SELECT DISTINCT marine_output.ident |
|
429 | 429 | FROM marine_output".$filter_query." marine_output.ident <> '' |
430 | 430 | ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0"; |
431 | 431 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $ident_array = array(); |
436 | 436 | $temp_array = array(); |
437 | 437 | |
438 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
438 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
439 | 439 | { |
440 | 440 | $temp_array['ident'] = $row['ident']; |
441 | 441 | $ident_array[] = $temp_array; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | public function getIdentity($mmsi) |
454 | 454 | { |
455 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
455 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
456 | 456 | $query = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1"; |
457 | 457 | $sth = $this->db->prepare($query); |
458 | 458 | $sth->execute(array(':mmsi' => $mmsi)); |
@@ -477,12 +477,12 @@ discard block |
||
477 | 477 | } else $offset = '+00:00'; |
478 | 478 | |
479 | 479 | if ($globalDBdriver == 'mysql') { |
480 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
480 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
481 | 481 | FROM marine_output |
482 | 482 | WHERE marine_output.date <> '' |
483 | 483 | ORDER BY marine_output.date ASC LIMIT 0,200"; |
484 | 484 | } else { |
485 | - $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
485 | + $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
486 | 486 | FROM marine_output |
487 | 487 | WHERE marine_output.date <> '' |
488 | 488 | ORDER BY marine_output.date ASC LIMIT 0,200"; |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | $date_array = array(); |
495 | 495 | $temp_array = array(); |
496 | 496 | |
497 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
497 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
498 | 498 | { |
499 | 499 | $temp_array['date'] = $row['date']; |
500 | 500 | |
@@ -513,11 +513,11 @@ discard block |
||
513 | 513 | * @return String success or false |
514 | 514 | * |
515 | 515 | */ |
516 | - public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
|
516 | + public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL) |
|
517 | 517 | { |
518 | 518 | |
519 | 519 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
520 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
520 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident); |
|
521 | 521 | |
522 | 522 | try { |
523 | 523 | $sth = $this->db->prepare($query); |
@@ -539,11 +539,11 @@ discard block |
||
539 | 539 | * @return String success or false |
540 | 540 | * |
541 | 541 | */ |
542 | - public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
|
542 | + public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '') |
|
543 | 543 | { |
544 | 544 | |
545 | 545 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
546 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
546 | + $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id); |
|
547 | 547 | |
548 | 548 | try { |
549 | 549 | $sth = $this->db->prepare($query); |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
567 | 567 | { |
568 | 568 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
569 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
569 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
570 | 570 | |
571 | 571 | try { |
572 | 572 | $sth = $this->db->prepare($query); |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | * @param String $verticalrate vertival rate of flight |
605 | 605 | * @return String success or false |
606 | 606 | */ |
607 | - public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '') |
|
607 | + public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $format_source = '', $source_name = '') |
|
608 | 608 | { |
609 | 609 | global $globalURL, $globalMarineImageFetch; |
610 | 610 | |
@@ -671,31 +671,31 @@ discard block |
||
671 | 671 | } |
672 | 672 | |
673 | 673 | |
674 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
674 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
675 | 675 | { |
676 | 676 | $date = date("Y-m-d H:i:s", time()); |
677 | 677 | } |
678 | 678 | |
679 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
680 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
681 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
682 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
683 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
684 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
685 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
686 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
687 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
688 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
689 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
690 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
691 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
692 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
679 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
680 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
681 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
682 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
683 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
684 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
685 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
686 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
687 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
688 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
689 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
690 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
691 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
692 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
693 | 693 | |
694 | 694 | if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) { |
695 | 695 | $Image = new Image($this->db); |
696 | - $image_array = $Image->getMarineImage($mmsi,$imo,$ident); |
|
696 | + $image_array = $Image->getMarineImage($mmsi, $imo, $ident); |
|
697 | 697 | if (!isset($image_array[0]['mmsi'])) { |
698 | - $Image->addMarineImage($mmsi,$imo,$ident); |
|
698 | + $Image->addMarineImage($mmsi, $imo, $ident); |
|
699 | 699 | } |
700 | 700 | unset($Image); |
701 | 701 | } |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
708 | 708 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
709 | 709 | if ($arrival_date == '') $arrival_date = NULL; |
710 | - $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
|
710 | + $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
|
711 | 711 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
712 | 712 | |
713 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
713 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
714 | 714 | try { |
715 | 715 | |
716 | 716 | $sth = $this->db->prepare($query); |
@@ -735,13 +735,13 @@ discard block |
||
735 | 735 | { |
736 | 736 | global $globalDBdriver, $globalTimezone; |
737 | 737 | if ($globalDBdriver == 'mysql') { |
738 | - $query = "SELECT marine_output.ident FROM marine_output |
|
738 | + $query = "SELECT marine_output.ident FROM marine_output |
|
739 | 739 | WHERE marine_output.ident = :ident |
740 | 740 | AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
741 | 741 | AND marine_output.date < UTC_TIMESTAMP()"; |
742 | 742 | $query_data = array(':ident' => $ident); |
743 | 743 | } else { |
744 | - $query = "SELECT marine_output.ident FROM marine_output |
|
744 | + $query = "SELECT marine_output.ident FROM marine_output |
|
745 | 745 | WHERE marine_output.ident = :ident |
746 | 746 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
747 | 747 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -750,8 +750,8 @@ discard block |
||
750 | 750 | |
751 | 751 | $sth = $this->db->prepare($query); |
752 | 752 | $sth->execute($query_data); |
753 | - $ident_result=''; |
|
754 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
753 | + $ident_result = ''; |
|
754 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
755 | 755 | { |
756 | 756 | $ident_result = $row['ident']; |
757 | 757 | } |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | return false; |
778 | 778 | } else { |
779 | 779 | $q_array = explode(" ", $q); |
780 | - foreach ($q_array as $q_item){ |
|
781 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
780 | + foreach ($q_array as $q_item) { |
|
781 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
782 | 782 | $additional_query .= " AND ("; |
783 | 783 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
784 | 784 | $additional_query .= ")"; |
@@ -786,11 +786,11 @@ discard block |
||
786 | 786 | } |
787 | 787 | } |
788 | 788 | if ($globalDBdriver == 'mysql') { |
789 | - $query = "SELECT marine_output.* FROM marine_output |
|
789 | + $query = "SELECT marine_output.* FROM marine_output |
|
790 | 790 | WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
791 | 791 | AND marine_output.date < UTC_TIMESTAMP()"; |
792 | 792 | } else { |
793 | - $query = "SELECT marine_output.* FROM marine_output |
|
793 | + $query = "SELECT marine_output.* FROM marine_output |
|
794 | 794 | WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
795 | 795 | AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
796 | 796 | } |
@@ -809,16 +809,16 @@ discard block |
||
809 | 809 | * |
810 | 810 | */ |
811 | 811 | |
812 | - public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
812 | + public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
813 | 813 | { |
814 | 814 | global $globalDBdriver, $globalArchive; |
815 | 815 | //$filter_query = $this->getFilter($filters,true,true); |
816 | - $Connection= new Connection($this->db); |
|
816 | + $Connection = new Connection($this->db); |
|
817 | 817 | if (!$Connection->tableExists('countries')) return array(); |
818 | 818 | require_once('class.SpotterLive.php'); |
819 | 819 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
820 | 820 | $MarineLive = new MarineLive($this->db); |
821 | - $filter_query = $MarineLive->getFilter($filters,true,true); |
|
821 | + $filter_query = $MarineLive->getFilter($filters, true, true); |
|
822 | 822 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
823 | 823 | if ($olderthanmonths > 0) { |
824 | 824 | if ($globalDBdriver == 'mysql') { |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | } else { |
839 | 839 | require_once(dirname(__FILE__)."/class.MarineArchive.php"); |
840 | 840 | $MarineArchive = new MarineArchive($this->db); |
841 | - $filter_query = $MarineArchive->getFilter($filters,true,true); |
|
841 | + $filter_query = $MarineArchive->getFilter($filters, true, true); |
|
842 | 842 | $filter_query .= " over_country <> ''"; |
843 | 843 | if ($olderthanmonths > 0) { |
844 | 844 | if ($globalDBdriver == 'mysql') { |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | $flight_array = array(); |
867 | 867 | $temp_array = array(); |
868 | 868 | |
869 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
869 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
870 | 870 | { |
871 | 871 | $temp_array['marine_count'] = $row['nb']; |
872 | 872 | $temp_array['marine_country'] = $row['name']; |
@@ -885,11 +885,11 @@ discard block |
||
885 | 885 | * @return Array the callsign list |
886 | 886 | * |
887 | 887 | */ |
888 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
888 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
889 | 889 | { |
890 | 890 | global $globalDBdriver; |
891 | - $filter_query = $this->getFilter($filters,true,true); |
|
892 | - $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
891 | + $filter_query = $this->getFilter($filters, true, true); |
|
892 | + $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
893 | 893 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
894 | 894 | if ($olderthanmonths > 0) { |
895 | 895 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -903,28 +903,28 @@ discard block |
||
903 | 903 | if ($year != '') { |
904 | 904 | if ($globalDBdriver == 'mysql') { |
905 | 905 | $query .= " AND YEAR(marine_output.date) = :year"; |
906 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
906 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
907 | 907 | } else { |
908 | 908 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
909 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
909 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
910 | 910 | } |
911 | 911 | } |
912 | 912 | if ($month != '') { |
913 | 913 | if ($globalDBdriver == 'mysql') { |
914 | 914 | $query .= " AND MONTH(marine_output.date) = :month"; |
915 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
915 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
916 | 916 | } else { |
917 | 917 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
918 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
918 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
919 | 919 | } |
920 | 920 | } |
921 | 921 | if ($day != '') { |
922 | 922 | if ($globalDBdriver == 'mysql') { |
923 | 923 | $query .= " AND DAY(marine_output.date) = :day"; |
924 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
924 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
925 | 925 | } else { |
926 | 926 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
927 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
927 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | $callsign_array = array(); |
937 | 937 | $temp_array = array(); |
938 | 938 | |
939 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
939 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
940 | 940 | { |
941 | 941 | $temp_array['callsign_icao'] = $row['ident']; |
942 | 942 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | $date_array = array(); |
989 | 989 | $temp_array = array(); |
990 | 990 | |
991 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
991 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
992 | 992 | { |
993 | 993 | $temp_array['date_name'] = $row['date_name']; |
994 | 994 | $temp_array['date_count'] = $row['date_count']; |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | $datetime = new DateTime(); |
1015 | 1015 | $offset = $datetime->format('P'); |
1016 | 1016 | } else $offset = '+00:00'; |
1017 | - $filter_query = $this->getFilter($filters,true,true); |
|
1017 | + $filter_query = $this->getFilter($filters, true, true); |
|
1018 | 1018 | if ($globalDBdriver == 'mysql') { |
1019 | 1019 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1020 | 1020 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | $date_array = array(); |
1036 | 1036 | $temp_array = array(); |
1037 | 1037 | |
1038 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1038 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1039 | 1039 | { |
1040 | 1040 | $temp_array['date_name'] = $row['date_name']; |
1041 | 1041 | $temp_array['date_count'] = $row['date_count']; |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | $datetime = new DateTime(); |
1061 | 1061 | $offset = $datetime->format('P'); |
1062 | 1062 | } else $offset = '+00:00'; |
1063 | - $filter_query = $this->getFilter($filters,true,true); |
|
1063 | + $filter_query = $this->getFilter($filters, true, true); |
|
1064 | 1064 | if ($globalDBdriver == 'mysql') { |
1065 | 1065 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1066 | 1066 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | $date_array = array(); |
1082 | 1082 | $temp_array = array(); |
1083 | 1083 | |
1084 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1084 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1085 | 1085 | { |
1086 | 1086 | $temp_array['date_name'] = $row['date_name']; |
1087 | 1087 | $temp_array['date_count'] = $row['date_count']; |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | $date_array = array(); |
1129 | 1129 | $temp_array = array(); |
1130 | 1130 | |
1131 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1131 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1132 | 1132 | { |
1133 | 1133 | $temp_array['month_name'] = $row['month_name']; |
1134 | 1134 | $temp_array['year_name'] = $row['year_name']; |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | $datetime = new DateTime(); |
1158 | 1158 | $offset = $datetime->format('P'); |
1159 | 1159 | } else $offset = '+00:00'; |
1160 | - $filter_query = $this->getFilter($filters,true,true); |
|
1160 | + $filter_query = $this->getFilter($filters, true, true); |
|
1161 | 1161 | if ($globalDBdriver == 'mysql') { |
1162 | 1162 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
1163 | 1163 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1178,7 +1178,7 @@ discard block |
||
1178 | 1178 | $date_array = array(); |
1179 | 1179 | $temp_array = array(); |
1180 | 1180 | |
1181 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1181 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1182 | 1182 | { |
1183 | 1183 | $temp_array['year_name'] = $row['year_name']; |
1184 | 1184 | $temp_array['month_name'] = $row['month_name']; |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | * @return Array the hour list |
1199 | 1199 | * |
1200 | 1200 | */ |
1201 | - public function countAllHours($orderby,$filters = array()) |
|
1201 | + public function countAllHours($orderby, $filters = array()) |
|
1202 | 1202 | { |
1203 | 1203 | global $globalTimezone, $globalDBdriver; |
1204 | 1204 | if ($globalTimezone != '') { |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | $hour_array = array(); |
1247 | 1247 | $temp_array = array(); |
1248 | 1248 | |
1249 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1249 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1250 | 1250 | { |
1251 | 1251 | $temp_array['hour_name'] = $row['hour_name']; |
1252 | 1252 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1268,8 +1268,8 @@ discard block |
||
1268 | 1268 | public function countAllHoursByDate($date, $filters = array()) |
1269 | 1269 | { |
1270 | 1270 | global $globalTimezone, $globalDBdriver; |
1271 | - $filter_query = $this->getFilter($filters,true,true); |
|
1272 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1271 | + $filter_query = $this->getFilter($filters, true, true); |
|
1272 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1273 | 1273 | if ($globalTimezone != '') { |
1274 | 1274 | date_default_timezone_set($globalTimezone); |
1275 | 1275 | $datetime = new DateTime($date); |
@@ -1277,12 +1277,12 @@ discard block |
||
1277 | 1277 | } else $offset = '+00:00'; |
1278 | 1278 | |
1279 | 1279 | if ($globalDBdriver == 'mysql') { |
1280 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1280 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1281 | 1281 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date |
1282 | 1282 | GROUP BY hour_name |
1283 | 1283 | ORDER BY hour_name ASC"; |
1284 | 1284 | } else { |
1285 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1285 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1286 | 1286 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1287 | 1287 | GROUP BY hour_name |
1288 | 1288 | ORDER BY hour_name ASC"; |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | $hour_array = array(); |
1295 | 1295 | $temp_array = array(); |
1296 | 1296 | |
1297 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1297 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1298 | 1298 | { |
1299 | 1299 | $temp_array['hour_name'] = $row['hour_name']; |
1300 | 1300 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1316,8 +1316,8 @@ discard block |
||
1316 | 1316 | public function countAllHoursByIdent($ident, $filters = array()) |
1317 | 1317 | { |
1318 | 1318 | global $globalTimezone, $globalDBdriver; |
1319 | - $filter_query = $this->getFilter($filters,true,true); |
|
1320 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1319 | + $filter_query = $this->getFilter($filters, true, true); |
|
1320 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1321 | 1321 | if ($globalTimezone != '') { |
1322 | 1322 | date_default_timezone_set($globalTimezone); |
1323 | 1323 | $datetime = new DateTime(); |
@@ -1325,12 +1325,12 @@ discard block |
||
1325 | 1325 | } else $offset = '+00:00'; |
1326 | 1326 | |
1327 | 1327 | if ($globalDBdriver == 'mysql') { |
1328 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1328 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1329 | 1329 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1330 | 1330 | GROUP BY hour_name |
1331 | 1331 | ORDER BY hour_name ASC"; |
1332 | 1332 | } else { |
1333 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1333 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1334 | 1334 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1335 | 1335 | GROUP BY hour_name |
1336 | 1336 | ORDER BY hour_name ASC"; |
@@ -1338,12 +1338,12 @@ discard block |
||
1338 | 1338 | |
1339 | 1339 | |
1340 | 1340 | $sth = $this->db->prepare($query); |
1341 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1341 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1342 | 1342 | |
1343 | 1343 | $hour_array = array(); |
1344 | 1344 | $temp_array = array(); |
1345 | 1345 | |
1346 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1346 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1347 | 1347 | { |
1348 | 1348 | $temp_array['hour_name'] = $row['hour_name']; |
1349 | 1349 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1362,33 +1362,33 @@ discard block |
||
1362 | 1362 | * @return Integer the number of vessels |
1363 | 1363 | * |
1364 | 1364 | */ |
1365 | - public function countOverallMarine($filters = array(),$year = '',$month = '') |
|
1365 | + public function countOverallMarine($filters = array(), $year = '', $month = '') |
|
1366 | 1366 | { |
1367 | 1367 | global $globalDBdriver; |
1368 | 1368 | //$queryi = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output"; |
1369 | - $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1369 | + $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1370 | 1370 | $query_values = array(); |
1371 | 1371 | $query = ''; |
1372 | 1372 | if ($year != '') { |
1373 | 1373 | if ($globalDBdriver == 'mysql') { |
1374 | 1374 | $query .= " AND YEAR(marine_output.date) = :year"; |
1375 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1375 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1376 | 1376 | } else { |
1377 | 1377 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1378 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1378 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1379 | 1379 | } |
1380 | 1380 | } |
1381 | 1381 | if ($month != '') { |
1382 | 1382 | if ($globalDBdriver == 'mysql') { |
1383 | 1383 | $query .= " AND MONTH(marine_output.date) = :month"; |
1384 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1384 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1385 | 1385 | } else { |
1386 | 1386 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1387 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1387 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1388 | 1388 | } |
1389 | 1389 | } |
1390 | 1390 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1391 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1391 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1392 | 1392 | |
1393 | 1393 | $sth = $this->db->prepare($queryi); |
1394 | 1394 | $sth->execute($query_values); |
@@ -1401,32 +1401,32 @@ discard block |
||
1401 | 1401 | * @return Integer the number of vessels |
1402 | 1402 | * |
1403 | 1403 | */ |
1404 | - public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
|
1404 | + public function countOverallMarineTypes($filters = array(), $year = '', $month = '') |
|
1405 | 1405 | { |
1406 | 1406 | global $globalDBdriver; |
1407 | - $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1407 | + $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1408 | 1408 | $query_values = array(); |
1409 | 1409 | $query = ''; |
1410 | 1410 | if ($year != '') { |
1411 | 1411 | if ($globalDBdriver == 'mysql') { |
1412 | 1412 | $query .= " AND YEAR(marine_output.date) = :year"; |
1413 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1413 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1414 | 1414 | } else { |
1415 | 1415 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1416 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1416 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1417 | 1417 | } |
1418 | 1418 | } |
1419 | 1419 | if ($month != '') { |
1420 | 1420 | if ($globalDBdriver == 'mysql') { |
1421 | 1421 | $query .= " AND MONTH(marine_output.date) = :month"; |
1422 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1422 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1423 | 1423 | } else { |
1424 | 1424 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1425 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1425 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1426 | 1426 | } |
1427 | 1427 | } |
1428 | 1428 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1429 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1429 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1430 | 1430 | |
1431 | 1431 | $sth = $this->db->prepare($queryi); |
1432 | 1432 | $sth->execute($query_values); |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | public function countAllHoursFromToday($filters = array()) |
1444 | 1444 | { |
1445 | 1445 | global $globalTimezone, $globalDBdriver; |
1446 | - $filter_query = $this->getFilter($filters,true,true); |
|
1446 | + $filter_query = $this->getFilter($filters, true, true); |
|
1447 | 1447 | if ($globalTimezone != '') { |
1448 | 1448 | date_default_timezone_set($globalTimezone); |
1449 | 1449 | $datetime = new DateTime(); |
@@ -1451,12 +1451,12 @@ discard block |
||
1451 | 1451 | } else $offset = '+00:00'; |
1452 | 1452 | |
1453 | 1453 | if ($globalDBdriver == 'mysql') { |
1454 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1454 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1455 | 1455 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE() |
1456 | 1456 | GROUP BY hour_name |
1457 | 1457 | ORDER BY hour_name ASC"; |
1458 | 1458 | } else { |
1459 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1459 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1460 | 1460 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1461 | 1461 | GROUP BY hour_name |
1462 | 1462 | ORDER BY hour_name ASC"; |
@@ -1468,7 +1468,7 @@ discard block |
||
1468 | 1468 | $hour_array = array(); |
1469 | 1469 | $temp_array = array(); |
1470 | 1470 | |
1471 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1471 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1472 | 1472 | { |
1473 | 1473 | $temp_array['hour_name'] = $row['hour_name']; |
1474 | 1474 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1487,9 +1487,9 @@ discard block |
||
1487 | 1487 | */ |
1488 | 1488 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1489 | 1489 | { |
1490 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1490 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1491 | 1491 | |
1492 | - $query = "SELECT marine_output.marine_id |
|
1492 | + $query = "SELECT marine_output.marine_id |
|
1493 | 1493 | FROM marine_output |
1494 | 1494 | WHERE marine_output.fammarine_id = '".$fammarine_id."'"; |
1495 | 1495 | |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | $sth = $this->db->prepare($query); |
1498 | 1498 | $sth->execute(); |
1499 | 1499 | |
1500 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1500 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1501 | 1501 | { |
1502 | 1502 | return $row['marine_id']; |
1503 | 1503 | } |
@@ -1522,23 +1522,23 @@ discard block |
||
1522 | 1522 | } |
1523 | 1523 | |
1524 | 1524 | $current_date = date("Y-m-d H:i:s"); |
1525 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1525 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1526 | 1526 | |
1527 | 1527 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1528 | 1528 | |
1529 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1529 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1530 | 1530 | $years = $time_array['years']; |
1531 | 1531 | |
1532 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1532 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1533 | 1533 | $months = $time_array['months']; |
1534 | 1534 | |
1535 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1535 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1536 | 1536 | $days = $time_array['days']; |
1537 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1537 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1538 | 1538 | $hours = $time_array['hours']; |
1539 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1539 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1540 | 1540 | $minutes = $time_array['minutes']; |
1541 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1541 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1542 | 1542 | |
1543 | 1543 | return $time_array; |
1544 | 1544 | } |
@@ -1561,63 +1561,63 @@ discard block |
||
1561 | 1561 | $temp_array['direction_degree'] = $direction; |
1562 | 1562 | $temp_array['direction_shortname'] = "N"; |
1563 | 1563 | $temp_array['direction_fullname'] = "North"; |
1564 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
1564 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
1565 | 1565 | $temp_array['direction_degree'] = $direction; |
1566 | 1566 | $temp_array['direction_shortname'] = "NNE"; |
1567 | 1567 | $temp_array['direction_fullname'] = "North-Northeast"; |
1568 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
1568 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
1569 | 1569 | $temp_array['direction_degree'] = $direction; |
1570 | 1570 | $temp_array['direction_shortname'] = "NE"; |
1571 | 1571 | $temp_array['direction_fullname'] = "Northeast"; |
1572 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
1572 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
1573 | 1573 | $temp_array['direction_degree'] = $direction; |
1574 | 1574 | $temp_array['direction_shortname'] = "ENE"; |
1575 | 1575 | $temp_array['direction_fullname'] = "East-Northeast"; |
1576 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
1576 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
1577 | 1577 | $temp_array['direction_degree'] = $direction; |
1578 | 1578 | $temp_array['direction_shortname'] = "E"; |
1579 | 1579 | $temp_array['direction_fullname'] = "East"; |
1580 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
1580 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
1581 | 1581 | $temp_array['direction_degree'] = $direction; |
1582 | 1582 | $temp_array['direction_shortname'] = "ESE"; |
1583 | 1583 | $temp_array['direction_fullname'] = "East-Southeast"; |
1584 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
1584 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
1585 | 1585 | $temp_array['direction_degree'] = $direction; |
1586 | 1586 | $temp_array['direction_shortname'] = "SE"; |
1587 | 1587 | $temp_array['direction_fullname'] = "Southeast"; |
1588 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
1588 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
1589 | 1589 | $temp_array['direction_degree'] = $direction; |
1590 | 1590 | $temp_array['direction_shortname'] = "SSE"; |
1591 | 1591 | $temp_array['direction_fullname'] = "South-Southeast"; |
1592 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
1592 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
1593 | 1593 | $temp_array['direction_degree'] = $direction; |
1594 | 1594 | $temp_array['direction_shortname'] = "S"; |
1595 | 1595 | $temp_array['direction_fullname'] = "South"; |
1596 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
1596 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
1597 | 1597 | $temp_array['direction_degree'] = $direction; |
1598 | 1598 | $temp_array['direction_shortname'] = "SSW"; |
1599 | 1599 | $temp_array['direction_fullname'] = "South-Southwest"; |
1600 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
1600 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
1601 | 1601 | $temp_array['direction_degree'] = $direction; |
1602 | 1602 | $temp_array['direction_shortname'] = "SW"; |
1603 | 1603 | $temp_array['direction_fullname'] = "Southwest"; |
1604 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
1604 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
1605 | 1605 | $temp_array['direction_degree'] = $direction; |
1606 | 1606 | $temp_array['direction_shortname'] = "WSW"; |
1607 | 1607 | $temp_array['direction_fullname'] = "West-Southwest"; |
1608 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
1608 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
1609 | 1609 | $temp_array['direction_degree'] = $direction; |
1610 | 1610 | $temp_array['direction_shortname'] = "W"; |
1611 | 1611 | $temp_array['direction_fullname'] = "West"; |
1612 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
1612 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
1613 | 1613 | $temp_array['direction_degree'] = $direction; |
1614 | 1614 | $temp_array['direction_shortname'] = "WNW"; |
1615 | 1615 | $temp_array['direction_fullname'] = "West-Northwest"; |
1616 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
1616 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
1617 | 1617 | $temp_array['direction_degree'] = $direction; |
1618 | 1618 | $temp_array['direction_shortname'] = "NW"; |
1619 | 1619 | $temp_array['direction_fullname'] = "Northwest"; |
1620 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
1620 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
1621 | 1621 | $temp_array['direction_degree'] = $direction; |
1622 | 1622 | $temp_array['direction_shortname'] = "NNW"; |
1623 | 1623 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1634,11 +1634,11 @@ discard block |
||
1634 | 1634 | * @param Float $longitude longitute of the flight |
1635 | 1635 | * @return String the countrie |
1636 | 1636 | */ |
1637 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
1637 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
1638 | 1638 | { |
1639 | 1639 | global $globalDBdriver, $globalDebug; |
1640 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1641 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1640 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1641 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1642 | 1642 | |
1643 | 1643 | $Connection = new Connection($this->db); |
1644 | 1644 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | public function getCountryFromISO2($iso2) |
1679 | 1679 | { |
1680 | 1680 | global $globalDBdriver, $globalDebug; |
1681 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
1681 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
1682 | 1682 | |
1683 | 1683 | $Connection = new Connection($this->db); |
1684 | 1684 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | |
1727 | 1727 | $bitly_data = json_decode($bitly_data); |
1728 | 1728 | $bitly_url = ''; |
1729 | - if ($bitly_data->status_txt = "OK"){ |
|
1729 | + if ($bitly_data->status_txt = "OK") { |
|
1730 | 1730 | $bitly_url = $bitly_data->data->url; |
1731 | 1731 | } |
1732 | 1732 | |
@@ -1740,11 +1740,11 @@ discard block |
||
1740 | 1740 | * @return Array the vessel type list |
1741 | 1741 | * |
1742 | 1742 | */ |
1743 | - public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
1743 | + public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1744 | 1744 | { |
1745 | 1745 | global $globalDBdriver; |
1746 | - $filter_query = $this->getFilter($filters,true,true); |
|
1747 | - $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count |
|
1746 | + $filter_query = $this->getFilter($filters, true, true); |
|
1747 | + $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count |
|
1748 | 1748 | FROM marine_output ".$filter_query." marine_output.type <> ''"; |
1749 | 1749 | if ($olderthanmonths > 0) { |
1750 | 1750 | if ($globalDBdriver == 'mysql') { |
@@ -1764,28 +1764,28 @@ discard block |
||
1764 | 1764 | if ($year != '') { |
1765 | 1765 | if ($globalDBdriver == 'mysql') { |
1766 | 1766 | $query .= " AND YEAR(marine_output.date) = :year"; |
1767 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1767 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1768 | 1768 | } else { |
1769 | 1769 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1770 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1770 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1771 | 1771 | } |
1772 | 1772 | } |
1773 | 1773 | if ($month != '') { |
1774 | 1774 | if ($globalDBdriver == 'mysql') { |
1775 | 1775 | $query .= " AND MONTH(marine_output.date) = :month"; |
1776 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1776 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1777 | 1777 | } else { |
1778 | 1778 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1779 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1779 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1780 | 1780 | } |
1781 | 1781 | } |
1782 | 1782 | if ($day != '') { |
1783 | 1783 | if ($globalDBdriver == 'mysql') { |
1784 | 1784 | $query .= " AND DAY(marine_output.date) = :day"; |
1785 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1785 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1786 | 1786 | } else { |
1787 | 1787 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
1788 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1788 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1789 | 1789 | } |
1790 | 1790 | } |
1791 | 1791 | $query .= " GROUP BY marine_output.type ORDER BY marine_type_count DESC"; |
@@ -1794,7 +1794,7 @@ discard block |
||
1794 | 1794 | $sth->execute($query_values); |
1795 | 1795 | $marine_array = array(); |
1796 | 1796 | $temp_array = array(); |
1797 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1797 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1798 | 1798 | { |
1799 | 1799 | $temp_array['marine_type'] = $row['marine_type']; |
1800 | 1800 | $temp_array['marine_type_count'] = $row['marine_type_count']; |
@@ -1805,7 +1805,7 @@ discard block |
||
1805 | 1805 | |
1806 | 1806 | public function getOrderBy() |
1807 | 1807 | { |
1808 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
1808 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
1809 | 1809 | |
1810 | 1810 | return $orderby; |
1811 | 1811 |
@@ -14,33 +14,33 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_archive.fammarine_id"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_archive.fammarine_id"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_archive.fammarine_id"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_archive.fammarine_id"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($filter['source']) && !empty($filter['source'])) { |
43 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
43 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
44 | 44 | } |
45 | 45 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
46 | 46 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -68,42 +68,42 @@ discard block |
||
68 | 68 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_archive_output.date) = '".$filter['day']."'"; |
69 | 69 | } |
70 | 70 | } |
71 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_archive.fammarine_id"; |
|
71 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_archive.fammarine_id"; |
|
72 | 72 | } |
73 | 73 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
74 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
74 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
75 | 75 | } |
76 | 76 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
77 | 77 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
78 | 78 | if ($filter_query_where != '') { |
79 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
79 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
80 | 80 | } |
81 | 81 | $filter_query = $filter_query_join.$filter_query_where; |
82 | 82 | return $filter_query; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // marine_archive |
86 | - public function addMarineArchiveData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') { |
|
86 | + public function addMarineArchiveData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') { |
|
87 | 87 | require_once(dirname(__FILE__).'/class.Marine.php'); |
88 | 88 | if ($over_country == '') { |
89 | 89 | $Marine = new Marine($this->db); |
90 | - $data_country = $Marine->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
90 | + $data_country = $Marine->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
91 | 91 | if (!empty($data_country)) $country = $data_country['iso2']; |
92 | 92 | else $country = ''; |
93 | 93 | } else $country = $over_country; |
94 | 94 | |
95 | 95 | //$country = $over_country; |
96 | 96 | // Route is not added in marine_archive |
97 | - $query = 'INSERT INTO marine_archive (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) |
|
97 | + $query = 'INSERT INTO marine_archive (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) |
|
98 | 98 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)'; |
99 | 99 | |
100 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
100 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
101 | 101 | |
102 | 102 | try { |
103 | 103 | $sth = $this->db->prepare($query); |
104 | 104 | $sth->execute($query_values); |
105 | 105 | $sth->closeCursor(); |
106 | - } catch(PDOException $e) { |
|
106 | + } catch (PDOException $e) { |
|
107 | 107 | return "error : ".$e->getMessage(); |
108 | 108 | } |
109 | 109 | return "success"; |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | |
124 | 124 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
125 | 125 | //$query = "SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1"; |
126 | - $query = "SELECT marine_archive.* FROM marine_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
126 | + $query = "SELECT marine_archive.* FROM marine_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
127 | 127 | |
128 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident)); |
|
128 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident)); |
|
129 | 129 | |
130 | 130 | return $spotter_array; |
131 | 131 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
145 | 145 | //$query = MarineArchive->$global_query." WHERE marine_archive.fammarine_id = :id"; |
146 | 146 | //$query = "SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1"; |
147 | - $query = "SELECT * FROM marine_archive WHERE fammarine_id = :id ORDER BY date DESC LIMIT 1"; |
|
147 | + $query = "SELECT * FROM marine_archive WHERE fammarine_id = :id ORDER BY date DESC LIMIT 1"; |
|
148 | 148 | |
149 | 149 | // $spotter_array = Marine->getDataFromDB($query,array(':id' => $id)); |
150 | 150 | /* |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
159 | 159 | */ |
160 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id)); |
|
160 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id)); |
|
161 | 161 | |
162 | 162 | return $spotter_array; |
163 | 163 | } |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | { |
173 | 173 | date_default_timezone_set('UTC'); |
174 | 174 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
175 | - $query = $this->global_query." WHERE marine_archive.fammarine_id = :id ORDER BY date"; |
|
175 | + $query = $this->global_query." WHERE marine_archive.fammarine_id = :id ORDER BY date"; |
|
176 | 176 | |
177 | 177 | // $spotter_array = Marine->getDataFromDB($query,array(':id' => $id)); |
178 | 178 | |
179 | 179 | try { |
180 | 180 | $sth = $this->db->prepare($query); |
181 | 181 | $sth->execute(array(':id' => $id)); |
182 | - } catch(PDOException $e) { |
|
182 | + } catch (PDOException $e) { |
|
183 | 183 | echo $e->getMessage(); |
184 | 184 | die; |
185 | 185 | } |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | { |
199 | 199 | date_default_timezone_set('UTC'); |
200 | 200 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
201 | - $query = "SELECT marine_archive.latitude, marine_archive.longitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id"; |
|
201 | + $query = "SELECT marine_archive.latitude, marine_archive.longitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id"; |
|
202 | 202 | |
203 | 203 | // $spotter_array = Marine->getDataFromDB($query,array(':id' => $id)); |
204 | 204 | |
205 | 205 | try { |
206 | 206 | $sth = $this->db->prepare($query); |
207 | 207 | $sth->execute(array(':id' => $id)); |
208 | - } catch(PDOException $e) { |
|
208 | + } catch (PDOException $e) { |
|
209 | 209 | echo $e->getMessage(); |
210 | 210 | die; |
211 | 211 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | date_default_timezone_set('UTC'); |
228 | 228 | |
229 | 229 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
230 | - $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.ident = :ident AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date"; |
|
230 | + $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.ident = :ident AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date"; |
|
231 | 231 | |
232 | 232 | try { |
233 | 233 | $sth = $this->db->prepare($query); |
234 | 234 | $sth->execute(array(':ident' => $ident)); |
235 | - } catch(PDOException $e) { |
|
235 | + } catch (PDOException $e) { |
|
236 | 236 | echo $e->getMessage(); |
237 | 237 | die; |
238 | 238 | } |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | date_default_timezone_set('UTC'); |
254 | 254 | |
255 | 255 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
256 | - $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date"; |
|
256 | + $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date"; |
|
257 | 257 | |
258 | 258 | try { |
259 | 259 | $sth = $this->db->prepare($query); |
260 | 260 | $sth->execute(array(':id' => $id)); |
261 | - } catch(PDOException $e) { |
|
261 | + } catch (PDOException $e) { |
|
262 | 262 | echo $e->getMessage(); |
263 | 263 | die; |
264 | 264 | } |
@@ -279,12 +279,12 @@ discard block |
||
279 | 279 | date_default_timezone_set('UTC'); |
280 | 280 | |
281 | 281 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
282 | - $query = "SELECT marine_archive.altitude, marine_archive.ground_speed, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id ORDER BY date"; |
|
282 | + $query = "SELECT marine_archive.altitude, marine_archive.ground_speed, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id ORDER BY date"; |
|
283 | 283 | |
284 | 284 | try { |
285 | 285 | $sth = $this->db->prepare($query); |
286 | 286 | $sth->execute(array(':id' => $id)); |
287 | - } catch(PDOException $e) { |
|
287 | + } catch (PDOException $e) { |
|
288 | 288 | echo $e->getMessage(); |
289 | 289 | die; |
290 | 290 | } |
@@ -306,13 +306,13 @@ discard block |
||
306 | 306 | date_default_timezone_set('UTC'); |
307 | 307 | |
308 | 308 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
309 | - $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1"; |
|
309 | + $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1"; |
|
310 | 310 | // $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.ident = :ident"; |
311 | 311 | |
312 | 312 | try { |
313 | 313 | $sth = $this->db->prepare($query); |
314 | 314 | $sth->execute(array(':ident' => $ident)); |
315 | - } catch(PDOException $e) { |
|
315 | + } catch (PDOException $e) { |
|
316 | 316 | echo $e->getMessage(); |
317 | 317 | die; |
318 | 318 | } |
@@ -329,13 +329,13 @@ discard block |
||
329 | 329 | * @return Array the spotter information |
330 | 330 | * |
331 | 331 | */ |
332 | - public function getMarineArchiveData($ident,$fammarine_id,$date) |
|
332 | + public function getMarineArchiveData($ident, $fammarine_id, $date) |
|
333 | 333 | { |
334 | 334 | $Marine = new Marine($this->db); |
335 | 335 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
336 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.fammarine_id = :fammarine_id AND l.date LIKE :date GROUP BY l.fammarine_id) s on spotter_live.fammarine_id = s.fammarine_id AND spotter_live.date = s.maxdate"; |
|
336 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.fammarine_id = :fammarine_id AND l.date LIKE :date GROUP BY l.fammarine_id) s on spotter_live.fammarine_id = s.fammarine_id AND spotter_live.date = s.maxdate"; |
|
337 | 337 | |
338 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':fammarine_id' => $fammarine_id,':date' => $date.'%')); |
|
338 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':fammarine_id' => $fammarine_id, ':date' => $date.'%')); |
|
339 | 339 | |
340 | 340 | return $spotter_array; |
341 | 341 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | try { |
349 | 349 | $sth = $this->db->prepare($query); |
350 | 350 | $sth->execute(); |
351 | - } catch(PDOException $e) { |
|
351 | + } catch (PDOException $e) { |
|
352 | 352 | echo $e->getMessage(); |
353 | 353 | die; |
354 | 354 | } |
@@ -360,24 +360,24 @@ discard block |
||
360 | 360 | * @return Array the spotter information |
361 | 361 | * |
362 | 362 | */ |
363 | - public function getMinLiveMarineData($begindate,$enddate,$filter = array()) |
|
363 | + public function getMinLiveMarineData($begindate, $enddate, $filter = array()) |
|
364 | 364 | { |
365 | 365 | global $globalDBdriver, $globalLiveInterval; |
366 | 366 | date_default_timezone_set('UTC'); |
367 | 367 | |
368 | 368 | $filter_query = ''; |
369 | 369 | if (isset($filter['source']) && !empty($filter['source'])) { |
370 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
370 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
371 | 371 | } |
372 | 372 | // Use spotter_output also ? |
373 | 373 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
374 | - $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id "; |
|
374 | + $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id "; |
|
375 | 375 | } |
376 | 376 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
377 | 377 | $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id "; |
378 | 378 | } |
379 | 379 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
380 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
380 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id |
397 | 397 | AND marine_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON marine_archive.aircraft_icao = a.icao'; |
398 | 398 | */ |
399 | - $query = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
399 | + $query = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
400 | 400 | FROM marine_archive |
401 | 401 | INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao |
402 | 402 | WHERE marine_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
403 | 403 | '.$filter_query.' ORDER BY fammarine_id'; |
404 | 404 | } else { |
405 | 405 | //$query = 'SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao'; |
406 | - $query = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
406 | + $query = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
407 | 407 | FROM marine_archive |
408 | 408 | INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao |
409 | 409 | WHERE marine_archive.date >= '."'".$begindate."'".' AND marine_archive.date <= '."'".$enddate."'".' |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | try { |
414 | 414 | $sth = $this->db->prepare($query); |
415 | 415 | $sth->execute(); |
416 | - } catch(PDOException $e) { |
|
416 | + } catch (PDOException $e) { |
|
417 | 417 | echo $e->getMessage(); |
418 | 418 | die; |
419 | 419 | } |
@@ -428,24 +428,24 @@ discard block |
||
428 | 428 | * @return Array the spotter information |
429 | 429 | * |
430 | 430 | */ |
431 | - public function getMinLiveMarineDataPlayback($begindate,$enddate,$filter = array()) |
|
431 | + public function getMinLiveMarineDataPlayback($begindate, $enddate, $filter = array()) |
|
432 | 432 | { |
433 | 433 | global $globalDBdriver, $globalLiveInterval; |
434 | 434 | date_default_timezone_set('UTC'); |
435 | 435 | |
436 | 436 | $filter_query = ''; |
437 | 437 | if (isset($filter['source']) && !empty($filter['source'])) { |
438 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
438 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
439 | 439 | } |
440 | 440 | // Should use spotter_output also ? |
441 | 441 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
442 | - $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id "; |
|
442 | + $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id "; |
|
443 | 443 | } |
444 | 444 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
445 | 445 | $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id "; |
446 | 446 | } |
447 | 447 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
448 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
448 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | FROM marine_archive |
456 | 456 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON marine_archive.aircraft_icao = a.icao'; |
457 | 457 | */ |
458 | - $query = 'SELECT a.aircraft_shadow, marine_archive_output.ident, marine_archive_output.fammarine_id, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk |
|
458 | + $query = 'SELECT a.aircraft_shadow, marine_archive_output.ident, marine_archive_output.fammarine_id, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk |
|
459 | 459 | FROM marine_archive_output |
460 | 460 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON marine_archive_output.aircraft_icao = a.icao |
461 | 461 | WHERE (marine_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | WHERE marine_archive_output.date >= '."'".$begindate."'".' AND marine_archive_output.date <= '."'".$enddate."'".' |
471 | 471 | '.$filter_query.' GROUP BY marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao, marine_archive_output.arrival_airport_icao, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow'; |
472 | 472 | */ |
473 | - $query = 'SELECT DISTINCT marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow |
|
473 | + $query = 'SELECT DISTINCT marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow |
|
474 | 474 | FROM marine_archive_output |
475 | 475 | INNER JOIN (SELECT * FROM aircraft) a on marine_archive_output.aircraft_icao = a.icao |
476 | 476 | WHERE marine_archive_output.date >= '."'".$begindate."'".' AND marine_archive_output.date <= '."'".$enddate."'".' |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | try { |
483 | 483 | $sth = $this->db->prepare($query); |
484 | 484 | $sth->execute(); |
485 | - } catch(PDOException $e) { |
|
485 | + } catch (PDOException $e) { |
|
486 | 486 | echo $e->getMessage(); |
487 | 487 | die; |
488 | 488 | } |
@@ -497,23 +497,23 @@ discard block |
||
497 | 497 | * @return Array the spotter information |
498 | 498 | * |
499 | 499 | */ |
500 | - public function getLiveMarineCount($begindate,$enddate,$filter = array()) |
|
500 | + public function getLiveMarineCount($begindate, $enddate, $filter = array()) |
|
501 | 501 | { |
502 | 502 | global $globalDBdriver, $globalLiveInterval; |
503 | 503 | date_default_timezone_set('UTC'); |
504 | 504 | |
505 | 505 | $filter_query = ''; |
506 | 506 | if (isset($filter['source']) && !empty($filter['source'])) { |
507 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
507 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
508 | 508 | } |
509 | 509 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
510 | - $filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id "; |
|
510 | + $filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id "; |
|
511 | 511 | } |
512 | 512 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
513 | 513 | $filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id "; |
514 | 514 | } |
515 | 515 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
516 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
516 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | try { |
529 | 529 | $sth = $this->db->prepare($query); |
530 | 530 | $sth->execute(); |
531 | - } catch(PDOException $e) { |
|
531 | + } catch (PDOException $e) { |
|
532 | 532 | echo $e->getMessage(); |
533 | 533 | die; |
534 | 534 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @return Array the spotter information |
549 | 549 | * |
550 | 550 | */ |
551 | - public function searchMarineData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
551 | + public function searchMarineData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
552 | 552 | { |
553 | 553 | global $globalTimezone, $globalDBdriver; |
554 | 554 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | |
571 | 571 | $q_array = explode(" ", $q); |
572 | 572 | |
573 | - foreach ($q_array as $q_item){ |
|
573 | + foreach ($q_array as $q_item) { |
|
574 | 574 | $additional_query .= " AND ("; |
575 | 575 | $additional_query .= "(marine_archive_output.spotter_id like '%".$q_item."%') OR "; |
576 | 576 | $additional_query .= "(marine_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | if ($registration != "") |
604 | 604 | { |
605 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
605 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
606 | 606 | if (!is_string($registration)) |
607 | 607 | { |
608 | 608 | return false; |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | |
614 | 614 | if ($aircraft_icao != "") |
615 | 615 | { |
616 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
616 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
617 | 617 | if (!is_string($aircraft_icao)) |
618 | 618 | { |
619 | 619 | return false; |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | |
625 | 625 | if ($aircraft_manufacturer != "") |
626 | 626 | { |
627 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
627 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
628 | 628 | if (!is_string($aircraft_manufacturer)) |
629 | 629 | { |
630 | 630 | return false; |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | if ($airline_icao != "") |
647 | 647 | { |
648 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
648 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
649 | 649 | if (!is_string($airline_icao)) |
650 | 650 | { |
651 | 651 | return false; |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | |
657 | 657 | if ($airline_country != "") |
658 | 658 | { |
659 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
659 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
660 | 660 | if (!is_string($airline_country)) |
661 | 661 | { |
662 | 662 | return false; |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | |
668 | 668 | if ($airline_type != "") |
669 | 669 | { |
670 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
670 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
671 | 671 | if (!is_string($airline_type)) |
672 | 672 | { |
673 | 673 | return false; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | if ($airport != "") |
691 | 691 | { |
692 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
692 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
693 | 693 | if (!is_string($airport)) |
694 | 694 | { |
695 | 695 | return false; |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | |
701 | 701 | if ($airport_country != "") |
702 | 702 | { |
703 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
703 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
704 | 704 | if (!is_string($airport_country)) |
705 | 705 | { |
706 | 706 | return false; |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | |
712 | 712 | if ($callsign != "") |
713 | 713 | { |
714 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
714 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
715 | 715 | if (!is_string($callsign)) |
716 | 716 | { |
717 | 717 | return false; |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | $translate = $Translation->ident2icao($callsign); |
720 | 720 | if ($translate != $callsign) { |
721 | 721 | $additional_query .= " AND (marine_archive_output.ident = :callsign OR marine_archive_output.ident = :translate)"; |
722 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
722 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
723 | 723 | } else { |
724 | 724 | $additional_query .= " AND (marine_archive_output.ident = '".$callsign."')"; |
725 | 725 | } |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | |
729 | 729 | if ($owner != "") |
730 | 730 | { |
731 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
731 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
732 | 732 | if (!is_string($owner)) |
733 | 733 | { |
734 | 734 | return false; |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | |
740 | 740 | if ($pilot_name != "") |
741 | 741 | { |
742 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
742 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
743 | 743 | if (!is_string($pilot_name)) |
744 | 744 | { |
745 | 745 | return false; |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | |
751 | 751 | if ($pilot_id != "") |
752 | 752 | { |
753 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
753 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
754 | 754 | if (!is_string($pilot_id)) |
755 | 755 | { |
756 | 756 | return false; |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | |
762 | 762 | if ($departure_airport_route != "") |
763 | 763 | { |
764 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
764 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
765 | 765 | if (!is_string($departure_airport_route)) |
766 | 766 | { |
767 | 767 | return false; |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | |
773 | 773 | if ($arrival_airport_route != "") |
774 | 774 | { |
775 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
775 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
776 | 776 | if (!is_string($arrival_airport_route)) |
777 | 777 | { |
778 | 778 | return false; |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | { |
786 | 786 | $altitude_array = explode(",", $altitude); |
787 | 787 | |
788 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
789 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
788 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
789 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
790 | 790 | |
791 | 791 | |
792 | 792 | if ($altitude_array[1] != "") |
@@ -804,8 +804,8 @@ discard block |
||
804 | 804 | { |
805 | 805 | $date_array = explode(",", $date_posted); |
806 | 806 | |
807 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
808 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
807 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
808 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
809 | 809 | |
810 | 810 | if ($globalTimezone != '') { |
811 | 811 | date_default_timezone_set($globalTimezone); |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | { |
838 | 838 | $limit_array = explode(",", $limit); |
839 | 839 | |
840 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
841 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
840 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
841 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
842 | 842 | |
843 | 843 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
844 | 844 | { |
@@ -849,8 +849,8 @@ discard block |
||
849 | 849 | |
850 | 850 | |
851 | 851 | if ($origLat != "" && $origLon != "" && $dist != "") { |
852 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
853 | - $query="SELECT marine_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(marine_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(marine_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
852 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
853 | + $query = "SELECT marine_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(marine_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(marine_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
854 | 854 | FROM marine_archive_output, marine_archive WHERE spotter_output_archive.fammarine_id = marine_archive.fammarine_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
855 | 855 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(marine_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(marine_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
856 | 856 | } else { |
@@ -867,12 +867,12 @@ discard block |
||
867 | 867 | $additional_query .= " AND (marine_archive_output.waypoints <> '')"; |
868 | 868 | } |
869 | 869 | |
870 | - $query = "SELECT marine_archive_output.* FROM marine_archive_output |
|
870 | + $query = "SELECT marine_archive_output.* FROM marine_archive_output |
|
871 | 871 | WHERE marine_archive_output.ident <> '' |
872 | 872 | ".$additional_query." |
873 | 873 | ".$filter_query.$orderby_query; |
874 | 874 | } |
875 | - $spotter_array = $Marine->getDataFromDB($query, $query_values,$limit_query); |
|
875 | + $spotter_array = $Marine->getDataFromDB($query, $query_values, $limit_query); |
|
876 | 876 | |
877 | 877 | return $spotter_array; |
878 | 878 | } |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | try { |
890 | 890 | $sth = $this->db->prepare($query); |
891 | 891 | $sth->execute(); |
892 | - } catch(PDOException $e) { |
|
892 | + } catch (PDOException $e) { |
|
893 | 893 | return "error"; |
894 | 894 | } |
895 | 895 | } |
@@ -926,8 +926,8 @@ discard block |
||
926 | 926 | { |
927 | 927 | $limit_array = explode(",", $limit); |
928 | 928 | |
929 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
930 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
929 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
930 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
931 | 931 | |
932 | 932 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
933 | 933 | { |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | $query_values = array(); |
969 | 969 | $limit_query = ''; |
970 | 970 | $additional_query = ''; |
971 | - $filter_query = $this->getFilter($filter,true,true); |
|
971 | + $filter_query = $this->getFilter($filter, true, true); |
|
972 | 972 | |
973 | 973 | if ($owner != "") |
974 | 974 | { |
@@ -985,8 +985,8 @@ discard block |
||
985 | 985 | { |
986 | 986 | $limit_array = explode(",", $limit); |
987 | 987 | |
988 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
989 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
988 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
989 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
990 | 990 | |
991 | 991 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
992 | 992 | { |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | $query_values = array(); |
1027 | 1027 | $limit_query = ''; |
1028 | 1028 | $additional_query = ''; |
1029 | - $filter_query = $this->getFilter($filter,true,true); |
|
1029 | + $filter_query = $this->getFilter($filter, true, true); |
|
1030 | 1030 | |
1031 | 1031 | if ($pilot != "") |
1032 | 1032 | { |
@@ -1038,8 +1038,8 @@ discard block |
||
1038 | 1038 | { |
1039 | 1039 | $limit_array = explode(",", $limit); |
1040 | 1040 | |
1041 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1042 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1041 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1042 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1043 | 1043 | |
1044 | 1044 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1045 | 1045 | { |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | * @return Array the airline country list |
1070 | 1070 | * |
1071 | 1071 | */ |
1072 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1072 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1073 | 1073 | { |
1074 | 1074 | global $globalDBdriver; |
1075 | 1075 | /* |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | $flight_array = array(); |
1099 | 1099 | $temp_array = array(); |
1100 | 1100 | |
1101 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1101 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1102 | 1102 | { |
1103 | 1103 | $temp_array['flight_count'] = $row['nb']; |
1104 | 1104 | $temp_array['flight_country'] = $row['name']; |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | * @return Array the airline country list |
1116 | 1116 | * |
1117 | 1117 | */ |
1118 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1118 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1119 | 1119 | { |
1120 | 1120 | global $globalDBdriver; |
1121 | 1121 | /* |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | $flight_array = array(); |
1145 | 1145 | $temp_array = array(); |
1146 | 1146 | |
1147 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1147 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1148 | 1148 | { |
1149 | 1149 | $temp_array['airline_icao'] = $row['airline_icao']; |
1150 | 1150 | $temp_array['flight_count'] = $row['nb']; |
@@ -1162,14 +1162,14 @@ discard block |
||
1162 | 1162 | * @return Array the spotter information |
1163 | 1163 | * |
1164 | 1164 | */ |
1165 | - public function getDateArchiveMarineDataById($id,$date) |
|
1165 | + public function getDateArchiveMarineDataById($id, $date) |
|
1166 | 1166 | { |
1167 | 1167 | $Marine = new Marine($this->db); |
1168 | 1168 | date_default_timezone_set('UTC'); |
1169 | 1169 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1170 | 1170 | $query = 'SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate ORDER BY marine_archive.date DESC'; |
1171 | - $date = date('c',$date); |
|
1172 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1171 | + $date = date('c', $date); |
|
1172 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1173 | 1173 | return $spotter_array; |
1174 | 1174 | } |
1175 | 1175 | |
@@ -1179,14 +1179,14 @@ discard block |
||
1179 | 1179 | * @return Array the spotter information |
1180 | 1180 | * |
1181 | 1181 | */ |
1182 | - public function getDateArchiveMarineDataByIdent($ident,$date) |
|
1182 | + public function getDateArchiveMarineDataByIdent($ident, $date) |
|
1183 | 1183 | { |
1184 | 1184 | $Marine = new Marine($this->db); |
1185 | 1185 | date_default_timezone_set('UTC'); |
1186 | 1186 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1187 | 1187 | $query = 'SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate ORDER BY marine_archive.date DESC'; |
1188 | - $date = date('c',$date); |
|
1189 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1188 | + $date = date('c', $date); |
|
1189 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1190 | 1190 | return $spotter_array; |
1191 | 1191 | } |
1192 | 1192 | |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | * @return Array the spotter information |
1197 | 1197 | * |
1198 | 1198 | */ |
1199 | - public function getMarineDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1199 | + public function getMarineDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1200 | 1200 | { |
1201 | 1201 | global $global_query; |
1202 | 1202 | $Marine = new Marine($this->db); |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $query_values = array(); |
1205 | 1205 | $limit_query = ''; |
1206 | 1206 | $additional_query = ''; |
1207 | - $filter_query = $this->getFilter($filters,true,true); |
|
1207 | + $filter_query = $this->getFilter($filters, true, true); |
|
1208 | 1208 | |
1209 | 1209 | if ($airport != "") |
1210 | 1210 | { |
@@ -1221,8 +1221,8 @@ discard block |
||
1221 | 1221 | { |
1222 | 1222 | $limit_array = explode(",", $limit); |
1223 | 1223 | |
1224 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1225 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1224 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1225 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1226 | 1226 | |
1227 | 1227 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1228 | 1228 | { |
@@ -14,62 +14,62 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
35 | 35 | if ($flt['airlines'][0] != '') { |
36 | 36 | if (isset($flt['source'])) { |
37 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | 38 | } else { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
44 | 44 | if (isset($flt['source'])) { |
45 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | 46 | } else { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
51 | 51 | if (isset($flt['source'])) { |
52 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | 53 | } else { |
54 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
58 | 58 | if (isset($flt['source'])) { |
59 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | 60 | } else { |
61 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
65 | 65 | if (isset($flt['source'])) { |
66 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
70 | 70 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
71 | 71 | if ($filter['airlines'][0] != '') { |
72 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
78 | 78 | } |
79 | 79 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
80 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
81 | 81 | } |
82 | 82 | if (isset($filter['source']) && !empty($filter['source'])) { |
83 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
83 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
84 | 84 | } |
85 | 85 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
86 | 86 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
87 | 87 | } |
88 | 88 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
89 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
89 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
90 | 90 | } |
91 | 91 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
92 | 92 | $filter_query_date = ''; |
@@ -112,41 +112,41 @@ discard block |
||
112 | 112 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
113 | 113 | } |
114 | 114 | } |
115 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
115 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
116 | 116 | } |
117 | 117 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
118 | 118 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
119 | 119 | if ($filter_query_where != '') { |
120 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
120 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
121 | 121 | } |
122 | 122 | $filter_query = $filter_query_join.$filter_query_where; |
123 | 123 | return $filter_query; |
124 | 124 | } |
125 | 125 | |
126 | 126 | // Spotter_archive |
127 | - public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
127 | + public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
128 | 128 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
129 | 129 | if ($over_country == '') { |
130 | 130 | $Spotter = new Spotter($this->db); |
131 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
131 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
132 | 132 | if (!empty($data_country)) $country = $data_country['iso2']; |
133 | 133 | else $country = ''; |
134 | 134 | } else $country = $over_country; |
135 | - if ($airline_type === NULL) $airline_type =''; |
|
135 | + if ($airline_type === NULL) $airline_type = ''; |
|
136 | 136 | |
137 | 137 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
138 | 138 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
139 | 139 | |
140 | 140 | // Route is not added in spotter_archive |
141 | - $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
141 | + $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
142 | 142 | VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)"; |
143 | 143 | |
144 | - $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude); |
|
144 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude); |
|
145 | 145 | try { |
146 | 146 | $sth = $this->db->prepare($query); |
147 | 147 | $sth->execute($query_values); |
148 | 148 | $sth->closeCursor(); |
149 | - } catch(PDOException $e) { |
|
149 | + } catch (PDOException $e) { |
|
150 | 150 | return "error : ".$e->getMessage(); |
151 | 151 | } |
152 | 152 | return "success"; |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | |
167 | 167 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
168 | 168 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
169 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
169 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
170 | 170 | |
171 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
171 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
172 | 172 | |
173 | 173 | return $spotter_array; |
174 | 174 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
188 | 188 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
189 | 189 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
190 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
190 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
191 | 191 | |
192 | 192 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
193 | 193 | /* |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
202 | 202 | */ |
203 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
203 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
204 | 204 | |
205 | 205 | return $spotter_array; |
206 | 206 | } |
@@ -215,14 +215,14 @@ discard block |
||
215 | 215 | { |
216 | 216 | date_default_timezone_set('UTC'); |
217 | 217 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
218 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
218 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
219 | 219 | |
220 | 220 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
221 | 221 | |
222 | 222 | try { |
223 | 223 | $sth = $this->db->prepare($query); |
224 | 224 | $sth->execute(array(':id' => $id)); |
225 | - } catch(PDOException $e) { |
|
225 | + } catch (PDOException $e) { |
|
226 | 226 | echo $e->getMessage(); |
227 | 227 | die; |
228 | 228 | } |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | { |
242 | 242 | date_default_timezone_set('UTC'); |
243 | 243 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
244 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
244 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
245 | 245 | |
246 | 246 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
247 | 247 | |
248 | 248 | try { |
249 | 249 | $sth = $this->db->prepare($query); |
250 | 250 | $sth->execute(array(':id' => $id)); |
251 | - } catch(PDOException $e) { |
|
251 | + } catch (PDOException $e) { |
|
252 | 252 | echo $e->getMessage(); |
253 | 253 | die; |
254 | 254 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | date_default_timezone_set('UTC'); |
271 | 271 | |
272 | 272 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
273 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
273 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
274 | 274 | |
275 | 275 | try { |
276 | 276 | $sth = $this->db->prepare($query); |
277 | 277 | $sth->execute(array(':ident' => $ident)); |
278 | - } catch(PDOException $e) { |
|
278 | + } catch (PDOException $e) { |
|
279 | 279 | echo $e->getMessage(); |
280 | 280 | die; |
281 | 281 | } |
@@ -296,12 +296,12 @@ discard block |
||
296 | 296 | date_default_timezone_set('UTC'); |
297 | 297 | |
298 | 298 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
299 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
299 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
300 | 300 | |
301 | 301 | try { |
302 | 302 | $sth = $this->db->prepare($query); |
303 | 303 | $sth->execute(array(':id' => $id)); |
304 | - } catch(PDOException $e) { |
|
304 | + } catch (PDOException $e) { |
|
305 | 305 | echo $e->getMessage(); |
306 | 306 | die; |
307 | 307 | } |
@@ -322,12 +322,12 @@ discard block |
||
322 | 322 | date_default_timezone_set('UTC'); |
323 | 323 | |
324 | 324 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
325 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
325 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
326 | 326 | |
327 | 327 | try { |
328 | 328 | $sth = $this->db->prepare($query); |
329 | 329 | $sth->execute(array(':id' => $id)); |
330 | - } catch(PDOException $e) { |
|
330 | + } catch (PDOException $e) { |
|
331 | 331 | echo $e->getMessage(); |
332 | 332 | die; |
333 | 333 | } |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | date_default_timezone_set('UTC'); |
350 | 350 | |
351 | 351 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
352 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
352 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
353 | 353 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
354 | 354 | |
355 | 355 | try { |
356 | 356 | $sth = $this->db->prepare($query); |
357 | 357 | $sth->execute(array(':ident' => $ident)); |
358 | - } catch(PDOException $e) { |
|
358 | + } catch (PDOException $e) { |
|
359 | 359 | echo $e->getMessage(); |
360 | 360 | die; |
361 | 361 | } |
@@ -372,13 +372,13 @@ discard block |
||
372 | 372 | * @return Array the spotter information |
373 | 373 | * |
374 | 374 | */ |
375 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
375 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) |
|
376 | 376 | { |
377 | 377 | $Spotter = new Spotter($this->db); |
378 | 378 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
379 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
379 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
380 | 380 | |
381 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
381 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
382 | 382 | |
383 | 383 | return $spotter_array; |
384 | 384 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | try { |
395 | 395 | $sth = $this->db->prepare($query); |
396 | 396 | $sth->execute(); |
397 | - } catch(PDOException $e) { |
|
397 | + } catch (PDOException $e) { |
|
398 | 398 | echo $e->getMessage(); |
399 | 399 | die; |
400 | 400 | } |
@@ -406,24 +406,24 @@ discard block |
||
406 | 406 | * @return Array the spotter information |
407 | 407 | * |
408 | 408 | */ |
409 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
409 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array()) |
|
410 | 410 | { |
411 | 411 | global $globalDBdriver, $globalLiveInterval; |
412 | 412 | date_default_timezone_set('UTC'); |
413 | 413 | |
414 | 414 | $filter_query = ''; |
415 | 415 | if (isset($filter['source']) && !empty($filter['source'])) { |
416 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
416 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
417 | 417 | } |
418 | 418 | // Use spotter_output also ? |
419 | 419 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
420 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
420 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
421 | 421 | } |
422 | 422 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
423 | 423 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
424 | 424 | } |
425 | 425 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
426 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
426 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -442,14 +442,14 @@ discard block |
||
442 | 442 | GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id |
443 | 443 | AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
444 | 444 | */ |
445 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
445 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
446 | 446 | FROM spotter_archive |
447 | 447 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
448 | 448 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
449 | 449 | '.$filter_query.' ORDER BY flightaware_id'; |
450 | 450 | } else { |
451 | 451 | //$query = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
452 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
452 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
453 | 453 | FROM spotter_archive |
454 | 454 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
455 | 455 | WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".' |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | try { |
460 | 460 | $sth = $this->db->prepare($query); |
461 | 461 | $sth->execute(); |
462 | - } catch(PDOException $e) { |
|
462 | + } catch (PDOException $e) { |
|
463 | 463 | echo $e->getMessage(); |
464 | 464 | die; |
465 | 465 | } |
@@ -474,24 +474,24 @@ discard block |
||
474 | 474 | * @return Array the spotter information |
475 | 475 | * |
476 | 476 | */ |
477 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
477 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) |
|
478 | 478 | { |
479 | 479 | global $globalDBdriver, $globalLiveInterval; |
480 | 480 | date_default_timezone_set('UTC'); |
481 | 481 | |
482 | 482 | $filter_query = ''; |
483 | 483 | if (isset($filter['source']) && !empty($filter['source'])) { |
484 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
484 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
485 | 485 | } |
486 | 486 | // Should use spotter_output also ? |
487 | 487 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
488 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
488 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
489 | 489 | } |
490 | 490 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
491 | 491 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
492 | 492 | } |
493 | 493 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
494 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
494 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | FROM spotter_archive |
502 | 502 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
503 | 503 | */ |
504 | - $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
504 | + $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
505 | 505 | FROM spotter_archive_output |
506 | 506 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
507 | 507 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
517 | 517 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
518 | 518 | */ |
519 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
519 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
520 | 520 | FROM spotter_archive_output |
521 | 521 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
522 | 522 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | try { |
529 | 529 | $sth = $this->db->prepare($query); |
530 | 530 | $sth->execute(); |
531 | - } catch(PDOException $e) { |
|
531 | + } catch (PDOException $e) { |
|
532 | 532 | echo $e->getMessage(); |
533 | 533 | die; |
534 | 534 | } |
@@ -543,23 +543,23 @@ discard block |
||
543 | 543 | * @return Array the spotter information |
544 | 544 | * |
545 | 545 | */ |
546 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
546 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) |
|
547 | 547 | { |
548 | 548 | global $globalDBdriver, $globalLiveInterval; |
549 | 549 | date_default_timezone_set('UTC'); |
550 | 550 | |
551 | 551 | $filter_query = ''; |
552 | 552 | if (isset($filter['source']) && !empty($filter['source'])) { |
553 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
553 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
554 | 554 | } |
555 | 555 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
556 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
556 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
557 | 557 | } |
558 | 558 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
559 | 559 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
560 | 560 | } |
561 | 561 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
562 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
562 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | try { |
575 | 575 | $sth = $this->db->prepare($query); |
576 | 576 | $sth->execute(); |
577 | - } catch(PDOException $e) { |
|
577 | + } catch (PDOException $e) { |
|
578 | 578 | echo $e->getMessage(); |
579 | 579 | die; |
580 | 580 | } |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | * @return Array the spotter information |
595 | 595 | * |
596 | 596 | */ |
597 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
597 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
598 | 598 | { |
599 | 599 | global $globalTimezone, $globalDBdriver; |
600 | 600 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | |
617 | 617 | $q_array = explode(" ", $q); |
618 | 618 | |
619 | - foreach ($q_array as $q_item){ |
|
619 | + foreach ($q_array as $q_item) { |
|
620 | 620 | $additional_query .= " AND ("; |
621 | 621 | $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
622 | 622 | $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | |
649 | 649 | if ($registration != "") |
650 | 650 | { |
651 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
651 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
652 | 652 | if (!is_string($registration)) |
653 | 653 | { |
654 | 654 | return false; |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | |
660 | 660 | if ($aircraft_icao != "") |
661 | 661 | { |
662 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
662 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
663 | 663 | if (!is_string($aircraft_icao)) |
664 | 664 | { |
665 | 665 | return false; |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | |
671 | 671 | if ($aircraft_manufacturer != "") |
672 | 672 | { |
673 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
673 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
674 | 674 | if (!is_string($aircraft_manufacturer)) |
675 | 675 | { |
676 | 676 | return false; |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | |
692 | 692 | if ($airline_icao != "") |
693 | 693 | { |
694 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
694 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
695 | 695 | if (!is_string($airline_icao)) |
696 | 696 | { |
697 | 697 | return false; |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | |
703 | 703 | if ($airline_country != "") |
704 | 704 | { |
705 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
705 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
706 | 706 | if (!is_string($airline_country)) |
707 | 707 | { |
708 | 708 | return false; |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | |
714 | 714 | if ($airline_type != "") |
715 | 715 | { |
716 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
716 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
717 | 717 | if (!is_string($airline_type)) |
718 | 718 | { |
719 | 719 | return false; |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | |
736 | 736 | if ($airport != "") |
737 | 737 | { |
738 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
738 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
739 | 739 | if (!is_string($airport)) |
740 | 740 | { |
741 | 741 | return false; |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | |
747 | 747 | if ($airport_country != "") |
748 | 748 | { |
749 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
749 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
750 | 750 | if (!is_string($airport_country)) |
751 | 751 | { |
752 | 752 | return false; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | |
758 | 758 | if ($callsign != "") |
759 | 759 | { |
760 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
760 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
761 | 761 | if (!is_string($callsign)) |
762 | 762 | { |
763 | 763 | return false; |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | $translate = $Translation->ident2icao($callsign); |
766 | 766 | if ($translate != $callsign) { |
767 | 767 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
768 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
768 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
769 | 769 | } else { |
770 | 770 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
771 | 771 | } |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | |
775 | 775 | if ($owner != "") |
776 | 776 | { |
777 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
777 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
778 | 778 | if (!is_string($owner)) |
779 | 779 | { |
780 | 780 | return false; |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | |
786 | 786 | if ($pilot_name != "") |
787 | 787 | { |
788 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
788 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
789 | 789 | if (!is_string($pilot_name)) |
790 | 790 | { |
791 | 791 | return false; |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | |
797 | 797 | if ($pilot_id != "") |
798 | 798 | { |
799 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
799 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
800 | 800 | if (!is_string($pilot_id)) |
801 | 801 | { |
802 | 802 | return false; |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | |
808 | 808 | if ($departure_airport_route != "") |
809 | 809 | { |
810 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
810 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
811 | 811 | if (!is_string($departure_airport_route)) |
812 | 812 | { |
813 | 813 | return false; |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | |
819 | 819 | if ($arrival_airport_route != "") |
820 | 820 | { |
821 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
821 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
822 | 822 | if (!is_string($arrival_airport_route)) |
823 | 823 | { |
824 | 824 | return false; |
@@ -831,8 +831,8 @@ discard block |
||
831 | 831 | { |
832 | 832 | $altitude_array = explode(",", $altitude); |
833 | 833 | |
834 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
835 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
834 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
835 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
836 | 836 | |
837 | 837 | |
838 | 838 | if ($altitude_array[1] != "") |
@@ -850,8 +850,8 @@ discard block |
||
850 | 850 | { |
851 | 851 | $date_array = explode(",", $date_posted); |
852 | 852 | |
853 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
854 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
853 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
854 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
855 | 855 | |
856 | 856 | if ($globalTimezone != '') { |
857 | 857 | date_default_timezone_set($globalTimezone); |
@@ -883,8 +883,8 @@ discard block |
||
883 | 883 | { |
884 | 884 | $limit_array = explode(",", $limit); |
885 | 885 | |
886 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
887 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
886 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
887 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
888 | 888 | |
889 | 889 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
890 | 890 | { |
@@ -895,8 +895,8 @@ discard block |
||
895 | 895 | |
896 | 896 | |
897 | 897 | if ($origLat != "" && $origLon != "" && $dist != "") { |
898 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
899 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
898 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
899 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
900 | 900 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
901 | 901 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
902 | 902 | } else { |
@@ -913,12 +913,12 @@ discard block |
||
913 | 913 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
914 | 914 | } |
915 | 915 | |
916 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
916 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
917 | 917 | WHERE spotter_archive_output.ident <> '' |
918 | 918 | ".$additional_query." |
919 | 919 | ".$filter_query.$orderby_query; |
920 | 920 | } |
921 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
921 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
922 | 922 | |
923 | 923 | return $spotter_array; |
924 | 924 | } |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | try { |
936 | 936 | $sth = $this->db->prepare($query); |
937 | 937 | $sth->execute(); |
938 | - } catch(PDOException $e) { |
|
938 | + } catch (PDOException $e) { |
|
939 | 939 | return "error"; |
940 | 940 | } |
941 | 941 | } |
@@ -972,8 +972,8 @@ discard block |
||
972 | 972 | { |
973 | 973 | $limit_array = explode(",", $limit); |
974 | 974 | |
975 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
976 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
975 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
976 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
977 | 977 | |
978 | 978 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
979 | 979 | { |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | $query_values = array(); |
1015 | 1015 | $limit_query = ''; |
1016 | 1016 | $additional_query = ''; |
1017 | - $filter_query = $this->getFilter($filter,true,true); |
|
1017 | + $filter_query = $this->getFilter($filter, true, true); |
|
1018 | 1018 | |
1019 | 1019 | if ($owner != "") |
1020 | 1020 | { |
@@ -1031,8 +1031,8 @@ discard block |
||
1031 | 1031 | { |
1032 | 1032 | $limit_array = explode(",", $limit); |
1033 | 1033 | |
1034 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1035 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1034 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1035 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1036 | 1036 | |
1037 | 1037 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1038 | 1038 | { |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | $query_values = array(); |
1073 | 1073 | $limit_query = ''; |
1074 | 1074 | $additional_query = ''; |
1075 | - $filter_query = $this->getFilter($filter,true,true); |
|
1075 | + $filter_query = $this->getFilter($filter, true, true); |
|
1076 | 1076 | |
1077 | 1077 | if ($pilot != "") |
1078 | 1078 | { |
@@ -1084,8 +1084,8 @@ discard block |
||
1084 | 1084 | { |
1085 | 1085 | $limit_array = explode(",", $limit); |
1086 | 1086 | |
1087 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1088 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1087 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1088 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1089 | 1089 | |
1090 | 1090 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1091 | 1091 | { |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | * @return Array the airline country list |
1116 | 1116 | * |
1117 | 1117 | */ |
1118 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1118 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1119 | 1119 | { |
1120 | 1120 | global $globalDBdriver; |
1121 | 1121 | /* |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | $flight_array = array(); |
1145 | 1145 | $temp_array = array(); |
1146 | 1146 | |
1147 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1147 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1148 | 1148 | { |
1149 | 1149 | $temp_array['flight_count'] = $row['nb']; |
1150 | 1150 | $temp_array['flight_country'] = $row['name']; |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | * @return Array the airline country list |
1162 | 1162 | * |
1163 | 1163 | */ |
1164 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1164 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1165 | 1165 | { |
1166 | 1166 | global $globalDBdriver; |
1167 | 1167 | /* |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | $flight_array = array(); |
1191 | 1191 | $temp_array = array(); |
1192 | 1192 | |
1193 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1193 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1194 | 1194 | { |
1195 | 1195 | $temp_array['airline_icao'] = $row['airline_icao']; |
1196 | 1196 | $temp_array['flight_count'] = $row['nb']; |
@@ -1208,14 +1208,14 @@ discard block |
||
1208 | 1208 | * @return Array the spotter information |
1209 | 1209 | * |
1210 | 1210 | */ |
1211 | - public function getDateArchiveSpotterDataById($id,$date) |
|
1211 | + public function getDateArchiveSpotterDataById($id, $date) |
|
1212 | 1212 | { |
1213 | 1213 | $Spotter = new Spotter($this->db); |
1214 | 1214 | date_default_timezone_set('UTC'); |
1215 | 1215 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1216 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1217 | - $date = date('c',$date); |
|
1218 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1216 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1217 | + $date = date('c', $date); |
|
1218 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1219 | 1219 | return $spotter_array; |
1220 | 1220 | } |
1221 | 1221 | |
@@ -1225,14 +1225,14 @@ discard block |
||
1225 | 1225 | * @return Array the spotter information |
1226 | 1226 | * |
1227 | 1227 | */ |
1228 | - public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1228 | + public function getDateArchiveSpotterDataByIdent($ident, $date) |
|
1229 | 1229 | { |
1230 | 1230 | $Spotter = new Spotter($this->db); |
1231 | 1231 | date_default_timezone_set('UTC'); |
1232 | 1232 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1233 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1234 | - $date = date('c',$date); |
|
1235 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1233 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1234 | + $date = date('c', $date); |
|
1235 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1236 | 1236 | return $spotter_array; |
1237 | 1237 | } |
1238 | 1238 | |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | * @return Array the spotter information |
1243 | 1243 | * |
1244 | 1244 | */ |
1245 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1245 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1246 | 1246 | { |
1247 | 1247 | global $global_query; |
1248 | 1248 | $Spotter = new Spotter($this->db); |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | $query_values = array(); |
1251 | 1251 | $limit_query = ''; |
1252 | 1252 | $additional_query = ''; |
1253 | - $filter_query = $this->getFilter($filters,true,true); |
|
1253 | + $filter_query = $this->getFilter($filters, true, true); |
|
1254 | 1254 | |
1255 | 1255 | if ($airport != "") |
1256 | 1256 | { |
@@ -1267,8 +1267,8 @@ discard block |
||
1267 | 1267 | { |
1268 | 1268 | $limit_array = explode(",", $limit); |
1269 | 1269 | |
1270 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1271 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1270 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1271 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1272 | 1272 | |
1273 | 1273 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1274 | 1274 | { |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | try { |
983 | 983 | $sth = $this->db->prepare($query); |
984 | 984 | $sth->execute($query_values); |
985 | - } catch(PDOException $e) { |
|
985 | + } catch (PDOException $e) { |
|
986 | 986 | echo "error : ".$e->getMessage(); |
987 | 987 | } |
988 | 988 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1000,19 +1000,19 @@ discard block |
||
1000 | 1000 | try { |
1001 | 1001 | $sth = $this->db->prepare($query); |
1002 | 1002 | $sth->execute($query_values); |
1003 | - } catch(PDOException $e) { |
|
1003 | + } catch (PDOException $e) { |
|
1004 | 1004 | echo "error : ".$e->getMessage(); |
1005 | 1005 | } |
1006 | 1006 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1007 | 1007 | return $all; |
1008 | 1008 | } |
1009 | 1009 | public function getAllNOTAMtext() { |
1010 | - $query = 'SELECT full_notam FROM notam'; |
|
1010 | + $query = 'SELECT full_notam FROM notam'; |
|
1011 | 1011 | $query_values = array(); |
1012 | 1012 | try { |
1013 | 1013 | $sth = $this->db->prepare($query); |
1014 | 1014 | $sth->execute($query_values); |
1015 | - } catch(PDOException $e) { |
|
1015 | + } catch (PDOException $e) { |
|
1016 | 1016 | echo "error : ".$e->getMessage(); |
1017 | 1017 | } |
1018 | 1018 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1021,13 +1021,13 @@ discard block |
||
1021 | 1021 | public function createNOTAMtextFile($filename) { |
1022 | 1022 | $allnotam_result = $this->getAllNOTAMtext(); |
1023 | 1023 | $notamtext = ''; |
1024 | - foreach($allnotam_result as $notam) { |
|
1024 | + foreach ($allnotam_result as $notam) { |
|
1025 | 1025 | $notamtext .= '%%'."\n"; |
1026 | 1026 | $notamtext .= $notam['full_notam']; |
1027 | 1027 | $notamtext .= "\n".'%%'."\n"; |
1028 | 1028 | } |
1029 | 1029 | //$allnotam = implode('\n%%%%\n',$allnotam_result); |
1030 | - file_put_contents($filename,$notamtext); |
|
1030 | + file_put_contents($filename, $notamtext); |
|
1031 | 1031 | } |
1032 | 1032 | public function parseNOTAMtextFile($filename) { |
1033 | 1033 | $data = file_get_contents($filename); |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | try { |
1049 | 1049 | $sth = $this->db->prepare($query); |
1050 | 1050 | $sth->execute($query_values); |
1051 | - } catch(PDOException $e) { |
|
1051 | + } catch (PDOException $e) { |
|
1052 | 1052 | echo "error : ".$e->getMessage(); |
1053 | 1053 | } |
1054 | 1054 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1057,10 +1057,10 @@ discard block |
||
1057 | 1057 | public function getAllNOTAMbyCoord($coord) { |
1058 | 1058 | global $globalDBdriver; |
1059 | 1059 | if (is_array($coord)) { |
1060 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1061 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1062 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1063 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1060 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1061 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1062 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1063 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1064 | 1064 | if ($minlat > $maxlat) { |
1065 | 1065 | $tmplat = $minlat; |
1066 | 1066 | $minlat = $maxlat; |
@@ -1082,19 +1082,19 @@ discard block |
||
1082 | 1082 | try { |
1083 | 1083 | $sth = $this->db->prepare($query); |
1084 | 1084 | $sth->execute($query_values); |
1085 | - } catch(PDOException $e) { |
|
1085 | + } catch (PDOException $e) { |
|
1086 | 1086 | echo "error : ".$e->getMessage(); |
1087 | 1087 | } |
1088 | 1088 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1089 | 1089 | return $all; |
1090 | 1090 | } |
1091 | - public function getAllNOTAMbyCoordScope($coord,$scope) { |
|
1091 | + public function getAllNOTAMbyCoordScope($coord, $scope) { |
|
1092 | 1092 | global $globalDBdriver; |
1093 | 1093 | if (is_array($coord)) { |
1094 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1095 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1096 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1097 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1094 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1095 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1096 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1097 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1098 | 1098 | } else return array(); |
1099 | 1099 | if ($globalDBdriver == 'mysql') { |
1100 | 1100 | $query = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope'; |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | try { |
1107 | 1107 | $sth = $this->db->prepare($query); |
1108 | 1108 | $sth->execute($query_values); |
1109 | - } catch(PDOException $e) { |
|
1109 | + } catch (PDOException $e) { |
|
1110 | 1110 | echo "error : ".$e->getMessage(); |
1111 | 1111 | } |
1112 | 1112 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | try { |
1119 | 1119 | $sth = $this->db->prepare($query); |
1120 | 1120 | $sth->execute($query_values); |
1121 | - } catch(PDOException $e) { |
|
1121 | + } catch (PDOException $e) { |
|
1122 | 1122 | return "error : ".$e->getMessage(); |
1123 | 1123 | } |
1124 | 1124 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1126,13 +1126,13 @@ discard block |
||
1126 | 1126 | else return array(); |
1127 | 1127 | } |
1128 | 1128 | |
1129 | - public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) { |
|
1129 | + public function addNOTAM($ref, $title, $type, $fir, $code, $rules, $scope, $lower_limit, $upper_limit, $center_latitude, $center_longitude, $radius, $date_begin, $date_end, $permanent, $text, $full_notam) { |
|
1130 | 1130 | $query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)"; |
1131 | - $query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam); |
|
1131 | + $query_values = array(':ref' => $ref, ':title' => $title, ':type' => $type, ':fir' => $fir, ':code' => $code, ':rules' => $rules, ':scope' => $scope, ':lower_limit' => $lower_limit, ':upper_limit' => $upper_limit, ':center_latitude' => $center_latitude, ':center_longitude' => $center_longitude, ':radius' => $radius, ':date_begin' => $date_begin, ':date_end' => $date_end, ':permanent' => $permanent, ':text' => $text, ':full_notam' => $full_notam); |
|
1132 | 1132 | try { |
1133 | 1133 | $sth = $this->db->prepare($query); |
1134 | 1134 | $sth->execute($query_values); |
1135 | - } catch(PDOException $e) { |
|
1135 | + } catch (PDOException $e) { |
|
1136 | 1136 | return "error : ".$e->getMessage(); |
1137 | 1137 | } |
1138 | 1138 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | try { |
1144 | 1144 | $sth = $this->db->prepare($query); |
1145 | 1145 | $sth->execute($query_values); |
1146 | - } catch(PDOException $e) { |
|
1146 | + } catch (PDOException $e) { |
|
1147 | 1147 | return "error : ".$e->getMessage(); |
1148 | 1148 | } |
1149 | 1149 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | try { |
1159 | 1159 | $sth = $this->db->prepare($query); |
1160 | 1160 | $sth->execute($query_values); |
1161 | - } catch(PDOException $e) { |
|
1161 | + } catch (PDOException $e) { |
|
1162 | 1162 | return "error : ".$e->getMessage(); |
1163 | 1163 | } |
1164 | 1164 | } |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | try { |
1169 | 1169 | $sth = $this->db->prepare($query); |
1170 | 1170 | $sth->execute($query_values); |
1171 | - } catch(PDOException $e) { |
|
1171 | + } catch (PDOException $e) { |
|
1172 | 1172 | return "error : ".$e->getMessage(); |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | try { |
1178 | 1178 | $sth = $this->db->prepare($query); |
1179 | 1179 | $sth->execute(); |
1180 | - } catch(PDOException $e) { |
|
1180 | + } catch (PDOException $e) { |
|
1181 | 1181 | return "error : ".$e->getMessage(); |
1182 | 1182 | } |
1183 | 1183 | } |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | try { |
1187 | 1187 | $sth = $this->db->prepare($query); |
1188 | 1188 | $sth->execute(); |
1189 | - } catch(PDOException $e) { |
|
1189 | + } catch (PDOException $e) { |
|
1190 | 1190 | return "error : ".$e->getMessage(); |
1191 | 1191 | } |
1192 | 1192 | } |
@@ -1194,14 +1194,14 @@ discard block |
||
1194 | 1194 | public function updateNOTAM() { |
1195 | 1195 | global $globalNOTAMAirports; |
1196 | 1196 | if (isset($globalNOTAMAirports) && is_array($globalNOTAMAirports) && count($globalNOTAMAirports) > 0) { |
1197 | - foreach (array_chunk($globalNOTAMAirports,10) as $airport) { |
|
1198 | - $airport_icao = implode(',',$airport); |
|
1197 | + foreach (array_chunk($globalNOTAMAirports, 10) as $airport) { |
|
1198 | + $airport_icao = implode(',', $airport); |
|
1199 | 1199 | $alldata = $this->downloadNOTAM($airport_icao); |
1200 | 1200 | if (count($alldata) > 0) { |
1201 | 1201 | foreach ($alldata as $initial_data) { |
1202 | 1202 | $data = $this->parse($initial_data); |
1203 | 1203 | $notamref = $this->getNOTAMbyRef($data['ref']); |
1204 | - if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1204 | + if (count($notamref) == 0) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
1205 | 1205 | } |
1206 | 1206 | } |
1207 | 1207 | } |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | foreach ($alldata as $initial_data) { |
1215 | 1215 | $data = $this->parse($initial_data); |
1216 | 1216 | $notamref = $this->getNOTAMbyRef($data['ref']); |
1217 | - if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1217 | + if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
1218 | 1218 | } |
1219 | 1219 | } |
1220 | 1220 | } |
@@ -1223,12 +1223,12 @@ discard block |
||
1223 | 1223 | global $globalTransaction; |
1224 | 1224 | $Spotter = new Spotter($this->db); |
1225 | 1225 | $allairports = $Spotter->getAllAirportInfo(); |
1226 | - foreach (array_chunk($allairports,20) as $airport) { |
|
1226 | + foreach (array_chunk($allairports, 20) as $airport) { |
|
1227 | 1227 | $airports_icao = array(); |
1228 | - foreach($airport as $icao) { |
|
1228 | + foreach ($airport as $icao) { |
|
1229 | 1229 | if (isset($icao['icao'])) $airports_icao[] = $icao['icao']; |
1230 | 1230 | } |
1231 | - $airport_icao = implode(',',$airports_icao); |
|
1231 | + $airport_icao = implode(',', $airports_icao); |
|
1232 | 1232 | $alldata = $this->downloadNOTAM($airport_icao); |
1233 | 1233 | if ($globalTransaction) $this->db->beginTransaction(); |
1234 | 1234 | if (count($alldata) > 0) { |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | if (count($notamref) == 0) { |
1242 | 1242 | if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']); |
1243 | 1243 | if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']); |
1244 | - elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1244 | + elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'], '', '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
1245 | 1245 | } |
1246 | 1246 | } |
1247 | 1247 | } |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | date_default_timezone_set("UTC"); |
1256 | 1256 | $Common = new Common(); |
1257 | 1257 | //$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId={icao}&actionType=notamRetrievalByICAOs'); |
1258 | - $url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs'); |
|
1258 | + $url = str_replace('{icao}', $icao, 'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs'); |
|
1259 | 1259 | $data = $Common->getData($url); |
1260 | 1260 | preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches); |
1261 | 1261 | //print_r($matches); |
@@ -1272,9 +1272,9 @@ discard block |
||
1272 | 1272 | $result['permanent'] = ''; |
1273 | 1273 | $result['date_begin'] = NULL; |
1274 | 1274 | $result['date_end'] = NULL; |
1275 | - $data = str_ireplace(array("\r","\n",'\r','\n'),' ',$data); |
|
1275 | + $data = str_ireplace(array("\r", "\n", '\r', '\n'), ' ', $data); |
|
1276 | 1276 | //echo $data."\n"; |
1277 | - $data = preg_split('#\s(?=([A-Z]\)\s))#',$data); |
|
1277 | + $data = preg_split('#\s(?=([A-Z]\)\s))#', $data); |
|
1278 | 1278 | //print_r($data); |
1279 | 1279 | $q = false; |
1280 | 1280 | $a = false; |
@@ -1283,9 +1283,9 @@ discard block |
||
1283 | 1283 | $e = false; |
1284 | 1284 | foreach ($data as $line) { |
1285 | 1285 | $line = trim($line); |
1286 | - if (preg_match('#(^|\s)Q\) (.*)#',$line,$matches) && $q === false) { |
|
1287 | - $line = str_replace(' ','',$line); |
|
1288 | - if (preg_match('#Q\)([A-Z]{3,4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3}|)#',$line,$matches)) { |
|
1286 | + if (preg_match('#(^|\s)Q\) (.*)#', $line, $matches) && $q === false) { |
|
1287 | + $line = str_replace(' ', '', $line); |
|
1288 | + if (preg_match('#Q\)([A-Z]{3,4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3}|)#', $line, $matches)) { |
|
1289 | 1289 | //if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) { |
1290 | 1290 | //print_r($matches); |
1291 | 1291 | $result['fir'] = $matches[1]; |
@@ -1331,9 +1331,9 @@ discard block |
||
1331 | 1331 | elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning'; |
1332 | 1332 | $result['lower_limit'] = $matches[6]; |
1333 | 1333 | $result['upper_limit'] = $matches[7]; |
1334 | - $latitude = $Common->convertDec($matches[8],'latitude'); |
|
1334 | + $latitude = $Common->convertDec($matches[8], 'latitude'); |
|
1335 | 1335 | if ($matches[9] == 'S') $latitude = -$latitude; |
1336 | - $longitude = $Common->convertDec($matches[10],'longitude'); |
|
1336 | + $longitude = $Common->convertDec($matches[10], 'longitude'); |
|
1337 | 1337 | if ($matches[11] == 'W') $longitude = -$longitude; |
1338 | 1338 | $result['latitude'] = $latitude; |
1339 | 1339 | $result['longitude'] = $longitude; |
@@ -1345,24 +1345,24 @@ discard block |
||
1345 | 1345 | echo "Can't parse : ".$line."\n"; |
1346 | 1346 | } |
1347 | 1347 | } |
1348 | - elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) { |
|
1348 | + elseif (preg_match('#(^|\s)A\) (.*)#', $line, $matches) && $a === false) { |
|
1349 | 1349 | $result['icao'] = $matches[2]; |
1350 | 1350 | $a = true; |
1351 | 1351 | } |
1352 | - elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) { |
|
1352 | + elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#', $line, $matches) && $b === false) { |
|
1353 | 1353 | if ($matches[1] > 50) $year = '19'.$matches[2]; |
1354 | 1354 | else $year = '20'.$matches[2]; |
1355 | 1355 | $result['date_begin'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
1356 | 1356 | $b = true; |
1357 | 1357 | } |
1358 | - elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) { |
|
1358 | + elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#', $line, $matches) && $c === false) { |
|
1359 | 1359 | if ($matches[2] > 50) $year = '19'.$matches[2]; |
1360 | 1360 | else $year = '20'.$matches[2]; |
1361 | 1361 | $result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
1362 | 1362 | $result['permanent'] = 0; |
1363 | 1363 | $c = true; |
1364 | 1364 | } |
1365 | - elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
1365 | + elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#', $line, $matches) && $c === false) { |
|
1366 | 1366 | if ($matches[2] > 50) $year = '19'.$matches[2]; |
1367 | 1367 | else $year = '20'.$matches[2]; |
1368 | 1368 | $result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
@@ -1372,7 +1372,7 @@ discard block |
||
1372 | 1372 | else $result['permanent'] = 0; |
1373 | 1373 | $c = true; |
1374 | 1374 | } |
1375 | - elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
1375 | + elseif (preg_match('#(^|\s)C\) (EST|PERM)$#', $line, $matches) && $c === false) { |
|
1376 | 1376 | $result['date_end'] = '2030/12/20 12:00'; |
1377 | 1377 | if ($matches[2] == 'EST') $result['estimated'] = 1; |
1378 | 1378 | else $result['estimated'] = 0; |
@@ -1380,20 +1380,20 @@ discard block |
||
1380 | 1380 | else $result['permanent'] = 0; |
1381 | 1381 | $c = true; |
1382 | 1382 | } |
1383 | - elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) { |
|
1383 | + elseif (preg_match('#(^|\s)E\) (.*)#', $line, $matches) && $e === false) { |
|
1384 | 1384 | $rtext = array(); |
1385 | - $text = explode(' ',$matches[2]); |
|
1385 | + $text = explode(' ', $matches[2]); |
|
1386 | 1386 | foreach ($text as $word) { |
1387 | 1387 | if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]); |
1388 | - elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3); |
|
1388 | + elseif (ctype_digit(strval(substr($word, 3))) && isset($this->abbr[substr($word, 0, 3)])) $rtext[] = strtoupper($this->abbr[substr($word, 0, 3)]).' '.substr($word, 3); |
|
1389 | 1389 | else $rtext[] = $word; |
1390 | 1390 | } |
1391 | - $result['text'] = implode(' ',$rtext); |
|
1391 | + $result['text'] = implode(' ', $rtext); |
|
1392 | 1392 | $e = true; |
1393 | 1393 | //} elseif (preg_match('#F\) (.*)#',$line,$matches)) { |
1394 | 1394 | //} elseif (preg_match('#G\) (.*)#',$line,$matches)) { |
1395 | - } elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) { |
|
1396 | - $text = explode(' ',$line); |
|
1395 | + } elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#', $line, $matches)) { |
|
1396 | + $text = explode(' ', $line); |
|
1397 | 1397 | $result['ref'] = $text[0]; |
1398 | 1398 | if ($matches[1] == 'NOTAMN') $result['type'] = 'new'; |
1399 | 1399 | if ($matches[1] == 'NOTAMC') { |
@@ -14,33 +14,33 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($filter['source']) && !empty($filter['source'])) { |
43 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
43 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
44 | 44 | } |
45 | 45 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
46 | 46 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -68,38 +68,38 @@ discard block |
||
68 | 68 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'"; |
69 | 69 | } |
70 | 70 | } |
71 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
71 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
72 | 72 | } |
73 | 73 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
74 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
74 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
75 | 75 | } |
76 | 76 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
77 | 77 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
78 | 78 | if ($filter_query_where != '') { |
79 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
79 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
80 | 80 | } |
81 | 81 | $filter_query = $filter_query_join.$filter_query_where; |
82 | 82 | return $filter_query; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // tracker_archive |
86 | - public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') { |
|
86 | + public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') { |
|
87 | 87 | require_once(dirname(__FILE__).'/class.Tracker.php'); |
88 | 88 | if ($over_country == '') { |
89 | 89 | $Tracker = new Tracker($this->db); |
90 | - $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
90 | + $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
91 | 91 | if (!empty($data_country)) $country = $data_country['iso2']; |
92 | 92 | else $country = ''; |
93 | 93 | } else $country = $over_country; |
94 | 94 | // Route is not added in tracker_archive |
95 | - $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
95 | + $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
96 | 96 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
97 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type); |
|
97 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type); |
|
98 | 98 | try { |
99 | 99 | $sth = $this->db->prepare($query); |
100 | 100 | $sth->execute($query_values); |
101 | 101 | $sth->closeCursor(); |
102 | - } catch(PDOException $e) { |
|
102 | + } catch (PDOException $e) { |
|
103 | 103 | return "error : ".$e->getMessage(); |
104 | 104 | } |
105 | 105 | return "success"; |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | |
120 | 120 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
121 | 121 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
122 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
122 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
123 | 123 | |
124 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
124 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident)); |
|
125 | 125 | |
126 | 126 | return $spotter_array; |
127 | 127 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
141 | 141 | //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
142 | 142 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
143 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
143 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
144 | 144 | |
145 | 145 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
146 | 146 | /* |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
155 | 155 | */ |
156 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
156 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id)); |
|
157 | 157 | |
158 | 158 | return $spotter_array; |
159 | 159 | } |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | { |
169 | 169 | date_default_timezone_set('UTC'); |
170 | 170 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
171 | - $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
171 | + $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
172 | 172 | |
173 | 173 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
174 | 174 | |
175 | 175 | try { |
176 | 176 | $sth = $this->db->prepare($query); |
177 | 177 | $sth->execute(array(':id' => $id)); |
178 | - } catch(PDOException $e) { |
|
178 | + } catch (PDOException $e) { |
|
179 | 179 | echo $e->getMessage(); |
180 | 180 | die; |
181 | 181 | } |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | { |
195 | 195 | date_default_timezone_set('UTC'); |
196 | 196 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
197 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
197 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
198 | 198 | |
199 | 199 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
200 | 200 | |
201 | 201 | try { |
202 | 202 | $sth = $this->db->prepare($query); |
203 | 203 | $sth->execute(array(':id' => $id)); |
204 | - } catch(PDOException $e) { |
|
204 | + } catch (PDOException $e) { |
|
205 | 205 | echo $e->getMessage(); |
206 | 206 | die; |
207 | 207 | } |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | date_default_timezone_set('UTC'); |
224 | 224 | |
225 | 225 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
226 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
226 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
227 | 227 | |
228 | 228 | try { |
229 | 229 | $sth = $this->db->prepare($query); |
230 | 230 | $sth->execute(array(':ident' => $ident)); |
231 | - } catch(PDOException $e) { |
|
231 | + } catch (PDOException $e) { |
|
232 | 232 | echo $e->getMessage(); |
233 | 233 | die; |
234 | 234 | } |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | date_default_timezone_set('UTC'); |
250 | 250 | |
251 | 251 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
252 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
252 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
253 | 253 | |
254 | 254 | try { |
255 | 255 | $sth = $this->db->prepare($query); |
256 | 256 | $sth->execute(array(':id' => $id)); |
257 | - } catch(PDOException $e) { |
|
257 | + } catch (PDOException $e) { |
|
258 | 258 | echo $e->getMessage(); |
259 | 259 | die; |
260 | 260 | } |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | date_default_timezone_set('UTC'); |
276 | 276 | |
277 | 277 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
278 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
278 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
279 | 279 | |
280 | 280 | try { |
281 | 281 | $sth = $this->db->prepare($query); |
282 | 282 | $sth->execute(array(':id' => $id)); |
283 | - } catch(PDOException $e) { |
|
283 | + } catch (PDOException $e) { |
|
284 | 284 | echo $e->getMessage(); |
285 | 285 | die; |
286 | 286 | } |
@@ -302,13 +302,13 @@ discard block |
||
302 | 302 | date_default_timezone_set('UTC'); |
303 | 303 | |
304 | 304 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
305 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
305 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
306 | 306 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
307 | 307 | |
308 | 308 | try { |
309 | 309 | $sth = $this->db->prepare($query); |
310 | 310 | $sth->execute(array(':ident' => $ident)); |
311 | - } catch(PDOException $e) { |
|
311 | + } catch (PDOException $e) { |
|
312 | 312 | echo $e->getMessage(); |
313 | 313 | die; |
314 | 314 | } |
@@ -325,13 +325,13 @@ discard block |
||
325 | 325 | * @return Array the spotter information |
326 | 326 | * |
327 | 327 | */ |
328 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
328 | + public function getTrackerArchiveData($ident, $famtrackid, $date) |
|
329 | 329 | { |
330 | 330 | $Tracker = new Tracker($this->db); |
331 | 331 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
332 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
332 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
333 | 333 | |
334 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
334 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':famtrackid' => $famtrackid, ':date' => $date.'%')); |
|
335 | 335 | |
336 | 336 | return $spotter_array; |
337 | 337 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | try { |
345 | 345 | $sth = $this->db->prepare($query); |
346 | 346 | $sth->execute(); |
347 | - } catch(PDOException $e) { |
|
347 | + } catch (PDOException $e) { |
|
348 | 348 | echo $e->getMessage(); |
349 | 349 | die; |
350 | 350 | } |
@@ -356,24 +356,24 @@ discard block |
||
356 | 356 | * @return Array the spotter information |
357 | 357 | * |
358 | 358 | */ |
359 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
359 | + public function getMinLiveTrackerData($begindate, $enddate, $filter = array()) |
|
360 | 360 | { |
361 | 361 | global $globalDBdriver, $globalLiveInterval; |
362 | 362 | date_default_timezone_set('UTC'); |
363 | 363 | |
364 | 364 | $filter_query = ''; |
365 | 365 | if (isset($filter['source']) && !empty($filter['source'])) { |
366 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
366 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
367 | 367 | } |
368 | 368 | // Use spotter_output also ? |
369 | 369 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
370 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
370 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
371 | 371 | } |
372 | 372 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
373 | 373 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
374 | 374 | } |
375 | 375 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
376 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
376 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid |
393 | 393 | AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
394 | 394 | */ |
395 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
395 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
396 | 396 | FROM tracker_archive |
397 | 397 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
398 | 398 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
399 | 399 | '.$filter_query.' ORDER BY famtrackid'; |
400 | 400 | } else { |
401 | 401 | //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
402 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
402 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
403 | 403 | FROM tracker_archive |
404 | 404 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
405 | 405 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | try { |
410 | 410 | $sth = $this->db->prepare($query); |
411 | 411 | $sth->execute(); |
412 | - } catch(PDOException $e) { |
|
412 | + } catch (PDOException $e) { |
|
413 | 413 | echo $e->getMessage(); |
414 | 414 | die; |
415 | 415 | } |
@@ -424,24 +424,24 @@ discard block |
||
424 | 424 | * @return Array the spotter information |
425 | 425 | * |
426 | 426 | */ |
427 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
427 | + public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array()) |
|
428 | 428 | { |
429 | 429 | global $globalDBdriver, $globalLiveInterval; |
430 | 430 | date_default_timezone_set('UTC'); |
431 | 431 | |
432 | 432 | $filter_query = ''; |
433 | 433 | if (isset($filter['source']) && !empty($filter['source'])) { |
434 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
434 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
435 | 435 | } |
436 | 436 | // Should use spotter_output also ? |
437 | 437 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
438 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
438 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
439 | 439 | } |
440 | 440 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
441 | 441 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
442 | 442 | } |
443 | 443 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
444 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
444 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | FROM tracker_archive |
452 | 452 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
453 | 453 | */ |
454 | - $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
454 | + $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
455 | 455 | FROM tracker_archive_output |
456 | 456 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao |
457 | 457 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
467 | 467 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
468 | 468 | */ |
469 | - $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
469 | + $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
470 | 470 | FROM tracker_archive_output |
471 | 471 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
472 | 472 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | try { |
479 | 479 | $sth = $this->db->prepare($query); |
480 | 480 | $sth->execute(); |
481 | - } catch(PDOException $e) { |
|
481 | + } catch (PDOException $e) { |
|
482 | 482 | echo $e->getMessage(); |
483 | 483 | die; |
484 | 484 | } |
@@ -493,23 +493,23 @@ discard block |
||
493 | 493 | * @return Array the spotter information |
494 | 494 | * |
495 | 495 | */ |
496 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
496 | + public function getLiveTrackerCount($begindate, $enddate, $filter = array()) |
|
497 | 497 | { |
498 | 498 | global $globalDBdriver, $globalLiveInterval; |
499 | 499 | date_default_timezone_set('UTC'); |
500 | 500 | |
501 | 501 | $filter_query = ''; |
502 | 502 | if (isset($filter['source']) && !empty($filter['source'])) { |
503 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
503 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
504 | 504 | } |
505 | 505 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
506 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
506 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
507 | 507 | } |
508 | 508 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
509 | 509 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
510 | 510 | } |
511 | 511 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
512 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
512 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | try { |
525 | 525 | $sth = $this->db->prepare($query); |
526 | 526 | $sth->execute(); |
527 | - } catch(PDOException $e) { |
|
527 | + } catch (PDOException $e) { |
|
528 | 528 | echo $e->getMessage(); |
529 | 529 | die; |
530 | 530 | } |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * @return Array the spotter information |
545 | 545 | * |
546 | 546 | */ |
547 | - public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
547 | + public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
548 | 548 | { |
549 | 549 | global $globalTimezone, $globalDBdriver; |
550 | 550 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | $q_array = explode(" ", $q); |
568 | 568 | |
569 | - foreach ($q_array as $q_item){ |
|
569 | + foreach ($q_array as $q_item) { |
|
570 | 570 | $additional_query .= " AND ("; |
571 | 571 | $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
572 | 572 | $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | |
599 | 599 | if ($registration != "") |
600 | 600 | { |
601 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
601 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
602 | 602 | if (!is_string($registration)) |
603 | 603 | { |
604 | 604 | return false; |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | |
610 | 610 | if ($aircraft_icao != "") |
611 | 611 | { |
612 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
612 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
613 | 613 | if (!is_string($aircraft_icao)) |
614 | 614 | { |
615 | 615 | return false; |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | |
621 | 621 | if ($aircraft_manufacturer != "") |
622 | 622 | { |
623 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
623 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
624 | 624 | if (!is_string($aircraft_manufacturer)) |
625 | 625 | { |
626 | 626 | return false; |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | |
642 | 642 | if ($airline_icao != "") |
643 | 643 | { |
644 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
644 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
645 | 645 | if (!is_string($airline_icao)) |
646 | 646 | { |
647 | 647 | return false; |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | |
653 | 653 | if ($airline_country != "") |
654 | 654 | { |
655 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
655 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
656 | 656 | if (!is_string($airline_country)) |
657 | 657 | { |
658 | 658 | return false; |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | if ($airline_type != "") |
665 | 665 | { |
666 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
666 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
667 | 667 | if (!is_string($airline_type)) |
668 | 668 | { |
669 | 669 | return false; |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | |
686 | 686 | if ($airport != "") |
687 | 687 | { |
688 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
688 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
689 | 689 | if (!is_string($airport)) |
690 | 690 | { |
691 | 691 | return false; |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | if ($airport_country != "") |
698 | 698 | { |
699 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
699 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
700 | 700 | if (!is_string($airport_country)) |
701 | 701 | { |
702 | 702 | return false; |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | |
708 | 708 | if ($callsign != "") |
709 | 709 | { |
710 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
710 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
711 | 711 | if (!is_string($callsign)) |
712 | 712 | { |
713 | 713 | return false; |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | $translate = $Translation->ident2icao($callsign); |
716 | 716 | if ($translate != $callsign) { |
717 | 717 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
718 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
718 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
719 | 719 | } else { |
720 | 720 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
721 | 721 | } |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | |
725 | 725 | if ($owner != "") |
726 | 726 | { |
727 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
727 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
728 | 728 | if (!is_string($owner)) |
729 | 729 | { |
730 | 730 | return false; |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | |
736 | 736 | if ($pilot_name != "") |
737 | 737 | { |
738 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
738 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
739 | 739 | if (!is_string($pilot_name)) |
740 | 740 | { |
741 | 741 | return false; |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | |
747 | 747 | if ($pilot_id != "") |
748 | 748 | { |
749 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
749 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
750 | 750 | if (!is_string($pilot_id)) |
751 | 751 | { |
752 | 752 | return false; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | |
758 | 758 | if ($departure_airport_route != "") |
759 | 759 | { |
760 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
760 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
761 | 761 | if (!is_string($departure_airport_route)) |
762 | 762 | { |
763 | 763 | return false; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | |
769 | 769 | if ($arrival_airport_route != "") |
770 | 770 | { |
771 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
771 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
772 | 772 | if (!is_string($arrival_airport_route)) |
773 | 773 | { |
774 | 774 | return false; |
@@ -781,8 +781,8 @@ discard block |
||
781 | 781 | { |
782 | 782 | $altitude_array = explode(",", $altitude); |
783 | 783 | |
784 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
785 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
784 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
785 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
786 | 786 | |
787 | 787 | |
788 | 788 | if ($altitude_array[1] != "") |
@@ -800,8 +800,8 @@ discard block |
||
800 | 800 | { |
801 | 801 | $date_array = explode(",", $date_posted); |
802 | 802 | |
803 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
804 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
803 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
804 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
805 | 805 | |
806 | 806 | if ($globalTimezone != '') { |
807 | 807 | date_default_timezone_set($globalTimezone); |
@@ -833,8 +833,8 @@ discard block |
||
833 | 833 | { |
834 | 834 | $limit_array = explode(",", $limit); |
835 | 835 | |
836 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
837 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
836 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
837 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
838 | 838 | |
839 | 839 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
840 | 840 | { |
@@ -845,8 +845,8 @@ discard block |
||
845 | 845 | |
846 | 846 | |
847 | 847 | if ($origLat != "" && $origLon != "" && $dist != "") { |
848 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
849 | - $query="SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
848 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
849 | + $query = "SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
850 | 850 | FROM tracker_archive_output, tracker_archive WHERE spotter_output_archive.famtrackid = tracker_archive.famtrackid AND spotter_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
851 | 851 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
852 | 852 | } else { |
@@ -863,12 +863,12 @@ discard block |
||
863 | 863 | $additional_query .= " AND (tracker_archive_output.waypoints <> '')"; |
864 | 864 | } |
865 | 865 | |
866 | - $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
866 | + $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
867 | 867 | WHERE tracker_archive_output.ident <> '' |
868 | 868 | ".$additional_query." |
869 | 869 | ".$filter_query.$orderby_query; |
870 | 870 | } |
871 | - $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
|
871 | + $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
|
872 | 872 | |
873 | 873 | return $spotter_array; |
874 | 874 | } |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | try { |
886 | 886 | $sth = $this->db->prepare($query); |
887 | 887 | $sth->execute(); |
888 | - } catch(PDOException $e) { |
|
888 | + } catch (PDOException $e) { |
|
889 | 889 | return "error"; |
890 | 890 | } |
891 | 891 | } |
@@ -922,8 +922,8 @@ discard block |
||
922 | 922 | { |
923 | 923 | $limit_array = explode(",", $limit); |
924 | 924 | |
925 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
926 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
925 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
926 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
927 | 927 | |
928 | 928 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
929 | 929 | { |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | $query_values = array(); |
965 | 965 | $limit_query = ''; |
966 | 966 | $additional_query = ''; |
967 | - $filter_query = $this->getFilter($filter,true,true); |
|
967 | + $filter_query = $this->getFilter($filter, true, true); |
|
968 | 968 | |
969 | 969 | if ($owner != "") |
970 | 970 | { |
@@ -981,8 +981,8 @@ discard block |
||
981 | 981 | { |
982 | 982 | $limit_array = explode(",", $limit); |
983 | 983 | |
984 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
985 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
984 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
985 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
986 | 986 | |
987 | 987 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
988 | 988 | { |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | $query_values = array(); |
1023 | 1023 | $limit_query = ''; |
1024 | 1024 | $additional_query = ''; |
1025 | - $filter_query = $this->getFilter($filter,true,true); |
|
1025 | + $filter_query = $this->getFilter($filter, true, true); |
|
1026 | 1026 | |
1027 | 1027 | if ($pilot != "") |
1028 | 1028 | { |
@@ -1034,8 +1034,8 @@ discard block |
||
1034 | 1034 | { |
1035 | 1035 | $limit_array = explode(",", $limit); |
1036 | 1036 | |
1037 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1038 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1037 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1038 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1039 | 1039 | |
1040 | 1040 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1041 | 1041 | { |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | * @return Array the airline country list |
1066 | 1066 | * |
1067 | 1067 | */ |
1068 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1068 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1069 | 1069 | { |
1070 | 1070 | global $globalDBdriver; |
1071 | 1071 | /* |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | $flight_array = array(); |
1095 | 1095 | $temp_array = array(); |
1096 | 1096 | |
1097 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1097 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1098 | 1098 | { |
1099 | 1099 | $temp_array['flight_count'] = $row['nb']; |
1100 | 1100 | $temp_array['flight_country'] = $row['name']; |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | * @return Array the airline country list |
1112 | 1112 | * |
1113 | 1113 | */ |
1114 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1114 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1115 | 1115 | { |
1116 | 1116 | global $globalDBdriver; |
1117 | 1117 | /* |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | $flight_array = array(); |
1141 | 1141 | $temp_array = array(); |
1142 | 1142 | |
1143 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1143 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1144 | 1144 | { |
1145 | 1145 | $temp_array['airline_icao'] = $row['airline_icao']; |
1146 | 1146 | $temp_array['flight_count'] = $row['nb']; |
@@ -1158,14 +1158,14 @@ discard block |
||
1158 | 1158 | * @return Array the spotter information |
1159 | 1159 | * |
1160 | 1160 | */ |
1161 | - public function getDateArchiveTrackerDataById($id,$date) |
|
1161 | + public function getDateArchiveTrackerDataById($id, $date) |
|
1162 | 1162 | { |
1163 | 1163 | $Tracker = new Tracker($this->db); |
1164 | 1164 | date_default_timezone_set('UTC'); |
1165 | 1165 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1166 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1167 | - $date = date('c',$date); |
|
1168 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1166 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1167 | + $date = date('c', $date); |
|
1168 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1169 | 1169 | return $spotter_array; |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1175,14 +1175,14 @@ discard block |
||
1175 | 1175 | * @return Array the spotter information |
1176 | 1176 | * |
1177 | 1177 | */ |
1178 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
1178 | + public function getDateArchiveTrackerDataByIdent($ident, $date) |
|
1179 | 1179 | { |
1180 | 1180 | $Tracker = new Tracker($this->db); |
1181 | 1181 | date_default_timezone_set('UTC'); |
1182 | 1182 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1183 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1184 | - $date = date('c',$date); |
|
1185 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1183 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1184 | + $date = date('c', $date); |
|
1185 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1186 | 1186 | return $spotter_array; |
1187 | 1187 | } |
1188 | 1188 | |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | * @return Array the spotter information |
1193 | 1193 | * |
1194 | 1194 | */ |
1195 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1195 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1196 | 1196 | { |
1197 | 1197 | global $global_query; |
1198 | 1198 | $Tracker = new Tracker($this->db); |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | $query_values = array(); |
1201 | 1201 | $limit_query = ''; |
1202 | 1202 | $additional_query = ''; |
1203 | - $filter_query = $this->getFilter($filters,true,true); |
|
1203 | + $filter_query = $this->getFilter($filters, true, true); |
|
1204 | 1204 | |
1205 | 1205 | if ($airport != "") |
1206 | 1206 | { |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | { |
1218 | 1218 | $limit_array = explode(",", $limit); |
1219 | 1219 | |
1220 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1221 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1220 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1221 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1222 | 1222 | |
1223 | 1223 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1224 | 1224 | { |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
5 | 5 | $global_query = "SELECT tracker_output.* FROM tracker_output"; |
6 | 6 | |
7 | -class Tracker{ |
|
7 | +class Tracker { |
|
8 | 8 | public $db; |
9 | 9 | |
10 | 10 | public function __construct($dbc = null) { |
@@ -19,33 +19,33 @@ discard block |
||
19 | 19 | * @return Array the SQL part |
20 | 20 | */ |
21 | 21 | |
22 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
22 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
23 | 23 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
24 | 24 | $filters = array(); |
25 | 25 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
26 | 26 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
27 | 27 | $filters = $globalStatsFilters[$globalFilterName]; |
28 | 28 | } else { |
29 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
29 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | if (isset($filter[0]['source'])) { |
33 | - $filters = array_merge($filters,$filter); |
|
33 | + $filters = array_merge($filters, $filter); |
|
34 | 34 | } |
35 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
35 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
36 | 36 | $filter_query_join = ''; |
37 | 37 | $filter_query_where = ''; |
38 | - foreach($filters as $flt) { |
|
38 | + foreach ($filters as $flt) { |
|
39 | 39 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
40 | 40 | if (isset($flt['source'])) { |
41 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
42 | 42 | } else { |
43 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
43 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
47 | 47 | if (isset($filter['source']) && !empty($filter['source'])) { |
48 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
48 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
49 | 49 | } |
50 | 50 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
51 | 51 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
75 | 75 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
76 | 76 | if ($filter_query_where != '') { |
77 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
77 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
78 | 78 | } |
79 | 79 | $filter_query = $filter_query_join.$filter_query_where; |
80 | 80 | return $filter_query; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return Array the spotter information |
90 | 90 | * |
91 | 91 | */ |
92 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
92 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
93 | 93 | { |
94 | 94 | date_default_timezone_set('UTC'); |
95 | 95 | if (!is_string($query)) |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | $sth = $this->db->prepare($query.$limitQuery); |
110 | 110 | $sth->execute($params); |
111 | 111 | } catch (PDOException $e) { |
112 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
112 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
113 | 113 | exit(); |
114 | 114 | } |
115 | 115 | |
116 | 116 | $num_rows = 0; |
117 | 117 | $spotter_array = array(); |
118 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
118 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
119 | 119 | { |
120 | 120 | $num_rows++; |
121 | 121 | $temp_array = array(); |
@@ -171,17 +171,17 @@ discard block |
||
171 | 171 | { |
172 | 172 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
173 | 173 | } else { |
174 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
174 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
175 | 175 | } |
176 | 176 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
177 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
178 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
177 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
178 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
179 | 179 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
180 | 180 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
181 | 181 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
182 | 182 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
183 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
184 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
183 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
184 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
185 | 185 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
186 | 186 | } |
187 | 187 | } |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | { |
219 | 219 | $limit_array = explode(",", $limit); |
220 | 220 | |
221 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
222 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
221 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
222 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
223 | 223 | |
224 | 224 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
225 | 225 | { |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | $orderby_query = " ORDER BY tracker_output.date DESC"; |
237 | 237 | } |
238 | 238 | |
239 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
239 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
240 | 240 | |
241 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
241 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
242 | 242 | |
243 | 243 | return $spotter_array; |
244 | 244 | } |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | if ($id == '') return array(); |
258 | 258 | $additional_query = "tracker_output.famtrackid = :id"; |
259 | 259 | $query_values = array(':id' => $id); |
260 | - $query = $global_query." WHERE ".$additional_query." "; |
|
261 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
260 | + $query = $global_query." WHERE ".$additional_query." "; |
|
261 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
262 | 262 | return $spotter_array; |
263 | 263 | } |
264 | 264 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $query_values = array(); |
278 | 278 | $limit_query = ''; |
279 | 279 | $additional_query = ''; |
280 | - $filter_query = $this->getFilter($filter,true,true); |
|
280 | + $filter_query = $this->getFilter($filter, true, true); |
|
281 | 281 | if ($ident != "") |
282 | 282 | { |
283 | 283 | if (!is_string($ident)) |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | { |
294 | 294 | $limit_array = explode(",", $limit); |
295 | 295 | |
296 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
297 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
296 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
297 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
298 | 298 | |
299 | 299 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
300 | 300 | { |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | return $spotter_array; |
319 | 319 | } |
320 | 320 | |
321 | - public function getTrackerDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
321 | + public function getTrackerDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
322 | 322 | { |
323 | 323 | global $global_query, $globalTimezone, $globalDBdriver; |
324 | 324 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $limit_query = ''; |
327 | 327 | $additional_query = ''; |
328 | 328 | |
329 | - $filter_query = $this->getFilter($filter,true,true); |
|
329 | + $filter_query = $this->getFilter($filter, true, true); |
|
330 | 330 | |
331 | 331 | if ($date != "") |
332 | 332 | { |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | { |
353 | 353 | $limit_array = explode(",", $limit); |
354 | 354 | |
355 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
356 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
355 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
356 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
357 | 357 | |
358 | 358 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
359 | 359 | { |
@@ -384,11 +384,11 @@ discard block |
||
384 | 384 | * @return Array list of source name |
385 | 385 | * |
386 | 386 | */ |
387 | - public function getAllSourceName($type = '',$filters = array()) |
|
387 | + public function getAllSourceName($type = '', $filters = array()) |
|
388 | 388 | { |
389 | - $filter_query = $this->getFilter($filters,true,true); |
|
389 | + $filter_query = $this->getFilter($filters, true, true); |
|
390 | 390 | $query_values = array(); |
391 | - $query = "SELECT DISTINCT tracker_output.source_name |
|
391 | + $query = "SELECT DISTINCT tracker_output.source_name |
|
392 | 392 | FROM tracker_output".$filter_query." tracker_output.source_name <> ''"; |
393 | 393 | if ($type != '') { |
394 | 394 | $query_values = array(':type' => $type); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $source_array = array(); |
404 | 404 | $temp_array = array(); |
405 | 405 | |
406 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
406 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
407 | 407 | { |
408 | 408 | $temp_array['source_name'] = $row['source_name']; |
409 | 409 | $source_array[] = $temp_array; |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function getAllIdents($filters = array()) |
422 | 422 | { |
423 | - $filter_query = $this->getFilter($filters,true,true); |
|
424 | - $query = "SELECT DISTINCT tracker_output.ident |
|
423 | + $filter_query = $this->getFilter($filters, true, true); |
|
424 | + $query = "SELECT DISTINCT tracker_output.ident |
|
425 | 425 | FROM tracker_output".$filter_query." tracker_output.ident <> '' |
426 | 426 | ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0"; |
427 | 427 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $ident_array = array(); |
432 | 432 | $temp_array = array(); |
433 | 433 | |
434 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
434 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
435 | 435 | { |
436 | 436 | $temp_array['ident'] = $row['ident']; |
437 | 437 | $ident_array[] = $temp_array; |
@@ -456,12 +456,12 @@ discard block |
||
456 | 456 | } else $offset = '+00:00'; |
457 | 457 | |
458 | 458 | if ($globalDBdriver == 'mysql') { |
459 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
459 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
460 | 460 | FROM tracker_output |
461 | 461 | WHERE tracker_output.date <> '' |
462 | 462 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
463 | 463 | } else { |
464 | - $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
464 | + $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
465 | 465 | FROM tracker_output |
466 | 466 | WHERE tracker_output.date <> '' |
467 | 467 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $date_array = array(); |
474 | 474 | $temp_array = array(); |
475 | 475 | |
476 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
476 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
477 | 477 | { |
478 | 478 | $temp_array['date'] = $row['date']; |
479 | 479 | |
@@ -492,11 +492,11 @@ discard block |
||
492 | 492 | * @return String success or false |
493 | 493 | * |
494 | 494 | */ |
495 | - public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
|
495 | + public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL) |
|
496 | 496 | { |
497 | 497 | |
498 | 498 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
499 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
499 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident); |
|
500 | 500 | |
501 | 501 | try { |
502 | 502 | $sth = $this->db->prepare($query); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
521 | 521 | { |
522 | 522 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
523 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
523 | + $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
524 | 524 | |
525 | 525 | try { |
526 | 526 | $sth = $this->db->prepare($query); |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * @param String $verticalrate vertival rate of flight |
561 | 561 | * @return String success or false |
562 | 562 | */ |
563 | - public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
|
563 | + public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '') |
|
564 | 564 | { |
565 | 565 | global $globalURL; |
566 | 566 | |
@@ -628,21 +628,21 @@ discard block |
||
628 | 628 | } |
629 | 629 | |
630 | 630 | |
631 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
631 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
632 | 632 | { |
633 | 633 | $date = date("Y-m-d H:i:s", time()); |
634 | 634 | } |
635 | 635 | |
636 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
637 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
638 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
639 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
640 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
641 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
642 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
643 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
644 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
645 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
636 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
637 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
638 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
639 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
640 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
641 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
642 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
643 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
644 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
645 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
646 | 646 | |
647 | 647 | if ($latitude == '' && $longitude == '') { |
648 | 648 | $latitude = 0; |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | } |
651 | 651 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
652 | 652 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
653 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
653 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
654 | 654 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
655 | 655 | |
656 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
656 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type); |
|
657 | 657 | |
658 | 658 | try { |
659 | 659 | |
@@ -679,13 +679,13 @@ discard block |
||
679 | 679 | { |
680 | 680 | global $globalDBdriver, $globalTimezone; |
681 | 681 | if ($globalDBdriver == 'mysql') { |
682 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
682 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
683 | 683 | WHERE tracker_output.ident = :ident |
684 | 684 | AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
685 | 685 | AND tracker_output.date < UTC_TIMESTAMP()"; |
686 | 686 | $query_data = array(':ident' => $ident); |
687 | 687 | } else { |
688 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
688 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
689 | 689 | WHERE tracker_output.ident = :ident |
690 | 690 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
691 | 691 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | |
695 | 695 | $sth = $this->db->prepare($query); |
696 | 696 | $sth->execute($query_data); |
697 | - $ident_result=''; |
|
698 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
697 | + $ident_result = ''; |
|
698 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
699 | 699 | { |
700 | 700 | $ident_result = $row['ident']; |
701 | 701 | } |
@@ -721,8 +721,8 @@ discard block |
||
721 | 721 | return false; |
722 | 722 | } else { |
723 | 723 | $q_array = explode(" ", $q); |
724 | - foreach ($q_array as $q_item){ |
|
725 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
724 | + foreach ($q_array as $q_item) { |
|
725 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
726 | 726 | $additional_query .= " AND ("; |
727 | 727 | $additional_query .= "(tracker_output.ident like '%".$q_item."%')"; |
728 | 728 | $additional_query .= ")"; |
@@ -730,11 +730,11 @@ discard block |
||
730 | 730 | } |
731 | 731 | } |
732 | 732 | if ($globalDBdriver == 'mysql') { |
733 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
733 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
734 | 734 | WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
735 | 735 | AND tracker_output.date < UTC_TIMESTAMP()"; |
736 | 736 | } else { |
737 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
737 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
738 | 738 | WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
739 | 739 | AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
740 | 740 | } |
@@ -753,16 +753,16 @@ discard block |
||
753 | 753 | * |
754 | 754 | */ |
755 | 755 | |
756 | - public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
756 | + public function countAllTrackerOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
757 | 757 | { |
758 | 758 | global $globalDBdriver, $globalArchive; |
759 | 759 | //$filter_query = $this->getFilter($filters,true,true); |
760 | - $Connection= new Connection($this->db); |
|
760 | + $Connection = new Connection($this->db); |
|
761 | 761 | if (!$Connection->tableExists('countries')) return array(); |
762 | 762 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
763 | 763 | require_once('class.TrackerLive.php'); |
764 | 764 | $TrackerLive = new TrackerLive($this->db); |
765 | - $filter_query = $TrackerLive->getFilter($filters,true,true); |
|
765 | + $filter_query = $TrackerLive->getFilter($filters, true, true); |
|
766 | 766 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
767 | 767 | if ($olderthanmonths > 0) { |
768 | 768 | if ($globalDBdriver == 'mysql') { |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | } else { |
783 | 783 | require_once('class.TrackerArchive.php'); |
784 | 784 | $TrackerArchive = new TrackerArchive($this->db); |
785 | - $filter_query = $TrackerArchive->getFilter($filters,true,true); |
|
785 | + $filter_query = $TrackerArchive->getFilter($filters, true, true); |
|
786 | 786 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
787 | 787 | if ($olderthanmonths > 0) { |
788 | 788 | if ($globalDBdriver == 'mysql') { |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | $flight_array = array(); |
811 | 811 | $temp_array = array(); |
812 | 812 | |
813 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
813 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
814 | 814 | { |
815 | 815 | $temp_array['flight_count'] = $row['nb']; |
816 | 816 | $temp_array['flight_country'] = $row['name']; |
@@ -827,11 +827,11 @@ discard block |
||
827 | 827 | * @return Array the callsign list |
828 | 828 | * |
829 | 829 | */ |
830 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
830 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
831 | 831 | { |
832 | 832 | global $globalDBdriver; |
833 | - $filter_query = $this->getFilter($filters,true,true); |
|
834 | - $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
833 | + $filter_query = $this->getFilter($filters, true, true); |
|
834 | + $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
835 | 835 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
836 | 836 | if ($olderthanmonths > 0) { |
837 | 837 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -845,28 +845,28 @@ discard block |
||
845 | 845 | if ($year != '') { |
846 | 846 | if ($globalDBdriver == 'mysql') { |
847 | 847 | $query .= " AND YEAR(tracker_output.date) = :year"; |
848 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
848 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
849 | 849 | } else { |
850 | 850 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
851 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
851 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
852 | 852 | } |
853 | 853 | } |
854 | 854 | if ($month != '') { |
855 | 855 | if ($globalDBdriver == 'mysql') { |
856 | 856 | $query .= " AND MONTH(tracker_output.date) = :month"; |
857 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
857 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
858 | 858 | } else { |
859 | 859 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
860 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
860 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
861 | 861 | } |
862 | 862 | } |
863 | 863 | if ($day != '') { |
864 | 864 | if ($globalDBdriver == 'mysql') { |
865 | 865 | $query .= " AND DAY(tracker_output.date) = :day"; |
866 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
866 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
867 | 867 | } else { |
868 | 868 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
869 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
869 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | $callsign_array = array(); |
879 | 879 | $temp_array = array(); |
880 | 880 | |
881 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
881 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
882 | 882 | { |
883 | 883 | $temp_array['callsign_icao'] = $row['ident']; |
884 | 884 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | $date_array = array(); |
931 | 931 | $temp_array = array(); |
932 | 932 | |
933 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
933 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
934 | 934 | { |
935 | 935 | $temp_array['date_name'] = $row['date_name']; |
936 | 936 | $temp_array['date_count'] = $row['date_count']; |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | $datetime = new DateTime(); |
957 | 957 | $offset = $datetime->format('P'); |
958 | 958 | } else $offset = '+00:00'; |
959 | - $filter_query = $this->getFilter($filters,true,true); |
|
959 | + $filter_query = $this->getFilter($filters, true, true); |
|
960 | 960 | if ($globalDBdriver == 'mysql') { |
961 | 961 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
962 | 962 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | $date_array = array(); |
978 | 978 | $temp_array = array(); |
979 | 979 | |
980 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
980 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
981 | 981 | { |
982 | 982 | $temp_array['date_name'] = $row['date_name']; |
983 | 983 | $temp_array['date_count'] = $row['date_count']; |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | $datetime = new DateTime(); |
1003 | 1003 | $offset = $datetime->format('P'); |
1004 | 1004 | } else $offset = '+00:00'; |
1005 | - $filter_query = $this->getFilter($filters,true,true); |
|
1005 | + $filter_query = $this->getFilter($filters, true, true); |
|
1006 | 1006 | if ($globalDBdriver == 'mysql') { |
1007 | 1007 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1008 | 1008 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | $date_array = array(); |
1024 | 1024 | $temp_array = array(); |
1025 | 1025 | |
1026 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1026 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1027 | 1027 | { |
1028 | 1028 | $temp_array['date_name'] = $row['date_name']; |
1029 | 1029 | $temp_array['date_count'] = $row['date_count']; |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | $date_array = array(); |
1071 | 1071 | $temp_array = array(); |
1072 | 1072 | |
1073 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1073 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1074 | 1074 | { |
1075 | 1075 | $temp_array['month_name'] = $row['month_name']; |
1076 | 1076 | $temp_array['year_name'] = $row['year_name']; |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | $datetime = new DateTime(); |
1100 | 1100 | $offset = $datetime->format('P'); |
1101 | 1101 | } else $offset = '+00:00'; |
1102 | - $filter_query = $this->getFilter($filters,true,true); |
|
1102 | + $filter_query = $this->getFilter($filters, true, true); |
|
1103 | 1103 | if ($globalDBdriver == 'mysql') { |
1104 | 1104 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
1105 | 1105 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | $date_array = array(); |
1121 | 1121 | $temp_array = array(); |
1122 | 1122 | |
1123 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1123 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1124 | 1124 | { |
1125 | 1125 | $temp_array['year_name'] = $row['year_name']; |
1126 | 1126 | $temp_array['month_name'] = $row['month_name']; |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | * @return Array the hour list |
1141 | 1141 | * |
1142 | 1142 | */ |
1143 | - public function countAllHours($orderby,$filters = array()) |
|
1143 | + public function countAllHours($orderby, $filters = array()) |
|
1144 | 1144 | { |
1145 | 1145 | global $globalTimezone, $globalDBdriver; |
1146 | 1146 | if ($globalTimezone != '') { |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | $hour_array = array(); |
1189 | 1189 | $temp_array = array(); |
1190 | 1190 | |
1191 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1191 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1192 | 1192 | { |
1193 | 1193 | $temp_array['hour_name'] = $row['hour_name']; |
1194 | 1194 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1210,8 +1210,8 @@ discard block |
||
1210 | 1210 | public function countAllHoursByDate($date, $filters = array()) |
1211 | 1211 | { |
1212 | 1212 | global $globalTimezone, $globalDBdriver; |
1213 | - $filter_query = $this->getFilter($filters,true,true); |
|
1214 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1213 | + $filter_query = $this->getFilter($filters, true, true); |
|
1214 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1215 | 1215 | if ($globalTimezone != '') { |
1216 | 1216 | date_default_timezone_set($globalTimezone); |
1217 | 1217 | $datetime = new DateTime($date); |
@@ -1219,12 +1219,12 @@ discard block |
||
1219 | 1219 | } else $offset = '+00:00'; |
1220 | 1220 | |
1221 | 1221 | if ($globalDBdriver == 'mysql') { |
1222 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1222 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1223 | 1223 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date |
1224 | 1224 | GROUP BY hour_name |
1225 | 1225 | ORDER BY hour_name ASC"; |
1226 | 1226 | } else { |
1227 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1227 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1228 | 1228 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1229 | 1229 | GROUP BY hour_name |
1230 | 1230 | ORDER BY hour_name ASC"; |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | $hour_array = array(); |
1237 | 1237 | $temp_array = array(); |
1238 | 1238 | |
1239 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1239 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1240 | 1240 | { |
1241 | 1241 | $temp_array['hour_name'] = $row['hour_name']; |
1242 | 1242 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1258,8 +1258,8 @@ discard block |
||
1258 | 1258 | public function countAllHoursByIdent($ident, $filters = array()) |
1259 | 1259 | { |
1260 | 1260 | global $globalTimezone, $globalDBdriver; |
1261 | - $filter_query = $this->getFilter($filters,true,true); |
|
1262 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1261 | + $filter_query = $this->getFilter($filters, true, true); |
|
1262 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1263 | 1263 | if ($globalTimezone != '') { |
1264 | 1264 | date_default_timezone_set($globalTimezone); |
1265 | 1265 | $datetime = new DateTime(); |
@@ -1267,12 +1267,12 @@ discard block |
||
1267 | 1267 | } else $offset = '+00:00'; |
1268 | 1268 | |
1269 | 1269 | if ($globalDBdriver == 'mysql') { |
1270 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1270 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1271 | 1271 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
1272 | 1272 | GROUP BY hour_name |
1273 | 1273 | ORDER BY hour_name ASC"; |
1274 | 1274 | } else { |
1275 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1275 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1276 | 1276 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
1277 | 1277 | GROUP BY hour_name |
1278 | 1278 | ORDER BY hour_name ASC"; |
@@ -1280,12 +1280,12 @@ discard block |
||
1280 | 1280 | |
1281 | 1281 | |
1282 | 1282 | $sth = $this->db->prepare($query); |
1283 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1283 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1284 | 1284 | |
1285 | 1285 | $hour_array = array(); |
1286 | 1286 | $temp_array = array(); |
1287 | 1287 | |
1288 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1288 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1289 | 1289 | { |
1290 | 1290 | $temp_array['hour_name'] = $row['hour_name']; |
1291 | 1291 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1304,33 +1304,33 @@ discard block |
||
1304 | 1304 | * @return Integer the number of trackers |
1305 | 1305 | * |
1306 | 1306 | */ |
1307 | - public function countOverallTracker($filters = array(),$year = '',$month = '') |
|
1307 | + public function countOverallTracker($filters = array(), $year = '', $month = '') |
|
1308 | 1308 | { |
1309 | 1309 | global $globalDBdriver; |
1310 | 1310 | //$queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output"; |
1311 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
1311 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
1312 | 1312 | $query_values = array(); |
1313 | 1313 | $query = ''; |
1314 | 1314 | if ($year != '') { |
1315 | 1315 | if ($globalDBdriver == 'mysql') { |
1316 | 1316 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1317 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1317 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1318 | 1318 | } else { |
1319 | 1319 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1320 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1320 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1321 | 1321 | } |
1322 | 1322 | } |
1323 | 1323 | if ($month != '') { |
1324 | 1324 | if ($globalDBdriver == 'mysql') { |
1325 | 1325 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1326 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1326 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1327 | 1327 | } else { |
1328 | 1328 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1329 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1329 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1330 | 1330 | } |
1331 | 1331 | } |
1332 | 1332 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1333 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1333 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1334 | 1334 | |
1335 | 1335 | $sth = $this->db->prepare($queryi); |
1336 | 1336 | $sth->execute($query_values); |
@@ -1343,32 +1343,32 @@ discard block |
||
1343 | 1343 | * @return Integer the number of flights |
1344 | 1344 | * |
1345 | 1345 | */ |
1346 | - public function countOverallTrackerTypes($filters = array(),$year = '',$month = '') |
|
1346 | + public function countOverallTrackerTypes($filters = array(), $year = '', $month = '') |
|
1347 | 1347 | { |
1348 | 1348 | global $globalDBdriver; |
1349 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
1349 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
1350 | 1350 | $query_values = array(); |
1351 | 1351 | $query = ''; |
1352 | 1352 | if ($year != '') { |
1353 | 1353 | if ($globalDBdriver == 'mysql') { |
1354 | 1354 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1355 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1355 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1356 | 1356 | } else { |
1357 | 1357 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1358 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1358 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1359 | 1359 | } |
1360 | 1360 | } |
1361 | 1361 | if ($month != '') { |
1362 | 1362 | if ($globalDBdriver == 'mysql') { |
1363 | 1363 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1364 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1364 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1365 | 1365 | } else { |
1366 | 1366 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1367 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1367 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1368 | 1368 | } |
1369 | 1369 | } |
1370 | 1370 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1371 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1371 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1372 | 1372 | |
1373 | 1373 | $sth = $this->db->prepare($queryi); |
1374 | 1374 | $sth->execute($query_values); |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | public function countAllHoursFromToday($filters = array()) |
1386 | 1386 | { |
1387 | 1387 | global $globalTimezone, $globalDBdriver; |
1388 | - $filter_query = $this->getFilter($filters,true,true); |
|
1388 | + $filter_query = $this->getFilter($filters, true, true); |
|
1389 | 1389 | if ($globalTimezone != '') { |
1390 | 1390 | date_default_timezone_set($globalTimezone); |
1391 | 1391 | $datetime = new DateTime(); |
@@ -1393,12 +1393,12 @@ discard block |
||
1393 | 1393 | } else $offset = '+00:00'; |
1394 | 1394 | |
1395 | 1395 | if ($globalDBdriver == 'mysql') { |
1396 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1396 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1397 | 1397 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE() |
1398 | 1398 | GROUP BY hour_name |
1399 | 1399 | ORDER BY hour_name ASC"; |
1400 | 1400 | } else { |
1401 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1401 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1402 | 1402 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1403 | 1403 | GROUP BY hour_name |
1404 | 1404 | ORDER BY hour_name ASC"; |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | $hour_array = array(); |
1411 | 1411 | $temp_array = array(); |
1412 | 1412 | |
1413 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1413 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1414 | 1414 | { |
1415 | 1415 | $temp_array['hour_name'] = $row['hour_name']; |
1416 | 1416 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1429,9 +1429,9 @@ discard block |
||
1429 | 1429 | */ |
1430 | 1430 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
1431 | 1431 | { |
1432 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
1432 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
1433 | 1433 | |
1434 | - $query = "SELECT tracker_output.tracker_id |
|
1434 | + $query = "SELECT tracker_output.tracker_id |
|
1435 | 1435 | FROM tracker_output |
1436 | 1436 | WHERE tracker_output.famtrackid = '".$famtrackid."'"; |
1437 | 1437 | |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | $sth = $this->db->prepare($query); |
1440 | 1440 | $sth->execute(); |
1441 | 1441 | |
1442 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1442 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1443 | 1443 | { |
1444 | 1444 | return $row['tracker_id']; |
1445 | 1445 | } |
@@ -1464,23 +1464,23 @@ discard block |
||
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | $current_date = date("Y-m-d H:i:s"); |
1467 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1467 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1468 | 1468 | |
1469 | 1469 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1470 | 1470 | |
1471 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1471 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1472 | 1472 | $years = $time_array['years']; |
1473 | 1473 | |
1474 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1474 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1475 | 1475 | $months = $time_array['months']; |
1476 | 1476 | |
1477 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1477 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1478 | 1478 | $days = $time_array['days']; |
1479 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1479 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1480 | 1480 | $hours = $time_array['hours']; |
1481 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1481 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1482 | 1482 | $minutes = $time_array['minutes']; |
1483 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1483 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1484 | 1484 | |
1485 | 1485 | return $time_array; |
1486 | 1486 | } |
@@ -1503,63 +1503,63 @@ discard block |
||
1503 | 1503 | $temp_array['direction_degree'] = $direction; |
1504 | 1504 | $temp_array['direction_shortname'] = "N"; |
1505 | 1505 | $temp_array['direction_fullname'] = "North"; |
1506 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
1506 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
1507 | 1507 | $temp_array['direction_degree'] = $direction; |
1508 | 1508 | $temp_array['direction_shortname'] = "NNE"; |
1509 | 1509 | $temp_array['direction_fullname'] = "North-Northeast"; |
1510 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
1510 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
1511 | 1511 | $temp_array['direction_degree'] = $direction; |
1512 | 1512 | $temp_array['direction_shortname'] = "NE"; |
1513 | 1513 | $temp_array['direction_fullname'] = "Northeast"; |
1514 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
1514 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
1515 | 1515 | $temp_array['direction_degree'] = $direction; |
1516 | 1516 | $temp_array['direction_shortname'] = "ENE"; |
1517 | 1517 | $temp_array['direction_fullname'] = "East-Northeast"; |
1518 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
1518 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
1519 | 1519 | $temp_array['direction_degree'] = $direction; |
1520 | 1520 | $temp_array['direction_shortname'] = "E"; |
1521 | 1521 | $temp_array['direction_fullname'] = "East"; |
1522 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
1522 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
1523 | 1523 | $temp_array['direction_degree'] = $direction; |
1524 | 1524 | $temp_array['direction_shortname'] = "ESE"; |
1525 | 1525 | $temp_array['direction_fullname'] = "East-Southeast"; |
1526 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
1526 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
1527 | 1527 | $temp_array['direction_degree'] = $direction; |
1528 | 1528 | $temp_array['direction_shortname'] = "SE"; |
1529 | 1529 | $temp_array['direction_fullname'] = "Southeast"; |
1530 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
1530 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
1531 | 1531 | $temp_array['direction_degree'] = $direction; |
1532 | 1532 | $temp_array['direction_shortname'] = "SSE"; |
1533 | 1533 | $temp_array['direction_fullname'] = "South-Southeast"; |
1534 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
1534 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
1535 | 1535 | $temp_array['direction_degree'] = $direction; |
1536 | 1536 | $temp_array['direction_shortname'] = "S"; |
1537 | 1537 | $temp_array['direction_fullname'] = "South"; |
1538 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
1538 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
1539 | 1539 | $temp_array['direction_degree'] = $direction; |
1540 | 1540 | $temp_array['direction_shortname'] = "SSW"; |
1541 | 1541 | $temp_array['direction_fullname'] = "South-Southwest"; |
1542 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
1542 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
1543 | 1543 | $temp_array['direction_degree'] = $direction; |
1544 | 1544 | $temp_array['direction_shortname'] = "SW"; |
1545 | 1545 | $temp_array['direction_fullname'] = "Southwest"; |
1546 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
1546 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
1547 | 1547 | $temp_array['direction_degree'] = $direction; |
1548 | 1548 | $temp_array['direction_shortname'] = "WSW"; |
1549 | 1549 | $temp_array['direction_fullname'] = "West-Southwest"; |
1550 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
1550 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
1551 | 1551 | $temp_array['direction_degree'] = $direction; |
1552 | 1552 | $temp_array['direction_shortname'] = "W"; |
1553 | 1553 | $temp_array['direction_fullname'] = "West"; |
1554 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
1554 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
1555 | 1555 | $temp_array['direction_degree'] = $direction; |
1556 | 1556 | $temp_array['direction_shortname'] = "WNW"; |
1557 | 1557 | $temp_array['direction_fullname'] = "West-Northwest"; |
1558 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
1558 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
1559 | 1559 | $temp_array['direction_degree'] = $direction; |
1560 | 1560 | $temp_array['direction_shortname'] = "NW"; |
1561 | 1561 | $temp_array['direction_fullname'] = "Northwest"; |
1562 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
1562 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
1563 | 1563 | $temp_array['direction_degree'] = $direction; |
1564 | 1564 | $temp_array['direction_shortname'] = "NNW"; |
1565 | 1565 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1576,11 +1576,11 @@ discard block |
||
1576 | 1576 | * @param Float $longitude longitute of the flight |
1577 | 1577 | * @return String the countrie |
1578 | 1578 | */ |
1579 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
1579 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
1580 | 1580 | { |
1581 | 1581 | global $globalDBdriver, $globalDebug; |
1582 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1583 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1582 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1583 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1584 | 1584 | |
1585 | 1585 | $Connection = new Connection($this->db); |
1586 | 1586 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1620,7 +1620,7 @@ discard block |
||
1620 | 1620 | public function getCountryFromISO2($iso2) |
1621 | 1621 | { |
1622 | 1622 | global $globalDBdriver, $globalDebug; |
1623 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
1623 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
1624 | 1624 | |
1625 | 1625 | $Connection = new Connection($this->db); |
1626 | 1626 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1649,11 +1649,11 @@ discard block |
||
1649 | 1649 | * @return Array the vessel type list |
1650 | 1650 | * |
1651 | 1651 | */ |
1652 | - public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
1652 | + public function countAllTrackerTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1653 | 1653 | { |
1654 | 1654 | global $globalDBdriver; |
1655 | - $filter_query = $this->getFilter($filters,true,true); |
|
1656 | - $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
1655 | + $filter_query = $this->getFilter($filters, true, true); |
|
1656 | + $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
1657 | 1657 | FROM tracker_output ".$filter_query." tracker_output.type <> ''"; |
1658 | 1658 | if ($olderthanmonths > 0) { |
1659 | 1659 | if ($globalDBdriver == 'mysql') { |
@@ -1673,28 +1673,28 @@ discard block |
||
1673 | 1673 | if ($year != '') { |
1674 | 1674 | if ($globalDBdriver == 'mysql') { |
1675 | 1675 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1676 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1676 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1677 | 1677 | } else { |
1678 | 1678 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1679 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1679 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1680 | 1680 | } |
1681 | 1681 | } |
1682 | 1682 | if ($month != '') { |
1683 | 1683 | if ($globalDBdriver == 'mysql') { |
1684 | 1684 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1685 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1685 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1686 | 1686 | } else { |
1687 | 1687 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1688 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1688 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1689 | 1689 | } |
1690 | 1690 | } |
1691 | 1691 | if ($day != '') { |
1692 | 1692 | if ($globalDBdriver == 'mysql') { |
1693 | 1693 | $query .= " AND DAY(tracker_output.date) = :day"; |
1694 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1694 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1695 | 1695 | } else { |
1696 | 1696 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
1697 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1697 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1698 | 1698 | } |
1699 | 1699 | } |
1700 | 1700 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | $sth->execute($query_values); |
1704 | 1704 | $tracker_array = array(); |
1705 | 1705 | $temp_array = array(); |
1706 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1706 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1707 | 1707 | { |
1708 | 1708 | $temp_array['tracker_type'] = $row['tracker_type']; |
1709 | 1709 | $temp_array['tracker_type_count'] = $row['tracker_type_count']; |
@@ -1738,7 +1738,7 @@ discard block |
||
1738 | 1738 | |
1739 | 1739 | $bitly_data = json_decode($bitly_data); |
1740 | 1740 | $bitly_url = ''; |
1741 | - if ($bitly_data->status_txt = "OK"){ |
|
1741 | + if ($bitly_data->status_txt = "OK") { |
|
1742 | 1742 | $bitly_url = $bitly_data->data->url; |
1743 | 1743 | } |
1744 | 1744 | |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | |
1749 | 1749 | public function getOrderBy() |
1750 | 1750 | { |
1751 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
1751 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
1752 | 1752 | |
1753 | 1753 | return $orderby; |
1754 | 1754 |