@@ -19,47 +19,47 @@ discard block |
||
| 19 | 19 | // Check if schema is at latest version |
| 20 | 20 | $Connection = new Connection(); |
| 21 | 21 | if ($Connection->latest() === false) { |
| 22 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
| 23 | - exit(); |
|
| 22 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
| 23 | + exit(); |
|
| 24 | 24 | } |
| 25 | 25 | if (PHP_SAPI != 'cli') { |
| 26 | - echo "This script MUST be called from console, not a web browser."; |
|
| 26 | + echo "This script MUST be called from console, not a web browser."; |
|
| 27 | 27 | // exit(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // This is to be compatible with old version of settings.php |
| 31 | 31 | if (!isset($globalSources)) { |
| 32 | - if (isset($globalSBS1Hosts)) { |
|
| 33 | - //$hosts = $globalSBS1Hosts; |
|
| 34 | - foreach ($globalSBS1Hosts as $host) { |
|
| 35 | - $globalSources[] = array('host' => $host); |
|
| 36 | - } |
|
| 37 | - } else { |
|
| 38 | - if (!isset($globalSBS1Host)) { |
|
| 39 | - echo '$globalSources MUST be defined !'; |
|
| 40 | - die; |
|
| 32 | + if (isset($globalSBS1Hosts)) { |
|
| 33 | + //$hosts = $globalSBS1Hosts; |
|
| 34 | + foreach ($globalSBS1Hosts as $host) { |
|
| 35 | + $globalSources[] = array('host' => $host); |
|
| 36 | + } |
|
| 37 | + } else { |
|
| 38 | + if (!isset($globalSBS1Host)) { |
|
| 39 | + echo '$globalSources MUST be defined !'; |
|
| 40 | + die; |
|
| 41 | 41 | } |
| 42 | 42 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
| 43 | 43 | $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $options = getopt('s::',array('source::','server','idsource::')); |
| 48 | 48 | //if (isset($options['s'])) $hosts = array($options['s']); |
| 49 | 49 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 50 | 50 | if (isset($options['s'])) { |
| 51 | - $globalSources = array(); |
|
| 52 | - $globalSources[] = array('host' => $options['s']); |
|
| 51 | + $globalSources = array(); |
|
| 52 | + $globalSources[] = array('host' => $options['s']); |
|
| 53 | 53 | } elseif (isset($options['source'])) { |
| 54 | - $globalSources = array(); |
|
| 55 | - $globalSources[] = array('host' => $options['source']); |
|
| 54 | + $globalSources = array(); |
|
| 55 | + $globalSources[] = array('host' => $options['source']); |
|
| 56 | 56 | } |
| 57 | 57 | if (isset($options['server'])) $globalServer = TRUE; |
| 58 | 58 | if (isset($options['idsource'])) $id_source = $options['idsource']; |
| 59 | 59 | else $id_source = 1; |
| 60 | 60 | if (isset($globalServer) && $globalServer) { |
| 61 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 62 | - $SI=new SpotterServer(); |
|
| 61 | + if ($globalDebug) echo "Using Server Mode\n"; |
|
| 62 | + $SI=new SpotterServer(); |
|
| 63 | 63 | } else $SI=new SpotterImport($Connection->db); |
| 64 | 64 | //$APRS=new APRS($Connection->db); |
| 65 | 65 | $SBS=new SBS(); |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | //$servertz = system('date +%Z'); |
| 70 | 70 | // signal handler - playing nice with sockets and dump1090 |
| 71 | 71 | if (function_exists('pcntl_fork')) { |
| 72 | - pcntl_signal(SIGINT, function() { |
|
| 73 | - global $sockets; |
|
| 74 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 75 | - die("Bye!\n"); |
|
| 76 | - }); |
|
| 77 | - pcntl_signal_dispatch(); |
|
| 72 | + pcntl_signal(SIGINT, function() { |
|
| 73 | + global $sockets; |
|
| 74 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 75 | + die("Bye!\n"); |
|
| 76 | + }); |
|
| 77 | + pcntl_signal_dispatch(); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // let's try and connect |
@@ -84,162 +84,162 @@ discard block |
||
| 84 | 84 | $reset = 0; |
| 85 | 85 | |
| 86 | 86 | function create_socket($host, $port, &$errno, &$errstr) { |
| 87 | - $ip = gethostbyname($host); |
|
| 88 | - $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
| 89 | - $r = @socket_connect($s, $ip, $port); |
|
| 90 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 91 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 92 | - return $s; |
|
| 93 | - } |
|
| 94 | - $errno = socket_last_error($s); |
|
| 95 | - $errstr = socket_strerror($errno); |
|
| 96 | - socket_close($s); |
|
| 97 | - return false; |
|
| 87 | + $ip = gethostbyname($host); |
|
| 88 | + $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
| 89 | + $r = @socket_connect($s, $ip, $port); |
|
| 90 | + if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 91 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 92 | + return $s; |
|
| 93 | + } |
|
| 94 | + $errno = socket_last_error($s); |
|
| 95 | + $errstr = socket_strerror($errno); |
|
| 96 | + socket_close($s); |
|
| 97 | + return false; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | function create_socket_udp($host, $port, &$errno, &$errstr) { |
| 101 | - echo "Create an UDP socket...\n"; |
|
| 102 | - $ip = gethostbyname($host); |
|
| 103 | - $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
| 104 | - $r = @socket_bind($s, $ip, $port); |
|
| 105 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 106 | - return $s; |
|
| 107 | - } |
|
| 108 | - $errno = socket_last_error($s); |
|
| 109 | - $errstr = socket_strerror($errno); |
|
| 110 | - socket_close($s); |
|
| 111 | - return false; |
|
| 101 | + echo "Create an UDP socket...\n"; |
|
| 102 | + $ip = gethostbyname($host); |
|
| 103 | + $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
| 104 | + $r = @socket_bind($s, $ip, $port); |
|
| 105 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 106 | + return $s; |
|
| 107 | + } |
|
| 108 | + $errno = socket_last_error($s); |
|
| 109 | + $errstr = socket_strerror($errno); |
|
| 110 | + socket_close($s); |
|
| 111 | + return false; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | function connect_all($hosts) { |
| 115 | - //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 116 | - global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset; |
|
| 117 | - $reset++; |
|
| 118 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 119 | - foreach ($hosts as $id => $value) { |
|
| 115 | + //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 116 | + global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset; |
|
| 117 | + $reset++; |
|
| 118 | + if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 119 | + foreach ($hosts as $id => $value) { |
|
| 120 | 120 | $host = $value['host']; |
| 121 | 121 | $globalSources[$id]['last_exec'] = 0; |
| 122 | 122 | // Here we check type of source(s) |
| 123 | 123 | if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
| 124 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 125 | - //$formats[$id] = 'deltadbtxt'; |
|
| 126 | - $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 127 | - //$last_exec['deltadbtxt'] = 0; |
|
| 128 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 129 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 130 | - //$formats[$id] = 'vatsimtxt'; |
|
| 131 | - $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 132 | - //$last_exec['vatsimtxt'] = 0; |
|
| 133 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 134 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 135 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 136 | - $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 137 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 138 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 139 | - } else if (preg_match('/opensky/i',$host)) { |
|
| 140 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 141 | - $globalSources[$id]['format'] = 'opensky'; |
|
| 142 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 143 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 144 | - } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
| 145 | - //$formats[$id] = 'radarvirtueljson'; |
|
| 146 | - $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
| 147 | - //$last_exec['radarvirtueljson'] = 0; |
|
| 148 | - if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
| 149 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 150 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 151 | - exit(0); |
|
| 152 | - } |
|
| 153 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 154 | - //$formats[$id] = 'planeupdatefaa'; |
|
| 155 | - $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 156 | - //$last_exec['planeupdatefaa'] = 0; |
|
| 157 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 158 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 159 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 160 | - exit(0); |
|
| 161 | - } |
|
| 162 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 163 | - //$formats[$id] = 'phpvmacars'; |
|
| 164 | - $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 165 | - //$last_exec['phpvmacars'] = 0; |
|
| 166 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 167 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 168 | - //$formats[$id] = 'phpvmacars'; |
|
| 169 | - $globalSources[$id]['format'] = 'vam'; |
|
| 170 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 171 | - } else if (preg_match('/whazzup/i',$host)) { |
|
| 172 | - //$formats[$id] = 'whazzup'; |
|
| 173 | - $globalSources[$id]['format'] = 'whazzup'; |
|
| 174 | - //$last_exec['whazzup'] = 0; |
|
| 175 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 176 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
| 177 | - //$formats[$id] = 'pirepsjson'; |
|
| 178 | - $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 179 | - //$last_exec['pirepsjson'] = 0; |
|
| 180 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 181 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 182 | - //$formats[$id] = 'fr24json'; |
|
| 183 | - $globalSources[$id]['format'] = 'fr24json'; |
|
| 184 | - //$last_exec['fr24json'] = 0; |
|
| 185 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 186 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 187 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 188 | - exit(0); |
|
| 189 | - } |
|
| 190 | - //} else if (preg_match('/10001/',$host)) { |
|
| 191 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 192 | - //$formats[$id] = 'tsv'; |
|
| 193 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 194 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 195 | - } |
|
| 196 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 197 | - if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 198 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 199 | - $hostport = explode(':',$host); |
|
| 200 | - if (isset($hostport[1])) { |
|
| 124 | + if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 125 | + //$formats[$id] = 'deltadbtxt'; |
|
| 126 | + $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 127 | + //$last_exec['deltadbtxt'] = 0; |
|
| 128 | + if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 129 | + } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 130 | + //$formats[$id] = 'vatsimtxt'; |
|
| 131 | + $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 132 | + //$last_exec['vatsimtxt'] = 0; |
|
| 133 | + if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 134 | + } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 135 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 136 | + $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 137 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 138 | + if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 139 | + } else if (preg_match('/opensky/i',$host)) { |
|
| 140 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 141 | + $globalSources[$id]['format'] = 'opensky'; |
|
| 142 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 143 | + if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 144 | + } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
| 145 | + //$formats[$id] = 'radarvirtueljson'; |
|
| 146 | + $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
| 147 | + //$last_exec['radarvirtueljson'] = 0; |
|
| 148 | + if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
| 149 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 150 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 151 | + exit(0); |
|
| 152 | + } |
|
| 153 | + } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 154 | + //$formats[$id] = 'planeupdatefaa'; |
|
| 155 | + $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 156 | + //$last_exec['planeupdatefaa'] = 0; |
|
| 157 | + if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 158 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 159 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 160 | + exit(0); |
|
| 161 | + } |
|
| 162 | + } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 163 | + //$formats[$id] = 'phpvmacars'; |
|
| 164 | + $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 165 | + //$last_exec['phpvmacars'] = 0; |
|
| 166 | + if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 167 | + } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 168 | + //$formats[$id] = 'phpvmacars'; |
|
| 169 | + $globalSources[$id]['format'] = 'vam'; |
|
| 170 | + if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 171 | + } else if (preg_match('/whazzup/i',$host)) { |
|
| 172 | + //$formats[$id] = 'whazzup'; |
|
| 173 | + $globalSources[$id]['format'] = 'whazzup'; |
|
| 174 | + //$last_exec['whazzup'] = 0; |
|
| 175 | + if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 176 | + } else if (preg_match('/recentpireps/i',$host)) { |
|
| 177 | + //$formats[$id] = 'pirepsjson'; |
|
| 178 | + $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 179 | + //$last_exec['pirepsjson'] = 0; |
|
| 180 | + if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 181 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 182 | + //$formats[$id] = 'fr24json'; |
|
| 183 | + $globalSources[$id]['format'] = 'fr24json'; |
|
| 184 | + //$last_exec['fr24json'] = 0; |
|
| 185 | + if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 186 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 187 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 188 | + exit(0); |
|
| 189 | + } |
|
| 190 | + //} else if (preg_match('/10001/',$host)) { |
|
| 191 | + } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 192 | + //$formats[$id] = 'tsv'; |
|
| 193 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 194 | + if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 195 | + } |
|
| 196 | + } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 197 | + if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 198 | + } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 199 | + $hostport = explode(':',$host); |
|
| 200 | + if (isset($hostport[1])) { |
|
| 201 | 201 | $port = $hostport[1]; |
| 202 | 202 | $hostn = $hostport[0]; |
| 203 | - } else { |
|
| 203 | + } else { |
|
| 204 | 204 | $port = $globalSources[$id]['port']; |
| 205 | 205 | $hostn = $globalSources[$id]['host']; |
| 206 | - } |
|
| 207 | - if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 208 | - $s = create_socket($hostn,$port, $errno, $errstr); |
|
| 209 | - } else { |
|
| 210 | - $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 211 | - } |
|
| 212 | - if ($s) { |
|
| 213 | - $sockets[$id] = $s; |
|
| 214 | - if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 215 | - if (preg_match('/aprs/',$hostn)) { |
|
| 206 | + } |
|
| 207 | + if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 208 | + $s = create_socket($hostn,$port, $errno, $errstr); |
|
| 209 | + } else { |
|
| 210 | + $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 211 | + } |
|
| 212 | + if ($s) { |
|
| 213 | + $sockets[$id] = $s; |
|
| 214 | + if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 215 | + if (preg_match('/aprs/',$hostn)) { |
|
| 216 | 216 | //$formats[$id] = 'aprs'; |
| 217 | 217 | $globalSources[$id]['format'] = 'aprs'; |
| 218 | 218 | //$aprs_connect = 0; |
| 219 | 219 | //$use_aprs = true; |
| 220 | - } elseif ($port == '10001') { |
|
| 221 | - //$formats[$id] = 'tsv'; |
|
| 222 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 223 | - } elseif ($port == '30002') { |
|
| 224 | - //$formats[$id] = 'raw'; |
|
| 225 | - $globalSources[$id]['format'] = 'raw'; |
|
| 226 | - } elseif ($port == '5001') { |
|
| 227 | - //$formats[$id] = 'raw'; |
|
| 228 | - $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 229 | - } elseif ($port == '30005') { |
|
| 220 | + } elseif ($port == '10001') { |
|
| 221 | + //$formats[$id] = 'tsv'; |
|
| 222 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 223 | + } elseif ($port == '30002') { |
|
| 224 | + //$formats[$id] = 'raw'; |
|
| 225 | + $globalSources[$id]['format'] = 'raw'; |
|
| 226 | + } elseif ($port == '5001') { |
|
| 227 | + //$formats[$id] = 'raw'; |
|
| 228 | + $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 229 | + } elseif ($port == '30005') { |
|
| 230 | 230 | // Not yet supported |
| 231 | - //$formats[$id] = 'beast'; |
|
| 232 | - $globalSources[$id]['format'] = 'beast'; |
|
| 233 | - //} else $formats[$id] = 'sbs'; |
|
| 234 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 235 | - //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 231 | + //$formats[$id] = 'beast'; |
|
| 232 | + $globalSources[$id]['format'] = 'beast'; |
|
| 233 | + //} else $formats[$id] = 'sbs'; |
|
| 234 | + } else $globalSources[$id]['format'] = 'sbs'; |
|
| 235 | + //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 236 | 236 | } |
| 237 | 237 | if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
| 238 | - } else { |
|
| 238 | + } else { |
|
| 239 | 239 | if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
| 240 | - } |
|
| 241 | - } |
|
| 242 | - } |
|
| 240 | + } |
|
| 241 | + } |
|
| 242 | + } |
|
| 243 | 243 | } |
| 244 | 244 | if (!isset($globalMinFetch)) $globalMinFetch = 15; |
| 245 | 245 | |
@@ -266,18 +266,18 @@ discard block |
||
| 266 | 266 | die; |
| 267 | 267 | } |
| 268 | 268 | foreach ($globalSources as $key => $source) { |
| 269 | - if (!isset($source['format'])) { |
|
| 270 | - $globalSources[$key]['format'] = 'auto'; |
|
| 271 | - } |
|
| 269 | + if (!isset($source['format'])) { |
|
| 270 | + $globalSources[$key]['format'] = 'auto'; |
|
| 271 | + } |
|
| 272 | 272 | } |
| 273 | 273 | connect_all($globalSources); |
| 274 | 274 | foreach ($globalSources as $key => $source) { |
| 275 | - if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 275 | + if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 276 | 276 | $aprs_connect = 0; |
| 277 | 277 | $use_aprs = true; |
| 278 | 278 | if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
| 279 | 279 | break; |
| 280 | - } |
|
| 280 | + } |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | if ($use_aprs) { |
@@ -317,69 +317,69 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 319 | 319 | while ($i > 0) { |
| 320 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 321 | - // Delete old ATC |
|
| 322 | - if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 320 | + if (!$globalDaemon) $i = $endtime-time(); |
|
| 321 | + // Delete old ATC |
|
| 322 | + if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 323 | 323 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
| 324 | - $ATC->deleteOldATC(); |
|
| 325 | - } |
|
| 324 | + $ATC->deleteOldATC(); |
|
| 325 | + } |
|
| 326 | 326 | |
| 327 | - if (count($last_exec) > 0) { |
|
| 327 | + if (count($last_exec) > 0) { |
|
| 328 | 328 | $max = $globalMinFetch; |
| 329 | 329 | foreach ($last_exec as $last) { |
| 330 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 330 | + if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 331 | 331 | } |
| 332 | 332 | if ($max != $globalMinFetch) { |
| 333 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 334 | - sleep($globalMinFetch-$max+2); |
|
| 333 | + if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 334 | + sleep($globalMinFetch-$max+2); |
|
| 335 | + } |
|
| 335 | 336 | } |
| 336 | - } |
|
| 337 | 337 | |
| 338 | 338 | |
| 339 | - //foreach ($formats as $id => $value) { |
|
| 340 | - foreach ($globalSources as $id => $value) { |
|
| 339 | + //foreach ($formats as $id => $value) { |
|
| 340 | + foreach ($globalSources as $id => $value) { |
|
| 341 | 341 | if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
| 342 | 342 | if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 343 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 344 | - $buffer = $Common->getData($value['host']); |
|
| 345 | - if ($buffer != '') $reset = 0; |
|
| 346 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 347 | - $buffer = explode('\n',$buffer); |
|
| 348 | - foreach ($buffer as $line) { |
|
| 349 | - if ($line != '' && count($line) > 7) { |
|
| 350 | - $line = explode(',', $line); |
|
| 351 | - $data = array(); |
|
| 352 | - $data['hex'] = $line[1]; // hex |
|
| 353 | - $data['ident'] = $line[2]; // ident |
|
| 354 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 355 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 356 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 357 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 358 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 359 | - $data['verticalrate'] = ''; // vertical rate |
|
| 360 | - //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 361 | - $data['emergency'] = ''; // emergency |
|
| 362 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 363 | - $data['format_source'] = 'deltadbtxt'; |
|
| 364 | - $data['id_source'] = $id_source; |
|
| 365 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 366 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 367 | - $SI->add($data); |
|
| 368 | - unset($data); |
|
| 369 | - } |
|
| 370 | - } |
|
| 371 | - $last_exec[$id]['last'] = time(); |
|
| 343 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 344 | + $buffer = $Common->getData($value['host']); |
|
| 345 | + if ($buffer != '') $reset = 0; |
|
| 346 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 347 | + $buffer = explode('\n',$buffer); |
|
| 348 | + foreach ($buffer as $line) { |
|
| 349 | + if ($line != '' && count($line) > 7) { |
|
| 350 | + $line = explode(',', $line); |
|
| 351 | + $data = array(); |
|
| 352 | + $data['hex'] = $line[1]; // hex |
|
| 353 | + $data['ident'] = $line[2]; // ident |
|
| 354 | + if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 355 | + if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 356 | + if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 357 | + if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 358 | + if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 359 | + $data['verticalrate'] = ''; // vertical rate |
|
| 360 | + //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 361 | + $data['emergency'] = ''; // emergency |
|
| 362 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 363 | + $data['format_source'] = 'deltadbtxt'; |
|
| 364 | + $data['id_source'] = $id_source; |
|
| 365 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 366 | + if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 367 | + $SI->add($data); |
|
| 368 | + unset($data); |
|
| 369 | + } |
|
| 370 | + } |
|
| 371 | + $last_exec[$id]['last'] = time(); |
|
| 372 | 372 | //} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) { |
| 373 | 373 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { |
| 374 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 375 | - $buffer = $Common->getData($value['host']); |
|
| 376 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 377 | - $buffer = explode('\n',$buffer); |
|
| 378 | - $reset = 0; |
|
| 379 | - foreach ($buffer as $line) { |
|
| 380 | - if ($line != '') { |
|
| 381 | - $line = explode(':', $line); |
|
| 382 | - if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 374 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 375 | + $buffer = $Common->getData($value['host']); |
|
| 376 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 377 | + $buffer = explode('\n',$buffer); |
|
| 378 | + $reset = 0; |
|
| 379 | + foreach ($buffer as $line) { |
|
| 380 | + if ($line != '') { |
|
| 381 | + $line = explode(':', $line); |
|
| 382 | + if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 383 | 383 | $data = array(); |
| 384 | 384 | $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
| 385 | 385 | $data['pilot_id'] = $line[1]; |
@@ -391,36 +391,36 @@ discard block |
||
| 391 | 391 | if (isset($line[45])) $data['heading'] = $line[45]; // heading |
| 392 | 392 | elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
| 393 | 393 | $data['latitude'] = $line[5]; // lat |
| 394 | - $data['longitude'] = $line[6]; // long |
|
| 395 | - $data['verticalrate'] = ''; // vertical rate |
|
| 396 | - $data['squawk'] = ''; // squawk |
|
| 397 | - $data['emergency'] = ''; // emergency |
|
| 398 | - $data['waypoints'] = $line[30]; |
|
| 394 | + $data['longitude'] = $line[6]; // long |
|
| 395 | + $data['verticalrate'] = ''; // vertical rate |
|
| 396 | + $data['squawk'] = ''; // squawk |
|
| 397 | + $data['emergency'] = ''; // emergency |
|
| 398 | + $data['waypoints'] = $line[30]; |
|
| 399 | 399 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 400 | 400 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
| 401 | 401 | if (isset($line[37])) $data['last_update'] = $line[37]; |
| 402 | - $data['departure_airport_icao'] = $line[11]; |
|
| 403 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 404 | - $data['arrival_airport_icao'] = $line[13]; |
|
| 402 | + $data['departure_airport_icao'] = $line[11]; |
|
| 403 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 404 | + $data['arrival_airport_icao'] = $line[13]; |
|
| 405 | 405 | $data['frequency'] = $line[4]; |
| 406 | 406 | $data['type'] = $line[18]; |
| 407 | 407 | $data['range'] = $line[19]; |
| 408 | 408 | if (isset($line[35])) $data['info'] = $line[35]; |
| 409 | - $data['id_source'] = $id_source; |
|
| 410 | - //$data['arrival_airport_time'] = ; |
|
| 411 | - if ($line[9] != '') { |
|
| 412 | - $aircraft_data = explode('/',$line[9]); |
|
| 413 | - if (isset($aircraft_data[1])) { |
|
| 414 | - $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - /* |
|
| 409 | + $data['id_source'] = $id_source; |
|
| 410 | + //$data['arrival_airport_time'] = ; |
|
| 411 | + if ($line[9] != '') { |
|
| 412 | + $aircraft_data = explode('/',$line[9]); |
|
| 413 | + if (isset($aircraft_data[1])) { |
|
| 414 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + /* |
|
| 418 | 418 | if ($value == 'whazzup') $data['format_source'] = 'whazzup'; |
| 419 | 419 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 420 | 420 | */ |
| 421 | - $data['format_source'] = $value['format']; |
|
| 421 | + $data['format_source'] = $value['format']; |
|
| 422 | 422 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 423 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
| 423 | + if ($line[3] == 'PILOT') $SI->add($data); |
|
| 424 | 424 | elseif ($line[3] == 'ATC') { |
| 425 | 425 | //print_r($data); |
| 426 | 426 | $data['info'] = str_replace('^§','<br />',$data['info']); |
@@ -438,247 +438,247 @@ discard block |
||
| 438 | 438 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
| 439 | 439 | echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
| 440 | 440 | } |
| 441 | - unset($data); |
|
| 442 | - } |
|
| 443 | - } |
|
| 444 | - } |
|
| 445 | - //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
| 446 | - //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 447 | - $last_exec[$id]['last'] = time(); |
|
| 448 | - //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
| 449 | - } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 450 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 451 | - if ($buffer != '') { |
|
| 452 | - $all_data = json_decode($buffer,true); |
|
| 453 | - if (isset($all_data['acList'])) { |
|
| 441 | + unset($data); |
|
| 442 | + } |
|
| 443 | + } |
|
| 444 | + } |
|
| 445 | + //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
| 446 | + //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 447 | + $last_exec[$id]['last'] = time(); |
|
| 448 | + //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
| 449 | + } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 450 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 451 | + if ($buffer != '') { |
|
| 452 | + $all_data = json_decode($buffer,true); |
|
| 453 | + if (isset($all_data['acList'])) { |
|
| 454 | 454 | $reset = 0; |
| 455 | 455 | foreach ($all_data['acList'] as $line) { |
| 456 | - $data = array(); |
|
| 457 | - $data['hex'] = $line['Icao']; // hex |
|
| 458 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 459 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 460 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 461 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 462 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 463 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 464 | - //$data['verticalrate'] = $line['']; // verticale rate |
|
| 465 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 466 | - $data['emergency'] = ''; // emergency |
|
| 467 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 468 | - /* |
|
| 456 | + $data = array(); |
|
| 457 | + $data['hex'] = $line['Icao']; // hex |
|
| 458 | + if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 459 | + if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 460 | + if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 461 | + if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 462 | + if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 463 | + if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 464 | + //$data['verticalrate'] = $line['']; // verticale rate |
|
| 465 | + if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 466 | + $data['emergency'] = ''; // emergency |
|
| 467 | + if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 468 | + /* |
|
| 469 | 469 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 470 | 470 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 471 | 471 | */ |
| 472 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 473 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 474 | - $data['format_source'] = 'aircraftlistjson'; |
|
| 475 | - $data['id_source'] = $id_source; |
|
| 476 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 477 | - if (isset($data['datetime'])) $SI->add($data); |
|
| 478 | - unset($data); |
|
| 472 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 473 | + if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 474 | + $data['format_source'] = 'aircraftlistjson'; |
|
| 475 | + $data['id_source'] = $id_source; |
|
| 476 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 477 | + if (isset($data['datetime'])) $SI->add($data); |
|
| 478 | + unset($data); |
|
| 479 | 479 | } |
| 480 | - } else { |
|
| 480 | + } else { |
|
| 481 | 481 | $reset = 0; |
| 482 | 482 | foreach ($all_data as $line) { |
| 483 | - $data = array(); |
|
| 484 | - $data['hex'] = $line['hex']; // hex |
|
| 485 | - $data['ident'] = $line['flight']; // ident |
|
| 486 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 487 | - $data['speed'] = $line['speed']; // speed |
|
| 488 | - $data['heading'] = $line['track']; // heading |
|
| 489 | - $data['latitude'] = $line['lat']; // lat |
|
| 490 | - $data['longitude'] = $line['lon']; // long |
|
| 491 | - $data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 492 | - $data['squawk'] = $line['squawk']; // squawk |
|
| 493 | - $data['emergency'] = ''; // emergency |
|
| 494 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 495 | - $data['format_source'] = 'aircraftlistjson'; |
|
| 496 | - $data['id_source'] = $id_source; |
|
| 497 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 498 | - $SI->add($data); |
|
| 499 | - unset($data); |
|
| 483 | + $data = array(); |
|
| 484 | + $data['hex'] = $line['hex']; // hex |
|
| 485 | + $data['ident'] = $line['flight']; // ident |
|
| 486 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 487 | + $data['speed'] = $line['speed']; // speed |
|
| 488 | + $data['heading'] = $line['track']; // heading |
|
| 489 | + $data['latitude'] = $line['lat']; // lat |
|
| 490 | + $data['longitude'] = $line['lon']; // long |
|
| 491 | + $data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 492 | + $data['squawk'] = $line['squawk']; // squawk |
|
| 493 | + $data['emergency'] = ''; // emergency |
|
| 494 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 495 | + $data['format_source'] = 'aircraftlistjson'; |
|
| 496 | + $data['id_source'] = $id_source; |
|
| 497 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 498 | + $SI->add($data); |
|
| 499 | + unset($data); |
|
| 500 | + } |
|
| 500 | 501 | } |
| 501 | - } |
|
| 502 | - } |
|
| 503 | - //$last_exec['aircraftlistjson'] = time(); |
|
| 504 | - $last_exec[$id]['last'] = time(); |
|
| 505 | - //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 506 | - } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 507 | - $buffer = $Common->getData($value['host']); |
|
| 508 | - $all_data = json_decode($buffer,true); |
|
| 509 | - if (isset($all_data['planes'])) { |
|
| 502 | + } |
|
| 503 | + //$last_exec['aircraftlistjson'] = time(); |
|
| 504 | + $last_exec[$id]['last'] = time(); |
|
| 505 | + //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 506 | + } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 507 | + $buffer = $Common->getData($value['host']); |
|
| 508 | + $all_data = json_decode($buffer,true); |
|
| 509 | + if (isset($all_data['planes'])) { |
|
| 510 | 510 | $reset = 0; |
| 511 | 511 | foreach ($all_data['planes'] as $key => $line) { |
| 512 | - $data = array(); |
|
| 513 | - $data['hex'] = $key; // hex |
|
| 514 | - $data['ident'] = $line[3]; // ident |
|
| 515 | - $data['altitude'] = $line[6]; // altitude |
|
| 516 | - $data['speed'] = $line[8]; // speed |
|
| 517 | - $data['heading'] = $line[7]; // heading |
|
| 518 | - $data['latitude'] = $line[4]; // lat |
|
| 519 | - $data['longitude'] = $line[5]; // long |
|
| 520 | - //$data['verticalrate'] = $line[]; // verticale rate |
|
| 521 | - $data['squawk'] = $line[10]; // squawk |
|
| 522 | - $data['emergency'] = ''; // emergency |
|
| 523 | - $data['registration'] = $line[2]; |
|
| 524 | - $data['aircraft_icao'] = $line[0]; |
|
| 525 | - $deparr = explode('-',$line[1]); |
|
| 526 | - if (count($deparr) == 2) { |
|
| 512 | + $data = array(); |
|
| 513 | + $data['hex'] = $key; // hex |
|
| 514 | + $data['ident'] = $line[3]; // ident |
|
| 515 | + $data['altitude'] = $line[6]; // altitude |
|
| 516 | + $data['speed'] = $line[8]; // speed |
|
| 517 | + $data['heading'] = $line[7]; // heading |
|
| 518 | + $data['latitude'] = $line[4]; // lat |
|
| 519 | + $data['longitude'] = $line[5]; // long |
|
| 520 | + //$data['verticalrate'] = $line[]; // verticale rate |
|
| 521 | + $data['squawk'] = $line[10]; // squawk |
|
| 522 | + $data['emergency'] = ''; // emergency |
|
| 523 | + $data['registration'] = $line[2]; |
|
| 524 | + $data['aircraft_icao'] = $line[0]; |
|
| 525 | + $deparr = explode('-',$line[1]); |
|
| 526 | + if (count($deparr) == 2) { |
|
| 527 | 527 | $data['departure_airport_icao'] = $deparr[0]; |
| 528 | 528 | $data['arrival_airport_icao'] = $deparr[1]; |
| 529 | - } |
|
| 530 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 531 | - $data['format_source'] = 'planeupdatefaa'; |
|
| 532 | - $data['id_source'] = $id_source; |
|
| 533 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 534 | - $SI->add($data); |
|
| 535 | - unset($data); |
|
| 529 | + } |
|
| 530 | + $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 531 | + $data['format_source'] = 'planeupdatefaa'; |
|
| 532 | + $data['id_source'] = $id_source; |
|
| 533 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 534 | + $SI->add($data); |
|
| 535 | + unset($data); |
|
| 536 | + } |
|
| 536 | 537 | } |
| 537 | - } |
|
| 538 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 539 | - $last_exec[$id]['last'] = time(); |
|
| 540 | - } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 541 | - $buffer = $Common->getData($value['host']); |
|
| 542 | - $all_data = json_decode($buffer,true); |
|
| 543 | - if (isset($all_data['states'])) { |
|
| 538 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 539 | + $last_exec[$id]['last'] = time(); |
|
| 540 | + } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 541 | + $buffer = $Common->getData($value['host']); |
|
| 542 | + $all_data = json_decode($buffer,true); |
|
| 543 | + if (isset($all_data['states'])) { |
|
| 544 | 544 | $reset = 0; |
| 545 | 545 | foreach ($all_data['states'] as $key => $line) { |
| 546 | - $data = array(); |
|
| 547 | - $data['hex'] = $line[0]; // hex |
|
| 548 | - $data['ident'] = trim($line[1]); // ident |
|
| 549 | - $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 550 | - $data['speed'] = round($line[9]*1.94384); // speed |
|
| 551 | - $data['heading'] = round($line[10]); // heading |
|
| 552 | - $data['latitude'] = $line[5]; // lat |
|
| 553 | - $data['longitude'] = $line[6]; // long |
|
| 554 | - $data['verticalrate'] = $line[11]; // verticale rate |
|
| 555 | - //$data['squawk'] = $line[10]; // squawk |
|
| 556 | - //$data['emergency'] = ''; // emergency |
|
| 557 | - //$data['registration'] = $line[2]; |
|
| 558 | - //$data['aircraft_icao'] = $line[0]; |
|
| 559 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 560 | - $data['format_source'] = 'opensky'; |
|
| 561 | - $data['id_source'] = $id_source; |
|
| 562 | - $SI->add($data); |
|
| 563 | - unset($data); |
|
| 546 | + $data = array(); |
|
| 547 | + $data['hex'] = $line[0]; // hex |
|
| 548 | + $data['ident'] = trim($line[1]); // ident |
|
| 549 | + $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 550 | + $data['speed'] = round($line[9]*1.94384); // speed |
|
| 551 | + $data['heading'] = round($line[10]); // heading |
|
| 552 | + $data['latitude'] = $line[5]; // lat |
|
| 553 | + $data['longitude'] = $line[6]; // long |
|
| 554 | + $data['verticalrate'] = $line[11]; // verticale rate |
|
| 555 | + //$data['squawk'] = $line[10]; // squawk |
|
| 556 | + //$data['emergency'] = ''; // emergency |
|
| 557 | + //$data['registration'] = $line[2]; |
|
| 558 | + //$data['aircraft_icao'] = $line[0]; |
|
| 559 | + $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 560 | + $data['format_source'] = 'opensky'; |
|
| 561 | + $data['id_source'] = $id_source; |
|
| 562 | + $SI->add($data); |
|
| 563 | + unset($data); |
|
| 564 | + } |
|
| 564 | 565 | } |
| 565 | - } |
|
| 566 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 567 | - $last_exec[$id]['last'] = time(); |
|
| 568 | - //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
| 569 | - } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 570 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 571 | - $buffer = $Common->getData($value['host']); |
|
| 572 | - $all_data = json_decode($buffer,true); |
|
| 573 | - if (!empty($all_data)) $reset = 0; |
|
| 574 | - foreach ($all_data as $key => $line) { |
|
| 566 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 567 | + $last_exec[$id]['last'] = time(); |
|
| 568 | + //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
| 569 | + } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 570 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 571 | + $buffer = $Common->getData($value['host']); |
|
| 572 | + $all_data = json_decode($buffer,true); |
|
| 573 | + if (!empty($all_data)) $reset = 0; |
|
| 574 | + foreach ($all_data as $key => $line) { |
|
| 575 | 575 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 576 | - $data = array(); |
|
| 577 | - $data['hex'] = $line[0]; |
|
| 578 | - $data['ident'] = $line[16]; //$line[13] |
|
| 579 | - $data['altitude'] = $line[4]; // altitude |
|
| 580 | - $data['speed'] = $line[5]; // speed |
|
| 581 | - $data['heading'] = $line[3]; // heading |
|
| 582 | - $data['latitude'] = $line[1]; // lat |
|
| 583 | - $data['longitude'] = $line[2]; // long |
|
| 584 | - $data['verticalrate'] = $line[15]; // verticale rate |
|
| 585 | - $data['squawk'] = $line[6]; // squawk |
|
| 586 | - $data['aircraft_icao'] = $line[8]; |
|
| 587 | - $data['registration'] = $line[9]; |
|
| 588 | - $data['departure_airport_iata'] = $line[11]; |
|
| 589 | - $data['arrival_airport_iata'] = $line[12]; |
|
| 590 | - $data['emergency'] = ''; // emergency |
|
| 591 | - $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 592 | - $data['format_source'] = 'fr24json'; |
|
| 593 | - $data['id_source'] = $id_source; |
|
| 594 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 595 | - $SI->add($data); |
|
| 596 | - unset($data); |
|
| 576 | + $data = array(); |
|
| 577 | + $data['hex'] = $line[0]; |
|
| 578 | + $data['ident'] = $line[16]; //$line[13] |
|
| 579 | + $data['altitude'] = $line[4]; // altitude |
|
| 580 | + $data['speed'] = $line[5]; // speed |
|
| 581 | + $data['heading'] = $line[3]; // heading |
|
| 582 | + $data['latitude'] = $line[1]; // lat |
|
| 583 | + $data['longitude'] = $line[2]; // long |
|
| 584 | + $data['verticalrate'] = $line[15]; // verticale rate |
|
| 585 | + $data['squawk'] = $line[6]; // squawk |
|
| 586 | + $data['aircraft_icao'] = $line[8]; |
|
| 587 | + $data['registration'] = $line[9]; |
|
| 588 | + $data['departure_airport_iata'] = $line[11]; |
|
| 589 | + $data['arrival_airport_iata'] = $line[12]; |
|
| 590 | + $data['emergency'] = ''; // emergency |
|
| 591 | + $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 592 | + $data['format_source'] = 'fr24json'; |
|
| 593 | + $data['id_source'] = $id_source; |
|
| 594 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 595 | + $SI->add($data); |
|
| 596 | + unset($data); |
|
| 597 | + } |
|
| 597 | 598 | } |
| 598 | - } |
|
| 599 | - //$last_exec['fr24json'] = time(); |
|
| 600 | - $last_exec[$id]['last'] = time(); |
|
| 601 | - //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
| 602 | - } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 603 | - //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 604 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 605 | - //echo $buffer; |
|
| 606 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 607 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 608 | - $all_data = json_decode($buffer,true); |
|
| 609 | - if (json_last_error() != JSON_ERROR_NONE) { |
|
| 599 | + //$last_exec['fr24json'] = time(); |
|
| 600 | + $last_exec[$id]['last'] = time(); |
|
| 601 | + //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
| 602 | + } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 603 | + //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 604 | + $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 605 | + //echo $buffer; |
|
| 606 | + $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 607 | + $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 608 | + $all_data = json_decode($buffer,true); |
|
| 609 | + if (json_last_error() != JSON_ERROR_NONE) { |
|
| 610 | 610 | die(json_last_error_msg()); |
| 611 | - } |
|
| 612 | - if (isset($all_data['mrkrs'])) { |
|
| 611 | + } |
|
| 612 | + if (isset($all_data['mrkrs'])) { |
|
| 613 | 613 | $reset = 0; |
| 614 | 614 | foreach ($all_data['mrkrs'] as $key => $line) { |
| 615 | - if (isset($line['inf'])) { |
|
| 615 | + if (isset($line['inf'])) { |
|
| 616 | 616 | $data = array(); |
| 617 | 617 | $data['hex'] = $line['inf']['ia']; |
| 618 | 618 | if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
| 619 | - $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 620 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 621 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 622 | - $data['latitude'] = $line['pt'][0]; // lat |
|
| 623 | - $data['longitude'] = $line['pt'][1]; // long |
|
| 624 | - //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 625 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 626 | - //$data['aircraft_icao'] = $line[8]; |
|
| 627 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 619 | + $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 620 | + if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 621 | + if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 622 | + $data['latitude'] = $line['pt'][0]; // lat |
|
| 623 | + $data['longitude'] = $line['pt'][1]; // long |
|
| 624 | + //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 625 | + if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 626 | + //$data['aircraft_icao'] = $line[8]; |
|
| 627 | + if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 628 | 628 | //$data['departure_airport_iata'] = $line[11]; |
| 629 | 629 | //$data['arrival_airport_iata'] = $line[12]; |
| 630 | - //$data['emergency'] = ''; // emergency |
|
| 630 | + //$data['emergency'] = ''; // emergency |
|
| 631 | 631 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 632 | - $data['format_source'] = 'radarvirtueljson'; |
|
| 633 | - $data['id_source'] = $id_source; |
|
| 632 | + $data['format_source'] = 'radarvirtueljson'; |
|
| 633 | + $data['id_source'] = $id_source; |
|
| 634 | 634 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 635 | 635 | $SI->add($data); |
| 636 | 636 | unset($data); |
| 637 | - } |
|
| 637 | + } |
|
| 638 | + } |
|
| 638 | 639 | } |
| 639 | - } |
|
| 640 | - //$last_exec['radarvirtueljson'] = time(); |
|
| 641 | - $last_exec[$id]['last'] = time(); |
|
| 642 | - //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
| 643 | - } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 644 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 645 | - $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 646 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
| 640 | + //$last_exec['radarvirtueljson'] = time(); |
|
| 641 | + $last_exec[$id]['last'] = time(); |
|
| 642 | + //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
| 643 | + } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 644 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 645 | + $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 646 | + $all_data = json_decode(utf8_encode($buffer),true); |
|
| 647 | 647 | |
| 648 | - if (isset($all_data['pireps'])) { |
|
| 648 | + if (isset($all_data['pireps'])) { |
|
| 649 | 649 | $reset = 0; |
| 650 | - foreach ($all_data['pireps'] as $line) { |
|
| 651 | - $data = array(); |
|
| 652 | - $data['id'] = $line['id']; |
|
| 653 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 654 | - $data['ident'] = $line['callsign']; // ident |
|
| 655 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 656 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 657 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 658 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 659 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 660 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 661 | - $data['latitude'] = $line['lat']; // lat |
|
| 662 | - $data['longitude'] = $line['lon']; // long |
|
| 663 | - //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 664 | - //$data['squawk'] = $line['squawk']; // squawk |
|
| 665 | - //$data['emergency'] = ''; // emergency |
|
| 666 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 667 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 668 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 669 | - //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 670 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 671 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 672 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 673 | - else $data['info'] = ''; |
|
| 674 | - $data['format_source'] = 'pireps'; |
|
| 675 | - $data['id_source'] = $id_source; |
|
| 676 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 677 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 678 | - if ($line['icon'] == 'plane') { |
|
| 650 | + foreach ($all_data['pireps'] as $line) { |
|
| 651 | + $data = array(); |
|
| 652 | + $data['id'] = $line['id']; |
|
| 653 | + $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 654 | + $data['ident'] = $line['callsign']; // ident |
|
| 655 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 656 | + if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 657 | + if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 658 | + if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 659 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 660 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 661 | + $data['latitude'] = $line['lat']; // lat |
|
| 662 | + $data['longitude'] = $line['lon']; // long |
|
| 663 | + //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 664 | + //$data['squawk'] = $line['squawk']; // squawk |
|
| 665 | + //$data['emergency'] = ''; // emergency |
|
| 666 | + if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 667 | + if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 668 | + if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 669 | + //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 670 | + if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 671 | + if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 672 | + if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 673 | + else $data['info'] = ''; |
|
| 674 | + $data['format_source'] = 'pireps'; |
|
| 675 | + $data['id_source'] = $id_source; |
|
| 676 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 677 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 678 | + if ($line['icon'] == 'plane') { |
|
| 679 | 679 | $SI->add($data); |
| 680 | - // print_r($data); |
|
| 681 | - } elseif ($line['icon'] == 'ct') { |
|
| 680 | + // print_r($data); |
|
| 681 | + } elseif ($line['icon'] == 'ct') { |
|
| 682 | 682 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 683 | 683 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 684 | 684 | $typec = substr($data['ident'],-3); |
@@ -693,163 +693,163 @@ discard block |
||
| 693 | 693 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
| 694 | 694 | else $data['type'] = 'Observer'; |
| 695 | 695 | echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
| 696 | - } |
|
| 697 | - unset($data); |
|
| 696 | + } |
|
| 697 | + unset($data); |
|
| 698 | + } |
|
| 698 | 699 | } |
| 699 | - } |
|
| 700 | - //$last_exec['pirepsjson'] = time(); |
|
| 701 | - $last_exec[$id]['last'] = time(); |
|
| 702 | - //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
| 703 | - } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 704 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 705 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 706 | - $buffer = $Common->getData($value['host']); |
|
| 707 | - $all_data = json_decode($buffer,true); |
|
| 708 | - if ($buffer != '' && is_array($all_data)) { |
|
| 700 | + //$last_exec['pirepsjson'] = time(); |
|
| 701 | + $last_exec[$id]['last'] = time(); |
|
| 702 | + //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
| 703 | + } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 704 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 705 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 706 | + $buffer = $Common->getData($value['host']); |
|
| 707 | + $all_data = json_decode($buffer,true); |
|
| 708 | + if ($buffer != '' && is_array($all_data)) { |
|
| 709 | 709 | $reset = 0; |
| 710 | 710 | foreach ($all_data as $line) { |
| 711 | - $data = array(); |
|
| 712 | - //$data['id'] = $line['id']; // id not usable |
|
| 713 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 714 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 715 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 716 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 717 | - $data['ident'] = $line['flightnum']; // ident |
|
| 718 | - $data['altitude'] = $line['alt']; // altitude |
|
| 719 | - $data['speed'] = $line['gs']; // speed |
|
| 720 | - $data['heading'] = $line['heading']; // heading |
|
| 721 | - $data['latitude'] = $line['lat']; // lat |
|
| 722 | - $data['longitude'] = $line['lng']; // long |
|
| 723 | - $data['verticalrate'] = ''; // verticale rate |
|
| 724 | - $data['squawk'] = ''; // squawk |
|
| 725 | - $data['emergency'] = ''; // emergency |
|
| 726 | - //$data['datetime'] = $line['lastupdate']; |
|
| 727 | - $data['last_update'] = $line['lastupdate']; |
|
| 728 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 729 | - $data['departure_airport_icao'] = $line['depicao']; |
|
| 730 | - $data['departure_airport_time'] = $line['deptime']; |
|
| 731 | - $data['arrival_airport_icao'] = $line['arricao']; |
|
| 732 | - $data['arrival_airport_time'] = $line['arrtime']; |
|
| 733 | - $data['registration'] = $line['aircraft']; |
|
| 734 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 735 | - if (isset($line['aircraftname'])) { |
|
| 711 | + $data = array(); |
|
| 712 | + //$data['id'] = $line['id']; // id not usable |
|
| 713 | + if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 714 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 715 | + if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 716 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 717 | + $data['ident'] = $line['flightnum']; // ident |
|
| 718 | + $data['altitude'] = $line['alt']; // altitude |
|
| 719 | + $data['speed'] = $line['gs']; // speed |
|
| 720 | + $data['heading'] = $line['heading']; // heading |
|
| 721 | + $data['latitude'] = $line['lat']; // lat |
|
| 722 | + $data['longitude'] = $line['lng']; // long |
|
| 723 | + $data['verticalrate'] = ''; // verticale rate |
|
| 724 | + $data['squawk'] = ''; // squawk |
|
| 725 | + $data['emergency'] = ''; // emergency |
|
| 726 | + //$data['datetime'] = $line['lastupdate']; |
|
| 727 | + $data['last_update'] = $line['lastupdate']; |
|
| 728 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 729 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 730 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 731 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 732 | + $data['arrival_airport_time'] = $line['arrtime']; |
|
| 733 | + $data['registration'] = $line['aircraft']; |
|
| 734 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 735 | + if (isset($line['aircraftname'])) { |
|
| 736 | 736 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 737 | 737 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 738 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
| 739 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 740 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 741 | - else { |
|
| 742 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 743 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 744 | - else $data['aircraft_icao'] = $line['aircraftname']; |
|
| 745 | - } |
|
| 746 | - } |
|
| 747 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 748 | - $data['id_source'] = $id_source; |
|
| 749 | - $data['format_source'] = 'phpvmacars'; |
|
| 750 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 751 | - $SI->add($data); |
|
| 752 | - unset($data); |
|
| 738 | + $aircraft_data = explode('-',$line['aircraftname']); |
|
| 739 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 740 | + elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 741 | + else { |
|
| 742 | + $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 743 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 744 | + else $data['aircraft_icao'] = $line['aircraftname']; |
|
| 745 | + } |
|
| 746 | + } |
|
| 747 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 748 | + $data['id_source'] = $id_source; |
|
| 749 | + $data['format_source'] = 'phpvmacars'; |
|
| 750 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 751 | + $SI->add($data); |
|
| 752 | + unset($data); |
|
| 753 | 753 | } |
| 754 | 754 | if ($globalDebug) echo 'No more data...'."\n"; |
| 755 | 755 | unset($buffer); |
| 756 | 756 | unset($all_data); |
| 757 | - } |
|
| 758 | - //$last_exec['phpvmacars'] = time(); |
|
| 759 | - $last_exec[$id]['last'] = time(); |
|
| 760 | - } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 761 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 762 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 763 | - $buffer = $Common->getData($value['host']); |
|
| 764 | - $all_data = json_decode($buffer,true); |
|
| 765 | - if ($buffer != '' && is_array($all_data)) { |
|
| 757 | + } |
|
| 758 | + //$last_exec['phpvmacars'] = time(); |
|
| 759 | + $last_exec[$id]['last'] = time(); |
|
| 760 | + } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 761 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 762 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 763 | + $buffer = $Common->getData($value['host']); |
|
| 764 | + $all_data = json_decode($buffer,true); |
|
| 765 | + if ($buffer != '' && is_array($all_data)) { |
|
| 766 | 766 | $reset = 0; |
| 767 | 767 | foreach ($all_data as $line) { |
| 768 | - $data = array(); |
|
| 769 | - //$data['id'] = $line['id']; // id not usable |
|
| 770 | - $data['id'] = trim($line['flight_id']); |
|
| 771 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 772 | - $data['pilot_name'] = $line['pilot_name']; |
|
| 773 | - $data['pilot_id'] = $line['pilot_id']; |
|
| 774 | - $data['ident'] = trim($line['callsign']); // ident |
|
| 775 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 776 | - $data['speed'] = $line['gs']; // speed |
|
| 777 | - $data['heading'] = $line['heading']; // heading |
|
| 778 | - $data['latitude'] = $line['latitude']; // lat |
|
| 779 | - $data['longitude'] = $line['longitude']; // long |
|
| 780 | - $data['verticalrate'] = ''; // verticale rate |
|
| 781 | - $data['squawk'] = ''; // squawk |
|
| 782 | - $data['emergency'] = ''; // emergency |
|
| 783 | - //$data['datetime'] = $line['lastupdate']; |
|
| 784 | - $data['last_update'] = $line['last_update']; |
|
| 785 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 786 | - $data['departure_airport_icao'] = $line['departure']; |
|
| 787 | - //$data['departure_airport_time'] = $line['departure_time']; |
|
| 788 | - $data['arrival_airport_icao'] = $line['arrival']; |
|
| 789 | - //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 790 | - //$data['registration'] = $line['aircraft']; |
|
| 791 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 792 | - $data['aircraft_icao'] = $line['plane_type']; |
|
| 793 | - $data['id_source'] = $id_source; |
|
| 794 | - $data['format_source'] = 'vam'; |
|
| 795 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 796 | - $SI->add($data); |
|
| 797 | - unset($data); |
|
| 768 | + $data = array(); |
|
| 769 | + //$data['id'] = $line['id']; // id not usable |
|
| 770 | + $data['id'] = trim($line['flight_id']); |
|
| 771 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 772 | + $data['pilot_name'] = $line['pilot_name']; |
|
| 773 | + $data['pilot_id'] = $line['pilot_id']; |
|
| 774 | + $data['ident'] = trim($line['callsign']); // ident |
|
| 775 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 776 | + $data['speed'] = $line['gs']; // speed |
|
| 777 | + $data['heading'] = $line['heading']; // heading |
|
| 778 | + $data['latitude'] = $line['latitude']; // lat |
|
| 779 | + $data['longitude'] = $line['longitude']; // long |
|
| 780 | + $data['verticalrate'] = ''; // verticale rate |
|
| 781 | + $data['squawk'] = ''; // squawk |
|
| 782 | + $data['emergency'] = ''; // emergency |
|
| 783 | + //$data['datetime'] = $line['lastupdate']; |
|
| 784 | + $data['last_update'] = $line['last_update']; |
|
| 785 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 786 | + $data['departure_airport_icao'] = $line['departure']; |
|
| 787 | + //$data['departure_airport_time'] = $line['departure_time']; |
|
| 788 | + $data['arrival_airport_icao'] = $line['arrival']; |
|
| 789 | + //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 790 | + //$data['registration'] = $line['aircraft']; |
|
| 791 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 792 | + $data['aircraft_icao'] = $line['plane_type']; |
|
| 793 | + $data['id_source'] = $id_source; |
|
| 794 | + $data['format_source'] = 'vam'; |
|
| 795 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 796 | + $SI->add($data); |
|
| 797 | + unset($data); |
|
| 798 | 798 | } |
| 799 | 799 | if ($globalDebug) echo 'No more data...'."\n"; |
| 800 | 800 | unset($buffer); |
| 801 | 801 | unset($all_data); |
| 802 | - } |
|
| 803 | - //$last_exec['phpvmacars'] = time(); |
|
| 804 | - $last_exec[$id]['last'] = time(); |
|
| 802 | + } |
|
| 803 | + //$last_exec['phpvmacars'] = time(); |
|
| 804 | + $last_exec[$id]['last'] = time(); |
|
| 805 | 805 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
| 806 | 806 | } elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3') { |
| 807 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 808 | - //$last_exec[$id]['last'] = time(); |
|
| 807 | + if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 808 | + //$last_exec[$id]['last'] = time(); |
|
| 809 | 809 | |
| 810 | - //$read = array( $sockets[$id] ); |
|
| 811 | - $read = $sockets; |
|
| 812 | - $write = NULL; |
|
| 813 | - $e = NULL; |
|
| 814 | - $n = socket_select($read, $write, $e, $timeout); |
|
| 815 | - if ($e != NULL) var_dump($e); |
|
| 816 | - if ($n > 0) { |
|
| 810 | + //$read = array( $sockets[$id] ); |
|
| 811 | + $read = $sockets; |
|
| 812 | + $write = NULL; |
|
| 813 | + $e = NULL; |
|
| 814 | + $n = socket_select($read, $write, $e, $timeout); |
|
| 815 | + if ($e != NULL) var_dump($e); |
|
| 816 | + if ($n > 0) { |
|
| 817 | 817 | $reset = 0; |
| 818 | 818 | foreach ($read as $nb => $r) { |
| 819 | - //$value = $formats[$nb]; |
|
| 820 | - $format = $globalSources[$nb]['format']; |
|
| 821 | - if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
| 822 | - $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 823 | - } else { |
|
| 824 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 825 | - } |
|
| 826 | - //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 827 | - //echo $buffer."\n"; |
|
| 828 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 829 | - //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 830 | - $error = false; |
|
| 831 | - //$SI::del(); |
|
| 832 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 833 | - // SBS format is CSV format |
|
| 834 | - if ($buffer != '') { |
|
| 819 | + //$value = $formats[$nb]; |
|
| 820 | + $format = $globalSources[$nb]['format']; |
|
| 821 | + if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
| 822 | + $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 823 | + } else { |
|
| 824 | + $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 825 | + } |
|
| 826 | + //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 827 | + //echo $buffer."\n"; |
|
| 828 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 829 | + //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 830 | + $error = false; |
|
| 831 | + //$SI::del(); |
|
| 832 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 833 | + // SBS format is CSV format |
|
| 834 | + if ($buffer != '') { |
|
| 835 | 835 | $tt[$format] = 0; |
| 836 | 836 | if ($format == 'acarssbs3') { |
| 837 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 838 | - $ACARS->add(trim($buffer)); |
|
| 839 | - $ACARS->deleteLiveAcarsData(); |
|
| 837 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 838 | + $ACARS->add(trim($buffer)); |
|
| 839 | + $ACARS->deleteLiveAcarsData(); |
|
| 840 | 840 | } elseif ($format == 'raw') { |
| 841 | - // AVR format |
|
| 842 | - $data = $SBS->parse($buffer); |
|
| 843 | - if (is_array($data)) { |
|
| 841 | + // AVR format |
|
| 842 | + $data = $SBS->parse($buffer); |
|
| 843 | + if (is_array($data)) { |
|
| 844 | 844 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 845 | 845 | $data['format_source'] = 'raw'; |
| 846 | 846 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 847 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 848 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 849 | - } |
|
| 850 | - } elseif ($format == 'flightgearsp') { |
|
| 851 | - //echo $buffer."\n"; |
|
| 852 | - if (strlen($buffer) > 5) { |
|
| 847 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 848 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 849 | + } |
|
| 850 | + } elseif ($format == 'flightgearsp') { |
|
| 851 | + //echo $buffer."\n"; |
|
| 852 | + if (strlen($buffer) > 5) { |
|
| 853 | 853 | $line = explode(',',$buffer); |
| 854 | 854 | $data = array(); |
| 855 | 855 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
@@ -865,114 +865,114 @@ discard block |
||
| 865 | 865 | $data['format_source'] = 'flightgearsp'; |
| 866 | 866 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
| 867 | 867 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 868 | - } |
|
| 869 | - } elseif ($format == 'acars') { |
|
| 870 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 871 | - $ACARS->add(trim($buffer)); |
|
| 872 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 873 | - $ACARS->deleteLiveAcarsData(); |
|
| 868 | + } |
|
| 869 | + } elseif ($format == 'acars') { |
|
| 870 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 871 | + $ACARS->add(trim($buffer)); |
|
| 872 | + socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 873 | + $ACARS->deleteLiveAcarsData(); |
|
| 874 | 874 | } elseif ($format == 'flightgearmp') { |
| 875 | - if (substr($buffer,0,1) != '#') { |
|
| 875 | + if (substr($buffer,0,1) != '#') { |
|
| 876 | 876 | $data = array(); |
| 877 | 877 | //echo $buffer."\n"; |
| 878 | 878 | $line = explode(' ',$buffer); |
| 879 | 879 | if (count($line) == 11) { |
| 880 | - $userserver = explode('@',$line[0]); |
|
| 881 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 882 | - $data['ident'] = $userserver[0]; |
|
| 883 | - $data['registration'] = $userserver[0]; |
|
| 884 | - $data['latitude'] = $line[4]; |
|
| 885 | - $data['longitude'] = $line[5]; |
|
| 886 | - $data['altitude'] = $line[6]; |
|
| 887 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 888 | - $aircraft_type = $line[10]; |
|
| 889 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 890 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 891 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 880 | + $userserver = explode('@',$line[0]); |
|
| 881 | + $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 882 | + $data['ident'] = $userserver[0]; |
|
| 883 | + $data['registration'] = $userserver[0]; |
|
| 884 | + $data['latitude'] = $line[4]; |
|
| 885 | + $data['longitude'] = $line[5]; |
|
| 886 | + $data['altitude'] = $line[6]; |
|
| 887 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 888 | + $aircraft_type = $line[10]; |
|
| 889 | + $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 890 | + $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 891 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 892 | + } |
|
| 892 | 893 | } |
| 893 | - } |
|
| 894 | 894 | } elseif ($format == 'beast') { |
| 895 | - echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 896 | - die; |
|
| 895 | + echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 896 | + die; |
|
| 897 | 897 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
| 898 | - $line = explode("\t", $buffer); |
|
| 899 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
| 898 | + $line = explode("\t", $buffer); |
|
| 899 | + for($k = 0; $k < count($line); $k=$k+2) { |
|
| 900 | 900 | $key = $line[$k]; |
| 901 | - $lined[$key] = $line[$k+1]; |
|
| 902 | - } |
|
| 903 | - if (count($lined) > 3) { |
|
| 904 | - $data['hex'] = $lined['hexid']; |
|
| 905 | - //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 906 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 907 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 908 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 909 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 910 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 911 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 912 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 913 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 914 | - $data['id_source'] = $id_source; |
|
| 915 | - $data['format_source'] = 'tsv'; |
|
| 916 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 917 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 918 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 919 | - unset($lined); |
|
| 920 | - unset($data); |
|
| 921 | - } else $error = true; |
|
| 901 | + $lined[$key] = $line[$k+1]; |
|
| 902 | + } |
|
| 903 | + if (count($lined) > 3) { |
|
| 904 | + $data['hex'] = $lined['hexid']; |
|
| 905 | + //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 906 | + $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 907 | + if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 908 | + if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 909 | + if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 910 | + if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 911 | + if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 912 | + if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 913 | + if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 914 | + $data['id_source'] = $id_source; |
|
| 915 | + $data['format_source'] = 'tsv'; |
|
| 916 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 917 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 918 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 919 | + unset($lined); |
|
| 920 | + unset($data); |
|
| 921 | + } else $error = true; |
|
| 922 | 922 | } elseif ($format == 'aprs' && $use_aprs) { |
| 923 | - if ($aprs_connect == 0) { |
|
| 923 | + if ($aprs_connect == 0) { |
|
| 924 | 924 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
| 925 | 925 | $aprs_connect = 1; |
| 926 | - } |
|
| 927 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 926 | + } |
|
| 927 | + if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 928 | 928 | $aprs_last_tx = time(); |
| 929 | 929 | $data_aprs = "# Keep alive"; |
| 930 | 930 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 931 | - } |
|
| 932 | - //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 933 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
| 934 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
| 935 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 931 | + } |
|
| 932 | + //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 933 | + $buffer = str_replace('APRS <- ','',$buffer); |
|
| 934 | + $buffer = str_replace('APRS -> ','',$buffer); |
|
| 935 | + if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 936 | 936 | $line = $APRS->parse($buffer); |
| 937 | 937 | if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
| 938 | - $data = array(); |
|
| 939 | - //print_r($line); |
|
| 940 | - $data['hex'] = $line['address']; |
|
| 941 | - $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 942 | - //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 943 | - $data['ident'] = $line['ident']; |
|
| 944 | - $data['latitude'] = $line['latitude']; |
|
| 945 | - $data['longitude'] = $line['longitude']; |
|
| 946 | - //$data['verticalrate'] = $line[16]; |
|
| 947 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 948 | - else $data['speed'] = 0; |
|
| 949 | - $data['altitude'] = $line['altitude']; |
|
| 950 | - if (isset($line['course'])) $data['heading'] = $line['course']; |
|
| 951 | - //else $data['heading'] = 0; |
|
| 952 | - $data['aircraft_type'] = $line['stealth']; |
|
| 953 | - if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
| 954 | - $data['id_source'] = $id_source; |
|
| 955 | - $data['format_source'] = 'aprs'; |
|
| 956 | - $data['source_name'] = $line['source']; |
|
| 957 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 958 | - $currentdate = date('Y-m-d H:i:s'); |
|
| 959 | - $aprsdate = strtotime($data['datetime']); |
|
| 960 | - // Accept data if time <= system time + 20s |
|
| 961 | - if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
| 962 | - else { |
|
| 938 | + $data = array(); |
|
| 939 | + //print_r($line); |
|
| 940 | + $data['hex'] = $line['address']; |
|
| 941 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 942 | + //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 943 | + $data['ident'] = $line['ident']; |
|
| 944 | + $data['latitude'] = $line['latitude']; |
|
| 945 | + $data['longitude'] = $line['longitude']; |
|
| 946 | + //$data['verticalrate'] = $line[16]; |
|
| 947 | + if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 948 | + else $data['speed'] = 0; |
|
| 949 | + $data['altitude'] = $line['altitude']; |
|
| 950 | + if (isset($line['course'])) $data['heading'] = $line['course']; |
|
| 951 | + //else $data['heading'] = 0; |
|
| 952 | + $data['aircraft_type'] = $line['stealth']; |
|
| 953 | + if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
| 954 | + $data['id_source'] = $id_source; |
|
| 955 | + $data['format_source'] = 'aprs'; |
|
| 956 | + $data['source_name'] = $line['source']; |
|
| 957 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 958 | + $currentdate = date('Y-m-d H:i:s'); |
|
| 959 | + $aprsdate = strtotime($data['datetime']); |
|
| 960 | + // Accept data if time <= system time + 20s |
|
| 961 | + if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
| 962 | + else { |
|
| 963 | 963 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
| 964 | 964 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
| 965 | - } |
|
| 966 | - unset($data); |
|
| 965 | + } |
|
| 966 | + unset($data); |
|
| 967 | 967 | } |
| 968 | 968 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 969 | 969 | elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
| 970 | - } |
|
| 970 | + } |
|
| 971 | 971 | } else { |
| 972 | - $line = explode(',', $buffer); |
|
| 973 | - if (count($line) > 20) { |
|
| 974 | - $data['hex'] = $line[4]; |
|
| 975 | - /* |
|
| 972 | + $line = explode(',', $buffer); |
|
| 973 | + if (count($line) > 20) { |
|
| 974 | + $data['hex'] = $line[4]; |
|
| 975 | + /* |
|
| 976 | 976 | $data['datetime'] = $line[6].' '.$line[7]; |
| 977 | 977 | date_default_timezone_set($globalTimezone); |
| 978 | 978 | $datetime = new DateTime($data['datetime']); |
@@ -980,29 +980,29 @@ discard block |
||
| 980 | 980 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 981 | 981 | date_default_timezone_set('UTC'); |
| 982 | 982 | */ |
| 983 | - // Force datetime to current UTC datetime |
|
| 984 | - date_default_timezone_set('UTC'); |
|
| 985 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 986 | - $data['ident'] = trim($line[10]); |
|
| 987 | - $data['latitude'] = $line[14]; |
|
| 988 | - $data['longitude'] = $line[15]; |
|
| 989 | - $data['verticalrate'] = $line[16]; |
|
| 990 | - $data['emergency'] = $line[20]; |
|
| 991 | - $data['speed'] = $line[12]; |
|
| 992 | - $data['squawk'] = $line[17]; |
|
| 993 | - $data['altitude'] = $line[11]; |
|
| 994 | - $data['heading'] = $line[13]; |
|
| 995 | - $data['ground'] = $line[21]; |
|
| 996 | - $data['emergency'] = $line[19]; |
|
| 997 | - $data['format_source'] = 'sbs'; |
|
| 983 | + // Force datetime to current UTC datetime |
|
| 984 | + date_default_timezone_set('UTC'); |
|
| 985 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 986 | + $data['ident'] = trim($line[10]); |
|
| 987 | + $data['latitude'] = $line[14]; |
|
| 988 | + $data['longitude'] = $line[15]; |
|
| 989 | + $data['verticalrate'] = $line[16]; |
|
| 990 | + $data['emergency'] = $line[20]; |
|
| 991 | + $data['speed'] = $line[12]; |
|
| 992 | + $data['squawk'] = $line[17]; |
|
| 993 | + $data['altitude'] = $line[11]; |
|
| 994 | + $data['heading'] = $line[13]; |
|
| 995 | + $data['ground'] = $line[21]; |
|
| 996 | + $data['emergency'] = $line[19]; |
|
| 997 | + $data['format_source'] = 'sbs'; |
|
| 998 | 998 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 999 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1000 | - $data['id_source'] = $id_source; |
|
| 1001 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1002 | - else $error = true; |
|
| 1003 | - unset($data); |
|
| 1004 | - } else $error = true; |
|
| 1005 | - if ($error) { |
|
| 999 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1000 | + $data['id_source'] = $id_source; |
|
| 1001 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1002 | + else $error = true; |
|
| 1003 | + unset($data); |
|
| 1004 | + } else $error = true; |
|
| 1005 | + if ($error) { |
|
| 1006 | 1006 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
| 1007 | 1007 | if ($globalDebug) echo "Not a message. Ignoring... \n"; |
| 1008 | 1008 | } else { |
@@ -1018,13 +1018,13 @@ discard block |
||
| 1018 | 1018 | connect_all($sourceer); |
| 1019 | 1019 | $sourceer = array(); |
| 1020 | 1020 | } |
| 1021 | - } |
|
| 1021 | + } |
|
| 1022 | 1022 | } |
| 1023 | 1023 | // Sleep for xxx microseconds |
| 1024 | 1024 | if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
| 1025 | - } else { |
|
| 1025 | + } else { |
|
| 1026 | 1026 | if ($format == 'flightgearmp') { |
| 1027 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1027 | + if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1028 | 1028 | //@socket_close($r); |
| 1029 | 1029 | sleep($globalMinFetch); |
| 1030 | 1030 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1033,9 +1033,9 @@ discard block |
||
| 1033 | 1033 | break; |
| 1034 | 1034 | |
| 1035 | 1035 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1036 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1037 | - else $tt[$format] = 0; |
|
| 1038 | - if ($tt[$format] > 30) { |
|
| 1036 | + if (isset($tt[$format])) $tt[$format]++; |
|
| 1037 | + else $tt[$format] = 0; |
|
| 1038 | + if ($tt[$format] > 30) { |
|
| 1039 | 1039 | if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
| 1040 | 1040 | //@socket_close($r); |
| 1041 | 1041 | sleep(2); |
@@ -1046,23 +1046,23 @@ discard block |
||
| 1046 | 1046 | //connect_all($globalSources); |
| 1047 | 1047 | $tt[$format]=0; |
| 1048 | 1048 | break; |
| 1049 | - } |
|
| 1049 | + } |
|
| 1050 | + } |
|
| 1050 | 1051 | } |
| 1051 | - } |
|
| 1052 | 1052 | } |
| 1053 | - } else { |
|
| 1053 | + } else { |
|
| 1054 | 1054 | $error = socket_strerror(socket_last_error()); |
| 1055 | 1055 | if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
| 1056 | 1056 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || time() - $time >= $timeout) { |
| 1057 | 1057 | if (isset($globalDebug)) echo "Restarting...\n"; |
| 1058 | 1058 | // Restart the script if possible |
| 1059 | 1059 | if (is_array($sockets)) { |
| 1060 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1060 | + if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1061 | 1061 | |
| 1062 | - foreach ($sockets as $sock) { |
|
| 1062 | + foreach ($sockets as $sock) { |
|
| 1063 | 1063 | @socket_shutdown($sock,2); |
| 1064 | 1064 | @socket_close($sock); |
| 1065 | - } |
|
| 1065 | + } |
|
| 1066 | 1066 | |
| 1067 | 1067 | } |
| 1068 | 1068 | if ($globalDebug) echo "Restart all connections..."; |
@@ -1073,13 +1073,13 @@ discard block |
||
| 1073 | 1073 | if ($reset > 40) exit('Too many attempts...'); |
| 1074 | 1074 | connect_all($globalSources); |
| 1075 | 1075 | } |
| 1076 | - } |
|
| 1076 | + } |
|
| 1077 | 1077 | } |
| 1078 | 1078 | if ($globalDaemon === false) { |
| 1079 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1080 | - $SI->checkAll(); |
|
| 1079 | + if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1080 | + $SI->checkAll(); |
|
| 1081 | + } |
|
| 1081 | 1082 | } |
| 1082 | - } |
|
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | 1085 | ?> |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | - unset($_COOKIE['stats_airline_icao']); |
|
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | - $airline_icao = ''; |
|
| 11 | + unset($_COOKIE['stats_airline_icao']); |
|
| 12 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | + $airline_icao = ''; |
|
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | 18 | } |
| 19 | 19 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 20 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | function drawChart() { |
| 36 | 36 | var data = google.visualization.arrayToDataTable([ |
| 37 | 37 | ["'._("Owner").'", "'._("# of times").'"], '; |
| 38 | - $owner_data = ''; |
|
| 38 | + $owner_data = ''; |
|
| 39 | 39 | foreach($owner_array as $owner_item) |
| 40 | 40 | { |
| 41 | 41 | $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
| 42 | 42 | } |
| 43 | 43 | $owner_data = substr($owner_data, 0, -1); |
| 44 | 44 | print $owner_data; |
| 45 | - print ']); |
|
| 45 | + print ']); |
|
| 46 | 46 | |
| 47 | 47 | var options = { |
| 48 | 48 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | - unset($_COOKIE['stats_airline_icao']); |
|
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | - $airline_icao = ''; |
|
| 11 | + unset($_COOKIE['stats_airline_icao']); |
|
| 12 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | + $airline_icao = ''; |
|
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | 18 | } |
| 19 | 19 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 20 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | function drawChart() { |
| 37 | 37 | var data = google.visualization.arrayToDataTable([ |
| 38 | 38 | ["'._("Pilot").'", "'._("# of times").'"], '; |
| 39 | - $pilot_data = ''; |
|
| 39 | + $pilot_data = ''; |
|
| 40 | 40 | foreach($pilot_array as $pilot_item) |
| 41 | 41 | { |
| 42 | 42 | $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
| 43 | 43 | } |
| 44 | 44 | $pilot_data = substr($pilot_data, 0, -1); |
| 45 | 45 | print $pilot_data; |
| 46 | - print ']); |
|
| 46 | + print ']); |
|
| 47 | 47 | |
| 48 | 48 | var options = { |
| 49 | 49 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -15,33 +15,33 @@ discard block |
||
| 15 | 15 | if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
| 16 | 16 | $Connection = new Connection($dbc); |
| 17 | 17 | $this->db = $Connection->db(); |
| 18 | - } |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | 20 | public function addLastStatsUpdate($type,$stats_date) { |
| 21 | - $query = "DELETE FROM config WHERE name = :type; |
|
| 21 | + $query = "DELETE FROM config WHERE name = :type; |
|
| 22 | 22 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
| 23 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 24 | - try { |
|
| 25 | - $sth = $this->db->prepare($query); |
|
| 26 | - $sth->execute($query_values); |
|
| 27 | - } catch(PDOException $e) { |
|
| 28 | - return "error : ".$e->getMessage(); |
|
| 29 | - } |
|
| 30 | - } |
|
| 23 | + $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 24 | + try { |
|
| 25 | + $sth = $this->db->prepare($query); |
|
| 26 | + $sth->execute($query_values); |
|
| 27 | + } catch(PDOException $e) { |
|
| 28 | + return "error : ".$e->getMessage(); |
|
| 29 | + } |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | public function getLastStatsUpdate($type = 'last_update_stats') { |
| 33 | - $query = "SELECT value FROM config WHERE name = :type"; |
|
| 34 | - try { |
|
| 35 | - $sth = $this->db->prepare($query); |
|
| 36 | - $sth->execute(array(':type' => $type)); |
|
| 37 | - } catch(PDOException $e) { |
|
| 38 | - echo "error : ".$e->getMessage(); |
|
| 39 | - } |
|
| 40 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 41 | - return $all; |
|
| 42 | - } |
|
| 43 | - public function deleteStats($filter_name = '') { |
|
| 44 | - /* |
|
| 33 | + $query = "SELECT value FROM config WHERE name = :type"; |
|
| 34 | + try { |
|
| 35 | + $sth = $this->db->prepare($query); |
|
| 36 | + $sth->execute(array(':type' => $type)); |
|
| 37 | + } catch(PDOException $e) { |
|
| 38 | + echo "error : ".$e->getMessage(); |
|
| 39 | + } |
|
| 40 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 41 | + return $all; |
|
| 42 | + } |
|
| 43 | + public function deleteStats($filter_name = '') { |
|
| 44 | + /* |
|
| 45 | 45 | $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
| 46 | 46 | try { |
| 47 | 47 | $sth = $this->db->prepare($query); |
@@ -50,80 +50,80 @@ discard block |
||
| 50 | 50 | return "error : ".$e->getMessage(); |
| 51 | 51 | } |
| 52 | 52 | */ |
| 53 | - $query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
| 54 | - try { |
|
| 55 | - $sth = $this->db->prepare($query); |
|
| 56 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 57 | - } catch(PDOException $e) { |
|
| 58 | - return "error : ".$e->getMessage(); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - public function deleteOldStats($filter_name = '') { |
|
| 53 | + $query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
| 54 | + try { |
|
| 55 | + $sth = $this->db->prepare($query); |
|
| 56 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 57 | + } catch(PDOException $e) { |
|
| 58 | + return "error : ".$e->getMessage(); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + public function deleteOldStats($filter_name = '') { |
|
| 62 | 62 | |
| 63 | - $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
|
| 64 | - try { |
|
| 65 | - $sth = $this->db->prepare($query); |
|
| 66 | - $sth->execute(); |
|
| 67 | - } catch(PDOException $e) { |
|
| 68 | - return "error : ".$e->getMessage(); |
|
| 69 | - } |
|
| 63 | + $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
|
| 64 | + try { |
|
| 65 | + $sth = $this->db->prepare($query); |
|
| 66 | + $sth->execute(); |
|
| 67 | + } catch(PDOException $e) { |
|
| 68 | + return "error : ".$e->getMessage(); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - $query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
| 72 | - try { |
|
| 73 | - $sth = $this->db->prepare($query); |
|
| 74 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 75 | - } catch(PDOException $e) { |
|
| 76 | - return "error : ".$e->getMessage(); |
|
| 77 | - } |
|
| 78 | - } |
|
| 71 | + $query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
| 72 | + try { |
|
| 73 | + $sth = $this->db->prepare($query); |
|
| 74 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 75 | + } catch(PDOException $e) { |
|
| 76 | + return "error : ".$e->getMessage(); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | 79 | public function getAllAirlineNames($filter_name = '') { |
| 80 | 80 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 81 | - $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
| 82 | - try { |
|
| 83 | - $sth = $this->db->prepare($query); |
|
| 84 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 85 | - } catch(PDOException $e) { |
|
| 86 | - echo "error : ".$e->getMessage(); |
|
| 87 | - } |
|
| 88 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 89 | - return $all; |
|
| 90 | - } |
|
| 81 | + $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
| 82 | + try { |
|
| 83 | + $sth = $this->db->prepare($query); |
|
| 84 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 85 | + } catch(PDOException $e) { |
|
| 86 | + echo "error : ".$e->getMessage(); |
|
| 87 | + } |
|
| 88 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 89 | + return $all; |
|
| 90 | + } |
|
| 91 | 91 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 92 | 92 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 93 | - $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
| 94 | - try { |
|
| 95 | - $sth = $this->db->prepare($query); |
|
| 96 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 97 | - } catch(PDOException $e) { |
|
| 98 | - echo "error : ".$e->getMessage(); |
|
| 99 | - } |
|
| 100 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 101 | - return $all; |
|
| 102 | - } |
|
| 93 | + $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
| 94 | + try { |
|
| 95 | + $sth = $this->db->prepare($query); |
|
| 96 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 97 | + } catch(PDOException $e) { |
|
| 98 | + echo "error : ".$e->getMessage(); |
|
| 99 | + } |
|
| 100 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 101 | + return $all; |
|
| 102 | + } |
|
| 103 | 103 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
| 104 | 104 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 105 | - $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
|
| 106 | - try { |
|
| 107 | - $sth = $this->db->prepare($query); |
|
| 108 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 109 | - } catch(PDOException $e) { |
|
| 110 | - echo "error : ".$e->getMessage(); |
|
| 111 | - } |
|
| 112 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 113 | - return $all; |
|
| 114 | - } |
|
| 105 | + $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
|
| 106 | + try { |
|
| 107 | + $sth = $this->db->prepare($query); |
|
| 108 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 109 | + } catch(PDOException $e) { |
|
| 110 | + echo "error : ".$e->getMessage(); |
|
| 111 | + } |
|
| 112 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 113 | + return $all; |
|
| 114 | + } |
|
| 115 | 115 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 116 | 116 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 117 | - $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
|
| 118 | - try { |
|
| 119 | - $sth = $this->db->prepare($query); |
|
| 120 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 121 | - } catch(PDOException $e) { |
|
| 122 | - echo "error : ".$e->getMessage(); |
|
| 123 | - } |
|
| 124 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 125 | - return $all; |
|
| 126 | - } |
|
| 117 | + $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
|
| 118 | + try { |
|
| 119 | + $sth = $this->db->prepare($query); |
|
| 120 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 121 | + } catch(PDOException $e) { |
|
| 122 | + echo "error : ".$e->getMessage(); |
|
| 123 | + } |
|
| 124 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 125 | + return $all; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 142 | 142 | } else $all = array(); |
| 143 | - if (empty($all)) { |
|
| 144 | - $filters = array('airlines' => array($stats_airline)); |
|
| 145 | - if ($filter_name != '') { |
|
| 146 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 147 | - } |
|
| 148 | - $Spotter = new Spotter($this->db); |
|
| 149 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
|
| 150 | - } |
|
| 151 | - return $all; |
|
| 143 | + if (empty($all)) { |
|
| 144 | + $filters = array('airlines' => array($stats_airline)); |
|
| 145 | + if ($filter_name != '') { |
|
| 146 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 147 | + } |
|
| 148 | + $Spotter = new Spotter($this->db); |
|
| 149 | + $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
|
| 150 | + } |
|
| 151 | + return $all; |
|
| 152 | 152 | } |
| 153 | 153 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
| 154 | 154 | global $globalStatsFilters; |
@@ -164,15 +164,15 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 166 | 166 | } else $all = array(); |
| 167 | - if (empty($all)) { |
|
| 168 | - $Spotter = new Spotter($this->db); |
|
| 169 | - $filters = array(); |
|
| 170 | - if ($filter_name != '') { |
|
| 171 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 167 | + if (empty($all)) { |
|
| 168 | + $Spotter = new Spotter($this->db); |
|
| 169 | + $filters = array(); |
|
| 170 | + if ($filter_name != '') { |
|
| 171 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 172 | 172 | } |
| 173 | - $all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
| 174 | - } |
|
| 175 | - return $all; |
|
| 173 | + $all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
| 174 | + } |
|
| 175 | + return $all; |
|
| 176 | 176 | } |
| 177 | 177 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 178 | 178 | global $globalStatsFilters; |
@@ -213,37 +213,37 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 215 | 215 | } else $all = array(); |
| 216 | - if (empty($all)) { |
|
| 216 | + if (empty($all)) { |
|
| 217 | 217 | $filters = array('airlines' => array($stats_airline)); |
| 218 | 218 | if ($filter_name != '') { |
| 219 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 219 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 220 | 220 | } |
| 221 | 221 | $Spotter = new Spotter($this->db); |
| 222 | 222 | $all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
| 223 | - } |
|
| 224 | - return $all; |
|
| 223 | + } |
|
| 224 | + return $all; |
|
| 225 | 225 | } |
| 226 | 226 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 227 | 227 | global $globalStatsFilters; |
| 228 | 228 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 229 | 229 | if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
| 230 | 230 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
| 231 | - try { |
|
| 232 | - $sth = $this->db->prepare($query); |
|
| 233 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 234 | - } catch(PDOException $e) { |
|
| 235 | - echo "error : ".$e->getMessage(); |
|
| 236 | - } |
|
| 237 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 238 | - if (empty($all)) { |
|
| 231 | + try { |
|
| 232 | + $sth = $this->db->prepare($query); |
|
| 233 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 234 | + } catch(PDOException $e) { |
|
| 235 | + echo "error : ".$e->getMessage(); |
|
| 236 | + } |
|
| 237 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 238 | + if (empty($all)) { |
|
| 239 | 239 | $filters = array('airlines' => array($stats_airline)); |
| 240 | 240 | if ($filter_name != '') { |
| 241 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 241 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 242 | 242 | } |
| 243 | 243 | $Spotter = new Spotter($this->db); |
| 244 | 244 | $all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
| 245 | - } |
|
| 246 | - return $all; |
|
| 245 | + } |
|
| 246 | + return $all; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
@@ -260,16 +260,16 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 262 | 262 | } else $all = array(); |
| 263 | - if (empty($all)) { |
|
| 264 | - $Spotter = new Spotter($this->db); |
|
| 265 | - $filters = array(); |
|
| 266 | - if ($filter_name != '') { |
|
| 267 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 263 | + if (empty($all)) { |
|
| 264 | + $Spotter = new Spotter($this->db); |
|
| 265 | + $filters = array(); |
|
| 266 | + if ($filter_name != '') { |
|
| 267 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
|
| 271 | - } |
|
| 272 | - return $all; |
|
| 270 | + $all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
|
| 271 | + } |
|
| 272 | + return $all; |
|
| 273 | 273 | } |
| 274 | 274 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 275 | 275 | global $globalStatsFilters; |
@@ -285,15 +285,15 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 287 | 287 | } else $all = array(); |
| 288 | - if (empty($all)) { |
|
| 288 | + if (empty($all)) { |
|
| 289 | 289 | $filters = array('airlines' => array($stats_airline)); |
| 290 | 290 | if ($filter_name != '') { |
| 291 | 291 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 292 | 292 | } |
| 293 | - $Spotter = new Spotter($this->db); |
|
| 294 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
|
| 295 | - } |
|
| 296 | - return $all; |
|
| 293 | + $Spotter = new Spotter($this->db); |
|
| 294 | + $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
|
| 295 | + } |
|
| 296 | + return $all; |
|
| 297 | 297 | } |
| 298 | 298 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 299 | 299 | global $globalStatsFilters; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | echo "error : ".$e->getMessage(); |
| 334 | 334 | } |
| 335 | 335 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 336 | - /* |
|
| 336 | + /* |
|
| 337 | 337 | if (empty($all)) { |
| 338 | 338 | $Spotter = new Spotter($this->db); |
| 339 | 339 | $all = $Spotter->countAllFlightOverCountries($limit); |
@@ -384,15 +384,15 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 386 | 386 | } else $all = array(); |
| 387 | - if (empty($all)) { |
|
| 387 | + if (empty($all)) { |
|
| 388 | 388 | $filters = array('airlines' => array($stats_airline)); |
| 389 | 389 | if ($filter_name != '') { |
| 390 | 390 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 391 | 391 | } |
| 392 | - $Spotter = new Spotter($this->db); |
|
| 393 | - $all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
|
| 394 | - } |
|
| 395 | - return $all; |
|
| 392 | + $Spotter = new Spotter($this->db); |
|
| 393 | + $all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
|
| 394 | + } |
|
| 395 | + return $all; |
|
| 396 | 396 | } |
| 397 | 397 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 398 | 398 | global $globalStatsFilters; |
@@ -408,33 +408,33 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 410 | 410 | } else $all = array(); |
| 411 | - if (empty($all)) { |
|
| 411 | + if (empty($all)) { |
|
| 412 | 412 | $filters = array('airlines' => array($stats_airline)); |
| 413 | - if ($filter_name != '') { |
|
| 414 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 415 | - } |
|
| 416 | - $Spotter = new Spotter($this->db); |
|
| 417 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
|
| 418 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
|
| 419 | - $all = array(); |
|
| 420 | - foreach ($pall as $value) { |
|
| 421 | - $icao = $value['airport_departure_icao']; |
|
| 422 | - $all[$icao] = $value; |
|
| 423 | - } |
|
| 413 | + if ($filter_name != '') { |
|
| 414 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 415 | + } |
|
| 416 | + $Spotter = new Spotter($this->db); |
|
| 417 | + $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
|
| 418 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
|
| 419 | + $all = array(); |
|
| 420 | + foreach ($pall as $value) { |
|
| 421 | + $icao = $value['airport_departure_icao']; |
|
| 422 | + $all[$icao] = $value; |
|
| 423 | + } |
|
| 424 | 424 | |
| 425 | - foreach ($dall as $value) { |
|
| 426 | - $icao = $value['airport_departure_icao']; |
|
| 427 | - if (isset($all[$icao])) { |
|
| 428 | - $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 429 | - } else $all[$icao] = $value; |
|
| 430 | - } |
|
| 431 | - $count = array(); |
|
| 432 | - foreach ($all as $key => $row) { |
|
| 433 | - $count[$key] = $row['airport_departure_icao_count']; |
|
| 434 | - } |
|
| 435 | - array_multisort($count,SORT_DESC,$all); |
|
| 436 | - } |
|
| 437 | - return $all; |
|
| 425 | + foreach ($dall as $value) { |
|
| 426 | + $icao = $value['airport_departure_icao']; |
|
| 427 | + if (isset($all[$icao])) { |
|
| 428 | + $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 429 | + } else $all[$icao] = $value; |
|
| 430 | + } |
|
| 431 | + $count = array(); |
|
| 432 | + foreach ($all as $key => $row) { |
|
| 433 | + $count[$key] = $row['airport_departure_icao_count']; |
|
| 434 | + } |
|
| 435 | + array_multisort($count,SORT_DESC,$all); |
|
| 436 | + } |
|
| 437 | + return $all; |
|
| 438 | 438 | } |
| 439 | 439 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 440 | 440 | global $globalStatsFilters; |
@@ -458,26 +458,26 @@ discard block |
||
| 458 | 458 | $Spotter = new Spotter($this->db); |
| 459 | 459 | $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
| 460 | 460 | $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
| 461 | - $all = array(); |
|
| 462 | - foreach ($pall as $value) { |
|
| 463 | - $icao = $value['airport_arrival_icao']; |
|
| 464 | - $all[$icao] = $value; |
|
| 465 | - } |
|
| 461 | + $all = array(); |
|
| 462 | + foreach ($pall as $value) { |
|
| 463 | + $icao = $value['airport_arrival_icao']; |
|
| 464 | + $all[$icao] = $value; |
|
| 465 | + } |
|
| 466 | 466 | |
| 467 | - foreach ($dall as $value) { |
|
| 468 | - $icao = $value['airport_arrival_icao']; |
|
| 469 | - if (isset($all[$icao])) { |
|
| 470 | - $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 471 | - } else $all[$icao] = $value; |
|
| 472 | - } |
|
| 473 | - $count = array(); |
|
| 474 | - foreach ($all as $key => $row) { |
|
| 475 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
| 476 | - } |
|
| 477 | - array_multisort($count,SORT_DESC,$all); |
|
| 478 | - } |
|
| 467 | + foreach ($dall as $value) { |
|
| 468 | + $icao = $value['airport_arrival_icao']; |
|
| 469 | + if (isset($all[$icao])) { |
|
| 470 | + $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 471 | + } else $all[$icao] = $value; |
|
| 472 | + } |
|
| 473 | + $count = array(); |
|
| 474 | + foreach ($all as $key => $row) { |
|
| 475 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
| 476 | + } |
|
| 477 | + array_multisort($count,SORT_DESC,$all); |
|
| 478 | + } |
|
| 479 | 479 | |
| 480 | - return $all; |
|
| 480 | + return $all; |
|
| 481 | 481 | } |
| 482 | 482 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 483 | 483 | global $globalDBdriver, $globalStatsFilters; |
@@ -490,23 +490,23 @@ discard block |
||
| 490 | 490 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 491 | 491 | } |
| 492 | 492 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 493 | - try { |
|
| 494 | - $sth = $this->db->prepare($query); |
|
| 495 | - $sth->execute($query_data); |
|
| 496 | - } catch(PDOException $e) { |
|
| 497 | - echo "error : ".$e->getMessage(); |
|
| 498 | - } |
|
| 499 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 500 | - if (empty($all)) { |
|
| 493 | + try { |
|
| 494 | + $sth = $this->db->prepare($query); |
|
| 495 | + $sth->execute($query_data); |
|
| 496 | + } catch(PDOException $e) { |
|
| 497 | + echo "error : ".$e->getMessage(); |
|
| 498 | + } |
|
| 499 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 500 | + if (empty($all)) { |
|
| 501 | 501 | $filters = array('airlines' => array($stats_airline)); |
| 502 | 502 | if ($filter_name != '') { |
| 503 | 503 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 504 | 504 | } |
| 505 | - $Spotter = new Spotter($this->db); |
|
| 506 | - $all = $Spotter->countAllMonthsLastYear($filters); |
|
| 507 | - } |
|
| 505 | + $Spotter = new Spotter($this->db); |
|
| 506 | + $all = $Spotter->countAllMonthsLastYear($filters); |
|
| 507 | + } |
|
| 508 | 508 | |
| 509 | - return $all; |
|
| 509 | + return $all; |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
@@ -514,22 +514,22 @@ discard block |
||
| 514 | 514 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 515 | 515 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 516 | 516 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 517 | - try { |
|
| 518 | - $sth = $this->db->prepare($query); |
|
| 519 | - $sth->execute($query_data); |
|
| 520 | - } catch(PDOException $e) { |
|
| 521 | - echo "error : ".$e->getMessage(); |
|
| 522 | - } |
|
| 523 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 524 | - if (empty($all)) { |
|
| 517 | + try { |
|
| 518 | + $sth = $this->db->prepare($query); |
|
| 519 | + $sth->execute($query_data); |
|
| 520 | + } catch(PDOException $e) { |
|
| 521 | + echo "error : ".$e->getMessage(); |
|
| 522 | + } |
|
| 523 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 524 | + if (empty($all)) { |
|
| 525 | 525 | $filters = array('airlines' => array($stats_airline)); |
| 526 | 526 | if ($filter_name != '') { |
| 527 | 527 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 528 | 528 | } |
| 529 | - $Spotter = new Spotter($this->db); |
|
| 530 | - $all = $Spotter->countAllDatesLastMonth($filters); |
|
| 531 | - } |
|
| 532 | - return $all; |
|
| 529 | + $Spotter = new Spotter($this->db); |
|
| 530 | + $all = $Spotter->countAllDatesLastMonth($filters); |
|
| 531 | + } |
|
| 532 | + return $all; |
|
| 533 | 533 | } |
| 534 | 534 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 535 | 535 | global $globalDBdriver, $globalStatsFilters; |
@@ -540,108 +540,108 @@ discard block |
||
| 540 | 540 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 541 | 541 | } |
| 542 | 542 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 543 | - try { |
|
| 544 | - $sth = $this->db->prepare($query); |
|
| 545 | - $sth->execute($query_data); |
|
| 546 | - } catch(PDOException $e) { |
|
| 547 | - echo "error : ".$e->getMessage(); |
|
| 548 | - } |
|
| 549 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 550 | - if (empty($all)) { |
|
| 543 | + try { |
|
| 544 | + $sth = $this->db->prepare($query); |
|
| 545 | + $sth->execute($query_data); |
|
| 546 | + } catch(PDOException $e) { |
|
| 547 | + echo "error : ".$e->getMessage(); |
|
| 548 | + } |
|
| 549 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 550 | + if (empty($all)) { |
|
| 551 | 551 | $filters = array('airlines' => array($stats_airline)); |
| 552 | 552 | if ($filter_name != '') { |
| 553 | 553 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 554 | 554 | } |
| 555 | - $Spotter = new Spotter($this->db); |
|
| 556 | - $all = $Spotter->countAllDatesLast7Days($filters); |
|
| 557 | - } |
|
| 558 | - return $all; |
|
| 555 | + $Spotter = new Spotter($this->db); |
|
| 556 | + $all = $Spotter->countAllDatesLast7Days($filters); |
|
| 557 | + } |
|
| 558 | + return $all; |
|
| 559 | 559 | } |
| 560 | 560 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 561 | 561 | global $globalStatsFilters; |
| 562 | 562 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 563 | 563 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 564 | 564 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 565 | - try { |
|
| 566 | - $sth = $this->db->prepare($query); |
|
| 567 | - $sth->execute($query_data); |
|
| 568 | - } catch(PDOException $e) { |
|
| 569 | - echo "error : ".$e->getMessage(); |
|
| 570 | - } |
|
| 571 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 572 | - if (empty($all)) { |
|
| 565 | + try { |
|
| 566 | + $sth = $this->db->prepare($query); |
|
| 567 | + $sth->execute($query_data); |
|
| 568 | + } catch(PDOException $e) { |
|
| 569 | + echo "error : ".$e->getMessage(); |
|
| 570 | + } |
|
| 571 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 572 | + if (empty($all)) { |
|
| 573 | 573 | $filters = array('airlines' => array($stats_airline)); |
| 574 | 574 | if ($filter_name != '') { |
| 575 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 575 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 576 | 576 | } |
| 577 | - $Spotter = new Spotter($this->db); |
|
| 578 | - $all = $Spotter->countAllDates($filters); |
|
| 579 | - } |
|
| 580 | - return $all; |
|
| 577 | + $Spotter = new Spotter($this->db); |
|
| 578 | + $all = $Spotter->countAllDates($filters); |
|
| 579 | + } |
|
| 580 | + return $all; |
|
| 581 | 581 | } |
| 582 | 582 | public function countAllDatesByAirlines($filter_name = '') { |
| 583 | 583 | global $globalStatsFilters; |
| 584 | 584 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 585 | 585 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
| 586 | 586 | $query_data = array('filter_name' => $filter_name); |
| 587 | - try { |
|
| 588 | - $sth = $this->db->prepare($query); |
|
| 589 | - $sth->execute($query_data); |
|
| 590 | - } catch(PDOException $e) { |
|
| 591 | - echo "error : ".$e->getMessage(); |
|
| 592 | - } |
|
| 593 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 594 | - if (empty($all)) { |
|
| 595 | - $filters = array(); |
|
| 596 | - if ($filter_name != '') { |
|
| 597 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 587 | + try { |
|
| 588 | + $sth = $this->db->prepare($query); |
|
| 589 | + $sth->execute($query_data); |
|
| 590 | + } catch(PDOException $e) { |
|
| 591 | + echo "error : ".$e->getMessage(); |
|
| 592 | + } |
|
| 593 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 594 | + if (empty($all)) { |
|
| 595 | + $filters = array(); |
|
| 596 | + if ($filter_name != '') { |
|
| 597 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 598 | 598 | } |
| 599 | - $Spotter = new Spotter($this->db); |
|
| 600 | - $all = $Spotter->countAllDatesByAirlines($filters); |
|
| 601 | - } |
|
| 602 | - return $all; |
|
| 599 | + $Spotter = new Spotter($this->db); |
|
| 600 | + $all = $Spotter->countAllDatesByAirlines($filters); |
|
| 601 | + } |
|
| 602 | + return $all; |
|
| 603 | 603 | } |
| 604 | 604 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 605 | 605 | global $globalStatsFilters; |
| 606 | 606 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 607 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 608 | - try { |
|
| 609 | - $sth = $this->db->prepare($query); |
|
| 610 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 611 | - } catch(PDOException $e) { |
|
| 612 | - echo "error : ".$e->getMessage(); |
|
| 613 | - } |
|
| 614 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 615 | - if (empty($all)) { |
|
| 607 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 608 | + try { |
|
| 609 | + $sth = $this->db->prepare($query); |
|
| 610 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 611 | + } catch(PDOException $e) { |
|
| 612 | + echo "error : ".$e->getMessage(); |
|
| 613 | + } |
|
| 614 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 615 | + if (empty($all)) { |
|
| 616 | 616 | $filters = array('airlines' => array($stats_airline)); |
| 617 | 617 | if ($filter_name != '') { |
| 618 | 618 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 619 | 619 | } |
| 620 | - $Spotter = new Spotter($this->db); |
|
| 621 | - $all = $Spotter->countAllMonths($filters); |
|
| 622 | - } |
|
| 623 | - return $all; |
|
| 620 | + $Spotter = new Spotter($this->db); |
|
| 621 | + $all = $Spotter->countAllMonths($filters); |
|
| 622 | + } |
|
| 623 | + return $all; |
|
| 624 | 624 | } |
| 625 | 625 | public function countAllMilitaryMonths($filter_name = '') { |
| 626 | 626 | global $globalStatsFilters; |
| 627 | 627 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 628 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
|
| 629 | - try { |
|
| 630 | - $sth = $this->db->prepare($query); |
|
| 631 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 632 | - } catch(PDOException $e) { |
|
| 633 | - echo "error : ".$e->getMessage(); |
|
| 634 | - } |
|
| 635 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 636 | - if (empty($all)) { |
|
| 637 | - $filters = array(); |
|
| 638 | - if ($filter_name != '') { |
|
| 639 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 628 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
|
| 629 | + try { |
|
| 630 | + $sth = $this->db->prepare($query); |
|
| 631 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 632 | + } catch(PDOException $e) { |
|
| 633 | + echo "error : ".$e->getMessage(); |
|
| 634 | + } |
|
| 635 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 636 | + if (empty($all)) { |
|
| 637 | + $filters = array(); |
|
| 638 | + if ($filter_name != '') { |
|
| 639 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 640 | 640 | } |
| 641 | - $Spotter = new Spotter($this->db); |
|
| 642 | - $all = $Spotter->countAllMilitaryMonths($filters); |
|
| 643 | - } |
|
| 644 | - return $all; |
|
| 641 | + $Spotter = new Spotter($this->db); |
|
| 642 | + $all = $Spotter->countAllMilitaryMonths($filters); |
|
| 643 | + } |
|
| 644 | + return $all; |
|
| 645 | 645 | } |
| 646 | 646 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 647 | 647 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
@@ -657,22 +657,22 @@ discard block |
||
| 657 | 657 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 658 | 658 | } |
| 659 | 659 | if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
| 660 | - try { |
|
| 661 | - $sth = $this->db->prepare($query); |
|
| 662 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 663 | - } catch(PDOException $e) { |
|
| 664 | - echo "error : ".$e->getMessage(); |
|
| 665 | - } |
|
| 666 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 667 | - if (empty($all)) { |
|
| 660 | + try { |
|
| 661 | + $sth = $this->db->prepare($query); |
|
| 662 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 663 | + } catch(PDOException $e) { |
|
| 664 | + echo "error : ".$e->getMessage(); |
|
| 665 | + } |
|
| 666 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 667 | + if (empty($all)) { |
|
| 668 | 668 | $filters = array('airlines' => array($stats_airline)); |
| 669 | 669 | if ($filter_name != '') { |
| 670 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 670 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 671 | 671 | } |
| 672 | - $Spotter = new Spotter($this->db); |
|
| 673 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
| 674 | - } |
|
| 675 | - return $all; |
|
| 672 | + $Spotter = new Spotter($this->db); |
|
| 673 | + $all = $Spotter->countAllHours($orderby,$filters); |
|
| 674 | + } |
|
| 675 | + return $all; |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
@@ -696,9 +696,9 @@ discard block |
||
| 696 | 696 | if ($year == '') $year = date('Y'); |
| 697 | 697 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
| 698 | 698 | if (empty($all)) { |
| 699 | - $filters = array(); |
|
| 700 | - if ($filter_name != '') { |
|
| 701 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 699 | + $filters = array(); |
|
| 700 | + if ($filter_name != '') { |
|
| 701 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 702 | 702 | } |
| 703 | 703 | $Spotter = new Spotter($this->db); |
| 704 | 704 | $all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
@@ -750,9 +750,9 @@ discard block |
||
| 750 | 750 | $all = $result[0]['nb_airline']; |
| 751 | 751 | } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
| 752 | 752 | if (empty($all)) { |
| 753 | - $filters = array(); |
|
| 754 | - if ($filter_name != '') { |
|
| 755 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 753 | + $filters = array(); |
|
| 754 | + if ($filter_name != '') { |
|
| 755 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 756 | 756 | } |
| 757 | 757 | $Spotter = new Spotter($this->db); |
| 758 | 758 | $all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -805,33 +805,33 @@ discard block |
||
| 805 | 805 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 806 | 806 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
| 807 | 807 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 808 | - try { |
|
| 809 | - $sth = $this->db->prepare($query); |
|
| 810 | - $sth->execute($query_values); |
|
| 811 | - } catch(PDOException $e) { |
|
| 812 | - echo "error : ".$e->getMessage(); |
|
| 813 | - } |
|
| 814 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 815 | - return $all; |
|
| 808 | + try { |
|
| 809 | + $sth = $this->db->prepare($query); |
|
| 810 | + $sth->execute($query_values); |
|
| 811 | + } catch(PDOException $e) { |
|
| 812 | + echo "error : ".$e->getMessage(); |
|
| 813 | + } |
|
| 814 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 815 | + return $all; |
|
| 816 | 816 | } |
| 817 | 817 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 818 | 818 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 819 | - $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
| 820 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 821 | - try { |
|
| 822 | - $sth = $this->db->prepare($query); |
|
| 823 | - $sth->execute($query_values); |
|
| 824 | - } catch(PDOException $e) { |
|
| 825 | - echo "error : ".$e->getMessage(); |
|
| 826 | - } |
|
| 827 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 828 | - return $all; |
|
| 829 | - } |
|
| 819 | + $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
| 820 | + $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 821 | + try { |
|
| 822 | + $sth = $this->db->prepare($query); |
|
| 823 | + $sth->execute($query_values); |
|
| 824 | + } catch(PDOException $e) { |
|
| 825 | + echo "error : ".$e->getMessage(); |
|
| 826 | + } |
|
| 827 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 828 | + return $all; |
|
| 829 | + } |
|
| 830 | 830 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 831 | 831 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 832 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 833 | - if ($globalDBdriver == 'mysql') { |
|
| 834 | - if ($month == '') { |
|
| 832 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 833 | + if ($globalDBdriver == 'mysql') { |
|
| 834 | + if ($month == '') { |
|
| 835 | 835 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 836 | 836 | $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 837 | 837 | } else { |
@@ -846,137 +846,137 @@ discard block |
||
| 846 | 846 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 847 | 847 | $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
| 848 | 848 | } |
| 849 | - } |
|
| 850 | - try { |
|
| 851 | - $sth = $this->db->prepare($query); |
|
| 852 | - $sth->execute($query_values); |
|
| 853 | - } catch(PDOException $e) { |
|
| 854 | - echo "error : ".$e->getMessage(); |
|
| 855 | - } |
|
| 856 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 857 | - return $all[0]['total']; |
|
| 858 | - } |
|
| 849 | + } |
|
| 850 | + try { |
|
| 851 | + $sth = $this->db->prepare($query); |
|
| 852 | + $sth->execute($query_values); |
|
| 853 | + } catch(PDOException $e) { |
|
| 854 | + echo "error : ".$e->getMessage(); |
|
| 855 | + } |
|
| 856 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 857 | + return $all[0]['total']; |
|
| 858 | + } |
|
| 859 | 859 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 860 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 860 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 861 | 861 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 862 | - if ($globalDBdriver == 'mysql') { |
|
| 862 | + if ($globalDBdriver == 'mysql') { |
|
| 863 | 863 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 864 | 864 | } else { |
| 865 | 865 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 866 | - } |
|
| 867 | - $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 868 | - try { |
|
| 869 | - $sth = $this->db->prepare($query); |
|
| 870 | - $sth->execute($query_values); |
|
| 871 | - } catch(PDOException $e) { |
|
| 872 | - echo "error : ".$e->getMessage(); |
|
| 873 | - } |
|
| 874 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 875 | - return $all[0]['total']; |
|
| 876 | - } |
|
| 866 | + } |
|
| 867 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 868 | + try { |
|
| 869 | + $sth = $this->db->prepare($query); |
|
| 870 | + $sth->execute($query_values); |
|
| 871 | + } catch(PDOException $e) { |
|
| 872 | + echo "error : ".$e->getMessage(); |
|
| 873 | + } |
|
| 874 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 875 | + return $all[0]['total']; |
|
| 876 | + } |
|
| 877 | 877 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 878 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 878 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 879 | 879 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 880 | - if ($globalDBdriver == 'mysql') { |
|
| 880 | + if ($globalDBdriver == 'mysql') { |
|
| 881 | 881 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 882 | - } else { |
|
| 882 | + } else { |
|
| 883 | 883 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 884 | - } |
|
| 885 | - try { |
|
| 886 | - $sth = $this->db->prepare($query); |
|
| 887 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 888 | - } catch(PDOException $e) { |
|
| 889 | - echo "error : ".$e->getMessage(); |
|
| 890 | - } |
|
| 891 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 892 | - return $all[0]['total']; |
|
| 893 | - } |
|
| 884 | + } |
|
| 885 | + try { |
|
| 886 | + $sth = $this->db->prepare($query); |
|
| 887 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 888 | + } catch(PDOException $e) { |
|
| 889 | + echo "error : ".$e->getMessage(); |
|
| 890 | + } |
|
| 891 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 892 | + return $all[0]['total']; |
|
| 893 | + } |
|
| 894 | 894 | public function getStatsAirlineTotal($filter_name = '') { |
| 895 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 895 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 896 | 896 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 897 | - if ($globalDBdriver == 'mysql') { |
|
| 897 | + if ($globalDBdriver == 'mysql') { |
|
| 898 | 898 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 899 | - } else { |
|
| 899 | + } else { |
|
| 900 | 900 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 901 | - } |
|
| 902 | - try { |
|
| 903 | - $sth = $this->db->prepare($query); |
|
| 904 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 905 | - } catch(PDOException $e) { |
|
| 906 | - echo "error : ".$e->getMessage(); |
|
| 907 | - } |
|
| 908 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 909 | - return $all[0]['total']; |
|
| 910 | - } |
|
| 901 | + } |
|
| 902 | + try { |
|
| 903 | + $sth = $this->db->prepare($query); |
|
| 904 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 905 | + } catch(PDOException $e) { |
|
| 906 | + echo "error : ".$e->getMessage(); |
|
| 907 | + } |
|
| 908 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 909 | + return $all[0]['total']; |
|
| 910 | + } |
|
| 911 | 911 | public function getStatsOwnerTotal($filter_name = '') { |
| 912 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 912 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 913 | 913 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 914 | - if ($globalDBdriver == 'mysql') { |
|
| 914 | + if ($globalDBdriver == 'mysql') { |
|
| 915 | 915 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 916 | 916 | } else { |
| 917 | 917 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 918 | - } |
|
| 919 | - try { |
|
| 920 | - $sth = $this->db->prepare($query); |
|
| 921 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 922 | - } catch(PDOException $e) { |
|
| 923 | - echo "error : ".$e->getMessage(); |
|
| 924 | - } |
|
| 925 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 926 | - return $all[0]['total']; |
|
| 927 | - } |
|
| 918 | + } |
|
| 919 | + try { |
|
| 920 | + $sth = $this->db->prepare($query); |
|
| 921 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 922 | + } catch(PDOException $e) { |
|
| 923 | + echo "error : ".$e->getMessage(); |
|
| 924 | + } |
|
| 925 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 926 | + return $all[0]['total']; |
|
| 927 | + } |
|
| 928 | 928 | public function getStatsPilotTotal($filter_name = '') { |
| 929 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 929 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 930 | 930 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 931 | - if ($globalDBdriver == 'mysql') { |
|
| 932 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 933 | - } else { |
|
| 934 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 935 | - } |
|
| 936 | - try { |
|
| 937 | - $sth = $this->db->prepare($query); |
|
| 938 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 939 | - } catch(PDOException $e) { |
|
| 940 | - echo "error : ".$e->getMessage(); |
|
| 941 | - } |
|
| 942 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 943 | - return $all[0]['total']; |
|
| 944 | - } |
|
| 931 | + if ($globalDBdriver == 'mysql') { |
|
| 932 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 933 | + } else { |
|
| 934 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 935 | + } |
|
| 936 | + try { |
|
| 937 | + $sth = $this->db->prepare($query); |
|
| 938 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 939 | + } catch(PDOException $e) { |
|
| 940 | + echo "error : ".$e->getMessage(); |
|
| 941 | + } |
|
| 942 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 943 | + return $all[0]['total']; |
|
| 944 | + } |
|
| 945 | 945 | |
| 946 | 946 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 947 | 947 | global $globalDBdriver; |
| 948 | 948 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 949 | 949 | if ($globalDBdriver == 'mysql') { |
| 950 | 950 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
| 951 | - } else { |
|
| 951 | + } else { |
|
| 952 | 952 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 953 | 953 | } |
| 954 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 955 | - try { |
|
| 956 | - $sth = $this->db->prepare($query); |
|
| 957 | - $sth->execute($query_values); |
|
| 958 | - } catch(PDOException $e) { |
|
| 959 | - return "error : ".$e->getMessage(); |
|
| 960 | - } |
|
| 961 | - } |
|
| 954 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 955 | + try { |
|
| 956 | + $sth = $this->db->prepare($query); |
|
| 957 | + $sth->execute($query_values); |
|
| 958 | + } catch(PDOException $e) { |
|
| 959 | + return "error : ".$e->getMessage(); |
|
| 960 | + } |
|
| 961 | + } |
|
| 962 | 962 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 963 | 963 | global $globalDBdriver; |
| 964 | 964 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 965 | 965 | if ($globalDBdriver == 'mysql') { |
| 966 | 966 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 967 | 967 | } else { |
| 968 | - //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
| 968 | + //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
| 969 | 969 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 970 | - } |
|
| 971 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 972 | - try { |
|
| 973 | - $sth = $this->db->prepare($query); |
|
| 974 | - $sth->execute($query_values); |
|
| 975 | - } catch(PDOException $e) { |
|
| 976 | - return "error : ".$e->getMessage(); |
|
| 977 | - } |
|
| 978 | - } |
|
| 979 | - /* |
|
| 970 | + } |
|
| 971 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 972 | + try { |
|
| 973 | + $sth = $this->db->prepare($query); |
|
| 974 | + $sth->execute($query_values); |
|
| 975 | + } catch(PDOException $e) { |
|
| 976 | + return "error : ".$e->getMessage(); |
|
| 977 | + } |
|
| 978 | + } |
|
| 979 | + /* |
|
| 980 | 980 | public function getStatsSource($date,$stats_type = '') { |
| 981 | 981 | if ($stats_type == '') { |
| 982 | 982 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
@@ -1045,25 +1045,25 @@ discard block |
||
| 1045 | 1045 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
| 1046 | 1046 | } else { |
| 1047 | 1047 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
| 1048 | - } |
|
| 1049 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 1050 | - try { |
|
| 1051 | - $sth = $this->db->prepare($query); |
|
| 1052 | - $sth->execute($query_values); |
|
| 1053 | - } catch(PDOException $e) { |
|
| 1054 | - return "error : ".$e->getMessage(); |
|
| 1055 | - } |
|
| 1056 | - } |
|
| 1057 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
| 1058 | - $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
| 1059 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1060 | - try { |
|
| 1061 | - $sth = $this->db->prepare($query); |
|
| 1062 | - $sth->execute($query_values); |
|
| 1063 | - } catch(PDOException $e) { |
|
| 1064 | - return "error : ".$e->getMessage(); |
|
| 1065 | - } |
|
| 1066 | - } |
|
| 1048 | + } |
|
| 1049 | + $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 1050 | + try { |
|
| 1051 | + $sth = $this->db->prepare($query); |
|
| 1052 | + $sth->execute($query_values); |
|
| 1053 | + } catch(PDOException $e) { |
|
| 1054 | + return "error : ".$e->getMessage(); |
|
| 1055 | + } |
|
| 1056 | + } |
|
| 1057 | + public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
| 1058 | + $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
| 1059 | + $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1060 | + try { |
|
| 1061 | + $sth = $this->db->prepare($query); |
|
| 1062 | + $sth->execute($query_values); |
|
| 1063 | + } catch(PDOException $e) { |
|
| 1064 | + return "error : ".$e->getMessage(); |
|
| 1065 | + } |
|
| 1066 | + } |
|
| 1067 | 1067 | public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
| 1068 | 1068 | global $globalDBdriver; |
| 1069 | 1069 | if ($globalDBdriver == 'mysql') { |
@@ -1079,14 +1079,14 @@ discard block |
||
| 1079 | 1079 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1080 | 1080 | } |
| 1081 | 1081 | } |
| 1082 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1083 | - try { |
|
| 1084 | - $sth = $this->db->prepare($query); |
|
| 1085 | - $sth->execute($query_values); |
|
| 1086 | - } catch(PDOException $e) { |
|
| 1087 | - return "error : ".$e->getMessage(); |
|
| 1088 | - } |
|
| 1089 | - } |
|
| 1082 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1083 | + try { |
|
| 1084 | + $sth = $this->db->prepare($query); |
|
| 1085 | + $sth->execute($query_values); |
|
| 1086 | + } catch(PDOException $e) { |
|
| 1087 | + return "error : ".$e->getMessage(); |
|
| 1088 | + } |
|
| 1089 | + } |
|
| 1090 | 1090 | public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
| 1091 | 1091 | global $globalDBdriver; |
| 1092 | 1092 | if ($globalDBdriver == 'mysql') { |
@@ -1102,14 +1102,14 @@ discard block |
||
| 1102 | 1102 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| 1105 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1106 | - try { |
|
| 1107 | - $sth = $this->db->prepare($query); |
|
| 1108 | - $sth->execute($query_values); |
|
| 1109 | - } catch(PDOException $e) { |
|
| 1110 | - return "error : ".$e->getMessage(); |
|
| 1111 | - } |
|
| 1112 | - } |
|
| 1105 | + $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1106 | + try { |
|
| 1107 | + $sth = $this->db->prepare($query); |
|
| 1108 | + $sth->execute($query_values); |
|
| 1109 | + } catch(PDOException $e) { |
|
| 1110 | + return "error : ".$e->getMessage(); |
|
| 1111 | + } |
|
| 1112 | + } |
|
| 1113 | 1113 | public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) { |
| 1114 | 1114 | global $globalDBdriver; |
| 1115 | 1115 | if ($globalDBdriver == 'mysql') { |
@@ -1125,14 +1125,14 @@ discard block |
||
| 1125 | 1125 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
| 1126 | 1126 | } |
| 1127 | 1127 | } |
| 1128 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 1129 | - try { |
|
| 1130 | - $sth = $this->db->prepare($query); |
|
| 1131 | - $sth->execute($query_values); |
|
| 1132 | - } catch(PDOException $e) { |
|
| 1133 | - return "error : ".$e->getMessage(); |
|
| 1134 | - } |
|
| 1135 | - } |
|
| 1128 | + $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 1129 | + try { |
|
| 1130 | + $sth = $this->db->prepare($query); |
|
| 1131 | + $sth->execute($query_values); |
|
| 1132 | + } catch(PDOException $e) { |
|
| 1133 | + return "error : ".$e->getMessage(); |
|
| 1134 | + } |
|
| 1135 | + } |
|
| 1136 | 1136 | public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
| 1137 | 1137 | global $globalDBdriver; |
| 1138 | 1138 | if ($globalDBdriver == 'mysql') { |
@@ -1148,14 +1148,14 @@ discard block |
||
| 1148 | 1148 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1149 | 1149 | } |
| 1150 | 1150 | } |
| 1151 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1152 | - try { |
|
| 1153 | - $sth = $this->db->prepare($query); |
|
| 1154 | - $sth->execute($query_values); |
|
| 1155 | - } catch(PDOException $e) { |
|
| 1156 | - return "error : ".$e->getMessage(); |
|
| 1157 | - } |
|
| 1158 | - } |
|
| 1151 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1152 | + try { |
|
| 1153 | + $sth = $this->db->prepare($query); |
|
| 1154 | + $sth->execute($query_values); |
|
| 1155 | + } catch(PDOException $e) { |
|
| 1156 | + return "error : ".$e->getMessage(); |
|
| 1157 | + } |
|
| 1158 | + } |
|
| 1159 | 1159 | public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
| 1160 | 1160 | global $globalDBdriver; |
| 1161 | 1161 | if ($globalDBdriver == 'mysql') { |
@@ -1171,14 +1171,14 @@ discard block |
||
| 1171 | 1171 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
| 1172 | 1172 | } |
| 1173 | 1173 | } |
| 1174 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 1175 | - try { |
|
| 1176 | - $sth = $this->db->prepare($query); |
|
| 1177 | - $sth->execute($query_values); |
|
| 1178 | - } catch(PDOException $e) { |
|
| 1179 | - return "error : ".$e->getMessage(); |
|
| 1180 | - } |
|
| 1181 | - } |
|
| 1174 | + $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 1175 | + try { |
|
| 1176 | + $sth = $this->db->prepare($query); |
|
| 1177 | + $sth->execute($query_values); |
|
| 1178 | + } catch(PDOException $e) { |
|
| 1179 | + return "error : ".$e->getMessage(); |
|
| 1180 | + } |
|
| 1181 | + } |
|
| 1182 | 1182 | public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
| 1183 | 1183 | global $globalDBdriver; |
| 1184 | 1184 | if ($globalDBdriver == 'mysql') { |
@@ -1194,14 +1194,14 @@ discard block |
||
| 1194 | 1194 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1195 | 1195 | } |
| 1196 | 1196 | } |
| 1197 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1198 | - try { |
|
| 1199 | - $sth = $this->db->prepare($query); |
|
| 1200 | - $sth->execute($query_values); |
|
| 1201 | - } catch(PDOException $e) { |
|
| 1202 | - return "error : ".$e->getMessage(); |
|
| 1203 | - } |
|
| 1204 | - } |
|
| 1197 | + $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1198 | + try { |
|
| 1199 | + $sth = $this->db->prepare($query); |
|
| 1200 | + $sth->execute($query_values); |
|
| 1201 | + } catch(PDOException $e) { |
|
| 1202 | + return "error : ".$e->getMessage(); |
|
| 1203 | + } |
|
| 1204 | + } |
|
| 1205 | 1205 | public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
| 1206 | 1206 | global $globalDBdriver; |
| 1207 | 1207 | if ($globalDBdriver == 'mysql') { |
@@ -1217,14 +1217,14 @@ discard block |
||
| 1217 | 1217 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
| 1218 | 1218 | } |
| 1219 | 1219 | } |
| 1220 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
| 1221 | - try { |
|
| 1222 | - $sth = $this->db->prepare($query); |
|
| 1223 | - $sth->execute($query_values); |
|
| 1224 | - } catch(PDOException $e) { |
|
| 1225 | - return "error : ".$e->getMessage(); |
|
| 1226 | - } |
|
| 1227 | - } |
|
| 1220 | + $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
| 1221 | + try { |
|
| 1222 | + $sth = $this->db->prepare($query); |
|
| 1223 | + $sth->execute($query_values); |
|
| 1224 | + } catch(PDOException $e) { |
|
| 1225 | + return "error : ".$e->getMessage(); |
|
| 1226 | + } |
|
| 1227 | + } |
|
| 1228 | 1228 | public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
| 1229 | 1229 | global $globalDBdriver; |
| 1230 | 1230 | if ($airport_icao != '') { |
@@ -1248,8 +1248,8 @@ discard block |
||
| 1248 | 1248 | } catch(PDOException $e) { |
| 1249 | 1249 | return "error : ".$e->getMessage(); |
| 1250 | 1250 | } |
| 1251 | - } |
|
| 1252 | - } |
|
| 1251 | + } |
|
| 1252 | + } |
|
| 1253 | 1253 | public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
| 1254 | 1254 | global $globalDBdriver; |
| 1255 | 1255 | if ($airport_icao != '') { |
@@ -1265,8 +1265,8 @@ discard block |
||
| 1265 | 1265 | } catch(PDOException $e) { |
| 1266 | 1266 | return "error : ".$e->getMessage(); |
| 1267 | 1267 | } |
| 1268 | - } |
|
| 1269 | - } |
|
| 1268 | + } |
|
| 1269 | + } |
|
| 1270 | 1270 | public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
| 1271 | 1271 | global $globalDBdriver; |
| 1272 | 1272 | if ($airport_icao != '') { |
@@ -1283,15 +1283,15 @@ discard block |
||
| 1283 | 1283 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
| 1284 | 1284 | } |
| 1285 | 1285 | } |
| 1286 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1286 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1287 | 1287 | try { |
| 1288 | - $sth = $this->db->prepare($query); |
|
| 1289 | - $sth->execute($query_values); |
|
| 1290 | - } catch(PDOException $e) { |
|
| 1291 | - return "error : ".$e->getMessage(); |
|
| 1292 | - } |
|
| 1293 | - } |
|
| 1294 | - } |
|
| 1288 | + $sth = $this->db->prepare($query); |
|
| 1289 | + $sth->execute($query_values); |
|
| 1290 | + } catch(PDOException $e) { |
|
| 1291 | + return "error : ".$e->getMessage(); |
|
| 1292 | + } |
|
| 1293 | + } |
|
| 1294 | + } |
|
| 1295 | 1295 | public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
| 1296 | 1296 | global $globalDBdriver; |
| 1297 | 1297 | if ($airport_icao != '') { |
@@ -1307,46 +1307,46 @@ discard block |
||
| 1307 | 1307 | } catch(PDOException $e) { |
| 1308 | 1308 | return "error : ".$e->getMessage(); |
| 1309 | 1309 | } |
| 1310 | - } |
|
| 1311 | - } |
|
| 1310 | + } |
|
| 1311 | + } |
|
| 1312 | 1312 | |
| 1313 | 1313 | public function deleteStat($id) { |
| 1314 | - $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
| 1315 | - $query_values = array(':id' => $id); |
|
| 1316 | - try { |
|
| 1317 | - $sth = $this->db->prepare($query); |
|
| 1318 | - $sth->execute($query_values); |
|
| 1319 | - } catch(PDOException $e) { |
|
| 1320 | - return "error : ".$e->getMessage(); |
|
| 1321 | - } |
|
| 1322 | - } |
|
| 1314 | + $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
| 1315 | + $query_values = array(':id' => $id); |
|
| 1316 | + try { |
|
| 1317 | + $sth = $this->db->prepare($query); |
|
| 1318 | + $sth->execute($query_values); |
|
| 1319 | + } catch(PDOException $e) { |
|
| 1320 | + return "error : ".$e->getMessage(); |
|
| 1321 | + } |
|
| 1322 | + } |
|
| 1323 | 1323 | public function deleteStatFlight($type) { |
| 1324 | - $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
| 1325 | - $query_values = array(':type' => $type); |
|
| 1326 | - try { |
|
| 1327 | - $sth = $this->db->prepare($query); |
|
| 1328 | - $sth->execute($query_values); |
|
| 1329 | - } catch(PDOException $e) { |
|
| 1330 | - return "error : ".$e->getMessage(); |
|
| 1331 | - } |
|
| 1332 | - } |
|
| 1324 | + $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
| 1325 | + $query_values = array(':type' => $type); |
|
| 1326 | + try { |
|
| 1327 | + $sth = $this->db->prepare($query); |
|
| 1328 | + $sth->execute($query_values); |
|
| 1329 | + } catch(PDOException $e) { |
|
| 1330 | + return "error : ".$e->getMessage(); |
|
| 1331 | + } |
|
| 1332 | + } |
|
| 1333 | 1333 | public function deleteStatAirport($type) { |
| 1334 | - $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
| 1335 | - $query_values = array(':type' => $type); |
|
| 1336 | - try { |
|
| 1337 | - $sth = $this->db->prepare($query); |
|
| 1338 | - $sth->execute($query_values); |
|
| 1339 | - } catch(PDOException $e) { |
|
| 1340 | - return "error : ".$e->getMessage(); |
|
| 1341 | - } |
|
| 1342 | - } |
|
| 1334 | + $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
| 1335 | + $query_values = array(':type' => $type); |
|
| 1336 | + try { |
|
| 1337 | + $sth = $this->db->prepare($query); |
|
| 1338 | + $sth->execute($query_values); |
|
| 1339 | + } catch(PDOException $e) { |
|
| 1340 | + return "error : ".$e->getMessage(); |
|
| 1341 | + } |
|
| 1342 | + } |
|
| 1343 | 1343 | |
| 1344 | - public function addOldStats() { |
|
| 1345 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear; |
|
| 1346 | - $Common = new Common(); |
|
| 1347 | - $Connection = new Connection(); |
|
| 1348 | - date_default_timezone_set('UTC'); |
|
| 1349 | - $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
| 1344 | + public function addOldStats() { |
|
| 1345 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear; |
|
| 1346 | + $Common = new Common(); |
|
| 1347 | + $Connection = new Connection(); |
|
| 1348 | + date_default_timezone_set('UTC'); |
|
| 1349 | + $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
| 1350 | 1350 | if ($globalDebug) echo 'Update stats !'."\n"; |
| 1351 | 1351 | if (isset($last_update[0]['value'])) { |
| 1352 | 1352 | $last_update_day = $last_update[0]['value']; |
@@ -1392,24 +1392,24 @@ discard block |
||
| 1392 | 1392 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
| 1393 | 1393 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 1394 | 1394 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
| 1395 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 1395 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 1396 | 1396 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
| 1397 | - $alldata = array(); |
|
| 1397 | + $alldata = array(); |
|
| 1398 | 1398 | |
| 1399 | - foreach ($pall as $value) { |
|
| 1400 | - $icao = $value['airport_departure_icao']; |
|
| 1401 | - $alldata[$icao] = $value; |
|
| 1402 | - } |
|
| 1403 | - foreach ($dall as $value) { |
|
| 1404 | - $icao = $value['airport_departure_icao']; |
|
| 1405 | - if (isset($alldata[$icao])) { |
|
| 1406 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1407 | - } else $alldata[$icao] = $value; |
|
| 1408 | - } |
|
| 1409 | - $count = array(); |
|
| 1410 | - foreach ($alldata as $key => $row) { |
|
| 1411 | - $count[$key] = $row['airport_departure_icao_count']; |
|
| 1412 | - } |
|
| 1399 | + foreach ($pall as $value) { |
|
| 1400 | + $icao = $value['airport_departure_icao']; |
|
| 1401 | + $alldata[$icao] = $value; |
|
| 1402 | + } |
|
| 1403 | + foreach ($dall as $value) { |
|
| 1404 | + $icao = $value['airport_departure_icao']; |
|
| 1405 | + if (isset($alldata[$icao])) { |
|
| 1406 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1407 | + } else $alldata[$icao] = $value; |
|
| 1408 | + } |
|
| 1409 | + $count = array(); |
|
| 1410 | + foreach ($alldata as $key => $row) { |
|
| 1411 | + $count[$key] = $row['airport_departure_icao_count']; |
|
| 1412 | + } |
|
| 1413 | 1413 | array_multisort($count,SORT_DESC,$alldata); |
| 1414 | 1414 | foreach ($alldata as $number) { |
| 1415 | 1415 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
@@ -1417,25 +1417,25 @@ discard block |
||
| 1417 | 1417 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
| 1418 | 1418 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 1419 | 1419 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
| 1420 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 1420 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 1421 | 1421 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
| 1422 | - $alldata = array(); |
|
| 1423 | - foreach ($pall as $value) { |
|
| 1424 | - $icao = $value['airport_arrival_icao']; |
|
| 1425 | - $alldata[$icao] = $value; |
|
| 1426 | - } |
|
| 1427 | - foreach ($dall as $value) { |
|
| 1428 | - $icao = $value['airport_arrival_icao']; |
|
| 1429 | - if (isset($alldata[$icao])) { |
|
| 1430 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1431 | - } else $alldata[$icao] = $value; |
|
| 1432 | - } |
|
| 1433 | - $count = array(); |
|
| 1434 | - foreach ($alldata as $key => $row) { |
|
| 1435 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1436 | - } |
|
| 1437 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1438 | - foreach ($alldata as $number) { |
|
| 1422 | + $alldata = array(); |
|
| 1423 | + foreach ($pall as $value) { |
|
| 1424 | + $icao = $value['airport_arrival_icao']; |
|
| 1425 | + $alldata[$icao] = $value; |
|
| 1426 | + } |
|
| 1427 | + foreach ($dall as $value) { |
|
| 1428 | + $icao = $value['airport_arrival_icao']; |
|
| 1429 | + if (isset($alldata[$icao])) { |
|
| 1430 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1431 | + } else $alldata[$icao] = $value; |
|
| 1432 | + } |
|
| 1433 | + $count = array(); |
|
| 1434 | + foreach ($alldata as $key => $row) { |
|
| 1435 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1436 | + } |
|
| 1437 | + array_multisort($count,SORT_DESC,$alldata); |
|
| 1438 | + foreach ($alldata as $number) { |
|
| 1439 | 1439 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
| 1440 | 1440 | } |
| 1441 | 1441 | if ($Connection->tableExists('countries')) { |
@@ -1495,8 +1495,8 @@ discard block |
||
| 1495 | 1495 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1496 | 1496 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
| 1497 | 1497 | $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1498 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
| 1499 | - /* |
|
| 1498 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
| 1499 | + /* |
|
| 1500 | 1500 | $alldata = array(); |
| 1501 | 1501 | foreach ($pall as $value) { |
| 1502 | 1502 | $icao = $value['departure_airport_icao']; |
@@ -1515,29 +1515,29 @@ discard block |
||
| 1515 | 1515 | } |
| 1516 | 1516 | array_multisort($count,SORT_DESC,$alldata); |
| 1517 | 1517 | */ |
| 1518 | - foreach ($dall as $value) { |
|
| 1519 | - $icao = $value['departure_airport_icao']; |
|
| 1520 | - $ddate = $value['date']; |
|
| 1521 | - $find = false; |
|
| 1522 | - foreach ($pall as $pvalue) { |
|
| 1523 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1524 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1525 | - $find = true; |
|
| 1526 | - break; |
|
| 1527 | - } |
|
| 1528 | - } |
|
| 1529 | - if ($find === false) { |
|
| 1530 | - $pall[] = $value; |
|
| 1531 | - } |
|
| 1532 | - } |
|
| 1533 | - $alldata = $pall; |
|
| 1518 | + foreach ($dall as $value) { |
|
| 1519 | + $icao = $value['departure_airport_icao']; |
|
| 1520 | + $ddate = $value['date']; |
|
| 1521 | + $find = false; |
|
| 1522 | + foreach ($pall as $pvalue) { |
|
| 1523 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1524 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1525 | + $find = true; |
|
| 1526 | + break; |
|
| 1527 | + } |
|
| 1528 | + } |
|
| 1529 | + if ($find === false) { |
|
| 1530 | + $pall[] = $value; |
|
| 1531 | + } |
|
| 1532 | + } |
|
| 1533 | + $alldata = $pall; |
|
| 1534 | 1534 | foreach ($alldata as $number) { |
| 1535 | 1535 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
| 1536 | 1536 | } |
| 1537 | 1537 | echo '...Arrival'."\n"; |
| 1538 | 1538 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
| 1539 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
| 1540 | - /* |
|
| 1539 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
| 1540 | + /* |
|
| 1541 | 1541 | $alldata = array(); |
| 1542 | 1542 | foreach ($pall as $value) { |
| 1543 | 1543 | $icao = $value['arrival_airport_icao']; |
@@ -1557,22 +1557,22 @@ discard block |
||
| 1557 | 1557 | */ |
| 1558 | 1558 | |
| 1559 | 1559 | |
| 1560 | - foreach ($dall as $value) { |
|
| 1561 | - $icao = $value['arrival_airport_icao']; |
|
| 1562 | - $ddate = $value['date']; |
|
| 1563 | - $find = false; |
|
| 1564 | - foreach ($pall as $pvalue) { |
|
| 1565 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1566 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1567 | - $find = true; |
|
| 1568 | - break; |
|
| 1569 | - } |
|
| 1570 | - } |
|
| 1571 | - if ($find === false) { |
|
| 1572 | - $pall[] = $value; |
|
| 1573 | - } |
|
| 1574 | - } |
|
| 1575 | - $alldata = $pall; |
|
| 1560 | + foreach ($dall as $value) { |
|
| 1561 | + $icao = $value['arrival_airport_icao']; |
|
| 1562 | + $ddate = $value['date']; |
|
| 1563 | + $find = false; |
|
| 1564 | + foreach ($pall as $pvalue) { |
|
| 1565 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1566 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1567 | + $find = true; |
|
| 1568 | + break; |
|
| 1569 | + } |
|
| 1570 | + } |
|
| 1571 | + if ($find === false) { |
|
| 1572 | + $pall[] = $value; |
|
| 1573 | + } |
|
| 1574 | + } |
|
| 1575 | + $alldata = $pall; |
|
| 1576 | 1576 | foreach ($alldata as $number) { |
| 1577 | 1577 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
| 1578 | 1578 | } |
@@ -1639,51 +1639,51 @@ discard block |
||
| 1639 | 1639 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
| 1640 | 1640 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1641 | 1641 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
| 1642 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1642 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1643 | 1643 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
| 1644 | - //$alldata = array(); |
|
| 1645 | - foreach ($dall as $value) { |
|
| 1646 | - $icao = $value['airport_departure_icao']; |
|
| 1647 | - $dicao = $value['airline_icao']; |
|
| 1648 | - $find = false; |
|
| 1649 | - foreach ($pall as $pvalue) { |
|
| 1650 | - if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1651 | - $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1652 | - $find = true; |
|
| 1653 | - break; |
|
| 1654 | - } |
|
| 1655 | - } |
|
| 1656 | - if ($find === false) { |
|
| 1657 | - $pall[] = $value; |
|
| 1658 | - } |
|
| 1659 | - } |
|
| 1660 | - $alldata = $pall; |
|
| 1644 | + //$alldata = array(); |
|
| 1645 | + foreach ($dall as $value) { |
|
| 1646 | + $icao = $value['airport_departure_icao']; |
|
| 1647 | + $dicao = $value['airline_icao']; |
|
| 1648 | + $find = false; |
|
| 1649 | + foreach ($pall as $pvalue) { |
|
| 1650 | + if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1651 | + $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1652 | + $find = true; |
|
| 1653 | + break; |
|
| 1654 | + } |
|
| 1655 | + } |
|
| 1656 | + if ($find === false) { |
|
| 1657 | + $pall[] = $value; |
|
| 1658 | + } |
|
| 1659 | + } |
|
| 1660 | + $alldata = $pall; |
|
| 1661 | 1661 | foreach ($alldata as $number) { |
| 1662 | 1662 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
| 1663 | 1663 | } |
| 1664 | 1664 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
| 1665 | 1665 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1666 | 1666 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
| 1667 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1667 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1668 | 1668 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
| 1669 | - //$alldata = array(); |
|
| 1670 | - foreach ($dall as $value) { |
|
| 1671 | - $icao = $value['airport_arrival_icao']; |
|
| 1672 | - $dicao = $value['airline_icao']; |
|
| 1673 | - $find = false; |
|
| 1674 | - foreach ($pall as $pvalue) { |
|
| 1675 | - if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1676 | - $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1677 | - $find = true; |
|
| 1678 | - break; |
|
| 1679 | - } |
|
| 1680 | - } |
|
| 1681 | - if ($find === false) { |
|
| 1682 | - $pall[] = $value; |
|
| 1683 | - } |
|
| 1684 | - } |
|
| 1685 | - $alldata = $pall; |
|
| 1686 | - foreach ($alldata as $number) { |
|
| 1669 | + //$alldata = array(); |
|
| 1670 | + foreach ($dall as $value) { |
|
| 1671 | + $icao = $value['airport_arrival_icao']; |
|
| 1672 | + $dicao = $value['airline_icao']; |
|
| 1673 | + $find = false; |
|
| 1674 | + foreach ($pall as $pvalue) { |
|
| 1675 | + if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1676 | + $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1677 | + $find = true; |
|
| 1678 | + break; |
|
| 1679 | + } |
|
| 1680 | + } |
|
| 1681 | + if ($find === false) { |
|
| 1682 | + $pall[] = $value; |
|
| 1683 | + } |
|
| 1684 | + } |
|
| 1685 | + $alldata = $pall; |
|
| 1686 | + foreach ($alldata as $number) { |
|
| 1687 | 1687 | if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
| 1688 | 1688 | } |
| 1689 | 1689 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
@@ -1716,47 +1716,47 @@ discard block |
||
| 1716 | 1716 | } |
| 1717 | 1717 | if ($globalDebug) echo '...Departure'."\n"; |
| 1718 | 1718 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 1719 | - $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
| 1720 | - foreach ($dall as $value) { |
|
| 1721 | - $icao = $value['departure_airport_icao']; |
|
| 1722 | - $airline = $value['airline_icao']; |
|
| 1723 | - $ddate = $value['date']; |
|
| 1724 | - $find = false; |
|
| 1725 | - foreach ($pall as $pvalue) { |
|
| 1726 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
| 1727 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1728 | - $find = true; |
|
| 1729 | - break; |
|
| 1730 | - } |
|
| 1731 | - } |
|
| 1732 | - if ($find === false) { |
|
| 1733 | - $pall[] = $value; |
|
| 1734 | - } |
|
| 1735 | - } |
|
| 1736 | - $alldata = $pall; |
|
| 1719 | + $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
| 1720 | + foreach ($dall as $value) { |
|
| 1721 | + $icao = $value['departure_airport_icao']; |
|
| 1722 | + $airline = $value['airline_icao']; |
|
| 1723 | + $ddate = $value['date']; |
|
| 1724 | + $find = false; |
|
| 1725 | + foreach ($pall as $pvalue) { |
|
| 1726 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
| 1727 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1728 | + $find = true; |
|
| 1729 | + break; |
|
| 1730 | + } |
|
| 1731 | + } |
|
| 1732 | + if ($find === false) { |
|
| 1733 | + $pall[] = $value; |
|
| 1734 | + } |
|
| 1735 | + } |
|
| 1736 | + $alldata = $pall; |
|
| 1737 | 1737 | foreach ($alldata as $number) { |
| 1738 | 1738 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
| 1739 | 1739 | } |
| 1740 | 1740 | if ($globalDebug) echo '...Arrival'."\n"; |
| 1741 | 1741 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 1742 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
| 1743 | - foreach ($dall as $value) { |
|
| 1744 | - $icao = $value['arrival_airport_icao']; |
|
| 1745 | - $airline = $value['airline_icao']; |
|
| 1746 | - $ddate = $value['date']; |
|
| 1747 | - $find = false; |
|
| 1748 | - foreach ($pall as $pvalue) { |
|
| 1749 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
| 1750 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1751 | - $find = true; |
|
| 1752 | - break; |
|
| 1753 | - } |
|
| 1754 | - } |
|
| 1755 | - if ($find === false) { |
|
| 1756 | - $pall[] = $value; |
|
| 1757 | - } |
|
| 1758 | - } |
|
| 1759 | - $alldata = $pall; |
|
| 1742 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
| 1743 | + foreach ($dall as $value) { |
|
| 1744 | + $icao = $value['arrival_airport_icao']; |
|
| 1745 | + $airline = $value['airline_icao']; |
|
| 1746 | + $ddate = $value['date']; |
|
| 1747 | + $find = false; |
|
| 1748 | + foreach ($pall as $pvalue) { |
|
| 1749 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
| 1750 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1751 | + $find = true; |
|
| 1752 | + break; |
|
| 1753 | + } |
|
| 1754 | + } |
|
| 1755 | + if ($find === false) { |
|
| 1756 | + $pall[] = $value; |
|
| 1757 | + } |
|
| 1758 | + } |
|
| 1759 | + $alldata = $pall; |
|
| 1760 | 1760 | foreach ($alldata as $number) { |
| 1761 | 1761 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
| 1762 | 1762 | } |
@@ -1827,44 +1827,44 @@ discard block |
||
| 1827 | 1827 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
| 1828 | 1828 | } |
| 1829 | 1829 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
| 1830 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 1831 | - $alldata = array(); |
|
| 1832 | - foreach ($pall as $value) { |
|
| 1833 | - $icao = $value['airport_departure_icao']; |
|
| 1834 | - $alldata[$icao] = $value; |
|
| 1835 | - } |
|
| 1836 | - foreach ($dall as $value) { |
|
| 1837 | - $icao = $value['airport_departure_icao']; |
|
| 1838 | - if (isset($alldata[$icao])) { |
|
| 1839 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1840 | - } else $alldata[$icao] = $value; |
|
| 1841 | - } |
|
| 1842 | - $count = array(); |
|
| 1843 | - foreach ($alldata as $key => $row) { |
|
| 1844 | - $count[$key] = $row['airport_departure_icao_count']; |
|
| 1845 | - } |
|
| 1830 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 1831 | + $alldata = array(); |
|
| 1832 | + foreach ($pall as $value) { |
|
| 1833 | + $icao = $value['airport_departure_icao']; |
|
| 1834 | + $alldata[$icao] = $value; |
|
| 1835 | + } |
|
| 1836 | + foreach ($dall as $value) { |
|
| 1837 | + $icao = $value['airport_departure_icao']; |
|
| 1838 | + if (isset($alldata[$icao])) { |
|
| 1839 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1840 | + } else $alldata[$icao] = $value; |
|
| 1841 | + } |
|
| 1842 | + $count = array(); |
|
| 1843 | + foreach ($alldata as $key => $row) { |
|
| 1844 | + $count[$key] = $row['airport_departure_icao_count']; |
|
| 1845 | + } |
|
| 1846 | 1846 | array_multisort($count,SORT_DESC,$alldata); |
| 1847 | 1847 | foreach ($alldata as $number) { |
| 1848 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
| 1848 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
| 1849 | 1849 | } |
| 1850 | 1850 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
| 1851 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 1851 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 1852 | 1852 | $alldata = array(); |
| 1853 | - foreach ($pall as $value) { |
|
| 1854 | - $icao = $value['airport_arrival_icao']; |
|
| 1855 | - $alldata[$icao] = $value; |
|
| 1856 | - } |
|
| 1857 | - foreach ($dall as $value) { |
|
| 1858 | - $icao = $value['airport_arrival_icao']; |
|
| 1859 | - if (isset($alldata[$icao])) { |
|
| 1860 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1861 | - } else $alldata[$icao] = $value; |
|
| 1862 | - } |
|
| 1863 | - $count = array(); |
|
| 1864 | - foreach ($alldata as $key => $row) { |
|
| 1865 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1866 | - } |
|
| 1867 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1853 | + foreach ($pall as $value) { |
|
| 1854 | + $icao = $value['airport_arrival_icao']; |
|
| 1855 | + $alldata[$icao] = $value; |
|
| 1856 | + } |
|
| 1857 | + foreach ($dall as $value) { |
|
| 1858 | + $icao = $value['airport_arrival_icao']; |
|
| 1859 | + if (isset($alldata[$icao])) { |
|
| 1860 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1861 | + } else $alldata[$icao] = $value; |
|
| 1862 | + } |
|
| 1863 | + $count = array(); |
|
| 1864 | + foreach ($alldata as $key => $row) { |
|
| 1865 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1866 | + } |
|
| 1867 | + array_multisort($count,SORT_DESC,$alldata); |
|
| 1868 | 1868 | foreach ($alldata as $number) { |
| 1869 | 1869 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
| 1870 | 1870 | } |
@@ -1897,45 +1897,45 @@ discard block |
||
| 1897 | 1897 | } |
| 1898 | 1898 | echo '...Departure'."\n"; |
| 1899 | 1899 | $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
| 1900 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 1900 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 1901 | 1901 | foreach ($dall as $value) { |
| 1902 | - $icao = $value['departure_airport_icao']; |
|
| 1903 | - $ddate = $value['date']; |
|
| 1904 | - $find = false; |
|
| 1905 | - foreach ($pall as $pvalue) { |
|
| 1906 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1907 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1908 | - $find = true; |
|
| 1909 | - break; |
|
| 1910 | - } |
|
| 1911 | - } |
|
| 1912 | - if ($find === false) { |
|
| 1913 | - $pall[] = $value; |
|
| 1914 | - } |
|
| 1915 | - } |
|
| 1916 | - $alldata = $pall; |
|
| 1902 | + $icao = $value['departure_airport_icao']; |
|
| 1903 | + $ddate = $value['date']; |
|
| 1904 | + $find = false; |
|
| 1905 | + foreach ($pall as $pvalue) { |
|
| 1906 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1907 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1908 | + $find = true; |
|
| 1909 | + break; |
|
| 1910 | + } |
|
| 1911 | + } |
|
| 1912 | + if ($find === false) { |
|
| 1913 | + $pall[] = $value; |
|
| 1914 | + } |
|
| 1915 | + } |
|
| 1916 | + $alldata = $pall; |
|
| 1917 | 1917 | foreach ($alldata as $number) { |
| 1918 | 1918 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
| 1919 | 1919 | } |
| 1920 | 1920 | echo '...Arrival'."\n"; |
| 1921 | 1921 | $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
| 1922 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 1922 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 1923 | 1923 | foreach ($dall as $value) { |
| 1924 | 1924 | $icao = $value['arrival_airport_icao']; |
| 1925 | 1925 | $ddate = $value['date']; |
| 1926 | - $find = false; |
|
| 1926 | + $find = false; |
|
| 1927 | 1927 | foreach ($pall as $pvalue) { |
| 1928 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1929 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1930 | - $find = true; |
|
| 1931 | - break; |
|
| 1932 | - } |
|
| 1933 | - } |
|
| 1934 | - if ($find === false) { |
|
| 1935 | - $pall[] = $value; |
|
| 1936 | - } |
|
| 1937 | - } |
|
| 1938 | - $alldata = $pall; |
|
| 1928 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1929 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1930 | + $find = true; |
|
| 1931 | + break; |
|
| 1932 | + } |
|
| 1933 | + } |
|
| 1934 | + if ($find === false) { |
|
| 1935 | + $pall[] = $value; |
|
| 1936 | + } |
|
| 1937 | + } |
|
| 1938 | + $alldata = $pall; |
|
| 1939 | 1939 | foreach ($alldata as $number) { |
| 1940 | 1940 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
| 1941 | 1941 | } |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * Get SQL query part for filter used |
|
| 59 | - * @param Array $filter the filter |
|
| 60 | - * @return Array the SQL part |
|
| 61 | - */ |
|
| 58 | + * Get SQL query part for filter used |
|
| 59 | + * @param Array $filter the filter |
|
| 60 | + * @return Array the SQL part |
|
| 61 | + */ |
|
| 62 | 62 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 63 | 63 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 64 | 64 | $filters = array(); |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * Executes the SQL statements to get the spotter information |
|
| 133 | - * |
|
| 134 | - * @param String $query the SQL query |
|
| 135 | - * @param Array $params parameter of the query |
|
| 136 | - * @param String $limitQuery the limit query |
|
| 137 | - * @return Array the spotter information |
|
| 138 | - * |
|
| 139 | - */ |
|
| 132 | + * Executes the SQL statements to get the spotter information |
|
| 133 | + * |
|
| 134 | + * @param String $query the SQL query |
|
| 135 | + * @param Array $params parameter of the query |
|
| 136 | + * @param String $limitQuery the limit query |
|
| 137 | + * @return Array the spotter information |
|
| 138 | + * |
|
| 139 | + */ |
|
| 140 | 140 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 141 | 141 | { |
| 142 | 142 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -300,11 +300,11 @@ discard block |
||
| 300 | 300 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 301 | 301 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 302 | 302 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
| 303 | - } else { |
|
| 304 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 303 | + } else { |
|
| 304 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 305 | 305 | $temp_array['aircraft_name'] = 'N/A'; |
| 306 | 306 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
| 307 | - } |
|
| 307 | + } |
|
| 308 | 308 | } |
| 309 | 309 | $fromsource = NULL; |
| 310 | 310 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -500,11 +500,11 @@ discard block |
||
| 500 | 500 | |
| 501 | 501 | |
| 502 | 502 | /** |
| 503 | - * Gets all the spotter information |
|
| 504 | - * |
|
| 505 | - * @return Array the spotter information |
|
| 506 | - * |
|
| 507 | - */ |
|
| 503 | + * Gets all the spotter information |
|
| 504 | + * |
|
| 505 | + * @return Array the spotter information |
|
| 506 | + * |
|
| 507 | + */ |
|
| 508 | 508 | 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()) |
| 509 | 509 | { |
| 510 | 510 | global $globalTimezone, $globalDBdriver; |
@@ -851,11 +851,11 @@ discard block |
||
| 851 | 851 | |
| 852 | 852 | |
| 853 | 853 | /** |
| 854 | - * Gets all the spotter information based on the latest data entry |
|
| 855 | - * |
|
| 856 | - * @return Array the spotter information |
|
| 857 | - * |
|
| 858 | - */ |
|
| 854 | + * Gets all the spotter information based on the latest data entry |
|
| 855 | + * |
|
| 856 | + * @return Array the spotter information |
|
| 857 | + * |
|
| 858 | + */ |
|
| 859 | 859 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
| 860 | 860 | { |
| 861 | 861 | global $global_query; |
@@ -894,12 +894,12 @@ discard block |
||
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | |
| 897 | - /** |
|
| 898 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 899 | - * |
|
| 900 | - * @return Array the spotter information |
|
| 901 | - * |
|
| 902 | - */ |
|
| 897 | + /** |
|
| 898 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 899 | + * |
|
| 900 | + * @return Array the spotter information |
|
| 901 | + * |
|
| 902 | + */ |
|
| 903 | 903 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 904 | 904 | { |
| 905 | 905 | date_default_timezone_set('UTC'); |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | return false; |
| 928 | 928 | } |
| 929 | 929 | } |
| 930 | - $additional_query = ''; |
|
| 930 | + $additional_query = ''; |
|
| 931 | 931 | if ($interval != "") |
| 932 | 932 | { |
| 933 | 933 | if (!is_string($interval)) |
@@ -967,12 +967,12 @@ discard block |
||
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | |
| 970 | - /** |
|
| 971 | - * Gets all the spotter information sorted by the newest aircraft type |
|
| 972 | - * |
|
| 973 | - * @return Array the spotter information |
|
| 974 | - * |
|
| 975 | - */ |
|
| 970 | + /** |
|
| 971 | + * Gets all the spotter information sorted by the newest aircraft type |
|
| 972 | + * |
|
| 973 | + * @return Array the spotter information |
|
| 974 | + * |
|
| 975 | + */ |
|
| 976 | 976 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
| 977 | 977 | { |
| 978 | 978 | global $global_query; |
@@ -1013,11 +1013,11 @@ discard block |
||
| 1013 | 1013 | |
| 1014 | 1014 | |
| 1015 | 1015 | /** |
| 1016 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1017 | - * |
|
| 1018 | - * @return Array the spotter information |
|
| 1019 | - * |
|
| 1020 | - */ |
|
| 1016 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1017 | + * |
|
| 1018 | + * @return Array the spotter information |
|
| 1019 | + * |
|
| 1020 | + */ |
|
| 1021 | 1021 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
| 1022 | 1022 | { |
| 1023 | 1023 | global $global_query; |
@@ -1057,11 +1057,11 @@ discard block |
||
| 1057 | 1057 | |
| 1058 | 1058 | |
| 1059 | 1059 | /** |
| 1060 | - * Gets all the spotter information sorted by the newest airline |
|
| 1061 | - * |
|
| 1062 | - * @return Array the spotter information |
|
| 1063 | - * |
|
| 1064 | - */ |
|
| 1060 | + * Gets all the spotter information sorted by the newest airline |
|
| 1061 | + * |
|
| 1062 | + * @return Array the spotter information |
|
| 1063 | + * |
|
| 1064 | + */ |
|
| 1065 | 1065 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
| 1066 | 1066 | { |
| 1067 | 1067 | global $global_query; |
@@ -1100,12 +1100,12 @@ discard block |
||
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | |
| 1103 | - /** |
|
| 1104 | - * Gets all the spotter information sorted by the newest departure airport |
|
| 1105 | - * |
|
| 1106 | - * @return Array the spotter information |
|
| 1107 | - * |
|
| 1108 | - */ |
|
| 1103 | + /** |
|
| 1104 | + * Gets all the spotter information sorted by the newest departure airport |
|
| 1105 | + * |
|
| 1106 | + * @return Array the spotter information |
|
| 1107 | + * |
|
| 1108 | + */ |
|
| 1109 | 1109 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
| 1110 | 1110 | { |
| 1111 | 1111 | global $global_query; |
@@ -1147,11 +1147,11 @@ discard block |
||
| 1147 | 1147 | |
| 1148 | 1148 | |
| 1149 | 1149 | /** |
| 1150 | - * Gets all the spotter information sorted by the newest arrival airport |
|
| 1151 | - * |
|
| 1152 | - * @return Array the spotter information |
|
| 1153 | - * |
|
| 1154 | - */ |
|
| 1150 | + * Gets all the spotter information sorted by the newest arrival airport |
|
| 1151 | + * |
|
| 1152 | + * @return Array the spotter information |
|
| 1153 | + * |
|
| 1154 | + */ |
|
| 1155 | 1155 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
| 1156 | 1156 | { |
| 1157 | 1157 | global $global_query; |
@@ -1190,11 +1190,11 @@ discard block |
||
| 1190 | 1190 | |
| 1191 | 1191 | |
| 1192 | 1192 | /** |
| 1193 | - * Gets all the spotter information based on the spotter id |
|
| 1194 | - * |
|
| 1195 | - * @return Array the spotter information |
|
| 1196 | - * |
|
| 1197 | - */ |
|
| 1193 | + * Gets all the spotter information based on the spotter id |
|
| 1194 | + * |
|
| 1195 | + * @return Array the spotter information |
|
| 1196 | + * |
|
| 1197 | + */ |
|
| 1198 | 1198 | public function getSpotterDataByID($id = '') |
| 1199 | 1199 | { |
| 1200 | 1200 | global $global_query; |
@@ -1216,11 +1216,11 @@ discard block |
||
| 1216 | 1216 | |
| 1217 | 1217 | |
| 1218 | 1218 | /** |
| 1219 | - * Gets all the spotter information based on the callsign |
|
| 1220 | - * |
|
| 1221 | - * @return Array the spotter information |
|
| 1222 | - * |
|
| 1223 | - */ |
|
| 1219 | + * Gets all the spotter information based on the callsign |
|
| 1220 | + * |
|
| 1221 | + * @return Array the spotter information |
|
| 1222 | + * |
|
| 1223 | + */ |
|
| 1224 | 1224 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
| 1225 | 1225 | { |
| 1226 | 1226 | global $global_query; |
@@ -1273,11 +1273,11 @@ discard block |
||
| 1273 | 1273 | |
| 1274 | 1274 | |
| 1275 | 1275 | /** |
| 1276 | - * Gets all the spotter information based on the aircraft type |
|
| 1277 | - * |
|
| 1278 | - * @return Array the spotter information |
|
| 1279 | - * |
|
| 1280 | - */ |
|
| 1276 | + * Gets all the spotter information based on the aircraft type |
|
| 1277 | + * |
|
| 1278 | + * @return Array the spotter information |
|
| 1279 | + * |
|
| 1280 | + */ |
|
| 1281 | 1281 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
| 1282 | 1282 | { |
| 1283 | 1283 | global $global_query; |
@@ -1331,11 +1331,11 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | |
| 1333 | 1333 | /** |
| 1334 | - * Gets all the spotter information based on the aircraft registration |
|
| 1335 | - * |
|
| 1336 | - * @return Array the spotter information |
|
| 1337 | - * |
|
| 1338 | - */ |
|
| 1334 | + * Gets all the spotter information based on the aircraft registration |
|
| 1335 | + * |
|
| 1336 | + * @return Array the spotter information |
|
| 1337 | + * |
|
| 1338 | + */ |
|
| 1339 | 1339 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
| 1340 | 1340 | { |
| 1341 | 1341 | global $global_query; |
@@ -1392,11 +1392,11 @@ discard block |
||
| 1392 | 1392 | |
| 1393 | 1393 | |
| 1394 | 1394 | /** |
| 1395 | - * Gets all the spotter information based on the airline |
|
| 1396 | - * |
|
| 1397 | - * @return Array the spotter information |
|
| 1398 | - * |
|
| 1399 | - */ |
|
| 1395 | + * Gets all the spotter information based on the airline |
|
| 1396 | + * |
|
| 1397 | + * @return Array the spotter information |
|
| 1398 | + * |
|
| 1399 | + */ |
|
| 1400 | 1400 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
| 1401 | 1401 | { |
| 1402 | 1402 | global $global_query; |
@@ -1449,11 +1449,11 @@ discard block |
||
| 1449 | 1449 | |
| 1450 | 1450 | |
| 1451 | 1451 | /** |
| 1452 | - * Gets all the spotter information based on the airport |
|
| 1453 | - * |
|
| 1454 | - * @return Array the spotter information |
|
| 1455 | - * |
|
| 1456 | - */ |
|
| 1452 | + * Gets all the spotter information based on the airport |
|
| 1453 | + * |
|
| 1454 | + * @return Array the spotter information |
|
| 1455 | + * |
|
| 1456 | + */ |
|
| 1457 | 1457 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
| 1458 | 1458 | { |
| 1459 | 1459 | global $global_query; |
@@ -1507,11 +1507,11 @@ discard block |
||
| 1507 | 1507 | |
| 1508 | 1508 | |
| 1509 | 1509 | /** |
| 1510 | - * Gets all the spotter information based on the date |
|
| 1511 | - * |
|
| 1512 | - * @return Array the spotter information |
|
| 1513 | - * |
|
| 1514 | - */ |
|
| 1510 | + * Gets all the spotter information based on the date |
|
| 1511 | + * |
|
| 1512 | + * @return Array the spotter information |
|
| 1513 | + * |
|
| 1514 | + */ |
|
| 1515 | 1515 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
| 1516 | 1516 | { |
| 1517 | 1517 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1575,11 +1575,11 @@ discard block |
||
| 1575 | 1575 | |
| 1576 | 1576 | |
| 1577 | 1577 | /** |
| 1578 | - * Gets all the spotter information based on the country name |
|
| 1579 | - * |
|
| 1580 | - * @return Array the spotter information |
|
| 1581 | - * |
|
| 1582 | - */ |
|
| 1578 | + * Gets all the spotter information based on the country name |
|
| 1579 | + * |
|
| 1580 | + * @return Array the spotter information |
|
| 1581 | + * |
|
| 1582 | + */ |
|
| 1583 | 1583 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
| 1584 | 1584 | { |
| 1585 | 1585 | global $global_query; |
@@ -1633,11 +1633,11 @@ discard block |
||
| 1633 | 1633 | |
| 1634 | 1634 | |
| 1635 | 1635 | /** |
| 1636 | - * Gets all the spotter information based on the manufacturer name |
|
| 1637 | - * |
|
| 1638 | - * @return Array the spotter information |
|
| 1639 | - * |
|
| 1640 | - */ |
|
| 1636 | + * Gets all the spotter information based on the manufacturer name |
|
| 1637 | + * |
|
| 1638 | + * @return Array the spotter information |
|
| 1639 | + * |
|
| 1640 | + */ |
|
| 1641 | 1641 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
| 1642 | 1642 | { |
| 1643 | 1643 | global $global_query; |
@@ -1693,13 +1693,13 @@ discard block |
||
| 1693 | 1693 | |
| 1694 | 1694 | |
| 1695 | 1695 | /** |
| 1696 | - * Gets a list of all aircraft that take a route |
|
| 1697 | - * |
|
| 1698 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1699 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1700 | - * @return Array the spotter information |
|
| 1701 | - * |
|
| 1702 | - */ |
|
| 1696 | + * Gets a list of all aircraft that take a route |
|
| 1697 | + * |
|
| 1698 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1699 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1700 | + * @return Array the spotter information |
|
| 1701 | + * |
|
| 1702 | + */ |
|
| 1703 | 1703 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
| 1704 | 1704 | { |
| 1705 | 1705 | global $global_query; |
@@ -1768,11 +1768,11 @@ discard block |
||
| 1768 | 1768 | |
| 1769 | 1769 | |
| 1770 | 1770 | /** |
| 1771 | - * Gets all the spotter information based on the special column in the table |
|
| 1772 | - * |
|
| 1773 | - * @return Array the spotter information |
|
| 1774 | - * |
|
| 1775 | - */ |
|
| 1771 | + * Gets all the spotter information based on the special column in the table |
|
| 1772 | + * |
|
| 1773 | + * @return Array the spotter information |
|
| 1774 | + * |
|
| 1775 | + */ |
|
| 1776 | 1776 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
| 1777 | 1777 | { |
| 1778 | 1778 | global $global_query; |
@@ -1811,11 +1811,11 @@ discard block |
||
| 1811 | 1811 | } |
| 1812 | 1812 | |
| 1813 | 1813 | /** |
| 1814 | - * Gets all the highlight based on a aircraft registration |
|
| 1815 | - * |
|
| 1816 | - * @return String the highlight text |
|
| 1817 | - * |
|
| 1818 | - */ |
|
| 1814 | + * Gets all the highlight based on a aircraft registration |
|
| 1815 | + * |
|
| 1816 | + * @return String the highlight text |
|
| 1817 | + * |
|
| 1818 | + */ |
|
| 1819 | 1819 | public function getHighlightByRegistration($registration,$filter = array()) |
| 1820 | 1820 | { |
| 1821 | 1821 | global $global_query; |
@@ -1837,13 +1837,13 @@ discard block |
||
| 1837 | 1837 | |
| 1838 | 1838 | |
| 1839 | 1839 | /** |
| 1840 | - * Gets the squawk usage from squawk code |
|
| 1841 | - * |
|
| 1842 | - * @param String $squawk squawk code |
|
| 1843 | - * @param String $country country |
|
| 1844 | - * @return String usage |
|
| 1845 | - * |
|
| 1846 | - */ |
|
| 1840 | + * Gets the squawk usage from squawk code |
|
| 1841 | + * |
|
| 1842 | + * @param String $squawk squawk code |
|
| 1843 | + * @param String $country country |
|
| 1844 | + * @return String usage |
|
| 1845 | + * |
|
| 1846 | + */ |
|
| 1847 | 1847 | public function getSquawkUsage($squawk = '',$country = 'FR') |
| 1848 | 1848 | { |
| 1849 | 1849 | |
@@ -1864,12 +1864,12 @@ discard block |
||
| 1864 | 1864 | } |
| 1865 | 1865 | |
| 1866 | 1866 | /** |
| 1867 | - * Gets the airport icao from the iata |
|
| 1868 | - * |
|
| 1869 | - * @param String $airport_iata the iata code of the airport |
|
| 1870 | - * @return String airport iata |
|
| 1871 | - * |
|
| 1872 | - */ |
|
| 1867 | + * Gets the airport icao from the iata |
|
| 1868 | + * |
|
| 1869 | + * @param String $airport_iata the iata code of the airport |
|
| 1870 | + * @return String airport iata |
|
| 1871 | + * |
|
| 1872 | + */ |
|
| 1873 | 1873 | public function getAirportIcao($airport_iata = '') |
| 1874 | 1874 | { |
| 1875 | 1875 | |
@@ -1889,14 +1889,14 @@ discard block |
||
| 1889 | 1889 | } |
| 1890 | 1890 | |
| 1891 | 1891 | /** |
| 1892 | - * Gets the airport distance |
|
| 1893 | - * |
|
| 1894 | - * @param String $airport_icao the icao code of the airport |
|
| 1895 | - * @param Float $latitude the latitude |
|
| 1896 | - * @param Float $longitude the longitude |
|
| 1897 | - * @return Float distance to the airport |
|
| 1898 | - * |
|
| 1899 | - */ |
|
| 1892 | + * Gets the airport distance |
|
| 1893 | + * |
|
| 1894 | + * @param String $airport_icao the icao code of the airport |
|
| 1895 | + * @param Float $latitude the latitude |
|
| 1896 | + * @param Float $longitude the longitude |
|
| 1897 | + * @return Float distance to the airport |
|
| 1898 | + * |
|
| 1899 | + */ |
|
| 1900 | 1900 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
| 1901 | 1901 | { |
| 1902 | 1902 | |
@@ -1917,12 +1917,12 @@ discard block |
||
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | 1919 | /** |
| 1920 | - * Gets the airport info based on the icao |
|
| 1921 | - * |
|
| 1922 | - * @param String $airport the icao code of the airport |
|
| 1923 | - * @return Array airport information |
|
| 1924 | - * |
|
| 1925 | - */ |
|
| 1920 | + * Gets the airport info based on the icao |
|
| 1921 | + * |
|
| 1922 | + * @param String $airport the icao code of the airport |
|
| 1923 | + * @return Array airport information |
|
| 1924 | + * |
|
| 1925 | + */ |
|
| 1926 | 1926 | public function getAllAirportInfo($airport = '') |
| 1927 | 1927 | { |
| 1928 | 1928 | |
@@ -1968,12 +1968,12 @@ discard block |
||
| 1968 | 1968 | } |
| 1969 | 1969 | |
| 1970 | 1970 | /** |
| 1971 | - * Gets the airport info based on the country |
|
| 1972 | - * |
|
| 1973 | - * @param Array $countries Airports countries |
|
| 1974 | - * @return Array airport information |
|
| 1975 | - * |
|
| 1976 | - */ |
|
| 1971 | + * Gets the airport info based on the country |
|
| 1972 | + * |
|
| 1973 | + * @param Array $countries Airports countries |
|
| 1974 | + * @return Array airport information |
|
| 1975 | + * |
|
| 1976 | + */ |
|
| 1977 | 1977 | public function getAllAirportInfobyCountry($countries) |
| 1978 | 1978 | { |
| 1979 | 1979 | $lst_countries = ''; |
@@ -2011,12 +2011,12 @@ discard block |
||
| 2011 | 2011 | } |
| 2012 | 2012 | |
| 2013 | 2013 | /** |
| 2014 | - * Gets airports info based on the coord |
|
| 2015 | - * |
|
| 2016 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2017 | - * @return Array airport information |
|
| 2018 | - * |
|
| 2019 | - */ |
|
| 2014 | + * Gets airports info based on the coord |
|
| 2015 | + * |
|
| 2016 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2017 | + * @return Array airport information |
|
| 2018 | + * |
|
| 2019 | + */ |
|
| 2020 | 2020 | public function getAllAirportInfobyCoord($coord) |
| 2021 | 2021 | { |
| 2022 | 2022 | global $globalDBdriver; |
@@ -2047,12 +2047,12 @@ discard block |
||
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | 2049 | /** |
| 2050 | - * Gets waypoints info based on the coord |
|
| 2051 | - * |
|
| 2052 | - * @param Array $coord waypoints coord |
|
| 2053 | - * @return Array airport information |
|
| 2054 | - * |
|
| 2055 | - */ |
|
| 2050 | + * Gets waypoints info based on the coord |
|
| 2051 | + * |
|
| 2052 | + * @param Array $coord waypoints coord |
|
| 2053 | + * @return Array airport information |
|
| 2054 | + * |
|
| 2055 | + */ |
|
| 2056 | 2056 | public function getAllWaypointsInfobyCoord($coord) |
| 2057 | 2057 | { |
| 2058 | 2058 | if (is_array($coord)) { |
@@ -2086,12 +2086,12 @@ discard block |
||
| 2086 | 2086 | |
| 2087 | 2087 | |
| 2088 | 2088 | /** |
| 2089 | - * Gets the airline info based on the icao code or iata code |
|
| 2090 | - * |
|
| 2091 | - * @param String $airline_icao the iata code of the airport |
|
| 2092 | - * @return Array airport information |
|
| 2093 | - * |
|
| 2094 | - */ |
|
| 2089 | + * Gets the airline info based on the icao code or iata code |
|
| 2090 | + * |
|
| 2091 | + * @param String $airline_icao the iata code of the airport |
|
| 2092 | + * @return Array airport information |
|
| 2093 | + * |
|
| 2094 | + */ |
|
| 2095 | 2095 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2096 | 2096 | { |
| 2097 | 2097 | global $globalUseRealAirlines; |
@@ -2122,7 +2122,7 @@ discard block |
||
| 2122 | 2122 | } else { |
| 2123 | 2123 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
| 2124 | 2124 | } |
| 2125 | - /* |
|
| 2125 | + /* |
|
| 2126 | 2126 | $airline_array = array(); |
| 2127 | 2127 | $temp_array = array(); |
| 2128 | 2128 | |
@@ -2152,12 +2152,12 @@ discard block |
||
| 2152 | 2152 | } |
| 2153 | 2153 | |
| 2154 | 2154 | /** |
| 2155 | - * Gets the airline info based on the airline name |
|
| 2156 | - * |
|
| 2157 | - * @param String $airline_name the name of the airline |
|
| 2158 | - * @return Array airline information |
|
| 2159 | - * |
|
| 2160 | - */ |
|
| 2155 | + * Gets the airline info based on the airline name |
|
| 2156 | + * |
|
| 2157 | + * @param String $airline_name the name of the airline |
|
| 2158 | + * @return Array airline information |
|
| 2159 | + * |
|
| 2160 | + */ |
|
| 2161 | 2161 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2162 | 2162 | { |
| 2163 | 2163 | global $globalUseRealAirlines; |
@@ -2185,12 +2185,12 @@ discard block |
||
| 2185 | 2185 | |
| 2186 | 2186 | |
| 2187 | 2187 | /** |
| 2188 | - * Gets the aircraft info based on the aircraft type |
|
| 2189 | - * |
|
| 2190 | - * @param String $aircraft_type the aircraft type |
|
| 2191 | - * @return Array aircraft information |
|
| 2192 | - * |
|
| 2193 | - */ |
|
| 2188 | + * Gets the aircraft info based on the aircraft type |
|
| 2189 | + * |
|
| 2190 | + * @param String $aircraft_type the aircraft type |
|
| 2191 | + * @return Array aircraft information |
|
| 2192 | + * |
|
| 2193 | + */ |
|
| 2194 | 2194 | public function getAllAircraftInfo($aircraft_type) |
| 2195 | 2195 | { |
| 2196 | 2196 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2222,12 +2222,12 @@ discard block |
||
| 2222 | 2222 | } |
| 2223 | 2223 | |
| 2224 | 2224 | /** |
| 2225 | - * Gets the aircraft icao based on the aircraft name/type |
|
| 2226 | - * |
|
| 2227 | - * @param String $aircraft_type the aircraft type |
|
| 2228 | - * @return String aircraft information |
|
| 2229 | - * |
|
| 2230 | - */ |
|
| 2225 | + * Gets the aircraft icao based on the aircraft name/type |
|
| 2226 | + * |
|
| 2227 | + * @param String $aircraft_type the aircraft type |
|
| 2228 | + * @return String aircraft information |
|
| 2229 | + * |
|
| 2230 | + */ |
|
| 2231 | 2231 | public function getAircraftIcao($aircraft_type) |
| 2232 | 2232 | { |
| 2233 | 2233 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2252,12 +2252,12 @@ discard block |
||
| 2252 | 2252 | } |
| 2253 | 2253 | |
| 2254 | 2254 | /** |
| 2255 | - * Gets the aircraft info based on the aircraft modes |
|
| 2256 | - * |
|
| 2257 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2258 | - * @return String aircraft type |
|
| 2259 | - * |
|
| 2260 | - */ |
|
| 2255 | + * Gets the aircraft info based on the aircraft modes |
|
| 2256 | + * |
|
| 2257 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2258 | + * @return String aircraft type |
|
| 2259 | + * |
|
| 2260 | + */ |
|
| 2261 | 2261 | public function getAllAircraftType($aircraft_modes) |
| 2262 | 2262 | { |
| 2263 | 2263 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2277,12 +2277,12 @@ discard block |
||
| 2277 | 2277 | } |
| 2278 | 2278 | |
| 2279 | 2279 | /** |
| 2280 | - * Gets the aircraft info based on the aircraft registration |
|
| 2281 | - * |
|
| 2282 | - * @param String $registration the aircraft registration |
|
| 2283 | - * @return String aircraft type |
|
| 2284 | - * |
|
| 2285 | - */ |
|
| 2280 | + * Gets the aircraft info based on the aircraft registration |
|
| 2281 | + * |
|
| 2282 | + * @param String $registration the aircraft registration |
|
| 2283 | + * @return String aircraft type |
|
| 2284 | + * |
|
| 2285 | + */ |
|
| 2286 | 2286 | public function getAllAircraftTypeByRegistration($registration) |
| 2287 | 2287 | { |
| 2288 | 2288 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2300,12 +2300,12 @@ discard block |
||
| 2300 | 2300 | } |
| 2301 | 2301 | |
| 2302 | 2302 | /** |
| 2303 | - * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2304 | - * |
|
| 2305 | - * @param String $registration the aircraft registration |
|
| 2306 | - * @return Array spotter_id and flightaware_id |
|
| 2307 | - * |
|
| 2308 | - */ |
|
| 2303 | + * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2304 | + * |
|
| 2305 | + * @param String $registration the aircraft registration |
|
| 2306 | + * @return Array spotter_id and flightaware_id |
|
| 2307 | + * |
|
| 2308 | + */ |
|
| 2309 | 2309 | public function getAllIDByRegistration($registration) |
| 2310 | 2310 | { |
| 2311 | 2311 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2324,12 +2324,12 @@ discard block |
||
| 2324 | 2324 | } |
| 2325 | 2325 | |
| 2326 | 2326 | /** |
| 2327 | - * Gets correct aircraft operator code |
|
| 2328 | - * |
|
| 2329 | - * @param String $operator the aircraft operator code (callsign) |
|
| 2330 | - * @return String aircraft operator code |
|
| 2331 | - * |
|
| 2332 | - */ |
|
| 2327 | + * Gets correct aircraft operator code |
|
| 2328 | + * |
|
| 2329 | + * @param String $operator the aircraft operator code (callsign) |
|
| 2330 | + * @return String aircraft operator code |
|
| 2331 | + * |
|
| 2332 | + */ |
|
| 2333 | 2333 | public function getOperator($operator) |
| 2334 | 2334 | { |
| 2335 | 2335 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2346,16 +2346,16 @@ discard block |
||
| 2346 | 2346 | } |
| 2347 | 2347 | |
| 2348 | 2348 | /** |
| 2349 | - * Gets the aircraft route based on the aircraft callsign |
|
| 2350 | - * |
|
| 2351 | - * @param String $callsign the aircraft callsign |
|
| 2352 | - * @return Array aircraft type |
|
| 2353 | - * |
|
| 2354 | - */ |
|
| 2349 | + * Gets the aircraft route based on the aircraft callsign |
|
| 2350 | + * |
|
| 2351 | + * @param String $callsign the aircraft callsign |
|
| 2352 | + * @return Array aircraft type |
|
| 2353 | + * |
|
| 2354 | + */ |
|
| 2355 | 2355 | public function getRouteInfo($callsign) |
| 2356 | 2356 | { |
| 2357 | 2357 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2358 | - if ($callsign == '') return array(); |
|
| 2358 | + if ($callsign == '') return array(); |
|
| 2359 | 2359 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
| 2360 | 2360 | |
| 2361 | 2361 | $sth = $this->db->prepare($query); |
@@ -2369,12 +2369,12 @@ discard block |
||
| 2369 | 2369 | } |
| 2370 | 2370 | |
| 2371 | 2371 | /** |
| 2372 | - * Gets the aircraft info based on the aircraft registration |
|
| 2373 | - * |
|
| 2374 | - * @param String $registration the aircraft registration |
|
| 2375 | - * @return Array aircraft information |
|
| 2376 | - * |
|
| 2377 | - */ |
|
| 2372 | + * Gets the aircraft info based on the aircraft registration |
|
| 2373 | + * |
|
| 2374 | + * @param String $registration the aircraft registration |
|
| 2375 | + * @return Array aircraft information |
|
| 2376 | + * |
|
| 2377 | + */ |
|
| 2378 | 2378 | public function getAircraftInfoByRegistration($registration) |
| 2379 | 2379 | { |
| 2380 | 2380 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2401,12 +2401,12 @@ discard block |
||
| 2401 | 2401 | } |
| 2402 | 2402 | |
| 2403 | 2403 | /** |
| 2404 | - * Gets the aircraft owner & base based on the aircraft registration |
|
| 2405 | - * |
|
| 2406 | - * @param String $registration the aircraft registration |
|
| 2407 | - * @return Array aircraft information |
|
| 2408 | - * |
|
| 2409 | - */ |
|
| 2404 | + * Gets the aircraft owner & base based on the aircraft registration |
|
| 2405 | + * |
|
| 2406 | + * @param String $registration the aircraft registration |
|
| 2407 | + * @return Array aircraft information |
|
| 2408 | + * |
|
| 2409 | + */ |
|
| 2410 | 2410 | public function getAircraftOwnerByRegistration($registration) |
| 2411 | 2411 | { |
| 2412 | 2412 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2423,11 +2423,11 @@ discard block |
||
| 2423 | 2423 | |
| 2424 | 2424 | |
| 2425 | 2425 | /** |
| 2426 | - * Gets all flights (but with only little info) |
|
| 2427 | - * |
|
| 2428 | - * @return Array basic flight information |
|
| 2429 | - * |
|
| 2430 | - */ |
|
| 2426 | + * Gets all flights (but with only little info) |
|
| 2427 | + * |
|
| 2428 | + * @return Array basic flight information |
|
| 2429 | + * |
|
| 2430 | + */ |
|
| 2431 | 2431 | public function getAllFlightsforSitemap() |
| 2432 | 2432 | { |
| 2433 | 2433 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
@@ -2435,7 +2435,7 @@ discard block |
||
| 2435 | 2435 | |
| 2436 | 2436 | $sth = $this->db->prepare($query); |
| 2437 | 2437 | $sth->execute(); |
| 2438 | - /* |
|
| 2438 | + /* |
|
| 2439 | 2439 | $flight_array = array(); |
| 2440 | 2440 | $temp_array = array(); |
| 2441 | 2441 | |
@@ -2457,11 +2457,11 @@ discard block |
||
| 2457 | 2457 | } |
| 2458 | 2458 | |
| 2459 | 2459 | /** |
| 2460 | - * Gets a list of all aircraft manufacturers |
|
| 2461 | - * |
|
| 2462 | - * @return Array list of aircraft types |
|
| 2463 | - * |
|
| 2464 | - */ |
|
| 2460 | + * Gets a list of all aircraft manufacturers |
|
| 2461 | + * |
|
| 2462 | + * @return Array list of aircraft types |
|
| 2463 | + * |
|
| 2464 | + */ |
|
| 2465 | 2465 | public function getAllManufacturers() |
| 2466 | 2466 | { |
| 2467 | 2467 | /* |
@@ -2490,11 +2490,11 @@ discard block |
||
| 2490 | 2490 | |
| 2491 | 2491 | |
| 2492 | 2492 | /** |
| 2493 | - * Gets a list of all aircraft types |
|
| 2494 | - * |
|
| 2495 | - * @return Array list of aircraft types |
|
| 2496 | - * |
|
| 2497 | - */ |
|
| 2493 | + * Gets a list of all aircraft types |
|
| 2494 | + * |
|
| 2495 | + * @return Array list of aircraft types |
|
| 2496 | + * |
|
| 2497 | + */ |
|
| 2498 | 2498 | public function getAllAircraftTypes($filters = array()) |
| 2499 | 2499 | { |
| 2500 | 2500 | /* |
@@ -2529,11 +2529,11 @@ discard block |
||
| 2529 | 2529 | |
| 2530 | 2530 | |
| 2531 | 2531 | /** |
| 2532 | - * Gets a list of all aircraft registrations |
|
| 2533 | - * |
|
| 2534 | - * @return Array list of aircraft registrations |
|
| 2535 | - * |
|
| 2536 | - */ |
|
| 2532 | + * Gets a list of all aircraft registrations |
|
| 2533 | + * |
|
| 2534 | + * @return Array list of aircraft registrations |
|
| 2535 | + * |
|
| 2536 | + */ |
|
| 2537 | 2537 | public function getAllAircraftRegistrations($filters = array()) |
| 2538 | 2538 | { |
| 2539 | 2539 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2558,12 +2558,12 @@ discard block |
||
| 2558 | 2558 | } |
| 2559 | 2559 | |
| 2560 | 2560 | /** |
| 2561 | - * Gets all source name |
|
| 2562 | - * |
|
| 2563 | - * @param String type format of source |
|
| 2564 | - * @return Array list of source name |
|
| 2565 | - * |
|
| 2566 | - */ |
|
| 2561 | + * Gets all source name |
|
| 2562 | + * |
|
| 2563 | + * @param String type format of source |
|
| 2564 | + * @return Array list of source name |
|
| 2565 | + * |
|
| 2566 | + */ |
|
| 2567 | 2567 | public function getAllSourceName($type = '',$filters = array()) |
| 2568 | 2568 | { |
| 2569 | 2569 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2594,11 +2594,11 @@ discard block |
||
| 2594 | 2594 | |
| 2595 | 2595 | |
| 2596 | 2596 | /** |
| 2597 | - * Gets a list of all airline names |
|
| 2598 | - * |
|
| 2599 | - * @return Array list of airline names |
|
| 2600 | - * |
|
| 2601 | - */ |
|
| 2597 | + * Gets a list of all airline names |
|
| 2598 | + * |
|
| 2599 | + * @return Array list of airline names |
|
| 2600 | + * |
|
| 2601 | + */ |
|
| 2602 | 2602 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
| 2603 | 2603 | { |
| 2604 | 2604 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2647,11 +2647,11 @@ discard block |
||
| 2647 | 2647 | } |
| 2648 | 2648 | |
| 2649 | 2649 | /** |
| 2650 | - * Gets a list of all alliance names |
|
| 2651 | - * |
|
| 2652 | - * @return Array list of alliance names |
|
| 2653 | - * |
|
| 2654 | - */ |
|
| 2650 | + * Gets a list of all alliance names |
|
| 2651 | + * |
|
| 2652 | + * @return Array list of alliance names |
|
| 2653 | + * |
|
| 2654 | + */ |
|
| 2655 | 2655 | public function getAllAllianceNames($forsource = NULL,$filters = array()) |
| 2656 | 2656 | { |
| 2657 | 2657 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2676,11 +2676,11 @@ discard block |
||
| 2676 | 2676 | } |
| 2677 | 2677 | |
| 2678 | 2678 | /** |
| 2679 | - * Gets a list of all airline countries |
|
| 2680 | - * |
|
| 2681 | - * @return Array list of airline countries |
|
| 2682 | - * |
|
| 2683 | - */ |
|
| 2679 | + * Gets a list of all airline countries |
|
| 2680 | + * |
|
| 2681 | + * @return Array list of airline countries |
|
| 2682 | + * |
|
| 2683 | + */ |
|
| 2684 | 2684 | public function getAllAirlineCountries($filters = array()) |
| 2685 | 2685 | { |
| 2686 | 2686 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2708,11 +2708,11 @@ discard block |
||
| 2708 | 2708 | |
| 2709 | 2709 | |
| 2710 | 2710 | /** |
| 2711 | - * Gets a list of all departure & arrival names |
|
| 2712 | - * |
|
| 2713 | - * @return Array list of airport names |
|
| 2714 | - * |
|
| 2715 | - */ |
|
| 2711 | + * Gets a list of all departure & arrival names |
|
| 2712 | + * |
|
| 2713 | + * @return Array list of airport names |
|
| 2714 | + * |
|
| 2715 | + */ |
|
| 2716 | 2716 | public function getAllAirportNames($filters = array()) |
| 2717 | 2717 | { |
| 2718 | 2718 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2761,11 +2761,11 @@ discard block |
||
| 2761 | 2761 | |
| 2762 | 2762 | |
| 2763 | 2763 | /** |
| 2764 | - * Gets a list of all departure & arrival airport countries |
|
| 2765 | - * |
|
| 2766 | - * @return Array list of airport countries |
|
| 2767 | - * |
|
| 2768 | - */ |
|
| 2764 | + * Gets a list of all departure & arrival airport countries |
|
| 2765 | + * |
|
| 2766 | + * @return Array list of airport countries |
|
| 2767 | + * |
|
| 2768 | + */ |
|
| 2769 | 2769 | public function getAllAirportCountries($filters = array()) |
| 2770 | 2770 | { |
| 2771 | 2771 | $airport_array = array(); |
@@ -2813,11 +2813,11 @@ discard block |
||
| 2813 | 2813 | |
| 2814 | 2814 | |
| 2815 | 2815 | /** |
| 2816 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2817 | - * |
|
| 2818 | - * @return Array list of countries |
|
| 2819 | - * |
|
| 2820 | - */ |
|
| 2816 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2817 | + * |
|
| 2818 | + * @return Array list of countries |
|
| 2819 | + * |
|
| 2820 | + */ |
|
| 2821 | 2821 | public function getAllCountries($filters = array()) |
| 2822 | 2822 | { |
| 2823 | 2823 | $Connection= new Connection($this->db); |
@@ -2894,11 +2894,11 @@ discard block |
||
| 2894 | 2894 | |
| 2895 | 2895 | |
| 2896 | 2896 | /** |
| 2897 | - * Gets a list of all idents/callsigns |
|
| 2898 | - * |
|
| 2899 | - * @return Array list of ident/callsign names |
|
| 2900 | - * |
|
| 2901 | - */ |
|
| 2897 | + * Gets a list of all idents/callsigns |
|
| 2898 | + * |
|
| 2899 | + * @return Array list of ident/callsign names |
|
| 2900 | + * |
|
| 2901 | + */ |
|
| 2902 | 2902 | public function getAllIdents($filters = array()) |
| 2903 | 2903 | { |
| 2904 | 2904 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2922,9 +2922,9 @@ discard block |
||
| 2922 | 2922 | } |
| 2923 | 2923 | |
| 2924 | 2924 | /** |
| 2925 | - * Get a list of flights from airport since 7 days |
|
| 2926 | - * @return Array number, icao, name and city of airports |
|
| 2927 | - */ |
|
| 2925 | + * Get a list of flights from airport since 7 days |
|
| 2926 | + * @return Array number, icao, name and city of airports |
|
| 2927 | + */ |
|
| 2928 | 2928 | |
| 2929 | 2929 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
| 2930 | 2930 | global $globalTimezone, $globalDBdriver; |
@@ -2955,9 +2955,9 @@ discard block |
||
| 2955 | 2955 | } |
| 2956 | 2956 | |
| 2957 | 2957 | /** |
| 2958 | - * Get a list of flights from airport since 7 days |
|
| 2959 | - * @return Array number, icao, name and city of airports |
|
| 2960 | - */ |
|
| 2958 | + * Get a list of flights from airport since 7 days |
|
| 2959 | + * @return Array number, icao, name and city of airports |
|
| 2960 | + */ |
|
| 2961 | 2961 | |
| 2962 | 2962 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
| 2963 | 2963 | global $globalTimezone, $globalDBdriver; |
@@ -2987,9 +2987,9 @@ discard block |
||
| 2987 | 2987 | } |
| 2988 | 2988 | |
| 2989 | 2989 | /** |
| 2990 | - * Get a list of flights from detected airport since 7 days |
|
| 2991 | - * @return Array number, icao, name and city of airports |
|
| 2992 | - */ |
|
| 2990 | + * Get a list of flights from detected airport since 7 days |
|
| 2991 | + * @return Array number, icao, name and city of airports |
|
| 2992 | + */ |
|
| 2993 | 2993 | |
| 2994 | 2994 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 2995 | 2995 | global $globalTimezone, $globalDBdriver; |
@@ -3027,9 +3027,9 @@ discard block |
||
| 3027 | 3027 | } |
| 3028 | 3028 | |
| 3029 | 3029 | /** |
| 3030 | - * Get a list of flights from detected airport since 7 days |
|
| 3031 | - * @return Array number, icao, name and city of airports |
|
| 3032 | - */ |
|
| 3030 | + * Get a list of flights from detected airport since 7 days |
|
| 3031 | + * @return Array number, icao, name and city of airports |
|
| 3032 | + */ |
|
| 3033 | 3033 | |
| 3034 | 3034 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
| 3035 | 3035 | global $globalTimezone, $globalDBdriver; |
@@ -3071,9 +3071,9 @@ discard block |
||
| 3071 | 3071 | |
| 3072 | 3072 | |
| 3073 | 3073 | /** |
| 3074 | - * Get a list of flights to airport since 7 days |
|
| 3075 | - * @return Array number, icao, name and city of airports |
|
| 3076 | - */ |
|
| 3074 | + * Get a list of flights to airport since 7 days |
|
| 3075 | + * @return Array number, icao, name and city of airports |
|
| 3076 | + */ |
|
| 3077 | 3077 | |
| 3078 | 3078 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 3079 | 3079 | global $globalTimezone, $globalDBdriver; |
@@ -3106,9 +3106,9 @@ discard block |
||
| 3106 | 3106 | |
| 3107 | 3107 | |
| 3108 | 3108 | /** |
| 3109 | - * Get a list of flights detected to airport since 7 days |
|
| 3110 | - * @return Array number, icao, name and city of airports |
|
| 3111 | - */ |
|
| 3109 | + * Get a list of flights detected to airport since 7 days |
|
| 3110 | + * @return Array number, icao, name and city of airports |
|
| 3111 | + */ |
|
| 3112 | 3112 | |
| 3113 | 3113 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
| 3114 | 3114 | global $globalTimezone, $globalDBdriver; |
@@ -3149,9 +3149,9 @@ discard block |
||
| 3149 | 3149 | |
| 3150 | 3150 | |
| 3151 | 3151 | /** |
| 3152 | - * Get a list of flights to airport since 7 days |
|
| 3153 | - * @return Array number, icao, name and city of airports |
|
| 3154 | - */ |
|
| 3152 | + * Get a list of flights to airport since 7 days |
|
| 3153 | + * @return Array number, icao, name and city of airports |
|
| 3154 | + */ |
|
| 3155 | 3155 | |
| 3156 | 3156 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
| 3157 | 3157 | global $globalTimezone, $globalDBdriver; |
@@ -3183,9 +3183,9 @@ discard block |
||
| 3183 | 3183 | |
| 3184 | 3184 | |
| 3185 | 3185 | /** |
| 3186 | - * Get a list of flights detected to airport since 7 days |
|
| 3187 | - * @return Array number, icao, name and city of airports |
|
| 3188 | - */ |
|
| 3186 | + * Get a list of flights detected to airport since 7 days |
|
| 3187 | + * @return Array number, icao, name and city of airports |
|
| 3188 | + */ |
|
| 3189 | 3189 | |
| 3190 | 3190 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
| 3191 | 3191 | global $globalTimezone, $globalDBdriver; |
@@ -3229,11 +3229,11 @@ discard block |
||
| 3229 | 3229 | |
| 3230 | 3230 | |
| 3231 | 3231 | /** |
| 3232 | - * Gets a list of all dates |
|
| 3233 | - * |
|
| 3234 | - * @return Array list of date names |
|
| 3235 | - * |
|
| 3236 | - */ |
|
| 3232 | + * Gets a list of all dates |
|
| 3233 | + * |
|
| 3234 | + * @return Array list of date names |
|
| 3235 | + * |
|
| 3236 | + */ |
|
| 3237 | 3237 | public function getAllDates() |
| 3238 | 3238 | { |
| 3239 | 3239 | global $globalTimezone, $globalDBdriver; |
@@ -3274,11 +3274,11 @@ discard block |
||
| 3274 | 3274 | |
| 3275 | 3275 | |
| 3276 | 3276 | /** |
| 3277 | - * Gets all route combinations |
|
| 3278 | - * |
|
| 3279 | - * @return Array the route list |
|
| 3280 | - * |
|
| 3281 | - */ |
|
| 3277 | + * Gets all route combinations |
|
| 3278 | + * |
|
| 3279 | + * @return Array the route list |
|
| 3280 | + * |
|
| 3281 | + */ |
|
| 3282 | 3282 | public function getAllRoutes() |
| 3283 | 3283 | { |
| 3284 | 3284 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
@@ -3304,13 +3304,13 @@ discard block |
||
| 3304 | 3304 | } |
| 3305 | 3305 | |
| 3306 | 3306 | /** |
| 3307 | - * Update ident spotter data |
|
| 3308 | - * |
|
| 3309 | - * @param String $flightaware_id the ID from flightaware |
|
| 3310 | - * @param String $ident the flight ident |
|
| 3311 | - * @return String success or false |
|
| 3312 | - * |
|
| 3313 | - */ |
|
| 3307 | + * Update ident spotter data |
|
| 3308 | + * |
|
| 3309 | + * @param String $flightaware_id the ID from flightaware |
|
| 3310 | + * @param String $ident the flight ident |
|
| 3311 | + * @return String success or false |
|
| 3312 | + * |
|
| 3313 | + */ |
|
| 3314 | 3314 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
| 3315 | 3315 | { |
| 3316 | 3316 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3331,14 +3331,14 @@ discard block |
||
| 3331 | 3331 | } else { |
| 3332 | 3332 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3333 | 3333 | } |
| 3334 | - $airline_name = $airline_array[0]['name']; |
|
| 3335 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3336 | - $airline_country = $airline_array[0]['country']; |
|
| 3337 | - $airline_type = $airline_array[0]['type']; |
|
| 3334 | + $airline_name = $airline_array[0]['name']; |
|
| 3335 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3336 | + $airline_country = $airline_array[0]['country']; |
|
| 3337 | + $airline_type = $airline_array[0]['type']; |
|
| 3338 | 3338 | |
| 3339 | 3339 | |
| 3340 | 3340 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
| 3341 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3341 | + $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3342 | 3342 | |
| 3343 | 3343 | try { |
| 3344 | 3344 | $sth = $this->db->prepare($query); |
@@ -3351,19 +3351,19 @@ discard block |
||
| 3351 | 3351 | |
| 3352 | 3352 | } |
| 3353 | 3353 | /** |
| 3354 | - * Update latest spotter data |
|
| 3355 | - * |
|
| 3356 | - * @param String $flightaware_id the ID from flightaware |
|
| 3357 | - * @param String $ident the flight ident |
|
| 3358 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3359 | - * @return String success or false |
|
| 3360 | - * |
|
| 3361 | - */ |
|
| 3354 | + * Update latest spotter data |
|
| 3355 | + * |
|
| 3356 | + * @param String $flightaware_id the ID from flightaware |
|
| 3357 | + * @param String $ident the flight ident |
|
| 3358 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3359 | + * @return String success or false |
|
| 3360 | + * |
|
| 3361 | + */ |
|
| 3362 | 3362 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3363 | 3363 | { |
| 3364 | 3364 | if ($groundspeed == '') $groundspeed = NULL; |
| 3365 | 3365 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3366 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3366 | + $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3367 | 3367 | |
| 3368 | 3368 | try { |
| 3369 | 3369 | $sth = $this->db->prepare($query); |
@@ -3377,32 +3377,32 @@ discard block |
||
| 3377 | 3377 | } |
| 3378 | 3378 | |
| 3379 | 3379 | /** |
| 3380 | - * Adds a new spotter data |
|
| 3381 | - * |
|
| 3382 | - * @param String $flightaware_id the ID from flightaware |
|
| 3383 | - * @param String $ident the flight ident |
|
| 3384 | - * @param String $aircraft_icao the aircraft type |
|
| 3385 | - * @param String $departure_airport_icao the departure airport |
|
| 3386 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3387 | - * @param String $latitude latitude of flight |
|
| 3388 | - * @param String $longitude latitude of flight |
|
| 3389 | - * @param String $waypoints waypoints of flight |
|
| 3390 | - * @param String $altitude altitude of flight |
|
| 3391 | - * @param String $heading heading of flight |
|
| 3392 | - * @param String $groundspeed speed of flight |
|
| 3393 | - * @param String $date date of flight |
|
| 3394 | - * @param String $departure_airport_time departure time of flight |
|
| 3395 | - * @param String $arrival_airport_time arrival time of flight |
|
| 3396 | - * @param String $squawk squawk code of flight |
|
| 3397 | - * @param String $route_stop route stop of flight |
|
| 3398 | - * @param String $highlight highlight or not |
|
| 3399 | - * @param String $ModeS ModesS code of flight |
|
| 3400 | - * @param String $registration registration code of flight |
|
| 3401 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3402 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3403 | - * @param String $verticalrate vertival rate of flight |
|
| 3404 | - * @return String success or false |
|
| 3405 | - */ |
|
| 3380 | + * Adds a new spotter data |
|
| 3381 | + * |
|
| 3382 | + * @param String $flightaware_id the ID from flightaware |
|
| 3383 | + * @param String $ident the flight ident |
|
| 3384 | + * @param String $aircraft_icao the aircraft type |
|
| 3385 | + * @param String $departure_airport_icao the departure airport |
|
| 3386 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3387 | + * @param String $latitude latitude of flight |
|
| 3388 | + * @param String $longitude latitude of flight |
|
| 3389 | + * @param String $waypoints waypoints of flight |
|
| 3390 | + * @param String $altitude altitude of flight |
|
| 3391 | + * @param String $heading heading of flight |
|
| 3392 | + * @param String $groundspeed speed of flight |
|
| 3393 | + * @param String $date date of flight |
|
| 3394 | + * @param String $departure_airport_time departure time of flight |
|
| 3395 | + * @param String $arrival_airport_time arrival time of flight |
|
| 3396 | + * @param String $squawk squawk code of flight |
|
| 3397 | + * @param String $route_stop route stop of flight |
|
| 3398 | + * @param String $highlight highlight or not |
|
| 3399 | + * @param String $ModeS ModesS code of flight |
|
| 3400 | + * @param String $registration registration code of flight |
|
| 3401 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3402 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3403 | + * @param String $verticalrate vertival rate of flight |
|
| 3404 | + * @return String success or false |
|
| 3405 | + */ |
|
| 3406 | 3406 | public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
| 3407 | 3407 | { |
| 3408 | 3408 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
@@ -3617,8 +3617,8 @@ discard block |
||
| 3617 | 3617 | |
| 3618 | 3618 | if ($globalIVAO && $aircraft_icao != '') |
| 3619 | 3619 | { |
| 3620 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3621 | - else $airline_icao = ''; |
|
| 3620 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3621 | + else $airline_icao = ''; |
|
| 3622 | 3622 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3623 | 3623 | if (!isset($image_array[0]['registration'])) |
| 3624 | 3624 | { |
@@ -3649,53 +3649,53 @@ discard block |
||
| 3649 | 3649 | |
| 3650 | 3650 | if (count($airline_array) == 0) |
| 3651 | 3651 | { |
| 3652 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3653 | - } |
|
| 3654 | - if (count($aircraft_array) == 0) |
|
| 3655 | - { |
|
| 3656 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3657 | - } |
|
| 3658 | - if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3659 | - { |
|
| 3660 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3661 | - } |
|
| 3662 | - if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3663 | - { |
|
| 3664 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3665 | - } |
|
| 3666 | - if ($registration == '') $registration = 'NA'; |
|
| 3667 | - if ($latitude == '' && $longitude == '') { |
|
| 3668 | - $latitude = 0; |
|
| 3669 | - $longitude = 0; |
|
| 3670 | - } |
|
| 3671 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3672 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3673 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3674 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3675 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3676 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3652 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3653 | + } |
|
| 3654 | + if (count($aircraft_array) == 0) |
|
| 3655 | + { |
|
| 3656 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3657 | + } |
|
| 3658 | + if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3659 | + { |
|
| 3660 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3661 | + } |
|
| 3662 | + if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3663 | + { |
|
| 3664 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3665 | + } |
|
| 3666 | + if ($registration == '') $registration = 'NA'; |
|
| 3667 | + if ($latitude == '' && $longitude == '') { |
|
| 3668 | + $latitude = 0; |
|
| 3669 | + $longitude = 0; |
|
| 3670 | + } |
|
| 3671 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3672 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3673 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3674 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3675 | + if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3676 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3677 | 3677 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3678 | 3678 | |
| 3679 | - $airline_name = $airline_array[0]['name']; |
|
| 3680 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3681 | - $airline_country = $airline_array[0]['country']; |
|
| 3682 | - $airline_type = $airline_array[0]['type']; |
|
| 3679 | + $airline_name = $airline_array[0]['name']; |
|
| 3680 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3681 | + $airline_country = $airline_array[0]['country']; |
|
| 3682 | + $airline_type = $airline_array[0]['type']; |
|
| 3683 | 3683 | if ($airline_type == '') { |
| 3684 | 3684 | $timeelapsed = microtime(true); |
| 3685 | 3685 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3686 | 3686 | if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 3687 | 3687 | } |
| 3688 | 3688 | if ($airline_type == null) $airline_type = ''; |
| 3689 | - $aircraft_type = $aircraft_array[0]['type']; |
|
| 3690 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3691 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3692 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3693 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3689 | + $aircraft_type = $aircraft_array[0]['type']; |
|
| 3690 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3691 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3692 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3693 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3694 | 3694 | |
| 3695 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3696 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3697 | - $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3698 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3695 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3696 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3697 | + $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3698 | + $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3699 | 3699 | |
| 3700 | 3700 | try { |
| 3701 | 3701 | |
@@ -3703,7 +3703,7 @@ discard block |
||
| 3703 | 3703 | $sth->execute($query_values); |
| 3704 | 3704 | $this->db = null; |
| 3705 | 3705 | } catch (PDOException $e) { |
| 3706 | - return "error : ".$e->getMessage(); |
|
| 3706 | + return "error : ".$e->getMessage(); |
|
| 3707 | 3707 | } |
| 3708 | 3708 | |
| 3709 | 3709 | return "success"; |
@@ -3712,11 +3712,11 @@ discard block |
||
| 3712 | 3712 | |
| 3713 | 3713 | |
| 3714 | 3714 | /** |
| 3715 | - * Gets the aircraft ident within the last hour |
|
| 3716 | - * |
|
| 3717 | - * @return String the ident |
|
| 3718 | - * |
|
| 3719 | - */ |
|
| 3715 | + * Gets the aircraft ident within the last hour |
|
| 3716 | + * |
|
| 3717 | + * @return String the ident |
|
| 3718 | + * |
|
| 3719 | + */ |
|
| 3720 | 3720 | public function getIdentFromLastHour($ident) |
| 3721 | 3721 | { |
| 3722 | 3722 | global $globalDBdriver, $globalTimezone; |
@@ -3732,11 +3732,11 @@ discard block |
||
| 3732 | 3732 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3733 | 3733 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
| 3734 | 3734 | $query_data = array(':ident' => $ident); |
| 3735 | - } |
|
| 3735 | + } |
|
| 3736 | 3736 | |
| 3737 | 3737 | $sth = $this->db->prepare($query); |
| 3738 | 3738 | $sth->execute($query_data); |
| 3739 | - $ident_result=''; |
|
| 3739 | + $ident_result=''; |
|
| 3740 | 3740 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 3741 | 3741 | { |
| 3742 | 3742 | $ident_result = $row['ident']; |
@@ -3747,11 +3747,11 @@ discard block |
||
| 3747 | 3747 | |
| 3748 | 3748 | |
| 3749 | 3749 | /** |
| 3750 | - * Gets the aircraft data from the last 20 seconds |
|
| 3751 | - * |
|
| 3752 | - * @return Array the spotter data |
|
| 3753 | - * |
|
| 3754 | - */ |
|
| 3750 | + * Gets the aircraft data from the last 20 seconds |
|
| 3751 | + * |
|
| 3752 | + * @return Array the spotter data |
|
| 3753 | + * |
|
| 3754 | + */ |
|
| 3755 | 3755 | public function getRealTimeData($q = '') |
| 3756 | 3756 | { |
| 3757 | 3757 | global $globalDBdriver; |
@@ -3795,11 +3795,11 @@ discard block |
||
| 3795 | 3795 | |
| 3796 | 3796 | |
| 3797 | 3797 | /** |
| 3798 | - * Gets all airlines that have flown over |
|
| 3799 | - * |
|
| 3800 | - * @return Array the airline list |
|
| 3801 | - * |
|
| 3802 | - */ |
|
| 3798 | + * Gets all airlines that have flown over |
|
| 3799 | + * |
|
| 3800 | + * @return Array the airline list |
|
| 3801 | + * |
|
| 3802 | + */ |
|
| 3803 | 3803 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '') |
| 3804 | 3804 | { |
| 3805 | 3805 | global $globalDBdriver; |
@@ -3813,7 +3813,7 @@ discard block |
||
| 3813 | 3813 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 3814 | 3814 | } |
| 3815 | 3815 | } |
| 3816 | - if ($sincedate != '') { |
|
| 3816 | + if ($sincedate != '') { |
|
| 3817 | 3817 | if ($globalDBdriver == 'mysql') { |
| 3818 | 3818 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 3819 | 3819 | } else { |
@@ -3867,26 +3867,26 @@ discard block |
||
| 3867 | 3867 | } |
| 3868 | 3868 | |
| 3869 | 3869 | /** |
| 3870 | - * Gets all pilots that have flown over |
|
| 3871 | - * |
|
| 3872 | - * @return Array the pilots list |
|
| 3873 | - * |
|
| 3874 | - */ |
|
| 3870 | + * Gets all pilots that have flown over |
|
| 3871 | + * |
|
| 3872 | + * @return Array the pilots list |
|
| 3873 | + * |
|
| 3874 | + */ |
|
| 3875 | 3875 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '') |
| 3876 | 3876 | { |
| 3877 | 3877 | global $globalDBdriver; |
| 3878 | 3878 | $filter_query = $this->getFilter($filters,true,true); |
| 3879 | 3879 | $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
| 3880 | 3880 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
| 3881 | - if ($olderthanmonths > 0) { |
|
| 3882 | - if ($globalDBdriver == 'mysql') { |
|
| 3881 | + if ($olderthanmonths > 0) { |
|
| 3882 | + if ($globalDBdriver == 'mysql') { |
|
| 3883 | 3883 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3884 | 3884 | } else { |
| 3885 | 3885 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3886 | 3886 | } |
| 3887 | 3887 | } |
| 3888 | - if ($sincedate != '') { |
|
| 3889 | - if ($globalDBdriver == 'mysql') { |
|
| 3888 | + if ($sincedate != '') { |
|
| 3889 | + if ($globalDBdriver == 'mysql') { |
|
| 3890 | 3890 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3891 | 3891 | } else { |
| 3892 | 3892 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3941,25 +3941,25 @@ discard block |
||
| 3941 | 3941 | } |
| 3942 | 3942 | |
| 3943 | 3943 | /** |
| 3944 | - * Gets all pilots that have flown over |
|
| 3945 | - * |
|
| 3946 | - * @return Array the pilots list |
|
| 3947 | - * |
|
| 3948 | - */ |
|
| 3944 | + * Gets all pilots that have flown over |
|
| 3945 | + * |
|
| 3946 | + * @return Array the pilots list |
|
| 3947 | + * |
|
| 3948 | + */ |
|
| 3949 | 3949 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 3950 | 3950 | { |
| 3951 | 3951 | global $globalDBdriver; |
| 3952 | 3952 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
| 3953 | 3953 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 3954 | - if ($olderthanmonths > 0) { |
|
| 3955 | - if ($globalDBdriver == 'mysql') { |
|
| 3954 | + if ($olderthanmonths > 0) { |
|
| 3955 | + if ($globalDBdriver == 'mysql') { |
|
| 3956 | 3956 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3957 | 3957 | } else { |
| 3958 | 3958 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3959 | 3959 | } |
| 3960 | 3960 | } |
| 3961 | - if ($sincedate != '') { |
|
| 3962 | - if ($globalDBdriver == 'mysql') { |
|
| 3961 | + if ($sincedate != '') { |
|
| 3962 | + if ($globalDBdriver == 'mysql') { |
|
| 3963 | 3963 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3964 | 3964 | } else { |
| 3965 | 3965 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3988,26 +3988,26 @@ discard block |
||
| 3988 | 3988 | } |
| 3989 | 3989 | |
| 3990 | 3990 | /** |
| 3991 | - * Gets all owner that have flown over |
|
| 3992 | - * |
|
| 3993 | - * @return Array the pilots list |
|
| 3994 | - * |
|
| 3995 | - */ |
|
| 3991 | + * Gets all owner that have flown over |
|
| 3992 | + * |
|
| 3993 | + * @return Array the pilots list |
|
| 3994 | + * |
|
| 3995 | + */ |
|
| 3996 | 3996 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 3997 | 3997 | { |
| 3998 | 3998 | global $globalDBdriver; |
| 3999 | 3999 | $filter_query = $this->getFilter($filters,true,true); |
| 4000 | 4000 | $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 4001 | 4001 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL"; |
| 4002 | - if ($olderthanmonths > 0) { |
|
| 4003 | - if ($globalDBdriver == 'mysql') { |
|
| 4002 | + if ($olderthanmonths > 0) { |
|
| 4003 | + if ($globalDBdriver == 'mysql') { |
|
| 4004 | 4004 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 4005 | 4005 | } else { |
| 4006 | 4006 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4007 | 4007 | } |
| 4008 | 4008 | } |
| 4009 | - if ($sincedate != '') { |
|
| 4010 | - if ($globalDBdriver == 'mysql') { |
|
| 4009 | + if ($sincedate != '') { |
|
| 4010 | + if ($globalDBdriver == 'mysql') { |
|
| 4011 | 4011 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 4012 | 4012 | } else { |
| 4013 | 4013 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4058,26 +4058,26 @@ discard block |
||
| 4058 | 4058 | } |
| 4059 | 4059 | |
| 4060 | 4060 | /** |
| 4061 | - * Gets all owner that have flown over |
|
| 4062 | - * |
|
| 4063 | - * @return Array the pilots list |
|
| 4064 | - * |
|
| 4065 | - */ |
|
| 4061 | + * Gets all owner that have flown over |
|
| 4062 | + * |
|
| 4063 | + * @return Array the pilots list |
|
| 4064 | + * |
|
| 4065 | + */ |
|
| 4066 | 4066 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 4067 | 4067 | { |
| 4068 | 4068 | global $globalDBdriver; |
| 4069 | 4069 | $filter_query = $this->getFilter($filters,true,true); |
| 4070 | 4070 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 4071 | 4071 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 4072 | - if ($olderthanmonths > 0) { |
|
| 4073 | - if ($globalDBdriver == 'mysql') { |
|
| 4072 | + if ($olderthanmonths > 0) { |
|
| 4073 | + if ($globalDBdriver == 'mysql') { |
|
| 4074 | 4074 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4075 | 4075 | } else { |
| 4076 | 4076 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 4077 | 4077 | } |
| 4078 | 4078 | } |
| 4079 | - if ($sincedate != '') { |
|
| 4080 | - if ($globalDBdriver == 'mysql') { |
|
| 4079 | + if ($sincedate != '') { |
|
| 4080 | + if ($globalDBdriver == 'mysql') { |
|
| 4081 | 4081 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 4082 | 4082 | } else { |
| 4083 | 4083 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4104,11 +4104,11 @@ discard block |
||
| 4104 | 4104 | } |
| 4105 | 4105 | |
| 4106 | 4106 | /** |
| 4107 | - * Gets all airlines that have flown over by aircraft |
|
| 4108 | - * |
|
| 4109 | - * @return Array the airline list |
|
| 4110 | - * |
|
| 4111 | - */ |
|
| 4107 | + * Gets all airlines that have flown over by aircraft |
|
| 4108 | + * |
|
| 4109 | + * @return Array the airline list |
|
| 4110 | + * |
|
| 4111 | + */ |
|
| 4112 | 4112 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
| 4113 | 4113 | { |
| 4114 | 4114 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4140,11 +4140,11 @@ discard block |
||
| 4140 | 4140 | |
| 4141 | 4141 | |
| 4142 | 4142 | /** |
| 4143 | - * Gets all airline countries that have flown over by aircraft |
|
| 4144 | - * |
|
| 4145 | - * @return Array the airline country list |
|
| 4146 | - * |
|
| 4147 | - */ |
|
| 4143 | + * Gets all airline countries that have flown over by aircraft |
|
| 4144 | + * |
|
| 4145 | + * @return Array the airline country list |
|
| 4146 | + * |
|
| 4147 | + */ |
|
| 4148 | 4148 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
| 4149 | 4149 | { |
| 4150 | 4150 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4176,11 +4176,11 @@ discard block |
||
| 4176 | 4176 | |
| 4177 | 4177 | |
| 4178 | 4178 | /** |
| 4179 | - * Gets all airlines that have flown over by airport |
|
| 4180 | - * |
|
| 4181 | - * @return Array the airline list |
|
| 4182 | - * |
|
| 4183 | - */ |
|
| 4179 | + * Gets all airlines that have flown over by airport |
|
| 4180 | + * |
|
| 4181 | + * @return Array the airline list |
|
| 4182 | + * |
|
| 4183 | + */ |
|
| 4184 | 4184 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
| 4185 | 4185 | { |
| 4186 | 4186 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4211,11 +4211,11 @@ discard block |
||
| 4211 | 4211 | |
| 4212 | 4212 | |
| 4213 | 4213 | /** |
| 4214 | - * Gets all airline countries that have flown over by airport icao |
|
| 4215 | - * |
|
| 4216 | - * @return Array the airline country list |
|
| 4217 | - * |
|
| 4218 | - */ |
|
| 4214 | + * Gets all airline countries that have flown over by airport icao |
|
| 4215 | + * |
|
| 4216 | + * @return Array the airline country list |
|
| 4217 | + * |
|
| 4218 | + */ |
|
| 4219 | 4219 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
| 4220 | 4220 | { |
| 4221 | 4221 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4245,11 +4245,11 @@ discard block |
||
| 4245 | 4245 | |
| 4246 | 4246 | |
| 4247 | 4247 | /** |
| 4248 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4249 | - * |
|
| 4250 | - * @return Array the airline list |
|
| 4251 | - * |
|
| 4252 | - */ |
|
| 4248 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4249 | + * |
|
| 4250 | + * @return Array the airline list |
|
| 4251 | + * |
|
| 4252 | + */ |
|
| 4253 | 4253 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4254 | 4254 | { |
| 4255 | 4255 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4280,11 +4280,11 @@ discard block |
||
| 4280 | 4280 | |
| 4281 | 4281 | |
| 4282 | 4282 | /** |
| 4283 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4284 | - * |
|
| 4285 | - * @return Array the airline country list |
|
| 4286 | - * |
|
| 4287 | - */ |
|
| 4283 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4284 | + * |
|
| 4285 | + * @return Array the airline country list |
|
| 4286 | + * |
|
| 4287 | + */ |
|
| 4288 | 4288 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4289 | 4289 | { |
| 4290 | 4290 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4313,11 +4313,11 @@ discard block |
||
| 4313 | 4313 | |
| 4314 | 4314 | |
| 4315 | 4315 | /** |
| 4316 | - * Gets all airlines that have flown over by date |
|
| 4317 | - * |
|
| 4318 | - * @return Array the airline list |
|
| 4319 | - * |
|
| 4320 | - */ |
|
| 4316 | + * Gets all airlines that have flown over by date |
|
| 4317 | + * |
|
| 4318 | + * @return Array the airline list |
|
| 4319 | + * |
|
| 4320 | + */ |
|
| 4321 | 4321 | public function countAllAirlinesByDate($date,$filters = array()) |
| 4322 | 4322 | { |
| 4323 | 4323 | global $globalTimezone, $globalDBdriver; |
@@ -4361,11 +4361,11 @@ discard block |
||
| 4361 | 4361 | |
| 4362 | 4362 | |
| 4363 | 4363 | /** |
| 4364 | - * Gets all airline countries that have flown over by date |
|
| 4365 | - * |
|
| 4366 | - * @return Array the airline country list |
|
| 4367 | - * |
|
| 4368 | - */ |
|
| 4364 | + * Gets all airline countries that have flown over by date |
|
| 4365 | + * |
|
| 4366 | + * @return Array the airline country list |
|
| 4367 | + * |
|
| 4368 | + */ |
|
| 4369 | 4369 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
| 4370 | 4370 | { |
| 4371 | 4371 | global $globalTimezone, $globalDBdriver; |
@@ -4408,11 +4408,11 @@ discard block |
||
| 4408 | 4408 | |
| 4409 | 4409 | |
| 4410 | 4410 | /** |
| 4411 | - * Gets all airlines that have flown over by ident/callsign |
|
| 4412 | - * |
|
| 4413 | - * @return Array the airline list |
|
| 4414 | - * |
|
| 4415 | - */ |
|
| 4411 | + * Gets all airlines that have flown over by ident/callsign |
|
| 4412 | + * |
|
| 4413 | + * @return Array the airline list |
|
| 4414 | + * |
|
| 4415 | + */ |
|
| 4416 | 4416 | public function countAllAirlinesByIdent($ident,$filters = array()) |
| 4417 | 4417 | { |
| 4418 | 4418 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4442,11 +4442,11 @@ discard block |
||
| 4442 | 4442 | } |
| 4443 | 4443 | |
| 4444 | 4444 | /** |
| 4445 | - * Gets all airlines that have flown over by route |
|
| 4446 | - * |
|
| 4447 | - * @return Array the airline list |
|
| 4448 | - * |
|
| 4449 | - */ |
|
| 4445 | + * Gets all airlines that have flown over by route |
|
| 4446 | + * |
|
| 4447 | + * @return Array the airline list |
|
| 4448 | + * |
|
| 4449 | + */ |
|
| 4450 | 4450 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 4451 | 4451 | { |
| 4452 | 4452 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4478,11 +4478,11 @@ discard block |
||
| 4478 | 4478 | } |
| 4479 | 4479 | |
| 4480 | 4480 | /** |
| 4481 | - * Gets all airline countries that have flown over by route |
|
| 4482 | - * |
|
| 4483 | - * @return Array the airline country list |
|
| 4484 | - * |
|
| 4485 | - */ |
|
| 4481 | + * Gets all airline countries that have flown over by route |
|
| 4482 | + * |
|
| 4483 | + * @return Array the airline country list |
|
| 4484 | + * |
|
| 4485 | + */ |
|
| 4486 | 4486 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
| 4487 | 4487 | { |
| 4488 | 4488 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4514,11 +4514,11 @@ discard block |
||
| 4514 | 4514 | |
| 4515 | 4515 | |
| 4516 | 4516 | /** |
| 4517 | - * Gets all airlines that have flown over by country |
|
| 4518 | - * |
|
| 4519 | - * @return Array the airline list |
|
| 4520 | - * |
|
| 4521 | - */ |
|
| 4517 | + * Gets all airlines that have flown over by country |
|
| 4518 | + * |
|
| 4519 | + * @return Array the airline list |
|
| 4520 | + * |
|
| 4521 | + */ |
|
| 4522 | 4522 | public function countAllAirlinesByCountry($country,$filters = array()) |
| 4523 | 4523 | { |
| 4524 | 4524 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4548,11 +4548,11 @@ discard block |
||
| 4548 | 4548 | |
| 4549 | 4549 | |
| 4550 | 4550 | /** |
| 4551 | - * Gets all airline countries that have flown over by country |
|
| 4552 | - * |
|
| 4553 | - * @return Array the airline country list |
|
| 4554 | - * |
|
| 4555 | - */ |
|
| 4551 | + * Gets all airline countries that have flown over by country |
|
| 4552 | + * |
|
| 4553 | + * @return Array the airline country list |
|
| 4554 | + * |
|
| 4555 | + */ |
|
| 4556 | 4556 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
| 4557 | 4557 | { |
| 4558 | 4558 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4581,11 +4581,11 @@ discard block |
||
| 4581 | 4581 | |
| 4582 | 4582 | |
| 4583 | 4583 | /** |
| 4584 | - * Gets all airlines countries |
|
| 4585 | - * |
|
| 4586 | - * @return Array the airline country list |
|
| 4587 | - * |
|
| 4588 | - */ |
|
| 4584 | + * Gets all airlines countries |
|
| 4585 | + * |
|
| 4586 | + * @return Array the airline country list |
|
| 4587 | + * |
|
| 4588 | + */ |
|
| 4589 | 4589 | public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
| 4590 | 4590 | { |
| 4591 | 4591 | global $globalDBdriver; |
@@ -4640,11 +4640,11 @@ discard block |
||
| 4640 | 4640 | } |
| 4641 | 4641 | |
| 4642 | 4642 | /** |
| 4643 | - * Gets all number of flight over countries |
|
| 4644 | - * |
|
| 4645 | - * @return Array the airline country list |
|
| 4646 | - * |
|
| 4647 | - */ |
|
| 4643 | + * Gets all number of flight over countries |
|
| 4644 | + * |
|
| 4645 | + * @return Array the airline country list |
|
| 4646 | + * |
|
| 4647 | + */ |
|
| 4648 | 4648 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4649 | 4649 | { |
| 4650 | 4650 | global $globalDBdriver; |
@@ -4666,15 +4666,15 @@ discard block |
||
| 4666 | 4666 | $SpotterLive = new SpotterLive(); |
| 4667 | 4667 | $filter_query = $SpotterLive->getFilter($filters,true,true); |
| 4668 | 4668 | $filter_query .= ' over_country IS NOT NULL'; |
| 4669 | - if ($olderthanmonths > 0) { |
|
| 4669 | + if ($olderthanmonths > 0) { |
|
| 4670 | 4670 | if ($globalDBdriver == 'mysql') { |
| 4671 | 4671 | $filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4672 | 4672 | } else { |
| 4673 | 4673 | $filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4674 | 4674 | } |
| 4675 | 4675 | } |
| 4676 | - if ($sincedate != '') { |
|
| 4677 | - if ($globalDBdriver == 'mysql') { |
|
| 4676 | + if ($sincedate != '') { |
|
| 4677 | + if ($globalDBdriver == 'mysql') { |
|
| 4678 | 4678 | $filter_query .= " AND spotter_live.date > '".$sincedate."' "; |
| 4679 | 4679 | } else { |
| 4680 | 4680 | $filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4704,11 +4704,11 @@ discard block |
||
| 4704 | 4704 | |
| 4705 | 4705 | |
| 4706 | 4706 | /** |
| 4707 | - * Gets all aircraft types that have flown over |
|
| 4708 | - * |
|
| 4709 | - * @return Array the aircraft list |
|
| 4710 | - * |
|
| 4711 | - */ |
|
| 4707 | + * Gets all aircraft types that have flown over |
|
| 4708 | + * |
|
| 4709 | + * @return Array the aircraft list |
|
| 4710 | + * |
|
| 4711 | + */ |
|
| 4712 | 4712 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 4713 | 4713 | { |
| 4714 | 4714 | global $globalDBdriver; |
@@ -4778,11 +4778,11 @@ discard block |
||
| 4778 | 4778 | } |
| 4779 | 4779 | |
| 4780 | 4780 | /** |
| 4781 | - * Gets all aircraft types that have flown over by airline |
|
| 4782 | - * |
|
| 4783 | - * @return Array the aircraft list |
|
| 4784 | - * |
|
| 4785 | - */ |
|
| 4781 | + * Gets all aircraft types that have flown over by airline |
|
| 4782 | + * |
|
| 4783 | + * @return Array the aircraft list |
|
| 4784 | + * |
|
| 4785 | + */ |
|
| 4786 | 4786 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '') |
| 4787 | 4787 | { |
| 4788 | 4788 | global $globalDBdriver; |
@@ -4853,11 +4853,11 @@ discard block |
||
| 4853 | 4853 | } |
| 4854 | 4854 | |
| 4855 | 4855 | /** |
| 4856 | - * Gets all aircraft types that have flown over by months |
|
| 4857 | - * |
|
| 4858 | - * @return Array the aircraft list |
|
| 4859 | - * |
|
| 4860 | - */ |
|
| 4856 | + * Gets all aircraft types that have flown over by months |
|
| 4857 | + * |
|
| 4858 | + * @return Array the aircraft list |
|
| 4859 | + * |
|
| 4860 | + */ |
|
| 4861 | 4861 | public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4862 | 4862 | { |
| 4863 | 4863 | global $globalDBdriver; |
@@ -4901,11 +4901,11 @@ discard block |
||
| 4901 | 4901 | |
| 4902 | 4902 | |
| 4903 | 4903 | /** |
| 4904 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
| 4905 | - * |
|
| 4906 | - * @return Array the aircraft list |
|
| 4907 | - * |
|
| 4908 | - */ |
|
| 4904 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
| 4905 | + * |
|
| 4906 | + * @return Array the aircraft list |
|
| 4907 | + * |
|
| 4908 | + */ |
|
| 4909 | 4909 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
| 4910 | 4910 | { |
| 4911 | 4911 | $Image = new Image($this->db); |
@@ -4944,11 +4944,11 @@ discard block |
||
| 4944 | 4944 | |
| 4945 | 4945 | |
| 4946 | 4946 | /** |
| 4947 | - * Gets all aircraft types that have flown over by airline icao |
|
| 4948 | - * |
|
| 4949 | - * @return Array the aircraft list |
|
| 4950 | - * |
|
| 4951 | - */ |
|
| 4947 | + * Gets all aircraft types that have flown over by airline icao |
|
| 4948 | + * |
|
| 4949 | + * @return Array the aircraft list |
|
| 4950 | + * |
|
| 4951 | + */ |
|
| 4952 | 4952 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
| 4953 | 4953 | { |
| 4954 | 4954 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4977,11 +4977,11 @@ discard block |
||
| 4977 | 4977 | |
| 4978 | 4978 | |
| 4979 | 4979 | /** |
| 4980 | - * Gets all aircraft registration that have flown over by airline icao |
|
| 4981 | - * |
|
| 4982 | - * @return Array the aircraft list |
|
| 4983 | - * |
|
| 4984 | - */ |
|
| 4980 | + * Gets all aircraft registration that have flown over by airline icao |
|
| 4981 | + * |
|
| 4982 | + * @return Array the aircraft list |
|
| 4983 | + * |
|
| 4984 | + */ |
|
| 4985 | 4985 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
| 4986 | 4986 | { |
| 4987 | 4987 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5019,11 +5019,11 @@ discard block |
||
| 5019 | 5019 | |
| 5020 | 5020 | |
| 5021 | 5021 | /** |
| 5022 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5023 | - * |
|
| 5024 | - * @return Array the aircraft list |
|
| 5025 | - * |
|
| 5026 | - */ |
|
| 5022 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5023 | + * |
|
| 5024 | + * @return Array the aircraft list |
|
| 5025 | + * |
|
| 5026 | + */ |
|
| 5027 | 5027 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
| 5028 | 5028 | { |
| 5029 | 5029 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5051,11 +5051,11 @@ discard block |
||
| 5051 | 5051 | |
| 5052 | 5052 | |
| 5053 | 5053 | /** |
| 5054 | - * Gets all aircraft types that have flown over by airline icao |
|
| 5055 | - * |
|
| 5056 | - * @return Array the aircraft list |
|
| 5057 | - * |
|
| 5058 | - */ |
|
| 5054 | + * Gets all aircraft types that have flown over by airline icao |
|
| 5055 | + * |
|
| 5056 | + * @return Array the aircraft list |
|
| 5057 | + * |
|
| 5058 | + */ |
|
| 5059 | 5059 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
| 5060 | 5060 | { |
| 5061 | 5061 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5084,11 +5084,11 @@ discard block |
||
| 5084 | 5084 | |
| 5085 | 5085 | |
| 5086 | 5086 | /** |
| 5087 | - * Gets all aircraft registration that have flown over by airport icao |
|
| 5088 | - * |
|
| 5089 | - * @return Array the aircraft list |
|
| 5090 | - * |
|
| 5091 | - */ |
|
| 5087 | + * Gets all aircraft registration that have flown over by airport icao |
|
| 5088 | + * |
|
| 5089 | + * @return Array the aircraft list |
|
| 5090 | + * |
|
| 5091 | + */ |
|
| 5092 | 5092 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
| 5093 | 5093 | { |
| 5094 | 5094 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5125,11 +5125,11 @@ discard block |
||
| 5125 | 5125 | |
| 5126 | 5126 | |
| 5127 | 5127 | /** |
| 5128 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5129 | - * |
|
| 5130 | - * @return Array the aircraft list |
|
| 5131 | - * |
|
| 5132 | - */ |
|
| 5128 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5129 | + * |
|
| 5130 | + * @return Array the aircraft list |
|
| 5131 | + * |
|
| 5132 | + */ |
|
| 5133 | 5133 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
| 5134 | 5134 | { |
| 5135 | 5135 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5155,11 +5155,11 @@ discard block |
||
| 5155 | 5155 | } |
| 5156 | 5156 | |
| 5157 | 5157 | /** |
| 5158 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5159 | - * |
|
| 5160 | - * @return Array the aircraft list |
|
| 5161 | - * |
|
| 5162 | - */ |
|
| 5158 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5159 | + * |
|
| 5160 | + * @return Array the aircraft list |
|
| 5161 | + * |
|
| 5162 | + */ |
|
| 5163 | 5163 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 5164 | 5164 | { |
| 5165 | 5165 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5186,11 +5186,11 @@ discard block |
||
| 5186 | 5186 | |
| 5187 | 5187 | |
| 5188 | 5188 | /** |
| 5189 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5190 | - * |
|
| 5191 | - * @return Array the aircraft list |
|
| 5192 | - * |
|
| 5193 | - */ |
|
| 5189 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5190 | + * |
|
| 5191 | + * @return Array the aircraft list |
|
| 5192 | + * |
|
| 5193 | + */ |
|
| 5194 | 5194 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5195 | 5195 | { |
| 5196 | 5196 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5226,11 +5226,11 @@ discard block |
||
| 5226 | 5226 | } |
| 5227 | 5227 | |
| 5228 | 5228 | /** |
| 5229 | - * Gets all aircraft types that have flown over by date |
|
| 5230 | - * |
|
| 5231 | - * @return Array the aircraft list |
|
| 5232 | - * |
|
| 5233 | - */ |
|
| 5229 | + * Gets all aircraft types that have flown over by date |
|
| 5230 | + * |
|
| 5231 | + * @return Array the aircraft list |
|
| 5232 | + * |
|
| 5233 | + */ |
|
| 5234 | 5234 | public function countAllAircraftTypesByDate($date,$filters = array()) |
| 5235 | 5235 | { |
| 5236 | 5236 | global $globalTimezone, $globalDBdriver; |
@@ -5272,11 +5272,11 @@ discard block |
||
| 5272 | 5272 | |
| 5273 | 5273 | |
| 5274 | 5274 | /** |
| 5275 | - * Gets all aircraft registration that have flown over by date |
|
| 5276 | - * |
|
| 5277 | - * @return Array the aircraft list |
|
| 5278 | - * |
|
| 5279 | - */ |
|
| 5275 | + * Gets all aircraft registration that have flown over by date |
|
| 5276 | + * |
|
| 5277 | + * @return Array the aircraft list |
|
| 5278 | + * |
|
| 5279 | + */ |
|
| 5280 | 5280 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
| 5281 | 5281 | { |
| 5282 | 5282 | global $globalTimezone, $globalDBdriver; |
@@ -5327,11 +5327,11 @@ discard block |
||
| 5327 | 5327 | |
| 5328 | 5328 | |
| 5329 | 5329 | /** |
| 5330 | - * Gets all aircraft manufacturer that have flown over by date |
|
| 5331 | - * |
|
| 5332 | - * @return Array the aircraft manufacturer list |
|
| 5333 | - * |
|
| 5334 | - */ |
|
| 5330 | + * Gets all aircraft manufacturer that have flown over by date |
|
| 5331 | + * |
|
| 5332 | + * @return Array the aircraft manufacturer list |
|
| 5333 | + * |
|
| 5334 | + */ |
|
| 5335 | 5335 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
| 5336 | 5336 | { |
| 5337 | 5337 | global $globalTimezone, $globalDBdriver; |
@@ -5373,11 +5373,11 @@ discard block |
||
| 5373 | 5373 | |
| 5374 | 5374 | |
| 5375 | 5375 | /** |
| 5376 | - * Gets all aircraft types that have flown over by ident/callsign |
|
| 5377 | - * |
|
| 5378 | - * @return Array the aircraft list |
|
| 5379 | - * |
|
| 5380 | - */ |
|
| 5376 | + * Gets all aircraft types that have flown over by ident/callsign |
|
| 5377 | + * |
|
| 5378 | + * @return Array the aircraft list |
|
| 5379 | + * |
|
| 5380 | + */ |
|
| 5381 | 5381 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
| 5382 | 5382 | { |
| 5383 | 5383 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5406,11 +5406,11 @@ discard block |
||
| 5406 | 5406 | |
| 5407 | 5407 | |
| 5408 | 5408 | /** |
| 5409 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5410 | - * |
|
| 5411 | - * @return Array the aircraft list |
|
| 5412 | - * |
|
| 5413 | - */ |
|
| 5409 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5410 | + * |
|
| 5411 | + * @return Array the aircraft list |
|
| 5412 | + * |
|
| 5413 | + */ |
|
| 5414 | 5414 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
| 5415 | 5415 | { |
| 5416 | 5416 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5450,11 +5450,11 @@ discard block |
||
| 5450 | 5450 | |
| 5451 | 5451 | |
| 5452 | 5452 | /** |
| 5453 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5454 | - * |
|
| 5455 | - * @return Array the aircraft manufacturer list |
|
| 5456 | - * |
|
| 5457 | - */ |
|
| 5453 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5454 | + * |
|
| 5455 | + * @return Array the aircraft manufacturer list |
|
| 5456 | + * |
|
| 5457 | + */ |
|
| 5458 | 5458 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
| 5459 | 5459 | { |
| 5460 | 5460 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5480,11 +5480,11 @@ discard block |
||
| 5480 | 5480 | |
| 5481 | 5481 | |
| 5482 | 5482 | /** |
| 5483 | - * Gets all aircraft types that have flown over by route |
|
| 5484 | - * |
|
| 5485 | - * @return Array the aircraft list |
|
| 5486 | - * |
|
| 5487 | - */ |
|
| 5483 | + * Gets all aircraft types that have flown over by route |
|
| 5484 | + * |
|
| 5485 | + * @return Array the aircraft list |
|
| 5486 | + * |
|
| 5487 | + */ |
|
| 5488 | 5488 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5489 | 5489 | { |
| 5490 | 5490 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5513,11 +5513,11 @@ discard block |
||
| 5513 | 5513 | } |
| 5514 | 5514 | |
| 5515 | 5515 | /** |
| 5516 | - * Gets all aircraft registration that have flown over by route |
|
| 5517 | - * |
|
| 5518 | - * @return Array the aircraft list |
|
| 5519 | - * |
|
| 5520 | - */ |
|
| 5516 | + * Gets all aircraft registration that have flown over by route |
|
| 5517 | + * |
|
| 5518 | + * @return Array the aircraft list |
|
| 5519 | + * |
|
| 5520 | + */ |
|
| 5521 | 5521 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5522 | 5522 | { |
| 5523 | 5523 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5559,11 +5559,11 @@ discard block |
||
| 5559 | 5559 | |
| 5560 | 5560 | |
| 5561 | 5561 | /** |
| 5562 | - * Gets all aircraft manufacturer that have flown over by route |
|
| 5563 | - * |
|
| 5564 | - * @return Array the aircraft manufacturer list |
|
| 5565 | - * |
|
| 5566 | - */ |
|
| 5562 | + * Gets all aircraft manufacturer that have flown over by route |
|
| 5563 | + * |
|
| 5564 | + * @return Array the aircraft manufacturer list |
|
| 5565 | + * |
|
| 5566 | + */ |
|
| 5567 | 5567 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5568 | 5568 | { |
| 5569 | 5569 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5597,11 +5597,11 @@ discard block |
||
| 5597 | 5597 | |
| 5598 | 5598 | |
| 5599 | 5599 | /** |
| 5600 | - * Gets all aircraft types that have flown over by country |
|
| 5601 | - * |
|
| 5602 | - * @return Array the aircraft list |
|
| 5603 | - * |
|
| 5604 | - */ |
|
| 5600 | + * Gets all aircraft types that have flown over by country |
|
| 5601 | + * |
|
| 5602 | + * @return Array the aircraft list |
|
| 5603 | + * |
|
| 5604 | + */ |
|
| 5605 | 5605 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
| 5606 | 5606 | { |
| 5607 | 5607 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5632,11 +5632,11 @@ discard block |
||
| 5632 | 5632 | |
| 5633 | 5633 | |
| 5634 | 5634 | /** |
| 5635 | - * Gets all aircraft registration that have flown over by country |
|
| 5636 | - * |
|
| 5637 | - * @return Array the aircraft list |
|
| 5638 | - * |
|
| 5639 | - */ |
|
| 5635 | + * Gets all aircraft registration that have flown over by country |
|
| 5636 | + * |
|
| 5637 | + * @return Array the aircraft list |
|
| 5638 | + * |
|
| 5639 | + */ |
|
| 5640 | 5640 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
| 5641 | 5641 | { |
| 5642 | 5642 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5676,11 +5676,11 @@ discard block |
||
| 5676 | 5676 | |
| 5677 | 5677 | |
| 5678 | 5678 | /** |
| 5679 | - * Gets all aircraft manufacturer that have flown over by country |
|
| 5680 | - * |
|
| 5681 | - * @return Array the aircraft manufacturer list |
|
| 5682 | - * |
|
| 5683 | - */ |
|
| 5679 | + * Gets all aircraft manufacturer that have flown over by country |
|
| 5680 | + * |
|
| 5681 | + * @return Array the aircraft manufacturer list |
|
| 5682 | + * |
|
| 5683 | + */ |
|
| 5684 | 5684 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
| 5685 | 5685 | { |
| 5686 | 5686 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5711,18 +5711,18 @@ discard block |
||
| 5711 | 5711 | |
| 5712 | 5712 | |
| 5713 | 5713 | /** |
| 5714 | - * Gets all aircraft manufacturers that have flown over |
|
| 5715 | - * |
|
| 5716 | - * @return Array the aircraft list |
|
| 5717 | - * |
|
| 5718 | - */ |
|
| 5714 | + * Gets all aircraft manufacturers that have flown over |
|
| 5715 | + * |
|
| 5716 | + * @return Array the aircraft list |
|
| 5717 | + * |
|
| 5718 | + */ |
|
| 5719 | 5719 | public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '') |
| 5720 | 5720 | { |
| 5721 | 5721 | global $globalDBdriver; |
| 5722 | 5722 | $filter_query = $this->getFilter($filters,true,true); |
| 5723 | 5723 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
| 5724 | 5724 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 5725 | - $query_values = array(); |
|
| 5725 | + $query_values = array(); |
|
| 5726 | 5726 | if ($year != '') { |
| 5727 | 5727 | if ($globalDBdriver == 'mysql') { |
| 5728 | 5728 | $query .= " AND YEAR(spotter_output.date) = :year"; |
@@ -5775,11 +5775,11 @@ discard block |
||
| 5775 | 5775 | |
| 5776 | 5776 | |
| 5777 | 5777 | /** |
| 5778 | - * Gets all aircraft registrations that have flown over |
|
| 5779 | - * |
|
| 5780 | - * @return Array the aircraft list |
|
| 5781 | - * |
|
| 5782 | - */ |
|
| 5778 | + * Gets all aircraft registrations that have flown over |
|
| 5779 | + * |
|
| 5780 | + * @return Array the aircraft list |
|
| 5781 | + * |
|
| 5782 | + */ |
|
| 5783 | 5783 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 5784 | 5784 | { |
| 5785 | 5785 | global $globalDBdriver; |
@@ -5787,15 +5787,15 @@ discard block |
||
| 5787 | 5787 | $filter_query = $this->getFilter($filters,true,true); |
| 5788 | 5788 | $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5789 | 5789 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 5790 | - if ($olderthanmonths > 0) { |
|
| 5791 | - if ($globalDBdriver == 'mysql') { |
|
| 5790 | + if ($olderthanmonths > 0) { |
|
| 5791 | + if ($globalDBdriver == 'mysql') { |
|
| 5792 | 5792 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5793 | 5793 | } else { |
| 5794 | 5794 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5795 | 5795 | } |
| 5796 | 5796 | } |
| 5797 | - if ($sincedate != '') { |
|
| 5798 | - if ($globalDBdriver == 'mysql') { |
|
| 5797 | + if ($sincedate != '') { |
|
| 5798 | + if ($globalDBdriver == 'mysql') { |
|
| 5799 | 5799 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5800 | 5800 | } else { |
| 5801 | 5801 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5860,11 +5860,11 @@ discard block |
||
| 5860 | 5860 | |
| 5861 | 5861 | |
| 5862 | 5862 | /** |
| 5863 | - * Gets all aircraft registrations that have flown over |
|
| 5864 | - * |
|
| 5865 | - * @return Array the aircraft list |
|
| 5866 | - * |
|
| 5867 | - */ |
|
| 5863 | + * Gets all aircraft registrations that have flown over |
|
| 5864 | + * |
|
| 5865 | + * @return Array the aircraft list |
|
| 5866 | + * |
|
| 5867 | + */ |
|
| 5868 | 5868 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5869 | 5869 | { |
| 5870 | 5870 | global $globalDBdriver; |
@@ -5872,15 +5872,15 @@ discard block |
||
| 5872 | 5872 | $Image = new Image($this->db); |
| 5873 | 5873 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5874 | 5874 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 5875 | - if ($olderthanmonths > 0) { |
|
| 5876 | - if ($globalDBdriver == 'mysql') { |
|
| 5875 | + if ($olderthanmonths > 0) { |
|
| 5876 | + if ($globalDBdriver == 'mysql') { |
|
| 5877 | 5877 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5878 | 5878 | } else { |
| 5879 | 5879 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5880 | 5880 | } |
| 5881 | 5881 | } |
| 5882 | - if ($sincedate != '') { |
|
| 5883 | - if ($globalDBdriver == 'mysql') { |
|
| 5882 | + if ($sincedate != '') { |
|
| 5883 | + if ($globalDBdriver == 'mysql') { |
|
| 5884 | 5884 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5885 | 5885 | } else { |
| 5886 | 5886 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5889,7 +5889,7 @@ discard block |
||
| 5889 | 5889 | |
| 5890 | 5890 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5891 | 5891 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5892 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5892 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5893 | 5893 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5894 | 5894 | |
| 5895 | 5895 | $sth = $this->db->prepare($query); |
@@ -5921,26 +5921,26 @@ discard block |
||
| 5921 | 5921 | |
| 5922 | 5922 | |
| 5923 | 5923 | /** |
| 5924 | - * Gets all departure airports of the airplanes that have flown over |
|
| 5925 | - * |
|
| 5926 | - * @return Array the airport list |
|
| 5927 | - * |
|
| 5928 | - */ |
|
| 5924 | + * Gets all departure airports of the airplanes that have flown over |
|
| 5925 | + * |
|
| 5926 | + * @return Array the airport list |
|
| 5927 | + * |
|
| 5928 | + */ |
|
| 5929 | 5929 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 5930 | 5930 | { |
| 5931 | 5931 | global $globalDBdriver; |
| 5932 | 5932 | $filter_query = $this->getFilter($filters,true,true); |
| 5933 | 5933 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5934 | 5934 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 5935 | - if ($olderthanmonths > 0) { |
|
| 5936 | - if ($globalDBdriver == 'mysql') { |
|
| 5935 | + if ($olderthanmonths > 0) { |
|
| 5936 | + if ($globalDBdriver == 'mysql') { |
|
| 5937 | 5937 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5938 | 5938 | } else { |
| 5939 | 5939 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5940 | 5940 | } |
| 5941 | - } |
|
| 5942 | - if ($sincedate != '') { |
|
| 5943 | - if ($globalDBdriver == 'mysql') { |
|
| 5941 | + } |
|
| 5942 | + if ($sincedate != '') { |
|
| 5943 | + if ($globalDBdriver == 'mysql') { |
|
| 5944 | 5944 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5945 | 5945 | } else { |
| 5946 | 5946 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5974,7 +5974,7 @@ discard block |
||
| 5974 | 5974 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 5975 | 5975 | } |
| 5976 | 5976 | } |
| 5977 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5977 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5978 | 5978 | ORDER BY airport_departure_icao_count DESC"; |
| 5979 | 5979 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5980 | 5980 | |
@@ -5997,35 +5997,35 @@ discard block |
||
| 5997 | 5997 | } |
| 5998 | 5998 | |
| 5999 | 5999 | /** |
| 6000 | - * Gets all departure airports of the airplanes that have flown over |
|
| 6001 | - * |
|
| 6002 | - * @return Array the airport list |
|
| 6003 | - * |
|
| 6004 | - */ |
|
| 6000 | + * Gets all departure airports of the airplanes that have flown over |
|
| 6001 | + * |
|
| 6002 | + * @return Array the airport list |
|
| 6003 | + * |
|
| 6004 | + */ |
|
| 6005 | 6005 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6006 | 6006 | { |
| 6007 | 6007 | global $globalDBdriver; |
| 6008 | 6008 | $filter_query = $this->getFilter($filters,true,true); |
| 6009 | 6009 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6010 | 6010 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' "; |
| 6011 | - if ($olderthanmonths > 0) { |
|
| 6012 | - if ($globalDBdriver == 'mysql') { |
|
| 6011 | + if ($olderthanmonths > 0) { |
|
| 6012 | + if ($globalDBdriver == 'mysql') { |
|
| 6013 | 6013 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6014 | 6014 | } else { |
| 6015 | 6015 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6016 | 6016 | } |
| 6017 | - } |
|
| 6018 | - if ($sincedate != '') { |
|
| 6019 | - if ($globalDBdriver == 'mysql') { |
|
| 6017 | + } |
|
| 6018 | + if ($sincedate != '') { |
|
| 6019 | + if ($globalDBdriver == 'mysql') { |
|
| 6020 | 6020 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6021 | 6021 | } else { |
| 6022 | 6022 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6023 | 6023 | } |
| 6024 | 6024 | } |
| 6025 | 6025 | |
| 6026 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6027 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6028 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6026 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6027 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6028 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6029 | 6029 | ORDER BY airport_departure_icao_count DESC"; |
| 6030 | 6030 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6031 | 6031 | |
@@ -6050,26 +6050,26 @@ discard block |
||
| 6050 | 6050 | } |
| 6051 | 6051 | |
| 6052 | 6052 | /** |
| 6053 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6054 | - * |
|
| 6055 | - * @return Array the airport list |
|
| 6056 | - * |
|
| 6057 | - */ |
|
| 6053 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6054 | + * |
|
| 6055 | + * @return Array the airport list |
|
| 6056 | + * |
|
| 6057 | + */ |
|
| 6058 | 6058 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 6059 | 6059 | { |
| 6060 | 6060 | global $globalDBdriver; |
| 6061 | 6061 | $filter_query = $this->getFilter($filters,true,true); |
| 6062 | 6062 | $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
| 6063 | 6063 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 6064 | - if ($olderthanmonths > 0) { |
|
| 6065 | - if ($globalDBdriver == 'mysql') { |
|
| 6064 | + if ($olderthanmonths > 0) { |
|
| 6065 | + if ($globalDBdriver == 'mysql') { |
|
| 6066 | 6066 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6067 | 6067 | } else { |
| 6068 | 6068 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6069 | 6069 | } |
| 6070 | - } |
|
| 6071 | - if ($sincedate != '') { |
|
| 6072 | - if ($globalDBdriver == 'mysql') { |
|
| 6070 | + } |
|
| 6071 | + if ($sincedate != '') { |
|
| 6072 | + if ($globalDBdriver == 'mysql') { |
|
| 6073 | 6073 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6074 | 6074 | } else { |
| 6075 | 6075 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6103,10 +6103,10 @@ discard block |
||
| 6103 | 6103 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6104 | 6104 | } |
| 6105 | 6105 | } |
| 6106 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6106 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6107 | 6107 | ORDER BY airport_departure_icao_count DESC"; |
| 6108 | 6108 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6109 | - //echo $query; |
|
| 6109 | + //echo $query; |
|
| 6110 | 6110 | $sth = $this->db->prepare($query); |
| 6111 | 6111 | $sth->execute($query_values); |
| 6112 | 6112 | |
@@ -6127,35 +6127,35 @@ discard block |
||
| 6127 | 6127 | } |
| 6128 | 6128 | |
| 6129 | 6129 | /** |
| 6130 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6131 | - * |
|
| 6132 | - * @return Array the airport list |
|
| 6133 | - * |
|
| 6134 | - */ |
|
| 6130 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6131 | + * |
|
| 6132 | + * @return Array the airport list |
|
| 6133 | + * |
|
| 6134 | + */ |
|
| 6135 | 6135 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6136 | 6136 | { |
| 6137 | 6137 | global $globalDBdriver; |
| 6138 | 6138 | $filter_query = $this->getFilter($filters,true,true); |
| 6139 | 6139 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
| 6140 | 6140 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 6141 | - if ($olderthanmonths > 0) { |
|
| 6142 | - if ($globalDBdriver == 'mysql') { |
|
| 6141 | + if ($olderthanmonths > 0) { |
|
| 6142 | + if ($globalDBdriver == 'mysql') { |
|
| 6143 | 6143 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6144 | 6144 | } else { |
| 6145 | 6145 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6146 | 6146 | } |
| 6147 | - } |
|
| 6148 | - if ($sincedate != '') { |
|
| 6149 | - if ($globalDBdriver == 'mysql') { |
|
| 6147 | + } |
|
| 6148 | + if ($sincedate != '') { |
|
| 6149 | + if ($globalDBdriver == 'mysql') { |
|
| 6150 | 6150 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6151 | 6151 | } else { |
| 6152 | 6152 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
| 6153 | 6153 | } |
| 6154 | 6154 | } |
| 6155 | 6155 | |
| 6156 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6157 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6158 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6156 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6157 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6158 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6159 | 6159 | ORDER BY airport_departure_icao_count DESC"; |
| 6160 | 6160 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6161 | 6161 | |
@@ -6180,11 +6180,11 @@ discard block |
||
| 6180 | 6180 | } |
| 6181 | 6181 | |
| 6182 | 6182 | /** |
| 6183 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6184 | - * |
|
| 6185 | - * @return Array the airport list |
|
| 6186 | - * |
|
| 6187 | - */ |
|
| 6183 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6184 | + * |
|
| 6185 | + * @return Array the airport list |
|
| 6186 | + * |
|
| 6187 | + */ |
|
| 6188 | 6188 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
| 6189 | 6189 | { |
| 6190 | 6190 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6218,11 +6218,11 @@ discard block |
||
| 6218 | 6218 | |
| 6219 | 6219 | |
| 6220 | 6220 | /** |
| 6221 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6222 | - * |
|
| 6223 | - * @return Array the airport list |
|
| 6224 | - * |
|
| 6225 | - */ |
|
| 6221 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6222 | + * |
|
| 6223 | + * @return Array the airport list |
|
| 6224 | + * |
|
| 6225 | + */ |
|
| 6226 | 6226 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
| 6227 | 6227 | { |
| 6228 | 6228 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6253,11 +6253,11 @@ discard block |
||
| 6253 | 6253 | |
| 6254 | 6254 | |
| 6255 | 6255 | /** |
| 6256 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6257 | - * |
|
| 6258 | - * @return Array the airport list |
|
| 6259 | - * |
|
| 6260 | - */ |
|
| 6256 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6257 | + * |
|
| 6258 | + * @return Array the airport list |
|
| 6259 | + * |
|
| 6260 | + */ |
|
| 6261 | 6261 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
| 6262 | 6262 | { |
| 6263 | 6263 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6290,11 +6290,11 @@ discard block |
||
| 6290 | 6290 | |
| 6291 | 6291 | |
| 6292 | 6292 | /** |
| 6293 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6294 | - * |
|
| 6295 | - * @return Array the airport list |
|
| 6296 | - * |
|
| 6297 | - */ |
|
| 6293 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6294 | + * |
|
| 6295 | + * @return Array the airport list |
|
| 6296 | + * |
|
| 6297 | + */ |
|
| 6298 | 6298 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 6299 | 6299 | { |
| 6300 | 6300 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6324,11 +6324,11 @@ discard block |
||
| 6324 | 6324 | |
| 6325 | 6325 | |
| 6326 | 6326 | /** |
| 6327 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 6328 | - * |
|
| 6329 | - * @return Array the airport list |
|
| 6330 | - * |
|
| 6331 | - */ |
|
| 6327 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 6328 | + * |
|
| 6329 | + * @return Array the airport list |
|
| 6330 | + * |
|
| 6331 | + */ |
|
| 6332 | 6332 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
| 6333 | 6333 | { |
| 6334 | 6334 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6361,11 +6361,11 @@ discard block |
||
| 6361 | 6361 | |
| 6362 | 6362 | |
| 6363 | 6363 | /** |
| 6364 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6365 | - * |
|
| 6366 | - * @return Array the airport list |
|
| 6367 | - * |
|
| 6368 | - */ |
|
| 6364 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6365 | + * |
|
| 6366 | + * @return Array the airport list |
|
| 6367 | + * |
|
| 6368 | + */ |
|
| 6369 | 6369 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
| 6370 | 6370 | { |
| 6371 | 6371 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6395,11 +6395,11 @@ discard block |
||
| 6395 | 6395 | |
| 6396 | 6396 | |
| 6397 | 6397 | /** |
| 6398 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 6399 | - * |
|
| 6400 | - * @return Array the airport list |
|
| 6401 | - * |
|
| 6402 | - */ |
|
| 6398 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 6399 | + * |
|
| 6400 | + * @return Array the airport list |
|
| 6401 | + * |
|
| 6402 | + */ |
|
| 6403 | 6403 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
| 6404 | 6404 | { |
| 6405 | 6405 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6432,11 +6432,11 @@ discard block |
||
| 6432 | 6432 | |
| 6433 | 6433 | |
| 6434 | 6434 | /** |
| 6435 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 6436 | - * |
|
| 6437 | - * @return Array the airport list |
|
| 6438 | - * |
|
| 6439 | - */ |
|
| 6435 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 6436 | + * |
|
| 6437 | + * @return Array the airport list |
|
| 6438 | + * |
|
| 6439 | + */ |
|
| 6440 | 6440 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
| 6441 | 6441 | { |
| 6442 | 6442 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6467,11 +6467,11 @@ discard block |
||
| 6467 | 6467 | |
| 6468 | 6468 | |
| 6469 | 6469 | /** |
| 6470 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6471 | - * |
|
| 6472 | - * @return Array the airport list |
|
| 6473 | - * |
|
| 6474 | - */ |
|
| 6470 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6471 | + * |
|
| 6472 | + * @return Array the airport list |
|
| 6473 | + * |
|
| 6474 | + */ |
|
| 6475 | 6475 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6476 | 6476 | { |
| 6477 | 6477 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6504,11 +6504,11 @@ discard block |
||
| 6504 | 6504 | |
| 6505 | 6505 | |
| 6506 | 6506 | /** |
| 6507 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6508 | - * |
|
| 6509 | - * @return Array the airport list |
|
| 6510 | - * |
|
| 6511 | - */ |
|
| 6507 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6508 | + * |
|
| 6509 | + * @return Array the airport list |
|
| 6510 | + * |
|
| 6511 | + */ |
|
| 6512 | 6512 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6513 | 6513 | { |
| 6514 | 6514 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6538,11 +6538,11 @@ discard block |
||
| 6538 | 6538 | |
| 6539 | 6539 | |
| 6540 | 6540 | /** |
| 6541 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6542 | - * |
|
| 6543 | - * @return Array the airport list |
|
| 6544 | - * |
|
| 6545 | - */ |
|
| 6541 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6542 | + * |
|
| 6543 | + * @return Array the airport list |
|
| 6544 | + * |
|
| 6545 | + */ |
|
| 6546 | 6546 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
| 6547 | 6547 | { |
| 6548 | 6548 | global $globalTimezone, $globalDBdriver; |
@@ -6588,11 +6588,11 @@ discard block |
||
| 6588 | 6588 | |
| 6589 | 6589 | |
| 6590 | 6590 | /** |
| 6591 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6592 | - * |
|
| 6593 | - * @return Array the airport list |
|
| 6594 | - * |
|
| 6595 | - */ |
|
| 6591 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6592 | + * |
|
| 6593 | + * @return Array the airport list |
|
| 6594 | + * |
|
| 6595 | + */ |
|
| 6596 | 6596 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
| 6597 | 6597 | { |
| 6598 | 6598 | global $globalTimezone, $globalDBdriver; |
@@ -6635,11 +6635,11 @@ discard block |
||
| 6635 | 6635 | |
| 6636 | 6636 | |
| 6637 | 6637 | /** |
| 6638 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 6639 | - * |
|
| 6640 | - * @return Array the airport list |
|
| 6641 | - * |
|
| 6642 | - */ |
|
| 6638 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 6639 | + * |
|
| 6640 | + * @return Array the airport list |
|
| 6641 | + * |
|
| 6642 | + */ |
|
| 6643 | 6643 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
| 6644 | 6644 | { |
| 6645 | 6645 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6673,11 +6673,11 @@ discard block |
||
| 6673 | 6673 | |
| 6674 | 6674 | |
| 6675 | 6675 | /** |
| 6676 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 6677 | - * |
|
| 6678 | - * @return Array the airport list |
|
| 6679 | - * |
|
| 6680 | - */ |
|
| 6676 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 6677 | + * |
|
| 6678 | + * @return Array the airport list |
|
| 6679 | + * |
|
| 6680 | + */ |
|
| 6681 | 6681 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
| 6682 | 6682 | { |
| 6683 | 6683 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6708,11 +6708,11 @@ discard block |
||
| 6708 | 6708 | |
| 6709 | 6709 | |
| 6710 | 6710 | /** |
| 6711 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 6712 | - * |
|
| 6713 | - * @return Array the airport list |
|
| 6714 | - * |
|
| 6715 | - */ |
|
| 6711 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 6712 | + * |
|
| 6713 | + * @return Array the airport list |
|
| 6714 | + * |
|
| 6715 | + */ |
|
| 6716 | 6716 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
| 6717 | 6717 | { |
| 6718 | 6718 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6746,11 +6746,11 @@ discard block |
||
| 6746 | 6746 | |
| 6747 | 6747 | |
| 6748 | 6748 | /** |
| 6749 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6750 | - * |
|
| 6751 | - * @return Array the airport list |
|
| 6752 | - * |
|
| 6753 | - */ |
|
| 6749 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6750 | + * |
|
| 6751 | + * @return Array the airport list |
|
| 6752 | + * |
|
| 6753 | + */ |
|
| 6754 | 6754 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
| 6755 | 6755 | { |
| 6756 | 6756 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6780,31 +6780,31 @@ discard block |
||
| 6780 | 6780 | |
| 6781 | 6781 | |
| 6782 | 6782 | /** |
| 6783 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 6784 | - * |
|
| 6785 | - * @param Boolean $limit Limit result to 10 or not |
|
| 6786 | - * @param Integer $olderthanmonths Only show result older than x months |
|
| 6787 | - * @param String $sincedate Only show result since x date |
|
| 6788 | - * @param Boolean $icaoaskey Show result by ICAO |
|
| 6789 | - * @param Array $filters Filter used here |
|
| 6790 | - * @return Array the airport list |
|
| 6791 | - * |
|
| 6792 | - */ |
|
| 6783 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 6784 | + * |
|
| 6785 | + * @param Boolean $limit Limit result to 10 or not |
|
| 6786 | + * @param Integer $olderthanmonths Only show result older than x months |
|
| 6787 | + * @param String $sincedate Only show result since x date |
|
| 6788 | + * @param Boolean $icaoaskey Show result by ICAO |
|
| 6789 | + * @param Array $filters Filter used here |
|
| 6790 | + * @return Array the airport list |
|
| 6791 | + * |
|
| 6792 | + */ |
|
| 6793 | 6793 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 6794 | 6794 | { |
| 6795 | 6795 | global $globalDBdriver; |
| 6796 | 6796 | $filter_query = $this->getFilter($filters,true,true); |
| 6797 | 6797 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6798 | 6798 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 6799 | - if ($olderthanmonths > 0) { |
|
| 6800 | - if ($globalDBdriver == 'mysql') { |
|
| 6799 | + if ($olderthanmonths > 0) { |
|
| 6800 | + if ($globalDBdriver == 'mysql') { |
|
| 6801 | 6801 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6802 | 6802 | } else { |
| 6803 | 6803 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6804 | 6804 | } |
| 6805 | 6805 | } |
| 6806 | - if ($sincedate != '') { |
|
| 6807 | - if ($globalDBdriver == 'mysql') { |
|
| 6806 | + if ($sincedate != '') { |
|
| 6807 | + if ($globalDBdriver == 'mysql') { |
|
| 6808 | 6808 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6809 | 6809 | } else { |
| 6810 | 6810 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6838,7 +6838,7 @@ discard block |
||
| 6838 | 6838 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6839 | 6839 | } |
| 6840 | 6840 | } |
| 6841 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6841 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6842 | 6842 | ORDER BY airport_arrival_icao_count DESC"; |
| 6843 | 6843 | if ($limit) $query .= " LIMIT 10"; |
| 6844 | 6844 | |
@@ -6867,35 +6867,35 @@ discard block |
||
| 6867 | 6867 | } |
| 6868 | 6868 | |
| 6869 | 6869 | /** |
| 6870 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 6871 | - * |
|
| 6872 | - * @return Array the airport list |
|
| 6873 | - * |
|
| 6874 | - */ |
|
| 6870 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 6871 | + * |
|
| 6872 | + * @return Array the airport list |
|
| 6873 | + * |
|
| 6874 | + */ |
|
| 6875 | 6875 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 6876 | 6876 | { |
| 6877 | 6877 | global $globalDBdriver; |
| 6878 | 6878 | $filter_query = $this->getFilter($filters,true,true); |
| 6879 | 6879 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6880 | 6880 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' "; |
| 6881 | - if ($olderthanmonths > 0) { |
|
| 6882 | - if ($globalDBdriver == 'mysql') { |
|
| 6881 | + if ($olderthanmonths > 0) { |
|
| 6882 | + if ($globalDBdriver == 'mysql') { |
|
| 6883 | 6883 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6884 | 6884 | } else { |
| 6885 | 6885 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6886 | 6886 | } |
| 6887 | 6887 | } |
| 6888 | - if ($sincedate != '') { |
|
| 6889 | - if ($globalDBdriver == 'mysql') { |
|
| 6888 | + if ($sincedate != '') { |
|
| 6889 | + if ($globalDBdriver == 'mysql') { |
|
| 6890 | 6890 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6891 | 6891 | } else { |
| 6892 | 6892 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6893 | 6893 | } |
| 6894 | 6894 | } |
| 6895 | 6895 | |
| 6896 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6897 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6898 | - $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6896 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6897 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6898 | + $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6899 | 6899 | ORDER BY airport_arrival_icao_count DESC"; |
| 6900 | 6900 | if ($limit) $query .= " LIMIT 10"; |
| 6901 | 6901 | |
@@ -6926,26 +6926,26 @@ discard block |
||
| 6926 | 6926 | |
| 6927 | 6927 | |
| 6928 | 6928 | /** |
| 6929 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6930 | - * |
|
| 6931 | - * @return Array the airport list |
|
| 6932 | - * |
|
| 6933 | - */ |
|
| 6929 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6930 | + * |
|
| 6931 | + * @return Array the airport list |
|
| 6932 | + * |
|
| 6933 | + */ |
|
| 6934 | 6934 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 6935 | 6935 | { |
| 6936 | 6936 | global $globalDBdriver; |
| 6937 | 6937 | $filter_query = $this->getFilter($filters,true,true); |
| 6938 | 6938 | $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
| 6939 | 6939 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 6940 | - if ($olderthanmonths > 0) { |
|
| 6941 | - if ($globalDBdriver == 'mysql') { |
|
| 6940 | + if ($olderthanmonths > 0) { |
|
| 6941 | + if ($globalDBdriver == 'mysql') { |
|
| 6942 | 6942 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6943 | 6943 | } else { |
| 6944 | 6944 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6945 | 6945 | } |
| 6946 | 6946 | } |
| 6947 | - if ($sincedate != '') { |
|
| 6948 | - if ($globalDBdriver == 'mysql') { |
|
| 6947 | + if ($sincedate != '') { |
|
| 6948 | + if ($globalDBdriver == 'mysql') { |
|
| 6949 | 6949 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6950 | 6950 | } else { |
| 6951 | 6951 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6979,7 +6979,7 @@ discard block |
||
| 6979 | 6979 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6980 | 6980 | } |
| 6981 | 6981 | } |
| 6982 | - $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6982 | + $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6983 | 6983 | ORDER BY airport_arrival_icao_count DESC"; |
| 6984 | 6984 | if ($limit) $query .= " LIMIT 10"; |
| 6985 | 6985 | |
@@ -7007,35 +7007,35 @@ discard block |
||
| 7007 | 7007 | } |
| 7008 | 7008 | |
| 7009 | 7009 | /** |
| 7010 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7011 | - * |
|
| 7012 | - * @return Array the airport list |
|
| 7013 | - * |
|
| 7014 | - */ |
|
| 7010 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7011 | + * |
|
| 7012 | + * @return Array the airport list |
|
| 7013 | + * |
|
| 7014 | + */ |
|
| 7015 | 7015 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 7016 | 7016 | { |
| 7017 | 7017 | global $globalDBdriver; |
| 7018 | 7018 | $filter_query = $this->getFilter($filters,true,true); |
| 7019 | 7019 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
| 7020 | 7020 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 7021 | - if ($olderthanmonths > 0) { |
|
| 7022 | - if ($globalDBdriver == 'mysql') { |
|
| 7021 | + if ($olderthanmonths > 0) { |
|
| 7022 | + if ($globalDBdriver == 'mysql') { |
|
| 7023 | 7023 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 7024 | 7024 | } else { |
| 7025 | 7025 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 7026 | 7026 | } |
| 7027 | 7027 | } |
| 7028 | - if ($sincedate != '') { |
|
| 7029 | - if ($globalDBdriver == 'mysql') { |
|
| 7028 | + if ($sincedate != '') { |
|
| 7029 | + if ($globalDBdriver == 'mysql') { |
|
| 7030 | 7030 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 7031 | 7031 | } else { |
| 7032 | 7032 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 7033 | 7033 | } |
| 7034 | 7034 | } |
| 7035 | 7035 | |
| 7036 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7037 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7038 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7036 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7037 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7038 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7039 | 7039 | ORDER BY airport_arrival_icao_count DESC"; |
| 7040 | 7040 | if ($limit) $query .= " LIMIT 10"; |
| 7041 | 7041 | |
@@ -7065,11 +7065,11 @@ discard block |
||
| 7065 | 7065 | } |
| 7066 | 7066 | |
| 7067 | 7067 | /** |
| 7068 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7069 | - * |
|
| 7070 | - * @return Array the airport list |
|
| 7071 | - * |
|
| 7072 | - */ |
|
| 7068 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7069 | + * |
|
| 7070 | + * @return Array the airport list |
|
| 7071 | + * |
|
| 7072 | + */ |
|
| 7073 | 7073 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 7074 | 7074 | { |
| 7075 | 7075 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7101,11 +7101,11 @@ discard block |
||
| 7101 | 7101 | |
| 7102 | 7102 | |
| 7103 | 7103 | /** |
| 7104 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7105 | - * |
|
| 7106 | - * @return Array the airport list |
|
| 7107 | - * |
|
| 7108 | - */ |
|
| 7104 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7105 | + * |
|
| 7106 | + * @return Array the airport list |
|
| 7107 | + * |
|
| 7108 | + */ |
|
| 7109 | 7109 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
| 7110 | 7110 | { |
| 7111 | 7111 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7136,11 +7136,11 @@ discard block |
||
| 7136 | 7136 | |
| 7137 | 7137 | |
| 7138 | 7138 | /** |
| 7139 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7140 | - * |
|
| 7141 | - * @return Array the airport list |
|
| 7142 | - * |
|
| 7143 | - */ |
|
| 7139 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7140 | + * |
|
| 7141 | + * @return Array the airport list |
|
| 7142 | + * |
|
| 7143 | + */ |
|
| 7144 | 7144 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
| 7145 | 7145 | { |
| 7146 | 7146 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7174,11 +7174,11 @@ discard block |
||
| 7174 | 7174 | |
| 7175 | 7175 | |
| 7176 | 7176 | /** |
| 7177 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7178 | - * |
|
| 7179 | - * @return Array the airport list |
|
| 7180 | - * |
|
| 7181 | - */ |
|
| 7177 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7178 | + * |
|
| 7179 | + * @return Array the airport list |
|
| 7180 | + * |
|
| 7181 | + */ |
|
| 7182 | 7182 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 7183 | 7183 | { |
| 7184 | 7184 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7208,11 +7208,11 @@ discard block |
||
| 7208 | 7208 | |
| 7209 | 7209 | |
| 7210 | 7210 | /** |
| 7211 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 7212 | - * |
|
| 7213 | - * @return Array the airport list |
|
| 7214 | - * |
|
| 7215 | - */ |
|
| 7211 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 7212 | + * |
|
| 7213 | + * @return Array the airport list |
|
| 7214 | + * |
|
| 7215 | + */ |
|
| 7216 | 7216 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
| 7217 | 7217 | { |
| 7218 | 7218 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7246,11 +7246,11 @@ discard block |
||
| 7246 | 7246 | |
| 7247 | 7247 | |
| 7248 | 7248 | /** |
| 7249 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7250 | - * |
|
| 7251 | - * @return Array the airport list |
|
| 7252 | - * |
|
| 7253 | - */ |
|
| 7249 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7250 | + * |
|
| 7251 | + * @return Array the airport list |
|
| 7252 | + * |
|
| 7253 | + */ |
|
| 7254 | 7254 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
| 7255 | 7255 | { |
| 7256 | 7256 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7281,11 +7281,11 @@ discard block |
||
| 7281 | 7281 | |
| 7282 | 7282 | |
| 7283 | 7283 | /** |
| 7284 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 7285 | - * |
|
| 7286 | - * @return Array the airport list |
|
| 7287 | - * |
|
| 7288 | - */ |
|
| 7284 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 7285 | + * |
|
| 7286 | + * @return Array the airport list |
|
| 7287 | + * |
|
| 7288 | + */ |
|
| 7289 | 7289 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
| 7290 | 7290 | { |
| 7291 | 7291 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7318,11 +7318,11 @@ discard block |
||
| 7318 | 7318 | |
| 7319 | 7319 | |
| 7320 | 7320 | /** |
| 7321 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 7322 | - * |
|
| 7323 | - * @return Array the airport list |
|
| 7324 | - * |
|
| 7325 | - */ |
|
| 7321 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 7322 | + * |
|
| 7323 | + * @return Array the airport list |
|
| 7324 | + * |
|
| 7325 | + */ |
|
| 7326 | 7326 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
| 7327 | 7327 | { |
| 7328 | 7328 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7352,11 +7352,11 @@ discard block |
||
| 7352 | 7352 | |
| 7353 | 7353 | |
| 7354 | 7354 | /** |
| 7355 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7356 | - * |
|
| 7357 | - * @return Array the airport list |
|
| 7358 | - * |
|
| 7359 | - */ |
|
| 7355 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7356 | + * |
|
| 7357 | + * @return Array the airport list |
|
| 7358 | + * |
|
| 7359 | + */ |
|
| 7360 | 7360 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7361 | 7361 | { |
| 7362 | 7362 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7390,11 +7390,11 @@ discard block |
||
| 7390 | 7390 | |
| 7391 | 7391 | |
| 7392 | 7392 | /** |
| 7393 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7394 | - * |
|
| 7395 | - * @return Array the airport list |
|
| 7396 | - * |
|
| 7397 | - */ |
|
| 7393 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7394 | + * |
|
| 7395 | + * @return Array the airport list |
|
| 7396 | + * |
|
| 7397 | + */ |
|
| 7398 | 7398 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7399 | 7399 | { |
| 7400 | 7400 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7425,11 +7425,11 @@ discard block |
||
| 7425 | 7425 | |
| 7426 | 7426 | |
| 7427 | 7427 | /** |
| 7428 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 7429 | - * |
|
| 7430 | - * @return Array the airport list |
|
| 7431 | - * |
|
| 7432 | - */ |
|
| 7428 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 7429 | + * |
|
| 7430 | + * @return Array the airport list |
|
| 7431 | + * |
|
| 7432 | + */ |
|
| 7433 | 7433 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
| 7434 | 7434 | { |
| 7435 | 7435 | global $globalTimezone, $globalDBdriver; |
@@ -7475,11 +7475,11 @@ discard block |
||
| 7475 | 7475 | |
| 7476 | 7476 | |
| 7477 | 7477 | /** |
| 7478 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 7479 | - * |
|
| 7480 | - * @return Array the airport list |
|
| 7481 | - * |
|
| 7482 | - */ |
|
| 7478 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 7479 | + * |
|
| 7480 | + * @return Array the airport list |
|
| 7481 | + * |
|
| 7482 | + */ |
|
| 7483 | 7483 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 7484 | 7484 | { |
| 7485 | 7485 | global $globalTimezone, $globalDBdriver; |
@@ -7522,11 +7522,11 @@ discard block |
||
| 7522 | 7522 | |
| 7523 | 7523 | |
| 7524 | 7524 | /** |
| 7525 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 7526 | - * |
|
| 7527 | - * @return Array the airport list |
|
| 7528 | - * |
|
| 7529 | - */ |
|
| 7525 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 7526 | + * |
|
| 7527 | + * @return Array the airport list |
|
| 7528 | + * |
|
| 7529 | + */ |
|
| 7530 | 7530 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
| 7531 | 7531 | { |
| 7532 | 7532 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7559,11 +7559,11 @@ discard block |
||
| 7559 | 7559 | |
| 7560 | 7560 | |
| 7561 | 7561 | /** |
| 7562 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7563 | - * |
|
| 7564 | - * @return Array the airport list |
|
| 7565 | - * |
|
| 7566 | - */ |
|
| 7562 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7563 | + * |
|
| 7564 | + * @return Array the airport list |
|
| 7565 | + * |
|
| 7566 | + */ |
|
| 7567 | 7567 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 7568 | 7568 | { |
| 7569 | 7569 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7594,11 +7594,11 @@ discard block |
||
| 7594 | 7594 | |
| 7595 | 7595 | |
| 7596 | 7596 | /** |
| 7597 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 7598 | - * |
|
| 7599 | - * @return Array the airport list |
|
| 7600 | - * |
|
| 7601 | - */ |
|
| 7597 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 7598 | + * |
|
| 7599 | + * @return Array the airport list |
|
| 7600 | + * |
|
| 7601 | + */ |
|
| 7602 | 7602 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
| 7603 | 7603 | { |
| 7604 | 7604 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7631,11 +7631,11 @@ discard block |
||
| 7631 | 7631 | |
| 7632 | 7632 | |
| 7633 | 7633 | /** |
| 7634 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 7635 | - * |
|
| 7636 | - * @return Array the airport list |
|
| 7637 | - * |
|
| 7638 | - */ |
|
| 7634 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 7635 | + * |
|
| 7636 | + * @return Array the airport list |
|
| 7637 | + * |
|
| 7638 | + */ |
|
| 7639 | 7639 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
| 7640 | 7640 | { |
| 7641 | 7641 | global $globalDBdriver; |
@@ -7667,11 +7667,11 @@ discard block |
||
| 7667 | 7667 | |
| 7668 | 7668 | |
| 7669 | 7669 | /** |
| 7670 | - * Counts all airport departure countries |
|
| 7671 | - * |
|
| 7672 | - * @return Array the airport departure list |
|
| 7673 | - * |
|
| 7674 | - */ |
|
| 7670 | + * Counts all airport departure countries |
|
| 7671 | + * |
|
| 7672 | + * @return Array the airport departure list |
|
| 7673 | + * |
|
| 7674 | + */ |
|
| 7675 | 7675 | public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '') |
| 7676 | 7676 | { |
| 7677 | 7677 | global $globalDBdriver; |
@@ -7730,11 +7730,11 @@ discard block |
||
| 7730 | 7730 | |
| 7731 | 7731 | |
| 7732 | 7732 | /** |
| 7733 | - * Counts all airport arrival countries |
|
| 7734 | - * |
|
| 7735 | - * @return Array the airport arrival list |
|
| 7736 | - * |
|
| 7737 | - */ |
|
| 7733 | + * Counts all airport arrival countries |
|
| 7734 | + * |
|
| 7735 | + * @return Array the airport arrival list |
|
| 7736 | + * |
|
| 7737 | + */ |
|
| 7738 | 7738 | public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
| 7739 | 7739 | { |
| 7740 | 7740 | global $globalDBdriver; |
@@ -7796,11 +7796,11 @@ discard block |
||
| 7796 | 7796 | |
| 7797 | 7797 | |
| 7798 | 7798 | /** |
| 7799 | - * Gets all route combinations |
|
| 7800 | - * |
|
| 7801 | - * @return Array the route list |
|
| 7802 | - * |
|
| 7803 | - */ |
|
| 7799 | + * Gets all route combinations |
|
| 7800 | + * |
|
| 7801 | + * @return Array the route list |
|
| 7802 | + * |
|
| 7803 | + */ |
|
| 7804 | 7804 | public function countAllRoutes($filters = array()) |
| 7805 | 7805 | { |
| 7806 | 7806 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7839,11 +7839,11 @@ discard block |
||
| 7839 | 7839 | |
| 7840 | 7840 | |
| 7841 | 7841 | /** |
| 7842 | - * Gets all route combinations based on an aircraft |
|
| 7843 | - * |
|
| 7844 | - * @return Array the route list |
|
| 7845 | - * |
|
| 7846 | - */ |
|
| 7842 | + * Gets all route combinations based on an aircraft |
|
| 7843 | + * |
|
| 7844 | + * @return Array the route list |
|
| 7845 | + * |
|
| 7846 | + */ |
|
| 7847 | 7847 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
| 7848 | 7848 | { |
| 7849 | 7849 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7879,11 +7879,11 @@ discard block |
||
| 7879 | 7879 | |
| 7880 | 7880 | |
| 7881 | 7881 | /** |
| 7882 | - * Gets all route combinations based on an aircraft registration |
|
| 7883 | - * |
|
| 7884 | - * @return Array the route list |
|
| 7885 | - * |
|
| 7886 | - */ |
|
| 7882 | + * Gets all route combinations based on an aircraft registration |
|
| 7883 | + * |
|
| 7884 | + * @return Array the route list |
|
| 7885 | + * |
|
| 7886 | + */ |
|
| 7887 | 7887 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 7888 | 7888 | { |
| 7889 | 7889 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7921,11 +7921,11 @@ discard block |
||
| 7921 | 7921 | |
| 7922 | 7922 | |
| 7923 | 7923 | /** |
| 7924 | - * Gets all route combinations based on an airline |
|
| 7925 | - * |
|
| 7926 | - * @return Array the route list |
|
| 7927 | - * |
|
| 7928 | - */ |
|
| 7924 | + * Gets all route combinations based on an airline |
|
| 7925 | + * |
|
| 7926 | + * @return Array the route list |
|
| 7927 | + * |
|
| 7928 | + */ |
|
| 7929 | 7929 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 7930 | 7930 | { |
| 7931 | 7931 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7963,11 +7963,11 @@ discard block |
||
| 7963 | 7963 | |
| 7964 | 7964 | |
| 7965 | 7965 | /** |
| 7966 | - * Gets all route combinations based on an airport |
|
| 7967 | - * |
|
| 7968 | - * @return Array the route list |
|
| 7969 | - * |
|
| 7970 | - */ |
|
| 7966 | + * Gets all route combinations based on an airport |
|
| 7967 | + * |
|
| 7968 | + * @return Array the route list |
|
| 7969 | + * |
|
| 7970 | + */ |
|
| 7971 | 7971 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 7972 | 7972 | { |
| 7973 | 7973 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8004,11 +8004,11 @@ discard block |
||
| 8004 | 8004 | |
| 8005 | 8005 | |
| 8006 | 8006 | /** |
| 8007 | - * Gets all route combinations based on an country |
|
| 8008 | - * |
|
| 8009 | - * @return Array the route list |
|
| 8010 | - * |
|
| 8011 | - */ |
|
| 8007 | + * Gets all route combinations based on an country |
|
| 8008 | + * |
|
| 8009 | + * @return Array the route list |
|
| 8010 | + * |
|
| 8011 | + */ |
|
| 8012 | 8012 | public function countAllRoutesByCountry($country, $filters = array()) |
| 8013 | 8013 | { |
| 8014 | 8014 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8044,11 +8044,11 @@ discard block |
||
| 8044 | 8044 | |
| 8045 | 8045 | |
| 8046 | 8046 | /** |
| 8047 | - * Gets all route combinations based on an date |
|
| 8048 | - * |
|
| 8049 | - * @return Array the route list |
|
| 8050 | - * |
|
| 8051 | - */ |
|
| 8047 | + * Gets all route combinations based on an date |
|
| 8048 | + * |
|
| 8049 | + * @return Array the route list |
|
| 8050 | + * |
|
| 8051 | + */ |
|
| 8052 | 8052 | public function countAllRoutesByDate($date, $filters = array()) |
| 8053 | 8053 | { |
| 8054 | 8054 | global $globalTimezone, $globalDBdriver; |
@@ -8098,11 +8098,11 @@ discard block |
||
| 8098 | 8098 | |
| 8099 | 8099 | |
| 8100 | 8100 | /** |
| 8101 | - * Gets all route combinations based on an ident/callsign |
|
| 8102 | - * |
|
| 8103 | - * @return Array the route list |
|
| 8104 | - * |
|
| 8105 | - */ |
|
| 8101 | + * Gets all route combinations based on an ident/callsign |
|
| 8102 | + * |
|
| 8103 | + * @return Array the route list |
|
| 8104 | + * |
|
| 8105 | + */ |
|
| 8106 | 8106 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 8107 | 8107 | { |
| 8108 | 8108 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8139,11 +8139,11 @@ discard block |
||
| 8139 | 8139 | |
| 8140 | 8140 | |
| 8141 | 8141 | /** |
| 8142 | - * Gets all route combinations based on an manufacturer |
|
| 8143 | - * |
|
| 8144 | - * @return Array the route list |
|
| 8145 | - * |
|
| 8146 | - */ |
|
| 8142 | + * Gets all route combinations based on an manufacturer |
|
| 8143 | + * |
|
| 8144 | + * @return Array the route list |
|
| 8145 | + * |
|
| 8146 | + */ |
|
| 8147 | 8147 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 8148 | 8148 | { |
| 8149 | 8149 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8181,11 +8181,11 @@ discard block |
||
| 8181 | 8181 | |
| 8182 | 8182 | |
| 8183 | 8183 | /** |
| 8184 | - * Gets all route combinations with waypoints |
|
| 8185 | - * |
|
| 8186 | - * @return Array the route list |
|
| 8187 | - * |
|
| 8188 | - */ |
|
| 8184 | + * Gets all route combinations with waypoints |
|
| 8185 | + * |
|
| 8186 | + * @return Array the route list |
|
| 8187 | + * |
|
| 8188 | + */ |
|
| 8189 | 8189 | public function countAllRoutesWithWaypoints($filters = array()) |
| 8190 | 8190 | { |
| 8191 | 8191 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8222,11 +8222,11 @@ discard block |
||
| 8222 | 8222 | } |
| 8223 | 8223 | |
| 8224 | 8224 | /** |
| 8225 | - * Gets all callsigns that have flown over |
|
| 8226 | - * |
|
| 8227 | - * @return Array the callsign list |
|
| 8228 | - * |
|
| 8229 | - */ |
|
| 8225 | + * Gets all callsigns that have flown over |
|
| 8226 | + * |
|
| 8227 | + * @return Array the callsign list |
|
| 8228 | + * |
|
| 8229 | + */ |
|
| 8230 | 8230 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 8231 | 8231 | { |
| 8232 | 8232 | global $globalDBdriver; |
@@ -8292,11 +8292,11 @@ discard block |
||
| 8292 | 8292 | } |
| 8293 | 8293 | |
| 8294 | 8294 | /** |
| 8295 | - * Gets all callsigns that have flown over |
|
| 8296 | - * |
|
| 8297 | - * @return Array the callsign list |
|
| 8298 | - * |
|
| 8299 | - */ |
|
| 8295 | + * Gets all callsigns that have flown over |
|
| 8296 | + * |
|
| 8297 | + * @return Array the callsign list |
|
| 8298 | + * |
|
| 8299 | + */ |
|
| 8300 | 8300 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 8301 | 8301 | { |
| 8302 | 8302 | global $globalDBdriver; |
@@ -8337,11 +8337,11 @@ discard block |
||
| 8337 | 8337 | |
| 8338 | 8338 | |
| 8339 | 8339 | /** |
| 8340 | - * Counts all dates |
|
| 8341 | - * |
|
| 8342 | - * @return Array the date list |
|
| 8343 | - * |
|
| 8344 | - */ |
|
| 8340 | + * Counts all dates |
|
| 8341 | + * |
|
| 8342 | + * @return Array the date list |
|
| 8343 | + * |
|
| 8344 | + */ |
|
| 8345 | 8345 | public function countAllDates($filters = array()) |
| 8346 | 8346 | { |
| 8347 | 8347 | global $globalTimezone, $globalDBdriver; |
@@ -8386,11 +8386,11 @@ discard block |
||
| 8386 | 8386 | } |
| 8387 | 8387 | |
| 8388 | 8388 | /** |
| 8389 | - * Counts all dates |
|
| 8390 | - * |
|
| 8391 | - * @return Array the date list |
|
| 8392 | - * |
|
| 8393 | - */ |
|
| 8389 | + * Counts all dates |
|
| 8390 | + * |
|
| 8391 | + * @return Array the date list |
|
| 8392 | + * |
|
| 8393 | + */ |
|
| 8394 | 8394 | public function countAllDatesByAirlines($filters = array()) |
| 8395 | 8395 | { |
| 8396 | 8396 | global $globalTimezone, $globalDBdriver; |
@@ -8435,11 +8435,11 @@ discard block |
||
| 8435 | 8435 | } |
| 8436 | 8436 | |
| 8437 | 8437 | /** |
| 8438 | - * Counts all dates during the last 7 days |
|
| 8439 | - * |
|
| 8440 | - * @return Array the date list |
|
| 8441 | - * |
|
| 8442 | - */ |
|
| 8438 | + * Counts all dates during the last 7 days |
|
| 8439 | + * |
|
| 8440 | + * @return Array the date list |
|
| 8441 | + * |
|
| 8442 | + */ |
|
| 8443 | 8443 | public function countAllDatesLast7Days($filters = array()) |
| 8444 | 8444 | { |
| 8445 | 8445 | global $globalTimezone, $globalDBdriver; |
@@ -8461,7 +8461,7 @@ discard block |
||
| 8461 | 8461 | $query .= " GROUP BY date_name |
| 8462 | 8462 | ORDER BY date_name ASC"; |
| 8463 | 8463 | $query_data = array(':offset' => $offset); |
| 8464 | - } |
|
| 8464 | + } |
|
| 8465 | 8465 | |
| 8466 | 8466 | $sth = $this->db->prepare($query); |
| 8467 | 8467 | $sth->execute($query_data); |
@@ -8481,11 +8481,11 @@ discard block |
||
| 8481 | 8481 | } |
| 8482 | 8482 | |
| 8483 | 8483 | /** |
| 8484 | - * Counts all dates during the last month |
|
| 8485 | - * |
|
| 8486 | - * @return Array the date list |
|
| 8487 | - * |
|
| 8488 | - */ |
|
| 8484 | + * Counts all dates during the last month |
|
| 8485 | + * |
|
| 8486 | + * @return Array the date list |
|
| 8487 | + * |
|
| 8488 | + */ |
|
| 8489 | 8489 | public function countAllDatesLastMonth($filters = array()) |
| 8490 | 8490 | { |
| 8491 | 8491 | global $globalTimezone, $globalDBdriver; |
@@ -8507,7 +8507,7 @@ discard block |
||
| 8507 | 8507 | $query .= " GROUP BY date_name |
| 8508 | 8508 | ORDER BY date_name ASC"; |
| 8509 | 8509 | $query_data = array(':offset' => $offset); |
| 8510 | - } |
|
| 8510 | + } |
|
| 8511 | 8511 | |
| 8512 | 8512 | $sth = $this->db->prepare($query); |
| 8513 | 8513 | $sth->execute($query_data); |
@@ -8528,11 +8528,11 @@ discard block |
||
| 8528 | 8528 | |
| 8529 | 8529 | |
| 8530 | 8530 | /** |
| 8531 | - * Counts all dates during the last month |
|
| 8532 | - * |
|
| 8533 | - * @return Array the date list |
|
| 8534 | - * |
|
| 8535 | - */ |
|
| 8531 | + * Counts all dates during the last month |
|
| 8532 | + * |
|
| 8533 | + * @return Array the date list |
|
| 8534 | + * |
|
| 8535 | + */ |
|
| 8536 | 8536 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 8537 | 8537 | { |
| 8538 | 8538 | global $globalTimezone, $globalDBdriver; |
@@ -8555,7 +8555,7 @@ discard block |
||
| 8555 | 8555 | GROUP BY spotter_output.airline_icao, date_name |
| 8556 | 8556 | ORDER BY date_name ASC"; |
| 8557 | 8557 | $query_data = array(':offset' => $offset); |
| 8558 | - } |
|
| 8558 | + } |
|
| 8559 | 8559 | |
| 8560 | 8560 | $sth = $this->db->prepare($query); |
| 8561 | 8561 | $sth->execute($query_data); |
@@ -8577,11 +8577,11 @@ discard block |
||
| 8577 | 8577 | |
| 8578 | 8578 | |
| 8579 | 8579 | /** |
| 8580 | - * Counts all month |
|
| 8581 | - * |
|
| 8582 | - * @return Array the month list |
|
| 8583 | - * |
|
| 8584 | - */ |
|
| 8580 | + * Counts all month |
|
| 8581 | + * |
|
| 8582 | + * @return Array the month list |
|
| 8583 | + * |
|
| 8584 | + */ |
|
| 8585 | 8585 | public function countAllMonths($filters = array()) |
| 8586 | 8586 | { |
| 8587 | 8587 | global $globalTimezone, $globalDBdriver; |
@@ -8623,11 +8623,11 @@ discard block |
||
| 8623 | 8623 | } |
| 8624 | 8624 | |
| 8625 | 8625 | /** |
| 8626 | - * Counts all month |
|
| 8627 | - * |
|
| 8628 | - * @return Array the month list |
|
| 8629 | - * |
|
| 8630 | - */ |
|
| 8626 | + * Counts all month |
|
| 8627 | + * |
|
| 8628 | + * @return Array the month list |
|
| 8629 | + * |
|
| 8630 | + */ |
|
| 8631 | 8631 | public function countAllMonthsByAirlines($filters = array()) |
| 8632 | 8632 | { |
| 8633 | 8633 | global $globalTimezone, $globalDBdriver; |
@@ -8672,11 +8672,11 @@ discard block |
||
| 8672 | 8672 | } |
| 8673 | 8673 | |
| 8674 | 8674 | /** |
| 8675 | - * Counts all military month |
|
| 8676 | - * |
|
| 8677 | - * @return Array the month list |
|
| 8678 | - * |
|
| 8679 | - */ |
|
| 8675 | + * Counts all military month |
|
| 8676 | + * |
|
| 8677 | + * @return Array the month list |
|
| 8678 | + * |
|
| 8679 | + */ |
|
| 8680 | 8680 | public function countAllMilitaryMonths($filters = array()) |
| 8681 | 8681 | { |
| 8682 | 8682 | global $globalTimezone, $globalDBdriver; |
@@ -8717,11 +8717,11 @@ discard block |
||
| 8717 | 8717 | } |
| 8718 | 8718 | |
| 8719 | 8719 | /** |
| 8720 | - * Counts all month owners |
|
| 8721 | - * |
|
| 8722 | - * @return Array the month list |
|
| 8723 | - * |
|
| 8724 | - */ |
|
| 8720 | + * Counts all month owners |
|
| 8721 | + * |
|
| 8722 | + * @return Array the month list |
|
| 8723 | + * |
|
| 8724 | + */ |
|
| 8725 | 8725 | public function countAllMonthsOwners($filters = array()) |
| 8726 | 8726 | { |
| 8727 | 8727 | global $globalTimezone, $globalDBdriver; |
@@ -8763,11 +8763,11 @@ discard block |
||
| 8763 | 8763 | } |
| 8764 | 8764 | |
| 8765 | 8765 | /** |
| 8766 | - * Counts all month owners |
|
| 8767 | - * |
|
| 8768 | - * @return Array the month list |
|
| 8769 | - * |
|
| 8770 | - */ |
|
| 8766 | + * Counts all month owners |
|
| 8767 | + * |
|
| 8768 | + * @return Array the month list |
|
| 8769 | + * |
|
| 8770 | + */ |
|
| 8771 | 8771 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 8772 | 8772 | { |
| 8773 | 8773 | global $globalTimezone, $globalDBdriver; |
@@ -8810,11 +8810,11 @@ discard block |
||
| 8810 | 8810 | } |
| 8811 | 8811 | |
| 8812 | 8812 | /** |
| 8813 | - * Counts all month pilot |
|
| 8814 | - * |
|
| 8815 | - * @return Array the month list |
|
| 8816 | - * |
|
| 8817 | - */ |
|
| 8813 | + * Counts all month pilot |
|
| 8814 | + * |
|
| 8815 | + * @return Array the month list |
|
| 8816 | + * |
|
| 8817 | + */ |
|
| 8818 | 8818 | public function countAllMonthsPilots($filters = array()) |
| 8819 | 8819 | { |
| 8820 | 8820 | global $globalTimezone, $globalDBdriver; |
@@ -8856,11 +8856,11 @@ discard block |
||
| 8856 | 8856 | } |
| 8857 | 8857 | |
| 8858 | 8858 | /** |
| 8859 | - * Counts all month pilot |
|
| 8860 | - * |
|
| 8861 | - * @return Array the month list |
|
| 8862 | - * |
|
| 8863 | - */ |
|
| 8859 | + * Counts all month pilot |
|
| 8860 | + * |
|
| 8861 | + * @return Array the month list |
|
| 8862 | + * |
|
| 8863 | + */ |
|
| 8864 | 8864 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 8865 | 8865 | { |
| 8866 | 8866 | global $globalTimezone, $globalDBdriver; |
@@ -8903,11 +8903,11 @@ discard block |
||
| 8903 | 8903 | } |
| 8904 | 8904 | |
| 8905 | 8905 | /** |
| 8906 | - * Counts all month airline |
|
| 8907 | - * |
|
| 8908 | - * @return Array the month list |
|
| 8909 | - * |
|
| 8910 | - */ |
|
| 8906 | + * Counts all month airline |
|
| 8907 | + * |
|
| 8908 | + * @return Array the month list |
|
| 8909 | + * |
|
| 8910 | + */ |
|
| 8911 | 8911 | public function countAllMonthsAirlines($filters = array()) |
| 8912 | 8912 | { |
| 8913 | 8913 | global $globalTimezone, $globalDBdriver; |
@@ -8949,11 +8949,11 @@ discard block |
||
| 8949 | 8949 | } |
| 8950 | 8950 | |
| 8951 | 8951 | /** |
| 8952 | - * Counts all month aircraft |
|
| 8953 | - * |
|
| 8954 | - * @return Array the month list |
|
| 8955 | - * |
|
| 8956 | - */ |
|
| 8952 | + * Counts all month aircraft |
|
| 8953 | + * |
|
| 8954 | + * @return Array the month list |
|
| 8955 | + * |
|
| 8956 | + */ |
|
| 8957 | 8957 | public function countAllMonthsAircrafts($filters = array()) |
| 8958 | 8958 | { |
| 8959 | 8959 | global $globalTimezone, $globalDBdriver; |
@@ -8996,11 +8996,11 @@ discard block |
||
| 8996 | 8996 | |
| 8997 | 8997 | |
| 8998 | 8998 | /** |
| 8999 | - * Counts all month aircraft |
|
| 9000 | - * |
|
| 9001 | - * @return Array the month list |
|
| 9002 | - * |
|
| 9003 | - */ |
|
| 8999 | + * Counts all month aircraft |
|
| 9000 | + * |
|
| 9001 | + * @return Array the month list |
|
| 9002 | + * |
|
| 9003 | + */ |
|
| 9004 | 9004 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 9005 | 9005 | { |
| 9006 | 9006 | global $globalTimezone, $globalDBdriver; |
@@ -9043,11 +9043,11 @@ discard block |
||
| 9043 | 9043 | } |
| 9044 | 9044 | |
| 9045 | 9045 | /** |
| 9046 | - * Counts all month real arrival |
|
| 9047 | - * |
|
| 9048 | - * @return Array the month list |
|
| 9049 | - * |
|
| 9050 | - */ |
|
| 9046 | + * Counts all month real arrival |
|
| 9047 | + * |
|
| 9048 | + * @return Array the month list |
|
| 9049 | + * |
|
| 9050 | + */ |
|
| 9051 | 9051 | public function countAllMonthsRealArrivals($filters = array()) |
| 9052 | 9052 | { |
| 9053 | 9053 | global $globalTimezone, $globalDBdriver; |
@@ -9090,11 +9090,11 @@ discard block |
||
| 9090 | 9090 | |
| 9091 | 9091 | |
| 9092 | 9092 | /** |
| 9093 | - * Counts all month real arrival |
|
| 9094 | - * |
|
| 9095 | - * @return Array the month list |
|
| 9096 | - * |
|
| 9097 | - */ |
|
| 9093 | + * Counts all month real arrival |
|
| 9094 | + * |
|
| 9095 | + * @return Array the month list |
|
| 9096 | + * |
|
| 9097 | + */ |
|
| 9098 | 9098 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 9099 | 9099 | { |
| 9100 | 9100 | global $globalTimezone, $globalDBdriver; |
@@ -9138,11 +9138,11 @@ discard block |
||
| 9138 | 9138 | |
| 9139 | 9139 | |
| 9140 | 9140 | /** |
| 9141 | - * Counts all dates during the last year |
|
| 9142 | - * |
|
| 9143 | - * @return Array the date list |
|
| 9144 | - * |
|
| 9145 | - */ |
|
| 9141 | + * Counts all dates during the last year |
|
| 9142 | + * |
|
| 9143 | + * @return Array the date list |
|
| 9144 | + * |
|
| 9145 | + */ |
|
| 9146 | 9146 | public function countAllMonthsLastYear($filters) |
| 9147 | 9147 | { |
| 9148 | 9148 | global $globalTimezone, $globalDBdriver; |
@@ -9164,7 +9164,7 @@ discard block |
||
| 9164 | 9164 | $query .= " GROUP BY year_name, month_name |
| 9165 | 9165 | ORDER BY year_name, month_name ASC"; |
| 9166 | 9166 | $query_data = array(':offset' => $offset); |
| 9167 | - } |
|
| 9167 | + } |
|
| 9168 | 9168 | |
| 9169 | 9169 | $sth = $this->db->prepare($query); |
| 9170 | 9170 | $sth->execute($query_data); |
@@ -9187,11 +9187,11 @@ discard block |
||
| 9187 | 9187 | |
| 9188 | 9188 | |
| 9189 | 9189 | /** |
| 9190 | - * Counts all hours |
|
| 9191 | - * |
|
| 9192 | - * @return Array the hour list |
|
| 9193 | - * |
|
| 9194 | - */ |
|
| 9190 | + * Counts all hours |
|
| 9191 | + * |
|
| 9192 | + * @return Array the hour list |
|
| 9193 | + * |
|
| 9194 | + */ |
|
| 9195 | 9195 | public function countAllHours($orderby,$filters = array()) |
| 9196 | 9196 | { |
| 9197 | 9197 | global $globalTimezone, $globalDBdriver; |
@@ -9252,11 +9252,11 @@ discard block |
||
| 9252 | 9252 | } |
| 9253 | 9253 | |
| 9254 | 9254 | /** |
| 9255 | - * Counts all hours |
|
| 9256 | - * |
|
| 9257 | - * @return Array the hour list |
|
| 9258 | - * |
|
| 9259 | - */ |
|
| 9255 | + * Counts all hours |
|
| 9256 | + * |
|
| 9257 | + * @return Array the hour list |
|
| 9258 | + * |
|
| 9259 | + */ |
|
| 9260 | 9260 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 9261 | 9261 | { |
| 9262 | 9262 | global $globalTimezone, $globalDBdriver; |
@@ -9319,11 +9319,11 @@ discard block |
||
| 9319 | 9319 | |
| 9320 | 9320 | |
| 9321 | 9321 | /** |
| 9322 | - * Counts all hours by airline |
|
| 9323 | - * |
|
| 9324 | - * @return Array the hour list |
|
| 9325 | - * |
|
| 9326 | - */ |
|
| 9322 | + * Counts all hours by airline |
|
| 9323 | + * |
|
| 9324 | + * @return Array the hour list |
|
| 9325 | + * |
|
| 9326 | + */ |
|
| 9327 | 9327 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 9328 | 9328 | { |
| 9329 | 9329 | global $globalTimezone, $globalDBdriver; |
@@ -9369,11 +9369,11 @@ discard block |
||
| 9369 | 9369 | |
| 9370 | 9370 | |
| 9371 | 9371 | /** |
| 9372 | - * Counts all hours by aircraft |
|
| 9373 | - * |
|
| 9374 | - * @return Array the hour list |
|
| 9375 | - * |
|
| 9376 | - */ |
|
| 9372 | + * Counts all hours by aircraft |
|
| 9373 | + * |
|
| 9374 | + * @return Array the hour list |
|
| 9375 | + * |
|
| 9376 | + */ |
|
| 9377 | 9377 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 9378 | 9378 | { |
| 9379 | 9379 | global $globalTimezone, $globalDBdriver; |
@@ -9416,11 +9416,11 @@ discard block |
||
| 9416 | 9416 | |
| 9417 | 9417 | |
| 9418 | 9418 | /** |
| 9419 | - * Counts all hours by aircraft registration |
|
| 9420 | - * |
|
| 9421 | - * @return Array the hour list |
|
| 9422 | - * |
|
| 9423 | - */ |
|
| 9419 | + * Counts all hours by aircraft registration |
|
| 9420 | + * |
|
| 9421 | + * @return Array the hour list |
|
| 9422 | + * |
|
| 9423 | + */ |
|
| 9424 | 9424 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 9425 | 9425 | { |
| 9426 | 9426 | global $globalTimezone, $globalDBdriver; |
@@ -9463,11 +9463,11 @@ discard block |
||
| 9463 | 9463 | |
| 9464 | 9464 | |
| 9465 | 9465 | /** |
| 9466 | - * Counts all hours by airport |
|
| 9467 | - * |
|
| 9468 | - * @return Array the hour list |
|
| 9469 | - * |
|
| 9470 | - */ |
|
| 9466 | + * Counts all hours by airport |
|
| 9467 | + * |
|
| 9468 | + * @return Array the hour list |
|
| 9469 | + * |
|
| 9470 | + */ |
|
| 9471 | 9471 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 9472 | 9472 | { |
| 9473 | 9473 | global $globalTimezone, $globalDBdriver; |
@@ -9511,11 +9511,11 @@ discard block |
||
| 9511 | 9511 | |
| 9512 | 9512 | |
| 9513 | 9513 | /** |
| 9514 | - * Counts all hours by manufacturer |
|
| 9515 | - * |
|
| 9516 | - * @return Array the hour list |
|
| 9517 | - * |
|
| 9518 | - */ |
|
| 9514 | + * Counts all hours by manufacturer |
|
| 9515 | + * |
|
| 9516 | + * @return Array the hour list |
|
| 9517 | + * |
|
| 9518 | + */ |
|
| 9519 | 9519 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
| 9520 | 9520 | { |
| 9521 | 9521 | global $globalTimezone, $globalDBdriver; |
@@ -9559,11 +9559,11 @@ discard block |
||
| 9559 | 9559 | |
| 9560 | 9560 | |
| 9561 | 9561 | /** |
| 9562 | - * Counts all hours by date |
|
| 9563 | - * |
|
| 9564 | - * @return Array the hour list |
|
| 9565 | - * |
|
| 9566 | - */ |
|
| 9562 | + * Counts all hours by date |
|
| 9563 | + * |
|
| 9564 | + * @return Array the hour list |
|
| 9565 | + * |
|
| 9566 | + */ |
|
| 9567 | 9567 | public function countAllHoursByDate($date, $filters = array()) |
| 9568 | 9568 | { |
| 9569 | 9569 | global $globalTimezone, $globalDBdriver; |
@@ -9607,11 +9607,11 @@ discard block |
||
| 9607 | 9607 | |
| 9608 | 9608 | |
| 9609 | 9609 | /** |
| 9610 | - * Counts all hours by a ident/callsign |
|
| 9611 | - * |
|
| 9612 | - * @return Array the hour list |
|
| 9613 | - * |
|
| 9614 | - */ |
|
| 9610 | + * Counts all hours by a ident/callsign |
|
| 9611 | + * |
|
| 9612 | + * @return Array the hour list |
|
| 9613 | + * |
|
| 9614 | + */ |
|
| 9615 | 9615 | public function countAllHoursByIdent($ident, $filters = array()) |
| 9616 | 9616 | { |
| 9617 | 9617 | global $globalTimezone, $globalDBdriver; |
@@ -9656,11 +9656,11 @@ discard block |
||
| 9656 | 9656 | |
| 9657 | 9657 | |
| 9658 | 9658 | /** |
| 9659 | - * Counts all hours by route |
|
| 9660 | - * |
|
| 9661 | - * @return Array the hour list |
|
| 9662 | - * |
|
| 9663 | - */ |
|
| 9659 | + * Counts all hours by route |
|
| 9660 | + * |
|
| 9661 | + * @return Array the hour list |
|
| 9662 | + * |
|
| 9663 | + */ |
|
| 9664 | 9664 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
| 9665 | 9665 | { |
| 9666 | 9666 | global $globalTimezone, $globalDBdriver; |
@@ -9704,11 +9704,11 @@ discard block |
||
| 9704 | 9704 | |
| 9705 | 9705 | |
| 9706 | 9706 | /** |
| 9707 | - * Counts all hours by country |
|
| 9708 | - * |
|
| 9709 | - * @return Array the hour list |
|
| 9710 | - * |
|
| 9711 | - */ |
|
| 9707 | + * Counts all hours by country |
|
| 9708 | + * |
|
| 9709 | + * @return Array the hour list |
|
| 9710 | + * |
|
| 9711 | + */ |
|
| 9712 | 9712 | public function countAllHoursByCountry($country, $filters = array()) |
| 9713 | 9713 | { |
| 9714 | 9714 | global $globalTimezone, $globalDBdriver; |
@@ -9753,11 +9753,11 @@ discard block |
||
| 9753 | 9753 | |
| 9754 | 9754 | |
| 9755 | 9755 | /** |
| 9756 | - * Counts all aircraft that have flown over |
|
| 9757 | - * |
|
| 9758 | - * @return Integer the number of aircrafts |
|
| 9759 | - * |
|
| 9760 | - */ |
|
| 9756 | + * Counts all aircraft that have flown over |
|
| 9757 | + * |
|
| 9758 | + * @return Integer the number of aircrafts |
|
| 9759 | + * |
|
| 9760 | + */ |
|
| 9761 | 9761 | public function countOverallAircrafts($filters = array(),$year = '',$month = '') |
| 9762 | 9762 | { |
| 9763 | 9763 | global $globalDBdriver; |
@@ -9790,11 +9790,11 @@ discard block |
||
| 9790 | 9790 | } |
| 9791 | 9791 | |
| 9792 | 9792 | /** |
| 9793 | - * Counts all flight that really arrival |
|
| 9794 | - * |
|
| 9795 | - * @return Integer the number of aircrafts |
|
| 9796 | - * |
|
| 9797 | - */ |
|
| 9793 | + * Counts all flight that really arrival |
|
| 9794 | + * |
|
| 9795 | + * @return Integer the number of aircrafts |
|
| 9796 | + * |
|
| 9797 | + */ |
|
| 9798 | 9798 | public function countOverallArrival($filters = array(),$year = '',$month = '') |
| 9799 | 9799 | { |
| 9800 | 9800 | global $globalDBdriver; |
@@ -9827,11 +9827,11 @@ discard block |
||
| 9827 | 9827 | } |
| 9828 | 9828 | |
| 9829 | 9829 | /** |
| 9830 | - * Counts all pilots that have flown over |
|
| 9831 | - * |
|
| 9832 | - * @return Integer the number of pilots |
|
| 9833 | - * |
|
| 9834 | - */ |
|
| 9830 | + * Counts all pilots that have flown over |
|
| 9831 | + * |
|
| 9832 | + * @return Integer the number of pilots |
|
| 9833 | + * |
|
| 9834 | + */ |
|
| 9835 | 9835 | public function countOverallPilots($filters = array(),$year = '',$month = '') |
| 9836 | 9836 | { |
| 9837 | 9837 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9862,11 +9862,11 @@ discard block |
||
| 9862 | 9862 | } |
| 9863 | 9863 | |
| 9864 | 9864 | /** |
| 9865 | - * Counts all owners that have flown over |
|
| 9866 | - * |
|
| 9867 | - * @return Integer the number of owners |
|
| 9868 | - * |
|
| 9869 | - */ |
|
| 9865 | + * Counts all owners that have flown over |
|
| 9866 | + * |
|
| 9867 | + * @return Integer the number of owners |
|
| 9868 | + * |
|
| 9869 | + */ |
|
| 9870 | 9870 | public function countOverallOwners($filters = array(),$year = '',$month = '') |
| 9871 | 9871 | { |
| 9872 | 9872 | global $globalDBdriver; |
@@ -9899,11 +9899,11 @@ discard block |
||
| 9899 | 9899 | |
| 9900 | 9900 | |
| 9901 | 9901 | /** |
| 9902 | - * Counts all flights that have flown over |
|
| 9903 | - * |
|
| 9904 | - * @return Integer the number of flights |
|
| 9905 | - * |
|
| 9906 | - */ |
|
| 9902 | + * Counts all flights that have flown over |
|
| 9903 | + * |
|
| 9904 | + * @return Integer the number of flights |
|
| 9905 | + * |
|
| 9906 | + */ |
|
| 9907 | 9907 | public function countOverallFlights($filters = array(),$year = '',$month = '') |
| 9908 | 9908 | { |
| 9909 | 9909 | global $globalDBdriver; |
@@ -9938,11 +9938,11 @@ discard block |
||
| 9938 | 9938 | } |
| 9939 | 9939 | |
| 9940 | 9940 | /** |
| 9941 | - * Counts all military flights that have flown over |
|
| 9942 | - * |
|
| 9943 | - * @return Integer the number of flights |
|
| 9944 | - * |
|
| 9945 | - */ |
|
| 9941 | + * Counts all military flights that have flown over |
|
| 9942 | + * |
|
| 9943 | + * @return Integer the number of flights |
|
| 9944 | + * |
|
| 9945 | + */ |
|
| 9946 | 9946 | public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '') |
| 9947 | 9947 | { |
| 9948 | 9948 | global $globalDBdriver; |
@@ -9977,11 +9977,11 @@ discard block |
||
| 9977 | 9977 | |
| 9978 | 9978 | |
| 9979 | 9979 | /** |
| 9980 | - * Counts all airlines that have flown over |
|
| 9981 | - * |
|
| 9982 | - * @return Integer the number of airlines |
|
| 9983 | - * |
|
| 9984 | - */ |
|
| 9980 | + * Counts all airlines that have flown over |
|
| 9981 | + * |
|
| 9982 | + * @return Integer the number of airlines |
|
| 9983 | + * |
|
| 9984 | + */ |
|
| 9985 | 9985 | public function countOverallAirlines($filters = array(),$year = '',$month = '') |
| 9986 | 9986 | { |
| 9987 | 9987 | global $globalDBdriver; |
@@ -10008,8 +10008,8 @@ discard block |
||
| 10008 | 10008 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 10009 | 10009 | } |
| 10010 | 10010 | } |
| 10011 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 10012 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10011 | + if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 10012 | + else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10013 | 10013 | |
| 10014 | 10014 | |
| 10015 | 10015 | $sth = $this->db->prepare($queryi); |
@@ -10019,11 +10019,11 @@ discard block |
||
| 10019 | 10019 | |
| 10020 | 10020 | |
| 10021 | 10021 | /** |
| 10022 | - * Counts all hours of today |
|
| 10023 | - * |
|
| 10024 | - * @return Array the hour list |
|
| 10025 | - * |
|
| 10026 | - */ |
|
| 10022 | + * Counts all hours of today |
|
| 10023 | + * |
|
| 10024 | + * @return Array the hour list |
|
| 10025 | + * |
|
| 10026 | + */ |
|
| 10027 | 10027 | public function countAllHoursFromToday($filters = array()) |
| 10028 | 10028 | { |
| 10029 | 10029 | global $globalTimezone, $globalDBdriver; |
@@ -10063,11 +10063,11 @@ discard block |
||
| 10063 | 10063 | } |
| 10064 | 10064 | |
| 10065 | 10065 | /** |
| 10066 | - * Gets all the spotter information based on calculated upcoming flights |
|
| 10067 | - * |
|
| 10068 | - * @return Array the spotter information |
|
| 10069 | - * |
|
| 10070 | - */ |
|
| 10066 | + * Gets all the spotter information based on calculated upcoming flights |
|
| 10067 | + * |
|
| 10068 | + * @return Array the spotter information |
|
| 10069 | + * |
|
| 10070 | + */ |
|
| 10071 | 10071 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 10072 | 10072 | { |
| 10073 | 10073 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -10142,12 +10142,12 @@ discard block |
||
| 10142 | 10142 | } |
| 10143 | 10143 | |
| 10144 | 10144 | |
| 10145 | - /** |
|
| 10146 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 10147 | - * |
|
| 10148 | - * @return Integer the Barrie Spotter ID |
|
| 10145 | + /** |
|
| 10146 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 10147 | + * |
|
| 10148 | + * @return Integer the Barrie Spotter ID |
|
| 10149 | 10149 | q * |
| 10150 | - */ |
|
| 10150 | + */ |
|
| 10151 | 10151 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 10152 | 10152 | { |
| 10153 | 10153 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -10168,13 +10168,13 @@ discard block |
||
| 10168 | 10168 | |
| 10169 | 10169 | |
| 10170 | 10170 | /** |
| 10171 | - * Parses a date string |
|
| 10172 | - * |
|
| 10173 | - * @param String $dateString the date string |
|
| 10174 | - * @param String $timezone the timezone of a user |
|
| 10175 | - * @return Array the time information |
|
| 10176 | - * |
|
| 10177 | - */ |
|
| 10171 | + * Parses a date string |
|
| 10172 | + * |
|
| 10173 | + * @param String $dateString the date string |
|
| 10174 | + * @param String $timezone the timezone of a user |
|
| 10175 | + * @return Array the time information |
|
| 10176 | + * |
|
| 10177 | + */ |
|
| 10178 | 10178 | public function parseDateString($dateString, $timezone = '') |
| 10179 | 10179 | { |
| 10180 | 10180 | $time_array = array(); |
@@ -10210,12 +10210,12 @@ discard block |
||
| 10210 | 10210 | |
| 10211 | 10211 | |
| 10212 | 10212 | /** |
| 10213 | - * Parses the direction degrees to working |
|
| 10214 | - * |
|
| 10215 | - * @param Float $direction the direction in degrees |
|
| 10216 | - * @return Array the direction information |
|
| 10217 | - * |
|
| 10218 | - */ |
|
| 10213 | + * Parses the direction degrees to working |
|
| 10214 | + * |
|
| 10215 | + * @param Float $direction the direction in degrees |
|
| 10216 | + * @return Array the direction information |
|
| 10217 | + * |
|
| 10218 | + */ |
|
| 10219 | 10219 | public function parseDirection($direction = 0) |
| 10220 | 10220 | { |
| 10221 | 10221 | if ($direction == '') $direction = 0; |
@@ -10294,12 +10294,12 @@ discard block |
||
| 10294 | 10294 | |
| 10295 | 10295 | |
| 10296 | 10296 | /** |
| 10297 | - * Gets the aircraft registration |
|
| 10298 | - * |
|
| 10299 | - * @param String $flightaware_id the flight aware id |
|
| 10300 | - * @return String the aircraft registration |
|
| 10301 | - * |
|
| 10302 | - */ |
|
| 10297 | + * Gets the aircraft registration |
|
| 10298 | + * |
|
| 10299 | + * @param String $flightaware_id the flight aware id |
|
| 10300 | + * @return String the aircraft registration |
|
| 10301 | + * |
|
| 10302 | + */ |
|
| 10303 | 10303 | |
| 10304 | 10304 | public function getAircraftRegistration($flightaware_id) |
| 10305 | 10305 | { |
@@ -10328,12 +10328,12 @@ discard block |
||
| 10328 | 10328 | |
| 10329 | 10329 | |
| 10330 | 10330 | /** |
| 10331 | - * Gets the aircraft registration from ModeS |
|
| 10332 | - * |
|
| 10333 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 10334 | - * @return String the aircraft registration |
|
| 10335 | - * |
|
| 10336 | - */ |
|
| 10331 | + * Gets the aircraft registration from ModeS |
|
| 10332 | + * |
|
| 10333 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 10334 | + * @return String the aircraft registration |
|
| 10335 | + * |
|
| 10336 | + */ |
|
| 10337 | 10337 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 10338 | 10338 | { |
| 10339 | 10339 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -10346,19 +10346,19 @@ discard block |
||
| 10346 | 10346 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 10347 | 10347 | $sth->closeCursor(); |
| 10348 | 10348 | if (count($row) > 0) { |
| 10349 | - //return $row['Registration']; |
|
| 10350 | - return $row['registration']; |
|
| 10349 | + //return $row['Registration']; |
|
| 10350 | + return $row['registration']; |
|
| 10351 | 10351 | } else return ''; |
| 10352 | 10352 | |
| 10353 | 10353 | } |
| 10354 | 10354 | |
| 10355 | 10355 | /** |
| 10356 | - * Gets the aircraft type from ModeS |
|
| 10357 | - * |
|
| 10358 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 10359 | - * @return String the aircraft type |
|
| 10360 | - * |
|
| 10361 | - */ |
|
| 10356 | + * Gets the aircraft type from ModeS |
|
| 10357 | + * |
|
| 10358 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 10359 | + * @return String the aircraft type |
|
| 10360 | + * |
|
| 10361 | + */ |
|
| 10362 | 10362 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 10363 | 10363 | { |
| 10364 | 10364 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -10371,19 +10371,19 @@ discard block |
||
| 10371 | 10371 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 10372 | 10372 | $sth->closeCursor(); |
| 10373 | 10373 | if (count($row) > 0) { |
| 10374 | - if ($row['type_flight'] == null) return ''; |
|
| 10375 | - else return $row['type_flight']; |
|
| 10374 | + if ($row['type_flight'] == null) return ''; |
|
| 10375 | + else return $row['type_flight']; |
|
| 10376 | 10376 | } else return ''; |
| 10377 | 10377 | |
| 10378 | 10378 | } |
| 10379 | 10379 | |
| 10380 | 10380 | /** |
| 10381 | - * Gets Country from latitude/longitude |
|
| 10382 | - * |
|
| 10383 | - * @param Float $latitude latitute of the flight |
|
| 10384 | - * @param Float $longitude longitute of the flight |
|
| 10385 | - * @return String the countrie |
|
| 10386 | - */ |
|
| 10381 | + * Gets Country from latitude/longitude |
|
| 10382 | + * |
|
| 10383 | + * @param Float $latitude latitute of the flight |
|
| 10384 | + * @param Float $longitude longitute of the flight |
|
| 10385 | + * @return String the countrie |
|
| 10386 | + */ |
|
| 10387 | 10387 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 10388 | 10388 | { |
| 10389 | 10389 | global $globalDBdriver, $globalDebug; |
@@ -10420,11 +10420,11 @@ discard block |
||
| 10420 | 10420 | } |
| 10421 | 10421 | |
| 10422 | 10422 | /** |
| 10423 | - * Gets Country from iso2 |
|
| 10424 | - * |
|
| 10425 | - * @param String $iso2 ISO2 country code |
|
| 10426 | - * @return String the countrie |
|
| 10427 | - */ |
|
| 10423 | + * Gets Country from iso2 |
|
| 10424 | + * |
|
| 10425 | + * @param String $iso2 ISO2 country code |
|
| 10426 | + * @return String the countrie |
|
| 10427 | + */ |
|
| 10428 | 10428 | public function getCountryFromISO2($iso2) |
| 10429 | 10429 | { |
| 10430 | 10430 | global $globalDBdriver, $globalDebug; |
@@ -10452,12 +10452,12 @@ discard block |
||
| 10452 | 10452 | } |
| 10453 | 10453 | |
| 10454 | 10454 | /** |
| 10455 | - * converts the registration code using the country prefix |
|
| 10456 | - * |
|
| 10457 | - * @param String $registration the aircraft registration |
|
| 10458 | - * @return String the aircraft registration |
|
| 10459 | - * |
|
| 10460 | - */ |
|
| 10455 | + * converts the registration code using the country prefix |
|
| 10456 | + * |
|
| 10457 | + * @param String $registration the aircraft registration |
|
| 10458 | + * @return String the aircraft registration |
|
| 10459 | + * |
|
| 10460 | + */ |
|
| 10461 | 10461 | public function convertAircraftRegistration($registration) |
| 10462 | 10462 | { |
| 10463 | 10463 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -10509,12 +10509,12 @@ discard block |
||
| 10509 | 10509 | } |
| 10510 | 10510 | |
| 10511 | 10511 | /** |
| 10512 | - * Country from the registration code |
|
| 10513 | - * |
|
| 10514 | - * @param String $registration the aircraft registration |
|
| 10515 | - * @return String the country |
|
| 10516 | - * |
|
| 10517 | - */ |
|
| 10512 | + * Country from the registration code |
|
| 10513 | + * |
|
| 10514 | + * @param String $registration the aircraft registration |
|
| 10515 | + * @return String the country |
|
| 10516 | + * |
|
| 10517 | + */ |
|
| 10518 | 10518 | public function countryFromAircraftRegistration($registration) |
| 10519 | 10519 | { |
| 10520 | 10520 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -10533,8 +10533,8 @@ discard block |
||
| 10533 | 10533 | $country = $row['country']; |
| 10534 | 10534 | } |
| 10535 | 10535 | } else { |
| 10536 | - $registration_1 = substr($registration, 0, 1); |
|
| 10537 | - $registration_2 = substr($registration, 0, 2); |
|
| 10536 | + $registration_1 = substr($registration, 0, 1); |
|
| 10537 | + $registration_2 = substr($registration, 0, 2); |
|
| 10538 | 10538 | |
| 10539 | 10539 | $country = ''; |
| 10540 | 10540 | //first get the prefix based on two characters |
@@ -10570,12 +10570,12 @@ discard block |
||
| 10570 | 10570 | } |
| 10571 | 10571 | |
| 10572 | 10572 | /** |
| 10573 | - * Registration prefix from the registration code |
|
| 10574 | - * |
|
| 10575 | - * @param String $registration the aircraft registration |
|
| 10576 | - * @return String the registration prefix |
|
| 10577 | - * |
|
| 10578 | - */ |
|
| 10573 | + * Registration prefix from the registration code |
|
| 10574 | + * |
|
| 10575 | + * @param String $registration the aircraft registration |
|
| 10576 | + * @return String the registration prefix |
|
| 10577 | + * |
|
| 10578 | + */ |
|
| 10579 | 10579 | public function registrationPrefixFromAircraftRegistration($registration) |
| 10580 | 10580 | { |
| 10581 | 10581 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -10594,8 +10594,8 @@ discard block |
||
| 10594 | 10594 | //$country = $row['country']; |
| 10595 | 10595 | } |
| 10596 | 10596 | } else { |
| 10597 | - $registration_1 = substr($registration, 0, 1); |
|
| 10598 | - $registration_2 = substr($registration, 0, 2); |
|
| 10597 | + $registration_1 = substr($registration, 0, 1); |
|
| 10598 | + $registration_2 = substr($registration, 0, 2); |
|
| 10599 | 10599 | |
| 10600 | 10600 | //first get the prefix based on two characters |
| 10601 | 10601 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
@@ -10631,12 +10631,12 @@ discard block |
||
| 10631 | 10631 | |
| 10632 | 10632 | |
| 10633 | 10633 | /** |
| 10634 | - * Country from the registration code |
|
| 10635 | - * |
|
| 10636 | - * @param String $registration the aircraft registration |
|
| 10637 | - * @return String the country |
|
| 10638 | - * |
|
| 10639 | - */ |
|
| 10634 | + * Country from the registration code |
|
| 10635 | + * |
|
| 10636 | + * @param String $registration the aircraft registration |
|
| 10637 | + * @return String the country |
|
| 10638 | + * |
|
| 10639 | + */ |
|
| 10640 | 10640 | public function countryFromAircraftRegistrationCode($registration) |
| 10641 | 10641 | { |
| 10642 | 10642 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -10653,11 +10653,11 @@ discard block |
||
| 10653 | 10653 | } |
| 10654 | 10654 | |
| 10655 | 10655 | /** |
| 10656 | - * Set a new highlight value for a flight |
|
| 10657 | - * |
|
| 10658 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 10659 | - * @param String $highlight New highlight value |
|
| 10660 | - */ |
|
| 10656 | + * Set a new highlight value for a flight |
|
| 10657 | + * |
|
| 10658 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 10659 | + * @param String $highlight New highlight value |
|
| 10660 | + */ |
|
| 10661 | 10661 | public function setHighlightFlight($flightaware_id,$highlight) { |
| 10662 | 10662 | |
| 10663 | 10663 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -10666,12 +10666,12 @@ discard block |
||
| 10666 | 10666 | } |
| 10667 | 10667 | |
| 10668 | 10668 | /** |
| 10669 | - * Set a new highlight value for a flight by Registration |
|
| 10670 | - * |
|
| 10671 | - * @param String $registration Registration of the aircraft |
|
| 10672 | - * @param String $date Date of spotted aircraft |
|
| 10673 | - * @param String $highlight New highlight value |
|
| 10674 | - */ |
|
| 10669 | + * Set a new highlight value for a flight by Registration |
|
| 10670 | + * |
|
| 10671 | + * @param String $registration Registration of the aircraft |
|
| 10672 | + * @param String $date Date of spotted aircraft |
|
| 10673 | + * @param String $highlight New highlight value |
|
| 10674 | + */ |
|
| 10675 | 10675 | public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
| 10676 | 10676 | if ($date == '') { |
| 10677 | 10677 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
@@ -10685,12 +10685,12 @@ discard block |
||
| 10685 | 10685 | } |
| 10686 | 10686 | |
| 10687 | 10687 | /** |
| 10688 | - * Gets the short url from bit.ly |
|
| 10689 | - * |
|
| 10690 | - * @param String $url the full url |
|
| 10691 | - * @return String the bit.ly url |
|
| 10692 | - * |
|
| 10693 | - */ |
|
| 10688 | + * Gets the short url from bit.ly |
|
| 10689 | + * |
|
| 10690 | + * @param String $url the full url |
|
| 10691 | + * @return String the bit.ly url |
|
| 10692 | + * |
|
| 10693 | + */ |
|
| 10694 | 10694 | public function getBitlyURL($url) |
| 10695 | 10695 | { |
| 10696 | 10696 | global $globalBitlyAccessToken; |
@@ -10979,11 +10979,11 @@ discard block |
||
| 10979 | 10979 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 10980 | 10980 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10981 | 10981 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10982 | - } else { |
|
| 10982 | + } else { |
|
| 10983 | 10983 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
| 10984 | 10984 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10985 | 10985 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10986 | - } |
|
| 10986 | + } |
|
| 10987 | 10987 | $sth = $this->db->prepare($query); |
| 10988 | 10988 | $sth->execute(); |
| 10989 | 10989 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -8,13 +8,13 @@ |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | - unset($_COOKIE['stats_airline_icao']); |
|
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | - $airline_icao = ''; |
|
| 11 | + unset($_COOKIE['stats_airline_icao']); |
|
| 12 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | + $airline_icao = ''; |
|
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | 18 | } |
| 19 | 19 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 20 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
@@ -8,13 +8,13 @@ |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | - unset($_COOKIE['stats_airline_icao']); |
|
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | - $airline_icao = ''; |
|
| 11 | + unset($_COOKIE['stats_airline_icao']); |
|
| 12 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | + $airline_icao = ''; |
|
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | 18 | } |
| 19 | 19 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 20 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
@@ -8,13 +8,13 @@ |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | - unset($_COOKIE['stats_airline_icao']); |
|
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | - $airline_icao = ''; |
|
| 11 | + unset($_COOKIE['stats_airline_icao']); |
|
| 12 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | + $airline_icao = ''; |
|
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | 18 | } |
| 19 | 19 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 20 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
@@ -8,13 +8,13 @@ |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | - unset($_COOKIE['stats_airline_icao']); |
|
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | - $airline_icao = ''; |
|
| 11 | + unset($_COOKIE['stats_airline_icao']); |
|
| 12 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | + $airline_icao = ''; |
|
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | 18 | } |
| 19 | 19 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 20 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |