@@ -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 |
@@ -83,161 +83,161 @@ discard block |
||
83 | 83 | $aprs_full = false; |
84 | 84 | |
85 | 85 | function create_socket($host, $port, &$errno, &$errstr) { |
86 | - $ip = gethostbyname($host); |
|
87 | - $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
88 | - $r = @socket_connect($s, $ip, $port); |
|
89 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
90 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
91 | - return $s; |
|
92 | - } |
|
93 | - $errno = socket_last_error($s); |
|
94 | - $errstr = socket_strerror($errno); |
|
95 | - socket_close($s); |
|
96 | - return false; |
|
86 | + $ip = gethostbyname($host); |
|
87 | + $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
88 | + $r = @socket_connect($s, $ip, $port); |
|
89 | + if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
90 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
91 | + return $s; |
|
92 | + } |
|
93 | + $errno = socket_last_error($s); |
|
94 | + $errstr = socket_strerror($errno); |
|
95 | + socket_close($s); |
|
96 | + return false; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | function create_socket_udp($host, $port, &$errno, &$errstr) { |
100 | - echo "UDP !!"; |
|
101 | - $ip = gethostbyname($host); |
|
102 | - $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
103 | - $r = @socket_bind($s, $ip, $port); |
|
104 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
105 | - return $s; |
|
106 | - } |
|
107 | - $errno = socket_last_error($s); |
|
108 | - $errstr = socket_strerror($errno); |
|
109 | - socket_close($s); |
|
110 | - return false; |
|
100 | + echo "UDP !!"; |
|
101 | + $ip = gethostbyname($host); |
|
102 | + $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
103 | + $r = @socket_bind($s, $ip, $port); |
|
104 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
105 | + return $s; |
|
106 | + } |
|
107 | + $errno = socket_last_error($s); |
|
108 | + $errstr = socket_strerror($errno); |
|
109 | + socket_close($s); |
|
110 | + return false; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | function connect_all($hosts) { |
114 | - //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
115 | - global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
116 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
117 | - foreach ($hosts as $id => $value) { |
|
114 | + //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
115 | + global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
116 | + if ($globalDebug) echo 'Connect to all...'."\n"; |
|
117 | + foreach ($hosts as $id => $value) { |
|
118 | 118 | $host = $value['host']; |
119 | 119 | $globalSources[$id]['last_exec'] = 0; |
120 | 120 | // Here we check type of source(s) |
121 | 121 | if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
122 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
123 | - //$formats[$id] = 'deltadbtxt'; |
|
124 | - $globalSources[$id]['format'] = 'deltadbtxt'; |
|
125 | - //$last_exec['deltadbtxt'] = 0; |
|
126 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
127 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
128 | - //$formats[$id] = 'vatsimtxt'; |
|
129 | - $globalSources[$id]['format'] = 'vatsimtxt'; |
|
130 | - //$last_exec['vatsimtxt'] = 0; |
|
131 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
132 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
133 | - //$formats[$id] = 'aircraftlistjson'; |
|
134 | - $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
135 | - //$last_exec['aircraftlistjson'] = 0; |
|
136 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
137 | - } else if (preg_match('/opensky/i',$host)) { |
|
138 | - //$formats[$id] = 'aircraftlistjson'; |
|
139 | - $globalSources[$id]['format'] = 'opensky'; |
|
140 | - //$last_exec['aircraftlistjson'] = 0; |
|
141 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
142 | - } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
143 | - //$formats[$id] = 'radarvirtueljson'; |
|
144 | - $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
145 | - //$last_exec['radarvirtueljson'] = 0; |
|
146 | - if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
147 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
148 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
149 | - exit(0); |
|
150 | - } |
|
151 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
152 | - //$formats[$id] = 'planeupdatefaa'; |
|
153 | - $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
154 | - //$last_exec['planeupdatefaa'] = 0; |
|
155 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
156 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
157 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
158 | - exit(0); |
|
159 | - } |
|
160 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
161 | - //$formats[$id] = 'phpvmacars'; |
|
162 | - $globalSources[$id]['format'] = 'phpvmacars'; |
|
163 | - //$last_exec['phpvmacars'] = 0; |
|
164 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
165 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
166 | - //$formats[$id] = 'phpvmacars'; |
|
167 | - $globalSources[$id]['format'] = 'vam'; |
|
168 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
169 | - } else if (preg_match('/whazzup/i',$host)) { |
|
170 | - //$formats[$id] = 'whazzup'; |
|
171 | - $globalSources[$id]['format'] = 'whazzup'; |
|
172 | - //$last_exec['whazzup'] = 0; |
|
173 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
174 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
175 | - //$formats[$id] = 'pirepsjson'; |
|
176 | - $globalSources[$id]['format'] = 'pirepsjson'; |
|
177 | - //$last_exec['pirepsjson'] = 0; |
|
178 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
179 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
180 | - //$formats[$id] = 'fr24json'; |
|
181 | - $globalSources[$id]['format'] = 'fr24json'; |
|
182 | - //$last_exec['fr24json'] = 0; |
|
183 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
184 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
185 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
186 | - exit(0); |
|
187 | - } |
|
188 | - //} else if (preg_match('/10001/',$host)) { |
|
189 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
190 | - //$formats[$id] = 'tsv'; |
|
191 | - $globalSources[$id]['format'] = 'tsv'; |
|
192 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
193 | - } |
|
194 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
195 | - if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
196 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
197 | - $hostport = explode(':',$host); |
|
198 | - if (isset($hostport[1])) { |
|
122 | + if (preg_match('/deltadb.txt$/i',$host)) { |
|
123 | + //$formats[$id] = 'deltadbtxt'; |
|
124 | + $globalSources[$id]['format'] = 'deltadbtxt'; |
|
125 | + //$last_exec['deltadbtxt'] = 0; |
|
126 | + if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
127 | + } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
128 | + //$formats[$id] = 'vatsimtxt'; |
|
129 | + $globalSources[$id]['format'] = 'vatsimtxt'; |
|
130 | + //$last_exec['vatsimtxt'] = 0; |
|
131 | + if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
132 | + } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
133 | + //$formats[$id] = 'aircraftlistjson'; |
|
134 | + $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
135 | + //$last_exec['aircraftlistjson'] = 0; |
|
136 | + if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
137 | + } else if (preg_match('/opensky/i',$host)) { |
|
138 | + //$formats[$id] = 'aircraftlistjson'; |
|
139 | + $globalSources[$id]['format'] = 'opensky'; |
|
140 | + //$last_exec['aircraftlistjson'] = 0; |
|
141 | + if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
142 | + } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
143 | + //$formats[$id] = 'radarvirtueljson'; |
|
144 | + $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
145 | + //$last_exec['radarvirtueljson'] = 0; |
|
146 | + if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
147 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
148 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
149 | + exit(0); |
|
150 | + } |
|
151 | + } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
152 | + //$formats[$id] = 'planeupdatefaa'; |
|
153 | + $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
154 | + //$last_exec['planeupdatefaa'] = 0; |
|
155 | + if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
156 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
157 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
158 | + exit(0); |
|
159 | + } |
|
160 | + } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
161 | + //$formats[$id] = 'phpvmacars'; |
|
162 | + $globalSources[$id]['format'] = 'phpvmacars'; |
|
163 | + //$last_exec['phpvmacars'] = 0; |
|
164 | + if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
165 | + } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
166 | + //$formats[$id] = 'phpvmacars'; |
|
167 | + $globalSources[$id]['format'] = 'vam'; |
|
168 | + if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
169 | + } else if (preg_match('/whazzup/i',$host)) { |
|
170 | + //$formats[$id] = 'whazzup'; |
|
171 | + $globalSources[$id]['format'] = 'whazzup'; |
|
172 | + //$last_exec['whazzup'] = 0; |
|
173 | + if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
174 | + } else if (preg_match('/recentpireps/i',$host)) { |
|
175 | + //$formats[$id] = 'pirepsjson'; |
|
176 | + $globalSources[$id]['format'] = 'pirepsjson'; |
|
177 | + //$last_exec['pirepsjson'] = 0; |
|
178 | + if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
179 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
180 | + //$formats[$id] = 'fr24json'; |
|
181 | + $globalSources[$id]['format'] = 'fr24json'; |
|
182 | + //$last_exec['fr24json'] = 0; |
|
183 | + if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
184 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
185 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
186 | + exit(0); |
|
187 | + } |
|
188 | + //} else if (preg_match('/10001/',$host)) { |
|
189 | + } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
190 | + //$formats[$id] = 'tsv'; |
|
191 | + $globalSources[$id]['format'] = 'tsv'; |
|
192 | + if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
193 | + } |
|
194 | + } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
195 | + if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
196 | + } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
197 | + $hostport = explode(':',$host); |
|
198 | + if (isset($hostport[1])) { |
|
199 | 199 | $port = $hostport[1]; |
200 | 200 | $hostn = $hostport[0]; |
201 | - } else { |
|
201 | + } else { |
|
202 | 202 | $port = $globalSources[$id]['port']; |
203 | 203 | $hostn = $globalSources[$id]['host']; |
204 | - } |
|
205 | - if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
206 | - $s = create_socket($hostn,$port, $errno, $errstr); |
|
207 | - } else { |
|
208 | - $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
209 | - } |
|
210 | - if ($s) { |
|
211 | - $sockets[$id] = $s; |
|
212 | - if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
213 | - if (preg_match('/aprs/',$hostn)) { |
|
204 | + } |
|
205 | + if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
206 | + $s = create_socket($hostn,$port, $errno, $errstr); |
|
207 | + } else { |
|
208 | + $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
209 | + } |
|
210 | + if ($s) { |
|
211 | + $sockets[$id] = $s; |
|
212 | + if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
213 | + if (preg_match('/aprs/',$hostn)) { |
|
214 | 214 | //$formats[$id] = 'aprs'; |
215 | 215 | $globalSources[$id]['format'] = 'aprs'; |
216 | 216 | //$aprs_connect = 0; |
217 | 217 | //$use_aprs = true; |
218 | - } elseif ($port == '10001') { |
|
219 | - //$formats[$id] = 'tsv'; |
|
220 | - $globalSources[$id]['format'] = 'tsv'; |
|
221 | - } elseif ($port == '30002') { |
|
222 | - //$formats[$id] = 'raw'; |
|
223 | - $globalSources[$id]['format'] = 'raw'; |
|
224 | - } elseif ($port == '5001') { |
|
225 | - //$formats[$id] = 'raw'; |
|
226 | - $globalSources[$id]['format'] = 'flightgearmp'; |
|
227 | - } elseif ($port == '30005') { |
|
218 | + } elseif ($port == '10001') { |
|
219 | + //$formats[$id] = 'tsv'; |
|
220 | + $globalSources[$id]['format'] = 'tsv'; |
|
221 | + } elseif ($port == '30002') { |
|
222 | + //$formats[$id] = 'raw'; |
|
223 | + $globalSources[$id]['format'] = 'raw'; |
|
224 | + } elseif ($port == '5001') { |
|
225 | + //$formats[$id] = 'raw'; |
|
226 | + $globalSources[$id]['format'] = 'flightgearmp'; |
|
227 | + } elseif ($port == '30005') { |
|
228 | 228 | // Not yet supported |
229 | - //$formats[$id] = 'beast'; |
|
230 | - $globalSources[$id]['format'] = 'beast'; |
|
231 | - //} else $formats[$id] = 'sbs'; |
|
232 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
233 | - //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
229 | + //$formats[$id] = 'beast'; |
|
230 | + $globalSources[$id]['format'] = 'beast'; |
|
231 | + //} else $formats[$id] = 'sbs'; |
|
232 | + } else $globalSources[$id]['format'] = 'sbs'; |
|
233 | + //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
234 | 234 | } |
235 | 235 | if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
236 | - } else { |
|
236 | + } else { |
|
237 | 237 | if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
238 | - } |
|
239 | - } |
|
240 | - } |
|
238 | + } |
|
239 | + } |
|
240 | + } |
|
241 | 241 | } |
242 | 242 | if (!isset($globalMinFetch)) $globalMinFetch = 15; |
243 | 243 | |
@@ -264,18 +264,18 @@ discard block |
||
264 | 264 | die; |
265 | 265 | } |
266 | 266 | foreach ($globalSources as $key => $source) { |
267 | - if (!isset($source['format'])) { |
|
268 | - $globalSources[$key]['format'] = 'auto'; |
|
269 | - } |
|
267 | + if (!isset($source['format'])) { |
|
268 | + $globalSources[$key]['format'] = 'auto'; |
|
269 | + } |
|
270 | 270 | } |
271 | 271 | connect_all($globalSources); |
272 | 272 | foreach ($globalSources as $key => $source) { |
273 | - if (isset($source['format']) && $source['format'] == 'aprs') { |
|
273 | + if (isset($source['format']) && $source['format'] == 'aprs') { |
|
274 | 274 | $aprs_connect = 0; |
275 | 275 | $use_aprs = true; |
276 | 276 | if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
277 | 277 | break; |
278 | - } |
|
278 | + } |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | if ($use_aprs) { |
@@ -315,67 +315,67 @@ discard block |
||
315 | 315 | |
316 | 316 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
317 | 317 | while ($i > 0) { |
318 | - if (!$globalDaemon) $i = $endtime-time(); |
|
319 | - // Delete old ATC |
|
320 | - if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
318 | + if (!$globalDaemon) $i = $endtime-time(); |
|
319 | + // Delete old ATC |
|
320 | + if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
321 | 321 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
322 | - $ATC->deleteOldATC(); |
|
323 | - } |
|
322 | + $ATC->deleteOldATC(); |
|
323 | + } |
|
324 | 324 | |
325 | - if (count($last_exec) > 0) { |
|
325 | + if (count($last_exec) > 0) { |
|
326 | 326 | $max = $globalMinFetch; |
327 | 327 | foreach ($last_exec as $last) { |
328 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
328 | + if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
329 | 329 | } |
330 | 330 | if ($max != $globalMinFetch) { |
331 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
332 | - sleep($globalMinFetch-$max+2); |
|
331 | + if ($globalDebug) echo 'Sleeping...'."\n"; |
|
332 | + sleep($globalMinFetch-$max+2); |
|
333 | + } |
|
333 | 334 | } |
334 | - } |
|
335 | 335 | |
336 | 336 | |
337 | - //foreach ($formats as $id => $value) { |
|
338 | - foreach ($globalSources as $id => $value) { |
|
337 | + //foreach ($formats as $id => $value) { |
|
338 | + foreach ($globalSources as $id => $value) { |
|
339 | 339 | if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
340 | 340 | if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
341 | - //$buffer = $Common->getData($hosts[$id]); |
|
342 | - $buffer = $Common->getData($value['host']); |
|
343 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
344 | - $buffer = explode('\n',$buffer); |
|
345 | - foreach ($buffer as $line) { |
|
346 | - if ($line != '' && count($line) > 7) { |
|
347 | - $line = explode(',', $line); |
|
348 | - $data = array(); |
|
349 | - $data['hex'] = $line[1]; // hex |
|
350 | - $data['ident'] = $line[2]; // ident |
|
351 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
352 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
353 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
354 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
355 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
356 | - $data['verticalrate'] = ''; // vertical rate |
|
357 | - //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
358 | - $data['emergency'] = ''; // emergency |
|
359 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
360 | - $data['format_source'] = 'deltadbtxt'; |
|
361 | - $data['id_source'] = $id_source; |
|
362 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
363 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
364 | - $SI->add($data); |
|
365 | - unset($data); |
|
366 | - } |
|
367 | - } |
|
368 | - $last_exec[$id]['last'] = time(); |
|
341 | + //$buffer = $Common->getData($hosts[$id]); |
|
342 | + $buffer = $Common->getData($value['host']); |
|
343 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
344 | + $buffer = explode('\n',$buffer); |
|
345 | + foreach ($buffer as $line) { |
|
346 | + if ($line != '' && count($line) > 7) { |
|
347 | + $line = explode(',', $line); |
|
348 | + $data = array(); |
|
349 | + $data['hex'] = $line[1]; // hex |
|
350 | + $data['ident'] = $line[2]; // ident |
|
351 | + if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
352 | + if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
353 | + if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
354 | + if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
355 | + if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
356 | + $data['verticalrate'] = ''; // vertical rate |
|
357 | + //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
358 | + $data['emergency'] = ''; // emergency |
|
359 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
360 | + $data['format_source'] = 'deltadbtxt'; |
|
361 | + $data['id_source'] = $id_source; |
|
362 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
363 | + if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
364 | + $SI->add($data); |
|
365 | + unset($data); |
|
366 | + } |
|
367 | + } |
|
368 | + $last_exec[$id]['last'] = time(); |
|
369 | 369 | //} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) { |
370 | 370 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { |
371 | - //$buffer = $Common->getData($hosts[$id]); |
|
372 | - $buffer = $Common->getData($value['host']); |
|
373 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
374 | - $buffer = explode('\n',$buffer); |
|
375 | - foreach ($buffer as $line) { |
|
376 | - if ($line != '') { |
|
377 | - $line = explode(':', $line); |
|
378 | - if (count($line) > 30 && $line[0] != 'callsign') { |
|
371 | + //$buffer = $Common->getData($hosts[$id]); |
|
372 | + $buffer = $Common->getData($value['host']); |
|
373 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
374 | + $buffer = explode('\n',$buffer); |
|
375 | + foreach ($buffer as $line) { |
|
376 | + if ($line != '') { |
|
377 | + $line = explode(':', $line); |
|
378 | + if (count($line) > 30 && $line[0] != 'callsign') { |
|
379 | 379 | $data = array(); |
380 | 380 | $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
381 | 381 | $data['pilot_id'] = $line[1]; |
@@ -387,36 +387,36 @@ discard block |
||
387 | 387 | if (isset($line[45])) $data['heading'] = $line[45]; // heading |
388 | 388 | elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
389 | 389 | $data['latitude'] = $line[5]; // lat |
390 | - $data['longitude'] = $line[6]; // long |
|
391 | - $data['verticalrate'] = ''; // vertical rate |
|
392 | - $data['squawk'] = ''; // squawk |
|
393 | - $data['emergency'] = ''; // emergency |
|
394 | - $data['waypoints'] = $line[30]; |
|
390 | + $data['longitude'] = $line[6]; // long |
|
391 | + $data['verticalrate'] = ''; // vertical rate |
|
392 | + $data['squawk'] = ''; // squawk |
|
393 | + $data['emergency'] = ''; // emergency |
|
394 | + $data['waypoints'] = $line[30]; |
|
395 | 395 | $data['datetime'] = date('Y-m-d H:i:s'); |
396 | 396 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
397 | 397 | if (isset($line[37])) $data['last_update'] = $line[37]; |
398 | - $data['departure_airport_icao'] = $line[11]; |
|
399 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
400 | - $data['arrival_airport_icao'] = $line[13]; |
|
398 | + $data['departure_airport_icao'] = $line[11]; |
|
399 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
400 | + $data['arrival_airport_icao'] = $line[13]; |
|
401 | 401 | $data['frequency'] = $line[4]; |
402 | 402 | $data['type'] = $line[18]; |
403 | 403 | $data['range'] = $line[19]; |
404 | 404 | if (isset($line[35])) $data['info'] = $line[35]; |
405 | - $data['id_source'] = $id_source; |
|
406 | - //$data['arrival_airport_time'] = ; |
|
407 | - if ($line[9] != '') { |
|
408 | - $aircraft_data = explode('/',$line[9]); |
|
409 | - if (isset($aircraft_data[1])) { |
|
410 | - $data['aircraft_icao'] = $aircraft_data[1]; |
|
411 | - } |
|
412 | - } |
|
413 | - /* |
|
405 | + $data['id_source'] = $id_source; |
|
406 | + //$data['arrival_airport_time'] = ; |
|
407 | + if ($line[9] != '') { |
|
408 | + $aircraft_data = explode('/',$line[9]); |
|
409 | + if (isset($aircraft_data[1])) { |
|
410 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
411 | + } |
|
412 | + } |
|
413 | + /* |
|
414 | 414 | if ($value == 'whazzup') $data['format_source'] = 'whazzup'; |
415 | 415 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
416 | 416 | */ |
417 | - $data['format_source'] = $value['format']; |
|
417 | + $data['format_source'] = $value['format']; |
|
418 | 418 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
419 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
419 | + if ($line[3] == 'PILOT') $SI->add($data); |
|
420 | 420 | elseif ($line[3] == 'ATC') { |
421 | 421 | //print_r($data); |
422 | 422 | $data['info'] = str_replace('^§','<br />',$data['info']); |
@@ -434,240 +434,240 @@ discard block |
||
434 | 434 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
435 | 435 | 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']); |
436 | 436 | } |
437 | - unset($data); |
|
438 | - } |
|
439 | - } |
|
440 | - } |
|
441 | - //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
442 | - //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
443 | - $last_exec[$id]['last'] = time(); |
|
444 | - //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
445 | - } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
446 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
447 | - if ($buffer != '') { |
|
448 | - $all_data = json_decode($buffer,true); |
|
449 | - if (isset($all_data['acList'])) { |
|
437 | + unset($data); |
|
438 | + } |
|
439 | + } |
|
440 | + } |
|
441 | + //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
442 | + //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
443 | + $last_exec[$id]['last'] = time(); |
|
444 | + //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
445 | + } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
446 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
447 | + if ($buffer != '') { |
|
448 | + $all_data = json_decode($buffer,true); |
|
449 | + if (isset($all_data['acList'])) { |
|
450 | 450 | foreach ($all_data['acList'] as $line) { |
451 | - $data = array(); |
|
452 | - $data['hex'] = $line['Icao']; // hex |
|
453 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
454 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
455 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
456 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
457 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
458 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
459 | - //$data['verticalrate'] = $line['']; // verticale rate |
|
460 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
461 | - $data['emergency'] = ''; // emergency |
|
462 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
463 | - /* |
|
451 | + $data = array(); |
|
452 | + $data['hex'] = $line['Icao']; // hex |
|
453 | + if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
454 | + if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
455 | + if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
456 | + if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
457 | + if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
458 | + if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
459 | + //$data['verticalrate'] = $line['']; // verticale rate |
|
460 | + if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
461 | + $data['emergency'] = ''; // emergency |
|
462 | + if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
463 | + /* |
|
464 | 464 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
465 | 465 | else $data['datetime'] = date('Y-m-d H:i:s'); |
466 | 466 | */ |
467 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
468 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
469 | - $data['format_source'] = 'aircraftlistjson'; |
|
470 | - $data['id_source'] = $id_source; |
|
471 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
472 | - if (isset($data['datetime'])) $SI->add($data); |
|
473 | - unset($data); |
|
467 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
468 | + if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
469 | + $data['format_source'] = 'aircraftlistjson'; |
|
470 | + $data['id_source'] = $id_source; |
|
471 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
472 | + if (isset($data['datetime'])) $SI->add($data); |
|
473 | + unset($data); |
|
474 | 474 | } |
475 | - } else { |
|
475 | + } else { |
|
476 | 476 | foreach ($all_data as $line) { |
477 | - $data = array(); |
|
478 | - $data['hex'] = $line['hex']; // hex |
|
479 | - $data['ident'] = $line['flight']; // ident |
|
480 | - $data['altitude'] = $line['altitude']; // altitude |
|
481 | - $data['speed'] = $line['speed']; // speed |
|
482 | - $data['heading'] = $line['track']; // heading |
|
483 | - $data['latitude'] = $line['lat']; // lat |
|
484 | - $data['longitude'] = $line['lon']; // long |
|
485 | - $data['verticalrate'] = $line['vrt']; // verticale rate |
|
486 | - $data['squawk'] = $line['squawk']; // squawk |
|
487 | - $data['emergency'] = ''; // emergency |
|
488 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
489 | - $data['format_source'] = 'aircraftlistjson'; |
|
490 | - $data['id_source'] = $id_source; |
|
491 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
492 | - $SI->add($data); |
|
493 | - unset($data); |
|
477 | + $data = array(); |
|
478 | + $data['hex'] = $line['hex']; // hex |
|
479 | + $data['ident'] = $line['flight']; // ident |
|
480 | + $data['altitude'] = $line['altitude']; // altitude |
|
481 | + $data['speed'] = $line['speed']; // speed |
|
482 | + $data['heading'] = $line['track']; // heading |
|
483 | + $data['latitude'] = $line['lat']; // lat |
|
484 | + $data['longitude'] = $line['lon']; // long |
|
485 | + $data['verticalrate'] = $line['vrt']; // verticale rate |
|
486 | + $data['squawk'] = $line['squawk']; // squawk |
|
487 | + $data['emergency'] = ''; // emergency |
|
488 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
489 | + $data['format_source'] = 'aircraftlistjson'; |
|
490 | + $data['id_source'] = $id_source; |
|
491 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
492 | + $SI->add($data); |
|
493 | + unset($data); |
|
494 | + } |
|
495 | + } |
|
494 | 496 | } |
495 | - } |
|
496 | - } |
|
497 | - //$last_exec['aircraftlistjson'] = time(); |
|
498 | - $last_exec[$id]['last'] = time(); |
|
499 | - //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
500 | - } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
501 | - $buffer = $Common->getData($value['host']); |
|
502 | - $all_data = json_decode($buffer,true); |
|
503 | - if (isset($all_data['planes'])) { |
|
497 | + //$last_exec['aircraftlistjson'] = time(); |
|
498 | + $last_exec[$id]['last'] = time(); |
|
499 | + //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
500 | + } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
501 | + $buffer = $Common->getData($value['host']); |
|
502 | + $all_data = json_decode($buffer,true); |
|
503 | + if (isset($all_data['planes'])) { |
|
504 | 504 | foreach ($all_data['planes'] as $key => $line) { |
505 | - $data = array(); |
|
506 | - $data['hex'] = $key; // hex |
|
507 | - $data['ident'] = $line[3]; // ident |
|
508 | - $data['altitude'] = $line[6]; // altitude |
|
509 | - $data['speed'] = $line[8]; // speed |
|
510 | - $data['heading'] = $line[7]; // heading |
|
511 | - $data['latitude'] = $line[4]; // lat |
|
512 | - $data['longitude'] = $line[5]; // long |
|
513 | - //$data['verticalrate'] = $line[]; // verticale rate |
|
514 | - $data['squawk'] = $line[10]; // squawk |
|
515 | - $data['emergency'] = ''; // emergency |
|
516 | - $data['registration'] = $line[2]; |
|
517 | - $data['aircraft_icao'] = $line[0]; |
|
518 | - $deparr = explode('-',$line[1]); |
|
519 | - if (count($deparr) == 2) { |
|
505 | + $data = array(); |
|
506 | + $data['hex'] = $key; // hex |
|
507 | + $data['ident'] = $line[3]; // ident |
|
508 | + $data['altitude'] = $line[6]; // altitude |
|
509 | + $data['speed'] = $line[8]; // speed |
|
510 | + $data['heading'] = $line[7]; // heading |
|
511 | + $data['latitude'] = $line[4]; // lat |
|
512 | + $data['longitude'] = $line[5]; // long |
|
513 | + //$data['verticalrate'] = $line[]; // verticale rate |
|
514 | + $data['squawk'] = $line[10]; // squawk |
|
515 | + $data['emergency'] = ''; // emergency |
|
516 | + $data['registration'] = $line[2]; |
|
517 | + $data['aircraft_icao'] = $line[0]; |
|
518 | + $deparr = explode('-',$line[1]); |
|
519 | + if (count($deparr) == 2) { |
|
520 | 520 | $data['departure_airport_icao'] = $deparr[0]; |
521 | 521 | $data['arrival_airport_icao'] = $deparr[1]; |
522 | - } |
|
523 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
524 | - $data['format_source'] = 'planeupdatefaa'; |
|
525 | - $data['id_source'] = $id_source; |
|
526 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
527 | - $SI->add($data); |
|
528 | - unset($data); |
|
522 | + } |
|
523 | + $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
524 | + $data['format_source'] = 'planeupdatefaa'; |
|
525 | + $data['id_source'] = $id_source; |
|
526 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
527 | + $SI->add($data); |
|
528 | + unset($data); |
|
529 | 529 | } |
530 | - } |
|
531 | - //$last_exec['planeupdatefaa'] = time(); |
|
532 | - $last_exec[$id]['last'] = time(); |
|
533 | - } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
534 | - $buffer = $Common->getData($value['host']); |
|
535 | - $all_data = json_decode($buffer,true); |
|
536 | - if (isset($all_data['states'])) { |
|
530 | + } |
|
531 | + //$last_exec['planeupdatefaa'] = time(); |
|
532 | + $last_exec[$id]['last'] = time(); |
|
533 | + } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
534 | + $buffer = $Common->getData($value['host']); |
|
535 | + $all_data = json_decode($buffer,true); |
|
536 | + if (isset($all_data['states'])) { |
|
537 | 537 | foreach ($all_data['states'] as $key => $line) { |
538 | - $data = array(); |
|
539 | - $data['hex'] = $line[0]; // hex |
|
540 | - $data['ident'] = trim($line[1]); // ident |
|
541 | - $data['altitude'] = round($line[7]*3.28084); // altitude |
|
542 | - $data['speed'] = round($line[9]*1.94384); // speed |
|
543 | - $data['heading'] = round($line[10]); // heading |
|
544 | - $data['latitude'] = $line[5]; // lat |
|
545 | - $data['longitude'] = $line[6]; // long |
|
546 | - $data['verticalrate'] = $line[11]; // verticale rate |
|
547 | - //$data['squawk'] = $line[10]; // squawk |
|
548 | - //$data['emergency'] = ''; // emergency |
|
549 | - //$data['registration'] = $line[2]; |
|
550 | - //$data['aircraft_icao'] = $line[0]; |
|
551 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
552 | - $data['format_source'] = 'opensky'; |
|
553 | - $data['id_source'] = $id_source; |
|
554 | - $SI->add($data); |
|
555 | - unset($data); |
|
538 | + $data = array(); |
|
539 | + $data['hex'] = $line[0]; // hex |
|
540 | + $data['ident'] = trim($line[1]); // ident |
|
541 | + $data['altitude'] = round($line[7]*3.28084); // altitude |
|
542 | + $data['speed'] = round($line[9]*1.94384); // speed |
|
543 | + $data['heading'] = round($line[10]); // heading |
|
544 | + $data['latitude'] = $line[5]; // lat |
|
545 | + $data['longitude'] = $line[6]; // long |
|
546 | + $data['verticalrate'] = $line[11]; // verticale rate |
|
547 | + //$data['squawk'] = $line[10]; // squawk |
|
548 | + //$data['emergency'] = ''; // emergency |
|
549 | + //$data['registration'] = $line[2]; |
|
550 | + //$data['aircraft_icao'] = $line[0]; |
|
551 | + $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
552 | + $data['format_source'] = 'opensky'; |
|
553 | + $data['id_source'] = $id_source; |
|
554 | + $SI->add($data); |
|
555 | + unset($data); |
|
556 | 556 | } |
557 | - } |
|
558 | - //$last_exec['planeupdatefaa'] = time(); |
|
559 | - $last_exec[$id]['last'] = time(); |
|
560 | - //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
561 | - } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
562 | - //$buffer = $Common->getData($hosts[$id]); |
|
563 | - $buffer = $Common->getData($value['host']); |
|
564 | - $all_data = json_decode($buffer,true); |
|
565 | - foreach ($all_data as $key => $line) { |
|
557 | + } |
|
558 | + //$last_exec['planeupdatefaa'] = time(); |
|
559 | + $last_exec[$id]['last'] = time(); |
|
560 | + //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
561 | + } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
562 | + //$buffer = $Common->getData($hosts[$id]); |
|
563 | + $buffer = $Common->getData($value['host']); |
|
564 | + $all_data = json_decode($buffer,true); |
|
565 | + foreach ($all_data as $key => $line) { |
|
566 | 566 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
567 | - $data = array(); |
|
568 | - $data['hex'] = $line[0]; |
|
569 | - $data['ident'] = $line[16]; //$line[13] |
|
570 | - $data['altitude'] = $line[4]; // altitude |
|
571 | - $data['speed'] = $line[5]; // speed |
|
572 | - $data['heading'] = $line[3]; // heading |
|
573 | - $data['latitude'] = $line[1]; // lat |
|
574 | - $data['longitude'] = $line[2]; // long |
|
575 | - $data['verticalrate'] = $line[15]; // verticale rate |
|
576 | - $data['squawk'] = $line[6]; // squawk |
|
577 | - $data['aircraft_icao'] = $line[8]; |
|
578 | - $data['registration'] = $line[9]; |
|
579 | - $data['departure_airport_iata'] = $line[11]; |
|
580 | - $data['arrival_airport_iata'] = $line[12]; |
|
581 | - $data['emergency'] = ''; // emergency |
|
582 | - $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
583 | - $data['format_source'] = 'fr24json'; |
|
584 | - $data['id_source'] = $id_source; |
|
585 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
586 | - $SI->add($data); |
|
587 | - unset($data); |
|
567 | + $data = array(); |
|
568 | + $data['hex'] = $line[0]; |
|
569 | + $data['ident'] = $line[16]; //$line[13] |
|
570 | + $data['altitude'] = $line[4]; // altitude |
|
571 | + $data['speed'] = $line[5]; // speed |
|
572 | + $data['heading'] = $line[3]; // heading |
|
573 | + $data['latitude'] = $line[1]; // lat |
|
574 | + $data['longitude'] = $line[2]; // long |
|
575 | + $data['verticalrate'] = $line[15]; // verticale rate |
|
576 | + $data['squawk'] = $line[6]; // squawk |
|
577 | + $data['aircraft_icao'] = $line[8]; |
|
578 | + $data['registration'] = $line[9]; |
|
579 | + $data['departure_airport_iata'] = $line[11]; |
|
580 | + $data['arrival_airport_iata'] = $line[12]; |
|
581 | + $data['emergency'] = ''; // emergency |
|
582 | + $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
583 | + $data['format_source'] = 'fr24json'; |
|
584 | + $data['id_source'] = $id_source; |
|
585 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
586 | + $SI->add($data); |
|
587 | + unset($data); |
|
588 | 588 | } |
589 | - } |
|
590 | - //$last_exec['fr24json'] = time(); |
|
591 | - $last_exec[$id]['last'] = time(); |
|
592 | - //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
593 | - } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
594 | - //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
595 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
596 | - //echo $buffer; |
|
597 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
598 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
599 | - $all_data = json_decode($buffer,true); |
|
600 | - if (json_last_error() != JSON_ERROR_NONE) { |
|
589 | + } |
|
590 | + //$last_exec['fr24json'] = time(); |
|
591 | + $last_exec[$id]['last'] = time(); |
|
592 | + //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
593 | + } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
594 | + //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
595 | + $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
596 | + //echo $buffer; |
|
597 | + $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
598 | + $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
599 | + $all_data = json_decode($buffer,true); |
|
600 | + if (json_last_error() != JSON_ERROR_NONE) { |
|
601 | 601 | die(json_last_error_msg()); |
602 | - } |
|
603 | - if (isset($all_data['mrkrs'])) { |
|
602 | + } |
|
603 | + if (isset($all_data['mrkrs'])) { |
|
604 | 604 | foreach ($all_data['mrkrs'] as $key => $line) { |
605 | - if (isset($line['inf'])) { |
|
605 | + if (isset($line['inf'])) { |
|
606 | 606 | $data = array(); |
607 | 607 | $data['hex'] = $line['inf']['ia']; |
608 | 608 | if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
609 | - $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
610 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
611 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
612 | - $data['latitude'] = $line['pt'][0]; // lat |
|
613 | - $data['longitude'] = $line['pt'][1]; // long |
|
614 | - //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
615 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
616 | - //$data['aircraft_icao'] = $line[8]; |
|
617 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
609 | + $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
610 | + if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
611 | + if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
612 | + $data['latitude'] = $line['pt'][0]; // lat |
|
613 | + $data['longitude'] = $line['pt'][1]; // long |
|
614 | + //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
615 | + if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
616 | + //$data['aircraft_icao'] = $line[8]; |
|
617 | + if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
618 | 618 | //$data['departure_airport_iata'] = $line[11]; |
619 | 619 | //$data['arrival_airport_iata'] = $line[12]; |
620 | - //$data['emergency'] = ''; // emergency |
|
620 | + //$data['emergency'] = ''; // emergency |
|
621 | 621 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
622 | - $data['format_source'] = 'radarvirtueljson'; |
|
623 | - $data['id_source'] = $id_source; |
|
622 | + $data['format_source'] = 'radarvirtueljson'; |
|
623 | + $data['id_source'] = $id_source; |
|
624 | 624 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
625 | 625 | $SI->add($data); |
626 | 626 | unset($data); |
627 | - } |
|
627 | + } |
|
628 | 628 | } |
629 | - } |
|
630 | - //$last_exec['radarvirtueljson'] = time(); |
|
631 | - $last_exec[$id]['last'] = time(); |
|
632 | - //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
633 | - } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
634 | - //$buffer = $Common->getData($hosts[$id]); |
|
635 | - $buffer = $Common->getData($value['host'].'?'.time()); |
|
636 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
629 | + } |
|
630 | + //$last_exec['radarvirtueljson'] = time(); |
|
631 | + $last_exec[$id]['last'] = time(); |
|
632 | + //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
633 | + } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
634 | + //$buffer = $Common->getData($hosts[$id]); |
|
635 | + $buffer = $Common->getData($value['host'].'?'.time()); |
|
636 | + $all_data = json_decode(utf8_encode($buffer),true); |
|
637 | 637 | |
638 | - if (isset($all_data['pireps'])) { |
|
639 | - foreach ($all_data['pireps'] as $line) { |
|
640 | - $data = array(); |
|
641 | - $data['id'] = $line['id']; |
|
642 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
643 | - $data['ident'] = $line['callsign']; // ident |
|
644 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
645 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
646 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
647 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
648 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
649 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
650 | - $data['latitude'] = $line['lat']; // lat |
|
651 | - $data['longitude'] = $line['lon']; // long |
|
652 | - //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
653 | - //$data['squawk'] = $line['squawk']; // squawk |
|
654 | - //$data['emergency'] = ''; // emergency |
|
655 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
656 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
657 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
658 | - //$data['arrival_airport_time'] = $line['arrtime']; |
|
659 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
660 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
661 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
662 | - else $data['info'] = ''; |
|
663 | - $data['format_source'] = 'pireps'; |
|
664 | - $data['id_source'] = $id_source; |
|
665 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
666 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
667 | - if ($line['icon'] == 'plane') { |
|
638 | + if (isset($all_data['pireps'])) { |
|
639 | + foreach ($all_data['pireps'] as $line) { |
|
640 | + $data = array(); |
|
641 | + $data['id'] = $line['id']; |
|
642 | + $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
643 | + $data['ident'] = $line['callsign']; // ident |
|
644 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
645 | + if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
646 | + if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
647 | + if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
648 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
649 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
650 | + $data['latitude'] = $line['lat']; // lat |
|
651 | + $data['longitude'] = $line['lon']; // long |
|
652 | + //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
653 | + //$data['squawk'] = $line['squawk']; // squawk |
|
654 | + //$data['emergency'] = ''; // emergency |
|
655 | + if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
656 | + if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
657 | + if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
658 | + //$data['arrival_airport_time'] = $line['arrtime']; |
|
659 | + if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
660 | + if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
661 | + if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
662 | + else $data['info'] = ''; |
|
663 | + $data['format_source'] = 'pireps'; |
|
664 | + $data['id_source'] = $id_source; |
|
665 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
666 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
667 | + if ($line['icon'] == 'plane') { |
|
668 | 668 | $SI->add($data); |
669 | - // print_r($data); |
|
670 | - } elseif ($line['icon'] == 'ct') { |
|
669 | + // print_r($data); |
|
670 | + } elseif ($line['icon'] == 'ct') { |
|
671 | 671 | $data['info'] = str_replace('^§','<br />',$data['info']); |
672 | 672 | $data['info'] = str_replace('&sect;','',$data['info']); |
673 | 673 | $typec = substr($data['ident'],-3); |
@@ -682,160 +682,160 @@ discard block |
||
682 | 682 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
683 | 683 | else $data['type'] = 'Observer'; |
684 | 684 | 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']); |
685 | - } |
|
686 | - unset($data); |
|
685 | + } |
|
686 | + unset($data); |
|
687 | 687 | } |
688 | - } |
|
689 | - //$last_exec['pirepsjson'] = time(); |
|
690 | - $last_exec[$id]['last'] = time(); |
|
691 | - //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
692 | - } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
693 | - //$buffer = $Common->getData($hosts[$id]); |
|
694 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
695 | - $buffer = $Common->getData($value['host']); |
|
696 | - $all_data = json_decode($buffer,true); |
|
697 | - if ($buffer != '' && is_array($all_data)) { |
|
688 | + } |
|
689 | + //$last_exec['pirepsjson'] = time(); |
|
690 | + $last_exec[$id]['last'] = time(); |
|
691 | + //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
692 | + } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
693 | + //$buffer = $Common->getData($hosts[$id]); |
|
694 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
695 | + $buffer = $Common->getData($value['host']); |
|
696 | + $all_data = json_decode($buffer,true); |
|
697 | + if ($buffer != '' && is_array($all_data)) { |
|
698 | 698 | foreach ($all_data as $line) { |
699 | - $data = array(); |
|
700 | - //$data['id'] = $line['id']; // id not usable |
|
701 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
702 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
703 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
704 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
705 | - $data['ident'] = $line['flightnum']; // ident |
|
706 | - $data['altitude'] = $line['alt']; // altitude |
|
707 | - $data['speed'] = $line['gs']; // speed |
|
708 | - $data['heading'] = $line['heading']; // heading |
|
709 | - $data['latitude'] = $line['lat']; // lat |
|
710 | - $data['longitude'] = $line['lng']; // long |
|
711 | - $data['verticalrate'] = ''; // verticale rate |
|
712 | - $data['squawk'] = ''; // squawk |
|
713 | - $data['emergency'] = ''; // emergency |
|
714 | - //$data['datetime'] = $line['lastupdate']; |
|
715 | - $data['last_update'] = $line['lastupdate']; |
|
716 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
717 | - $data['departure_airport_icao'] = $line['depicao']; |
|
718 | - $data['departure_airport_time'] = $line['deptime']; |
|
719 | - $data['arrival_airport_icao'] = $line['arricao']; |
|
720 | - $data['arrival_airport_time'] = $line['arrtime']; |
|
721 | - $data['registration'] = $line['aircraft']; |
|
722 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
723 | - if (isset($line['aircraftname'])) { |
|
699 | + $data = array(); |
|
700 | + //$data['id'] = $line['id']; // id not usable |
|
701 | + if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
702 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
703 | + if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
704 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
705 | + $data['ident'] = $line['flightnum']; // ident |
|
706 | + $data['altitude'] = $line['alt']; // altitude |
|
707 | + $data['speed'] = $line['gs']; // speed |
|
708 | + $data['heading'] = $line['heading']; // heading |
|
709 | + $data['latitude'] = $line['lat']; // lat |
|
710 | + $data['longitude'] = $line['lng']; // long |
|
711 | + $data['verticalrate'] = ''; // verticale rate |
|
712 | + $data['squawk'] = ''; // squawk |
|
713 | + $data['emergency'] = ''; // emergency |
|
714 | + //$data['datetime'] = $line['lastupdate']; |
|
715 | + $data['last_update'] = $line['lastupdate']; |
|
716 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
717 | + $data['departure_airport_icao'] = $line['depicao']; |
|
718 | + $data['departure_airport_time'] = $line['deptime']; |
|
719 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
720 | + $data['arrival_airport_time'] = $line['arrtime']; |
|
721 | + $data['registration'] = $line['aircraft']; |
|
722 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
723 | + if (isset($line['aircraftname'])) { |
|
724 | 724 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
725 | 725 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
726 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
727 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
728 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
729 | - else { |
|
730 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
731 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
732 | - else $data['aircraft_icao'] = $line['aircraftname']; |
|
733 | - } |
|
734 | - } |
|
735 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
736 | - $data['id_source'] = $id_source; |
|
737 | - $data['format_source'] = 'phpvmacars'; |
|
738 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
739 | - $SI->add($data); |
|
740 | - unset($data); |
|
726 | + $aircraft_data = explode('-',$line['aircraftname']); |
|
727 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
728 | + elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
729 | + else { |
|
730 | + $aircraft_data = explode(' ',$line['aircraftname']); |
|
731 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
732 | + else $data['aircraft_icao'] = $line['aircraftname']; |
|
733 | + } |
|
734 | + } |
|
735 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
736 | + $data['id_source'] = $id_source; |
|
737 | + $data['format_source'] = 'phpvmacars'; |
|
738 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
739 | + $SI->add($data); |
|
740 | + unset($data); |
|
741 | 741 | } |
742 | 742 | if ($globalDebug) echo 'No more data...'."\n"; |
743 | 743 | unset($buffer); |
744 | 744 | unset($all_data); |
745 | - } |
|
746 | - //$last_exec['phpvmacars'] = time(); |
|
747 | - $last_exec[$id]['last'] = time(); |
|
748 | - } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
749 | - //$buffer = $Common->getData($hosts[$id]); |
|
750 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
751 | - $buffer = $Common->getData($value['host']); |
|
752 | - $all_data = json_decode($buffer,true); |
|
753 | - if ($buffer != '' && is_array($all_data)) { |
|
745 | + } |
|
746 | + //$last_exec['phpvmacars'] = time(); |
|
747 | + $last_exec[$id]['last'] = time(); |
|
748 | + } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
749 | + //$buffer = $Common->getData($hosts[$id]); |
|
750 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
751 | + $buffer = $Common->getData($value['host']); |
|
752 | + $all_data = json_decode($buffer,true); |
|
753 | + if ($buffer != '' && is_array($all_data)) { |
|
754 | 754 | foreach ($all_data as $line) { |
755 | - $data = array(); |
|
756 | - //$data['id'] = $line['id']; // id not usable |
|
757 | - $data['id'] = trim($line['flight_id']); |
|
758 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
759 | - $data['pilot_name'] = $line['pilot_name']; |
|
760 | - $data['pilot_id'] = $line['pilot_id']; |
|
761 | - $data['ident'] = trim($line['callsign']); // ident |
|
762 | - $data['altitude'] = $line['altitude']; // altitude |
|
763 | - $data['speed'] = $line['gs']; // speed |
|
764 | - $data['heading'] = $line['heading']; // heading |
|
765 | - $data['latitude'] = $line['latitude']; // lat |
|
766 | - $data['longitude'] = $line['longitude']; // long |
|
767 | - $data['verticalrate'] = ''; // verticale rate |
|
768 | - $data['squawk'] = ''; // squawk |
|
769 | - $data['emergency'] = ''; // emergency |
|
770 | - //$data['datetime'] = $line['lastupdate']; |
|
771 | - $data['last_update'] = $line['last_update']; |
|
772 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
773 | - $data['departure_airport_icao'] = $line['departure']; |
|
774 | - //$data['departure_airport_time'] = $line['departure_time']; |
|
775 | - $data['arrival_airport_icao'] = $line['arrival']; |
|
776 | - //$data['arrival_airport_time'] = $line['arrival_time']; |
|
777 | - //$data['registration'] = $line['aircraft']; |
|
778 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
779 | - $data['aircraft_icao'] = $line['plane_type']; |
|
780 | - $data['id_source'] = $id_source; |
|
781 | - $data['format_source'] = 'vam'; |
|
782 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
783 | - $SI->add($data); |
|
784 | - unset($data); |
|
755 | + $data = array(); |
|
756 | + //$data['id'] = $line['id']; // id not usable |
|
757 | + $data['id'] = trim($line['flight_id']); |
|
758 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
759 | + $data['pilot_name'] = $line['pilot_name']; |
|
760 | + $data['pilot_id'] = $line['pilot_id']; |
|
761 | + $data['ident'] = trim($line['callsign']); // ident |
|
762 | + $data['altitude'] = $line['altitude']; // altitude |
|
763 | + $data['speed'] = $line['gs']; // speed |
|
764 | + $data['heading'] = $line['heading']; // heading |
|
765 | + $data['latitude'] = $line['latitude']; // lat |
|
766 | + $data['longitude'] = $line['longitude']; // long |
|
767 | + $data['verticalrate'] = ''; // verticale rate |
|
768 | + $data['squawk'] = ''; // squawk |
|
769 | + $data['emergency'] = ''; // emergency |
|
770 | + //$data['datetime'] = $line['lastupdate']; |
|
771 | + $data['last_update'] = $line['last_update']; |
|
772 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
773 | + $data['departure_airport_icao'] = $line['departure']; |
|
774 | + //$data['departure_airport_time'] = $line['departure_time']; |
|
775 | + $data['arrival_airport_icao'] = $line['arrival']; |
|
776 | + //$data['arrival_airport_time'] = $line['arrival_time']; |
|
777 | + //$data['registration'] = $line['aircraft']; |
|
778 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
779 | + $data['aircraft_icao'] = $line['plane_type']; |
|
780 | + $data['id_source'] = $id_source; |
|
781 | + $data['format_source'] = 'vam'; |
|
782 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
783 | + $SI->add($data); |
|
784 | + unset($data); |
|
785 | 785 | } |
786 | 786 | if ($globalDebug) echo 'No more data...'."\n"; |
787 | 787 | unset($buffer); |
788 | 788 | unset($all_data); |
789 | - } |
|
790 | - //$last_exec['phpvmacars'] = time(); |
|
791 | - $last_exec[$id]['last'] = time(); |
|
789 | + } |
|
790 | + //$last_exec['phpvmacars'] = time(); |
|
791 | + $last_exec[$id]['last'] = time(); |
|
792 | 792 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
793 | 793 | } 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') { |
794 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
795 | - //$last_exec[$id]['last'] = time(); |
|
794 | + if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
795 | + //$last_exec[$id]['last'] = time(); |
|
796 | 796 | |
797 | - //$read = array( $sockets[$id] ); |
|
798 | - $read = $sockets; |
|
799 | - $write = NULL; |
|
800 | - $e = NULL; |
|
801 | - $n = socket_select($read, $write, $e, $timeout); |
|
802 | - if ($e != NULL) var_dump($e); |
|
803 | - if ($n > 0) { |
|
797 | + //$read = array( $sockets[$id] ); |
|
798 | + $read = $sockets; |
|
799 | + $write = NULL; |
|
800 | + $e = NULL; |
|
801 | + $n = socket_select($read, $write, $e, $timeout); |
|
802 | + if ($e != NULL) var_dump($e); |
|
803 | + if ($n > 0) { |
|
804 | 804 | foreach ($read as $nb => $r) { |
805 | - //$value = $formats[$nb]; |
|
806 | - $format = $globalSources[$nb]['format']; |
|
807 | - if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
808 | - $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
809 | - } else { |
|
810 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
811 | - } |
|
812 | - //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
813 | - //echo $buffer."\n"; |
|
814 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
815 | - //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
816 | - $error = false; |
|
817 | - //$SI::del(); |
|
818 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
819 | - // SBS format is CSV format |
|
820 | - if ($buffer != '') { |
|
805 | + //$value = $formats[$nb]; |
|
806 | + $format = $globalSources[$nb]['format']; |
|
807 | + if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
808 | + $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
809 | + } else { |
|
810 | + $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
811 | + } |
|
812 | + //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
813 | + //echo $buffer."\n"; |
|
814 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
815 | + //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
816 | + $error = false; |
|
817 | + //$SI::del(); |
|
818 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
819 | + // SBS format is CSV format |
|
820 | + if ($buffer != '') { |
|
821 | 821 | $tt[$format] = 0; |
822 | 822 | if ($format == 'acarssbs3') { |
823 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
824 | - $ACARS->add(trim($buffer)); |
|
825 | - $ACARS->deleteLiveAcarsData(); |
|
823 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
824 | + $ACARS->add(trim($buffer)); |
|
825 | + $ACARS->deleteLiveAcarsData(); |
|
826 | 826 | } elseif ($format == 'raw') { |
827 | - // AVR format |
|
828 | - $data = $SBS->parse($buffer); |
|
829 | - if (is_array($data)) { |
|
827 | + // AVR format |
|
828 | + $data = $SBS->parse($buffer); |
|
829 | + if (is_array($data)) { |
|
830 | 830 | $data['datetime'] = date('Y-m-d H:i:s'); |
831 | 831 | $data['format_source'] = 'raw'; |
832 | 832 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
833 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
834 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
835 | - } |
|
836 | - } elseif ($format == 'flightgearsp') { |
|
837 | - //echo $buffer."\n"; |
|
838 | - if (strlen($buffer) > 5) { |
|
833 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
834 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
835 | + } |
|
836 | + } elseif ($format == 'flightgearsp') { |
|
837 | + //echo $buffer."\n"; |
|
838 | + if (strlen($buffer) > 5) { |
|
839 | 839 | $line = explode(',',$buffer); |
840 | 840 | $data = array(); |
841 | 841 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
@@ -851,114 +851,114 @@ discard block |
||
851 | 851 | $data['format_source'] = 'flightgearsp'; |
852 | 852 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
853 | 853 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
854 | - } |
|
855 | - } elseif ($format == 'acars') { |
|
856 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
857 | - $ACARS->add(trim($buffer)); |
|
858 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
859 | - $ACARS->deleteLiveAcarsData(); |
|
854 | + } |
|
855 | + } elseif ($format == 'acars') { |
|
856 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
857 | + $ACARS->add(trim($buffer)); |
|
858 | + socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
859 | + $ACARS->deleteLiveAcarsData(); |
|
860 | 860 | } elseif ($format == 'flightgearmp') { |
861 | - if (substr($buffer,0,1) != '#') { |
|
861 | + if (substr($buffer,0,1) != '#') { |
|
862 | 862 | $data = array(); |
863 | 863 | //echo $buffer."\n"; |
864 | 864 | $line = explode(' ',$buffer); |
865 | 865 | if (count($line) == 11) { |
866 | - $userserver = explode('@',$line[0]); |
|
867 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
868 | - $data['ident'] = $userserver[0]; |
|
869 | - $data['registration'] = $userserver[0]; |
|
870 | - $data['latitude'] = $line[4]; |
|
871 | - $data['longitude'] = $line[5]; |
|
872 | - $data['altitude'] = $line[6]; |
|
873 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
874 | - $aircraft_type = $line[10]; |
|
875 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
876 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
877 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
866 | + $userserver = explode('@',$line[0]); |
|
867 | + $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
868 | + $data['ident'] = $userserver[0]; |
|
869 | + $data['registration'] = $userserver[0]; |
|
870 | + $data['latitude'] = $line[4]; |
|
871 | + $data['longitude'] = $line[5]; |
|
872 | + $data['altitude'] = $line[6]; |
|
873 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
874 | + $aircraft_type = $line[10]; |
|
875 | + $aircraft_type = preg_split(':/:',$aircraft_type); |
|
876 | + $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
877 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
878 | + } |
|
878 | 879 | } |
879 | - } |
|
880 | 880 | } elseif ($format == 'beast') { |
881 | - echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
882 | - die; |
|
881 | + echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
882 | + die; |
|
883 | 883 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
884 | - $line = explode("\t", $buffer); |
|
885 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
884 | + $line = explode("\t", $buffer); |
|
885 | + for($k = 0; $k < count($line); $k=$k+2) { |
|
886 | 886 | $key = $line[$k]; |
887 | - $lined[$key] = $line[$k+1]; |
|
888 | - } |
|
889 | - if (count($lined) > 3) { |
|
890 | - $data['hex'] = $lined['hexid']; |
|
891 | - //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
892 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
893 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
894 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
895 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
896 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
897 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
898 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
899 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
900 | - $data['id_source'] = $id_source; |
|
901 | - $data['format_source'] = 'tsv'; |
|
902 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
903 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
904 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
905 | - unset($lined); |
|
906 | - unset($data); |
|
907 | - } else $error = true; |
|
887 | + $lined[$key] = $line[$k+1]; |
|
888 | + } |
|
889 | + if (count($lined) > 3) { |
|
890 | + $data['hex'] = $lined['hexid']; |
|
891 | + //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
892 | + $data['datetime'] = date('Y-m-d H:i:s');; |
|
893 | + if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
894 | + if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
895 | + if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
896 | + if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
897 | + if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
898 | + if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
899 | + if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
900 | + $data['id_source'] = $id_source; |
|
901 | + $data['format_source'] = 'tsv'; |
|
902 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
903 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
904 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
905 | + unset($lined); |
|
906 | + unset($data); |
|
907 | + } else $error = true; |
|
908 | 908 | } elseif ($format == 'aprs' && $use_aprs) { |
909 | - if ($aprs_connect == 0) { |
|
909 | + if ($aprs_connect == 0) { |
|
910 | 910 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
911 | 911 | $aprs_connect = 1; |
912 | - } |
|
913 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
912 | + } |
|
913 | + if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
914 | 914 | $aprs_last_tx = time(); |
915 | 915 | $data_aprs = "# Keep alive"; |
916 | 916 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
917 | - } |
|
918 | - //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
919 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
920 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
921 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
917 | + } |
|
918 | + //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
919 | + $buffer = str_replace('APRS <- ','',$buffer); |
|
920 | + $buffer = str_replace('APRS -> ','',$buffer); |
|
921 | + if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
922 | 922 | $line = $APRS->parse($buffer); |
923 | 923 | if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
924 | - $data = array(); |
|
925 | - //print_r($line); |
|
926 | - $data['hex'] = $line['address']; |
|
927 | - $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
928 | - //$data['datetime'] = date('Y-m-d H:i:s'); |
|
929 | - $data['ident'] = $line['ident']; |
|
930 | - $data['latitude'] = $line['latitude']; |
|
931 | - $data['longitude'] = $line['longitude']; |
|
932 | - //$data['verticalrate'] = $line[16]; |
|
933 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
934 | - else $data['speed'] = 0; |
|
935 | - $data['altitude'] = $line['altitude']; |
|
936 | - if (isset($line['course'])) $data['heading'] = $line['course']; |
|
937 | - //else $data['heading'] = 0; |
|
938 | - $data['aircraft_type'] = $line['stealth']; |
|
939 | - if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
940 | - $data['id_source'] = $id_source; |
|
941 | - $data['format_source'] = 'aprs'; |
|
942 | - $data['source_name'] = $line['source']; |
|
943 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
944 | - $currentdate = date('Y-m-d H:i:s'); |
|
945 | - $aprsdate = strtotime($data['datetime']); |
|
946 | - // Accept data if time <= system time + 20s |
|
947 | - 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); |
|
948 | - else { |
|
924 | + $data = array(); |
|
925 | + //print_r($line); |
|
926 | + $data['hex'] = $line['address']; |
|
927 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
928 | + //$data['datetime'] = date('Y-m-d H:i:s'); |
|
929 | + $data['ident'] = $line['ident']; |
|
930 | + $data['latitude'] = $line['latitude']; |
|
931 | + $data['longitude'] = $line['longitude']; |
|
932 | + //$data['verticalrate'] = $line[16]; |
|
933 | + if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
934 | + else $data['speed'] = 0; |
|
935 | + $data['altitude'] = $line['altitude']; |
|
936 | + if (isset($line['course'])) $data['heading'] = $line['course']; |
|
937 | + //else $data['heading'] = 0; |
|
938 | + $data['aircraft_type'] = $line['stealth']; |
|
939 | + if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
940 | + $data['id_source'] = $id_source; |
|
941 | + $data['format_source'] = 'aprs'; |
|
942 | + $data['source_name'] = $line['source']; |
|
943 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
944 | + $currentdate = date('Y-m-d H:i:s'); |
|
945 | + $aprsdate = strtotime($data['datetime']); |
|
946 | + // Accept data if time <= system time + 20s |
|
947 | + 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); |
|
948 | + else { |
|
949 | 949 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
950 | 950 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
951 | - } |
|
952 | - unset($data); |
|
951 | + } |
|
952 | + unset($data); |
|
953 | 953 | } |
954 | 954 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
955 | 955 | elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
956 | - } |
|
956 | + } |
|
957 | 957 | } else { |
958 | - $line = explode(',', $buffer); |
|
959 | - if (count($line) > 20) { |
|
960 | - $data['hex'] = $line[4]; |
|
961 | - /* |
|
958 | + $line = explode(',', $buffer); |
|
959 | + if (count($line) > 20) { |
|
960 | + $data['hex'] = $line[4]; |
|
961 | + /* |
|
962 | 962 | $data['datetime'] = $line[6].' '.$line[7]; |
963 | 963 | date_default_timezone_set($globalTimezone); |
964 | 964 | $datetime = new DateTime($data['datetime']); |
@@ -966,29 +966,29 @@ discard block |
||
966 | 966 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
967 | 967 | date_default_timezone_set('UTC'); |
968 | 968 | */ |
969 | - // Force datetime to current UTC datetime |
|
970 | - date_default_timezone_set('UTC'); |
|
971 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
972 | - $data['ident'] = trim($line[10]); |
|
973 | - $data['latitude'] = $line[14]; |
|
974 | - $data['longitude'] = $line[15]; |
|
975 | - $data['verticalrate'] = $line[16]; |
|
976 | - $data['emergency'] = $line[20]; |
|
977 | - $data['speed'] = $line[12]; |
|
978 | - $data['squawk'] = $line[17]; |
|
979 | - $data['altitude'] = $line[11]; |
|
980 | - $data['heading'] = $line[13]; |
|
981 | - $data['ground'] = $line[21]; |
|
982 | - $data['emergency'] = $line[19]; |
|
983 | - $data['format_source'] = 'sbs'; |
|
969 | + // Force datetime to current UTC datetime |
|
970 | + date_default_timezone_set('UTC'); |
|
971 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
972 | + $data['ident'] = trim($line[10]); |
|
973 | + $data['latitude'] = $line[14]; |
|
974 | + $data['longitude'] = $line[15]; |
|
975 | + $data['verticalrate'] = $line[16]; |
|
976 | + $data['emergency'] = $line[20]; |
|
977 | + $data['speed'] = $line[12]; |
|
978 | + $data['squawk'] = $line[17]; |
|
979 | + $data['altitude'] = $line[11]; |
|
980 | + $data['heading'] = $line[13]; |
|
981 | + $data['ground'] = $line[21]; |
|
982 | + $data['emergency'] = $line[19]; |
|
983 | + $data['format_source'] = 'sbs'; |
|
984 | 984 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
985 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
986 | - $data['id_source'] = $id_source; |
|
987 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
988 | - else $error = true; |
|
989 | - unset($data); |
|
990 | - } else $error = true; |
|
991 | - if ($error) { |
|
985 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
986 | + $data['id_source'] = $id_source; |
|
987 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
988 | + else $error = true; |
|
989 | + unset($data); |
|
990 | + } else $error = true; |
|
991 | + if ($error) { |
|
992 | 992 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
993 | 993 | if ($globalDebug) echo "Not a message. Ignoring... \n"; |
994 | 994 | } else { |
@@ -1004,13 +1004,13 @@ discard block |
||
1004 | 1004 | connect_all($sourceer); |
1005 | 1005 | $sourceer = array(); |
1006 | 1006 | } |
1007 | - } |
|
1007 | + } |
|
1008 | 1008 | } |
1009 | 1009 | // Sleep for xxx microseconds |
1010 | 1010 | if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
1011 | - } else { |
|
1011 | + } else { |
|
1012 | 1012 | if ($format == 'flightgearmp') { |
1013 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
1013 | + if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
1014 | 1014 | //@socket_close($r); |
1015 | 1015 | sleep($globalMinFetch); |
1016 | 1016 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1019,9 +1019,9 @@ discard block |
||
1019 | 1019 | break; |
1020 | 1020 | |
1021 | 1021 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
1022 | - if (isset($tt[$format])) $tt[$format]++; |
|
1023 | - else $tt[$format] = 0; |
|
1024 | - if ($tt[$format] > 30) { |
|
1022 | + if (isset($tt[$format])) $tt[$format]++; |
|
1023 | + else $tt[$format] = 0; |
|
1024 | + if ($tt[$format] > 30) { |
|
1025 | 1025 | if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
1026 | 1026 | //@socket_close($r); |
1027 | 1027 | sleep(2); |
@@ -1032,40 +1032,40 @@ discard block |
||
1032 | 1032 | //connect_all($globalSources); |
1033 | 1033 | $tt[$format]=0; |
1034 | 1034 | break; |
1035 | - } |
|
1035 | + } |
|
1036 | + } |
|
1036 | 1037 | } |
1037 | - } |
|
1038 | 1038 | } |
1039 | - } else { |
|
1039 | + } else { |
|
1040 | 1040 | $error = socket_strerror(socket_last_error()); |
1041 | 1041 | if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
1042 | 1042 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || time() - $time >= $timeout) { |
1043 | 1043 | if (isset($globalDebug)) echo "Restarting...\n"; |
1044 | 1044 | // Restart the script if possible |
1045 | 1045 | if (is_array($sockets)) { |
1046 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
1046 | + if ($globalDebug) echo "Shutdown all sockets..."; |
|
1047 | 1047 | |
1048 | - foreach ($sockets as $sock) { |
|
1048 | + foreach ($sockets as $sock) { |
|
1049 | 1049 | @socket_shutdown($sock,2); |
1050 | 1050 | @socket_close($sock); |
1051 | - } |
|
1051 | + } |
|
1052 | 1052 | |
1053 | 1053 | } |
1054 | - if ($globalDebug) echo "Restart all connections..."; |
|
1055 | - sleep(2); |
|
1056 | - $time = time(); |
|
1057 | - //connect_all($hosts); |
|
1058 | - $aprs_connect = 0; |
|
1059 | - connect_all($globalSources); |
|
1054 | + if ($globalDebug) echo "Restart all connections..."; |
|
1055 | + sleep(2); |
|
1056 | + $time = time(); |
|
1057 | + //connect_all($hosts); |
|
1058 | + $aprs_connect = 0; |
|
1059 | + connect_all($globalSources); |
|
1060 | 1060 | |
1061 | 1061 | } |
1062 | - } |
|
1062 | + } |
|
1063 | 1063 | } |
1064 | 1064 | if ($globalDaemon === false) { |
1065 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
1066 | - $SI->checkAll(); |
|
1065 | + if ($globalDebug) echo 'Check all...'."\n"; |
|
1066 | + $SI->checkAll(); |
|
1067 | + } |
|
1067 | 1068 | } |
1068 | - } |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | ?> |
@@ -9,16 +9,16 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.Source.php'); |
10 | 10 | |
11 | 11 | class SpotterImport { |
12 | - private $all_flights = array(); |
|
13 | - private $last_delete_hourly = 0; |
|
14 | - private $last_delete = 0; |
|
15 | - private $stats = array(); |
|
16 | - private $tmd = 0; |
|
17 | - private $source_location = array(); |
|
18 | - public $db = null; |
|
19 | - public $nb = 0; |
|
20 | - |
|
21 | - public function __construct($dbc = null) { |
|
12 | + private $all_flights = array(); |
|
13 | + private $last_delete_hourly = 0; |
|
14 | + private $last_delete = 0; |
|
15 | + private $stats = array(); |
|
16 | + private $tmd = 0; |
|
17 | + private $source_location = array(); |
|
18 | + public $db = null; |
|
19 | + public $nb = 0; |
|
20 | + |
|
21 | + public function __construct($dbc = null) { |
|
22 | 22 | global $globalBeta; |
23 | 23 | $Connection = new Connection($dbc); |
24 | 24 | $this->db = $Connection->db(); |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | $currentdate = date('Y-m-d'); |
30 | 30 | $sourcestat = $Stats->getStatsSource($currentdate); |
31 | 31 | if (!empty($sourcestat)) { |
32 | - foreach($sourcestat as $srcst) { |
|
33 | - $type = $srcst['stats_type']; |
|
32 | + foreach($sourcestat as $srcst) { |
|
33 | + $type = $srcst['stats_type']; |
|
34 | 34 | if ($type == 'polar' || $type == 'hist') { |
35 | - $source = $srcst['source_name']; |
|
36 | - $data = $srcst['source_data']; |
|
37 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
38 | - } |
|
39 | - } |
|
35 | + $source = $srcst['source_name']; |
|
36 | + $data = $srcst['source_data']; |
|
37 | + $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
38 | + } |
|
39 | + } |
|
40 | + } |
|
40 | 41 | } |
41 | - } |
|
42 | 42 | |
43 | - public function get_Schedule($id,$ident) { |
|
43 | + public function get_Schedule($id,$ident) { |
|
44 | 44 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
45 | 45 | // Get schedule here, so it's done only one time |
46 | 46 | |
@@ -60,42 +60,42 @@ discard block |
||
60 | 60 | $operator = $Spotter->getOperator($ident); |
61 | 61 | $scheduleexist = false; |
62 | 62 | if ($Schedule->checkSchedule($operator) == 0) { |
63 | - $operator = $Translation->checkTranslation($ident); |
|
64 | - if ($Schedule->checkSchedule($operator) == 0) { |
|
63 | + $operator = $Translation->checkTranslation($ident); |
|
64 | + if ($Schedule->checkSchedule($operator) == 0) { |
|
65 | 65 | $schedule = $Schedule->fetchSchedule($operator); |
66 | 66 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
67 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
68 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
69 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
70 | - // Should also check if route schedule = route from DB |
|
71 | - if ($schedule['DepartureAirportIATA'] != '') { |
|
67 | + if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
68 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
69 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
70 | + // Should also check if route schedule = route from DB |
|
71 | + if ($schedule['DepartureAirportIATA'] != '') { |
|
72 | 72 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
73 | - $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
74 | - if (trim($airport_icao) != '') { |
|
73 | + $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
74 | + if (trim($airport_icao) != '') { |
|
75 | 75 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
76 | 76 | if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
77 | - } |
|
77 | + } |
|
78 | + } |
|
78 | 79 | } |
79 | - } |
|
80 | - if ($schedule['ArrivalAirportIATA'] != '') { |
|
80 | + if ($schedule['ArrivalAirportIATA'] != '') { |
|
81 | 81 | if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) { |
82 | - $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
83 | - if (trim($airport_icao) != '') { |
|
82 | + $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
83 | + if (trim($airport_icao) != '') { |
|
84 | 84 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
85 | 85 | if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
86 | - } |
|
86 | + } |
|
87 | + } |
|
87 | 88 | } |
88 | - } |
|
89 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
89 | + $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
90 | 90 | } |
91 | - } else $scheduleexist = true; |
|
91 | + } else $scheduleexist = true; |
|
92 | 92 | } else $scheduleexist = true; |
93 | 93 | // close connection, at least one way will work ? |
94 | - if ($scheduleexist) { |
|
94 | + if ($scheduleexist) { |
|
95 | 95 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
96 | - $sch = $Schedule->getSchedule($operator); |
|
96 | + $sch = $Schedule->getSchedule($operator); |
|
97 | 97 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
98 | - } |
|
98 | + } |
|
99 | 99 | $Spotter->db = null; |
100 | 100 | $Schedule->db = null; |
101 | 101 | $Translation->db = null; |
@@ -110,92 +110,92 @@ discard block |
||
110 | 110 | } |
111 | 111 | */ |
112 | 112 | } |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | - public function checkAll() { |
|
115 | + public function checkAll() { |
|
116 | 116 | global $globalDebug; |
117 | 117 | if ($globalDebug) echo "Update last seen flights data...\n"; |
118 | 118 | foreach ($this->all_flights as $key => $flight) { |
119 | - if (isset($this->all_flights[$key]['id'])) { |
|
119 | + if (isset($this->all_flights[$key]['id'])) { |
|
120 | 120 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
121 | - $Spotter = new Spotter($this->db); |
|
122 | - $real_arrival = $this->arrival($key); |
|
123 | - $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
124 | - } |
|
121 | + $Spotter = new Spotter($this->db); |
|
122 | + $real_arrival = $this->arrival($key); |
|
123 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
124 | + } |
|
125 | + } |
|
125 | 126 | } |
126 | - } |
|
127 | 127 | |
128 | - public function arrival($key) { |
|
128 | + public function arrival($key) { |
|
129 | 129 | global $globalClosestMinDist, $globalDebug; |
130 | 130 | if ($globalDebug) echo 'Update arrival...'."\n"; |
131 | 131 | $Spotter = new Spotter($this->db); |
132 | - $airport_icao = ''; |
|
133 | - $airport_time = ''; |
|
134 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
132 | + $airport_icao = ''; |
|
133 | + $airport_time = ''; |
|
134 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
135 | 135 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
136 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
137 | - if (isset($closestAirports[0])) { |
|
138 | - if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
139 | - $airport_icao = $closestAirports[0]['icao']; |
|
140 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
141 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
142 | - } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
143 | - foreach ($closestAirports as $airport) { |
|
144 | - if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
145 | - $airport_icao = $airport['icao']; |
|
146 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
147 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
148 | - break; |
|
149 | - } |
|
150 | - } |
|
151 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
152 | - $airport_icao = $closestAirports[0]['icao']; |
|
153 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
154 | - } else { |
|
155 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
156 | - } |
|
157 | - } else { |
|
158 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
159 | - } |
|
160 | - |
|
161 | - } else { |
|
162 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
163 | - } |
|
164 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
165 | - } |
|
166 | - |
|
167 | - |
|
168 | - |
|
169 | - public function del() { |
|
136 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
137 | + if (isset($closestAirports[0])) { |
|
138 | + if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
139 | + $airport_icao = $closestAirports[0]['icao']; |
|
140 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
141 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
142 | + } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
143 | + foreach ($closestAirports as $airport) { |
|
144 | + if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
145 | + $airport_icao = $airport['icao']; |
|
146 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
147 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
148 | + break; |
|
149 | + } |
|
150 | + } |
|
151 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
152 | + $airport_icao = $closestAirports[0]['icao']; |
|
153 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
154 | + } else { |
|
155 | + if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
156 | + } |
|
157 | + } else { |
|
158 | + if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
159 | + } |
|
160 | + |
|
161 | + } else { |
|
162 | + if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
163 | + } |
|
164 | + return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
165 | + } |
|
166 | + |
|
167 | + |
|
168 | + |
|
169 | + public function del() { |
|
170 | 170 | global $globalDebug; |
171 | 171 | // Delete old infos |
172 | 172 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
173 | 173 | foreach ($this->all_flights as $key => $flight) { |
174 | - if (isset($flight['lastupdate'])) { |
|
175 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
176 | - if (isset($this->all_flights[$key]['id'])) { |
|
177 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
174 | + if (isset($flight['lastupdate'])) { |
|
175 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
176 | + if (isset($this->all_flights[$key]['id'])) { |
|
177 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
178 | 178 | /* |
179 | 179 | $SpotterLive = new SpotterLive(); |
180 | 180 | $SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']); |
181 | 181 | $SpotterLive->db = null; |
182 | 182 | */ |
183 | - $real_arrival = $this->arrival($key); |
|
184 | - $Spotter = new Spotter($this->db); |
|
185 | - if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
183 | + $real_arrival = $this->arrival($key); |
|
184 | + $Spotter = new Spotter($this->db); |
|
185 | + if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
186 | 186 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
187 | 187 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
188 | 188 | } |
189 | 189 | // Put in archive |
190 | 190 | // $Spotter->db = null; |
191 | - } |
|
192 | - unset($this->all_flights[$key]); |
|
193 | - } |
|
194 | - } |
|
195 | - } |
|
196 | - } |
|
197 | - |
|
198 | - public function add($line) { |
|
191 | + } |
|
192 | + unset($this->all_flights[$key]); |
|
193 | + } |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | + |
|
198 | + public function add($line) { |
|
199 | 199 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights; |
200 | 200 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
201 | 201 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
@@ -220,18 +220,18 @@ discard block |
||
220 | 220 | |
221 | 221 | // SBS format is CSV format |
222 | 222 | if(is_array($line) && isset($line['hex'])) { |
223 | - //print_r($line); |
|
224 | - if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
223 | + //print_r($line); |
|
224 | + if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
225 | 225 | |
226 | 226 | // Increment message number |
227 | 227 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
228 | - $current_date = date('Y-m-d'); |
|
229 | - $source = $line['source_name']; |
|
230 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
231 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
232 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
233 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
234 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
228 | + $current_date = date('Y-m-d'); |
|
229 | + $source = $line['source_name']; |
|
230 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
231 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
232 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
233 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
234 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /* |
@@ -247,17 +247,17 @@ discard block |
||
247 | 247 | //$this->db = $dbc; |
248 | 248 | |
249 | 249 | $hex = trim($line['hex']); |
250 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
251 | - else $id = trim($line['id']); |
|
250 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
251 | + else $id = trim($line['id']); |
|
252 | 252 | |
253 | 253 | //print_r($this->all_flights); |
254 | 254 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
255 | - $this->all_flights[$id] = array('hex' => $hex); |
|
256 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
257 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
255 | + $this->all_flights[$id] = array('hex' => $hex); |
|
256 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
257 | + //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
258 | 258 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
259 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
260 | - if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
259 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
260 | + if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
261 | 261 | |
262 | 262 | $timeelapsed = microtime(true); |
263 | 263 | $Spotter = new Spotter($this->db); |
@@ -266,38 +266,38 @@ discard block |
||
266 | 266 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
267 | 267 | |
268 | 268 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
269 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
270 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
271 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
272 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
269 | + if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
270 | + elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
271 | + elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
272 | + elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
273 | 273 | } |
274 | 274 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
275 | - } else if (isset($line['aircraft_name'])) { |
|
275 | + } else if (isset($line['aircraft_name'])) { |
|
276 | 276 | // Get aircraft ICAO from aircraft name |
277 | 277 | $Spotter = new Spotter($this->db); |
278 | 278 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
279 | 279 | $Spotter->db = null; |
280 | 280 | if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
281 | 281 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
282 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
283 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
284 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
285 | - if (!isset($line['id'])) { |
|
282 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
283 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
284 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
285 | + if (!isset($line['id'])) { |
|
286 | 286 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
287 | 287 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
288 | 288 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
289 | 289 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
290 | - //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
291 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
290 | + //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
291 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
292 | 292 | |
293 | - if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
294 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
293 | + if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
294 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
298 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
298 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
299 | 299 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
300 | - } else { |
|
300 | + } else { |
|
301 | 301 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
302 | 302 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
303 | 303 | /* |
@@ -306,38 +306,38 @@ discard block |
||
306 | 306 | print_r($line); |
307 | 307 | */ |
308 | 308 | return ''; |
309 | - } |
|
309 | + } |
|
310 | 310 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
311 | 311 | |
312 | 312 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
313 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
313 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
314 | 314 | } |
315 | 315 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
316 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
316 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
317 | 317 | } |
318 | 318 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
319 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
319 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
320 | 320 | } |
321 | 321 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
322 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
322 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
326 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
327 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
326 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
327 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
328 | 328 | $timeelapsed = microtime(true); |
329 | - $Spotter = new Spotter($this->db); |
|
330 | - $fromsource = NULL; |
|
331 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
332 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
329 | + $Spotter = new Spotter($this->db); |
|
330 | + $fromsource = NULL; |
|
331 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
332 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
333 | 333 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
334 | 334 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
335 | 335 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
336 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
336 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
337 | 337 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
338 | 338 | $Spotter->db = null; |
339 | 339 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
340 | - } |
|
340 | + } |
|
341 | 341 | |
342 | 342 | /* |
343 | 343 | if (!isset($line['id'])) { |
@@ -347,26 +347,26 @@ discard block |
||
347 | 347 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
348 | 348 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
349 | 349 | */ |
350 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
350 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
351 | 351 | |
352 | - //$putinarchive = true; |
|
353 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
352 | + //$putinarchive = true; |
|
353 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
354 | 354 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
355 | - } |
|
356 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
355 | + } |
|
356 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
357 | 357 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
358 | - } |
|
359 | - if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
360 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
361 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
358 | + } |
|
359 | + if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
360 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
361 | + } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
362 | 362 | $timeelapsed = microtime(true); |
363 | 363 | $Spotter = new Spotter($this->db); |
364 | 364 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
365 | 365 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
366 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
366 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
367 | 367 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
368 | 368 | |
369 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
369 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
370 | 370 | $timeelapsed = microtime(true); |
371 | 371 | $Spotter = new Spotter($this->db); |
372 | 372 | $route = $Spotter->getRouteInfo(trim($line['ident'])); |
@@ -380,43 +380,43 @@ discard block |
||
380 | 380 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
381 | 381 | |
382 | 382 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
383 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
384 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
383 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
384 | + if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
385 | 385 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
386 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
387 | - } |
|
386 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
387 | + } |
|
388 | 388 | } |
389 | 389 | if (!isset($globalFork)) $globalFork = TRUE; |
390 | 390 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
391 | 391 | if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
392 | 392 | } |
393 | - } |
|
393 | + } |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | if (isset($line['speed']) && $line['speed'] != '') { |
397 | 397 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
398 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
399 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
400 | - //$dataFound = true; |
|
398 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
399 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
400 | + //$dataFound = true; |
|
401 | 401 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
402 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
403 | - if ($distance > 1000 && $distance < 10000) { |
|
404 | - // use datetime |
|
402 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
403 | + if ($distance > 1000 && $distance < 10000) { |
|
404 | + // use datetime |
|
405 | 405 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
406 | 406 | $speed = $speed*3.6; |
407 | 407 | if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
408 | 408 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
409 | - } |
|
409 | + } |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | |
413 | 413 | |
414 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
415 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
416 | - else unset($timediff); |
|
417 | - if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
414 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
415 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
416 | + else unset($timediff); |
|
417 | + if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
418 | 418 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
419 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
419 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
420 | 420 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
421 | 421 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
422 | 422 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -430,16 +430,16 @@ discard block |
||
430 | 430 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
431 | 431 | $this->tmd = 0; |
432 | 432 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
433 | - } |
|
433 | + } |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
437 | - //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
437 | + //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
438 | 438 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
439 | 439 | if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
440 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
441 | - $dataFound = true; |
|
442 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
440 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
441 | + $dataFound = true; |
|
442 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
443 | 443 | } |
444 | 444 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
445 | 445 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -450,20 +450,20 @@ discard block |
||
450 | 450 | //$putinarchive = true; |
451 | 451 | } |
452 | 452 | */ |
453 | - /* |
|
453 | + /* |
|
454 | 454 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
455 | 455 | if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n"; |
456 | 456 | } |
457 | 457 | */ |
458 | 458 | } |
459 | 459 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
460 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
461 | - //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
460 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
461 | + //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
462 | 462 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
463 | 463 | if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
464 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
465 | - $dataFound = true; |
|
466 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
464 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
465 | + $dataFound = true; |
|
466 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
467 | 467 | } |
468 | 468 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
469 | 469 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -481,53 +481,53 @@ discard block |
||
481 | 481 | */ |
482 | 482 | } |
483 | 483 | |
484 | - } else if ($globalDebug && $timediff > 20) { |
|
484 | + } else if ($globalDebug && $timediff > 20) { |
|
485 | 485 | $this->tmd = $this->tmd + 1; |
486 | 486 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
487 | 487 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
488 | 488 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
489 | 489 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
490 | - } |
|
490 | + } |
|
491 | 491 | } |
492 | 492 | if (isset($line['last_update']) && $line['last_update'] != '') { |
493 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
494 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
493 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
494 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
495 | 495 | } |
496 | 496 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
497 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
498 | - //$dataFound = true; |
|
497 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
498 | + //$dataFound = true; |
|
499 | 499 | } |
500 | 500 | if (isset($line['format_source']) && $line['format_source'] != '') { |
501 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
501 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
502 | 502 | } |
503 | 503 | if (isset($line['source_name']) && $line['source_name'] != '') { |
504 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
504 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
505 | 505 | } |
506 | 506 | if (isset($line['emergency']) && $line['emergency'] != '') { |
507 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
508 | - //$dataFound = true; |
|
507 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
508 | + //$dataFound = true; |
|
509 | 509 | } |
510 | 510 | if (isset($line['ground']) && $line['ground'] != '') { |
511 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
511 | + if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
512 | 512 | // Here we force archive of flight because after ground it's a new one (or should be) |
513 | 513 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
514 | 514 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
515 | 515 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
516 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
516 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
517 | 517 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
518 | - } |
|
519 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
520 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
521 | - //$dataFound = true; |
|
518 | + } |
|
519 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
520 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
521 | + //$dataFound = true; |
|
522 | 522 | } |
523 | 523 | if (isset($line['squawk']) && $line['squawk'] != '') { |
524 | - if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
525 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
526 | - $highlight = ''; |
|
527 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
528 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
529 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
530 | - if ($highlight != '') { |
|
524 | + if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
525 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
526 | + $highlight = ''; |
|
527 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
528 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
529 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
530 | + if ($highlight != '') { |
|
531 | 531 | $timeelapsed = microtime(true); |
532 | 532 | $Spotter = new Spotter($this->db); |
533 | 533 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
@@ -537,38 +537,38 @@ discard block |
||
537 | 537 | $this->all_flights[$id]['putinarchive'] = true; |
538 | 538 | //$putinarchive = true; |
539 | 539 | //$highlight = ''; |
540 | - } |
|
540 | + } |
|
541 | 541 | |
542 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
543 | - //$dataFound = true; |
|
542 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
543 | + //$dataFound = true; |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | if (isset($line['altitude']) && $line['altitude'] != '') { |
547 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
547 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
548 | 548 | if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
549 | 549 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
550 | 550 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
551 | 551 | //$dataFound = true; |
552 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
552 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
556 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
556 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | if (isset($line['heading']) && $line['heading'] != '') { |
560 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
561 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
562 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
563 | - //$dataFound = true; |
|
560 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
561 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
562 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
563 | + //$dataFound = true; |
|
564 | 564 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
565 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
566 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
567 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
568 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
565 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
566 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
567 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
568 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
569 | 569 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
570 | - // If not enough messages and ACARS set heading to 0 |
|
571 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
570 | + // If not enough messages and ACARS set heading to 0 |
|
571 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
572 | 572 | } |
573 | 573 | if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
574 | 574 | elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -579,119 +579,119 @@ discard block |
||
579 | 579 | //if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
580 | 580 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
581 | 581 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
582 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
583 | - if ($this->all_flights[$id]['addedSpotter'] == 0) { |
|
584 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
585 | - //print_r($this->all_flights); |
|
586 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
587 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
588 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
582 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
583 | + if ($this->all_flights[$id]['addedSpotter'] == 0) { |
|
584 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
585 | + //print_r($this->all_flights); |
|
586 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
587 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
588 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
589 | 589 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
590 | 590 | $timeelapsed = microtime(true); |
591 | 591 | $SpotterLive = new SpotterLive($this->db); |
592 | 592 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
593 | - $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
|
594 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
593 | + $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
|
594 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
595 | 595 | } elseif (isset($line['id'])) { |
596 | - $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
597 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
596 | + $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
597 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
598 | 598 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
599 | - $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
|
600 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
599 | + $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
|
600 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
601 | 601 | } else $recent_ident = ''; |
602 | 602 | $SpotterLive->db=null; |
603 | 603 | |
604 | 604 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
605 | 605 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
606 | - } else { |
|
606 | + } else { |
|
607 | 607 | $recent_ident = ''; |
608 | 608 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
609 | - } |
|
610 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
611 | - if($recent_ident == "") |
|
612 | - { |
|
609 | + } |
|
610 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
611 | + if($recent_ident == "") |
|
612 | + { |
|
613 | 613 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
614 | 614 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
615 | 615 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
616 | 616 | //adds the spotter data for the archive |
617 | 617 | $ignoreImport = false; |
618 | 618 | foreach($globalAirportIgnore as $airportIgnore) { |
619 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
619 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
620 | 620 | $ignoreImport = true; |
621 | - } |
|
621 | + } |
|
622 | 622 | } |
623 | 623 | if (count($globalAirportAccept) > 0) { |
624 | - $ignoreImport = true; |
|
625 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
624 | + $ignoreImport = true; |
|
625 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
626 | 626 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
627 | - $ignoreImport = false; |
|
627 | + $ignoreImport = false; |
|
628 | + } |
|
628 | 629 | } |
629 | - } |
|
630 | 630 | } |
631 | 631 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
632 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
632 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
633 | 633 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
634 | - $ignoreImport = true; |
|
634 | + $ignoreImport = true; |
|
635 | + } |
|
635 | 636 | } |
636 | - } |
|
637 | 637 | } |
638 | 638 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
639 | - $ignoreImport = true; |
|
640 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
639 | + $ignoreImport = true; |
|
640 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
641 | 641 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
642 | - $ignoreImport = false; |
|
642 | + $ignoreImport = false; |
|
643 | + } |
|
643 | 644 | } |
644 | - } |
|
645 | 645 | } |
646 | 646 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
647 | - $ignoreImport = true; |
|
648 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
647 | + $ignoreImport = true; |
|
648 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
649 | 649 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
650 | - $ignoreImport = false; |
|
650 | + $ignoreImport = false; |
|
651 | + } |
|
651 | 652 | } |
652 | - } |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | if (!$ignoreImport) { |
656 | - $highlight = ''; |
|
657 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
658 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
659 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
660 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
661 | - $timeelapsed = microtime(true); |
|
662 | - $Spotter = new Spotter($this->db); |
|
663 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
664 | - $Spotter->db = null; |
|
665 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
666 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
656 | + $highlight = ''; |
|
657 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
658 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
659 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
660 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
661 | + $timeelapsed = microtime(true); |
|
662 | + $Spotter = new Spotter($this->db); |
|
663 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
664 | + $Spotter->db = null; |
|
665 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
666 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
667 | 667 | |
668 | - // Add source stat in DB |
|
669 | - $Stats = new Stats($this->db); |
|
670 | - if (!empty($this->stats)) { |
|
668 | + // Add source stat in DB |
|
669 | + $Stats = new Stats($this->db); |
|
670 | + if (!empty($this->stats)) { |
|
671 | 671 | if ($globalDebug) echo 'Add source stats : '; |
672 | - foreach($this->stats as $date => $data) { |
|
673 | - foreach($data as $source => $sourced) { |
|
674 | - //print_r($sourced); |
|
675 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
676 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
677 | - if (isset($sourced['msg'])) { |
|
678 | - if (time() - $sourced['msg']['date'] > 10) { |
|
679 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
680 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
681 | - unset($this->stats[$date][$source]['msg']); |
|
682 | - } |
|
683 | - } |
|
684 | - } |
|
685 | - if ($date != date('Y-m-d')) { |
|
686 | - unset($this->stats[$date]); |
|
687 | - } |
|
688 | - } |
|
689 | - if ($globalDebug) echo 'Done'."\n"; |
|
690 | - |
|
691 | - } |
|
692 | - $Stats->db = null; |
|
672 | + foreach($this->stats as $date => $data) { |
|
673 | + foreach($data as $source => $sourced) { |
|
674 | + //print_r($sourced); |
|
675 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
676 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
677 | + if (isset($sourced['msg'])) { |
|
678 | + if (time() - $sourced['msg']['date'] > 10) { |
|
679 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
680 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
681 | + unset($this->stats[$date][$source]['msg']); |
|
682 | + } |
|
683 | + } |
|
684 | + } |
|
685 | + if ($date != date('Y-m-d')) { |
|
686 | + unset($this->stats[$date]); |
|
687 | + } |
|
688 | + } |
|
689 | + if ($globalDebug) echo 'Done'."\n"; |
|
690 | + |
|
691 | + } |
|
692 | + $Stats->db = null; |
|
693 | 693 | |
694 | - $this->del(); |
|
694 | + $this->del(); |
|
695 | 695 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
696 | 696 | //$ignoreImport = false; |
697 | 697 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -709,18 +709,18 @@ discard block |
||
709 | 709 | */ |
710 | 710 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
711 | 711 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
712 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
713 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
714 | - $SpotterLive = new SpotterLive($this->db); |
|
715 | - $SpotterLive->deleteLiveSpotterData(); |
|
716 | - $SpotterLive->db=null; |
|
717 | - if ($globalDebug) echo " Done\n"; |
|
718 | - $this->last_delete = time(); |
|
712 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
713 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
714 | + $SpotterLive = new SpotterLive($this->db); |
|
715 | + $SpotterLive->deleteLiveSpotterData(); |
|
716 | + $SpotterLive->db=null; |
|
717 | + if ($globalDebug) echo " Done\n"; |
|
718 | + $this->last_delete = time(); |
|
719 | 719 | } |
720 | - } else { |
|
720 | + } else { |
|
721 | 721 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
722 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
723 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
722 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
723 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
724 | 724 | } |
725 | 725 | if (isset($globalDaemon) && !$globalDaemon) { |
726 | 726 | $Spotter = new Spotter($this->db); |
@@ -728,14 +728,14 @@ discard block |
||
728 | 728 | $Spotter->db = null; |
729 | 729 | } |
730 | 730 | |
731 | - } |
|
731 | + } |
|
732 | + } |
|
732 | 733 | } |
733 | - } |
|
734 | - //adds the spotter LIVE data |
|
735 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
736 | - //echo "\nAdd in Live !! \n"; |
|
737 | - //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
738 | - if ($globalDebug) { |
|
734 | + //adds the spotter LIVE data |
|
735 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
736 | + //echo "\nAdd in Live !! \n"; |
|
737 | + //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
738 | + if ($globalDebug) { |
|
739 | 739 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
740 | 740 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
741 | 741 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
@@ -743,49 +743,49 @@ discard block |
||
743 | 743 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
744 | 744 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
745 | 745 | } |
746 | - } |
|
747 | - $ignoreImport = false; |
|
748 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
749 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
746 | + } |
|
747 | + $ignoreImport = false; |
|
748 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
749 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
750 | 750 | |
751 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
752 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
753 | - $ignoreImport = true; |
|
751 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
752 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
753 | + $ignoreImport = true; |
|
754 | + } |
|
754 | 755 | } |
755 | - } |
|
756 | - if (count($globalAirportAccept) > 0) { |
|
757 | - $ignoreImport = true; |
|
758 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
759 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
756 | + if (count($globalAirportAccept) > 0) { |
|
757 | + $ignoreImport = true; |
|
758 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
759 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
760 | 760 | $ignoreImport = false; |
761 | - } |
|
761 | + } |
|
762 | 762 | } |
763 | - } |
|
764 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
763 | + } |
|
764 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
765 | 765 | foreach($globalAirlineIgnore as $airlineIgnore) { |
766 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
766 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
767 | 767 | $ignoreImport = true; |
768 | - } |
|
768 | + } |
|
769 | 769 | } |
770 | - } |
|
771 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
770 | + } |
|
771 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
772 | 772 | $ignoreImport = true; |
773 | 773 | foreach($globalAirlineAccept as $airlineAccept) { |
774 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
774 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
775 | 775 | $ignoreImport = false; |
776 | - } |
|
776 | + } |
|
777 | 777 | } |
778 | - } |
|
779 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
778 | + } |
|
779 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
780 | 780 | $ignoreImport = true; |
781 | 781 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
782 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
783 | - $ignoreImport = false; |
|
784 | - } |
|
782 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
783 | + $ignoreImport = false; |
|
784 | + } |
|
785 | + } |
|
785 | 786 | } |
786 | - } |
|
787 | 787 | |
788 | - if (!$ignoreImport) { |
|
788 | + if (!$ignoreImport) { |
|
789 | 789 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
790 | 790 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
791 | 791 | $timeelapsed = microtime(true); |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | if ($stats_heading == 16) $stats_heading = 0; |
824 | 824 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
825 | 825 | for ($i=0;$i<=15;$i++) { |
826 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
826 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
827 | 827 | } |
828 | 828 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
829 | 829 | } else { |
@@ -836,11 +836,11 @@ discard block |
||
836 | 836 | //var_dump($this->stats); |
837 | 837 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
838 | 838 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
839 | - end($this->stats[$current_date][$source]['hist']); |
|
840 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
839 | + end($this->stats[$current_date][$source]['hist']); |
|
840 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
841 | 841 | } else $mini = 0; |
842 | 842 | for ($i=$mini;$i<=$distance;$i+=10) { |
843 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
843 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
844 | 844 | } |
845 | 845 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
846 | 846 | } else { |
@@ -857,22 +857,22 @@ discard block |
||
857 | 857 | |
858 | 858 | |
859 | 859 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
860 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
861 | - $SpotterLive = new SpotterLive($this->db); |
|
862 | - $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
863 | - $SpotterLive->db = null; |
|
864 | - //SpotterLive->deleteLiveSpotterData(); |
|
865 | - if ($globalDebug) echo " Done\n"; |
|
866 | - $this->last_delete_hourly = time(); |
|
860 | + if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
861 | + $SpotterLive = new SpotterLive($this->db); |
|
862 | + $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
863 | + $SpotterLive->db = null; |
|
864 | + //SpotterLive->deleteLiveSpotterData(); |
|
865 | + if ($globalDebug) echo " Done\n"; |
|
866 | + $this->last_delete_hourly = time(); |
|
867 | 867 | } |
868 | 868 | |
869 | - } |
|
870 | - //$ignoreImport = false; |
|
869 | + } |
|
870 | + //$ignoreImport = false; |
|
871 | 871 | } |
872 | 872 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
873 | 873 | if ($send) return $this->all_flights[$id]; |
874 | - } |
|
874 | + } |
|
875 | + } |
|
875 | 876 | } |
876 | - } |
|
877 | 877 | } |
878 | 878 | ?> |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
16 | - * Get SQL query part for filter used |
|
17 | - * @param Array $filter the filter |
|
18 | - * @return Array the SQL part |
|
19 | - */ |
|
16 | + * Get SQL query part for filter used |
|
17 | + * @param Array $filter the filter |
|
18 | + * @return Array the SQL part |
|
19 | + */ |
|
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
22 | 22 | $filters = array(); |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | - * Executes the SQL statements to get the spotter information |
|
88 | - * |
|
89 | - * @param String $query the SQL query |
|
90 | - * @param Array $params parameter of the query |
|
91 | - * @param String $limitQuery the limit query |
|
92 | - * @return Array the spotter information |
|
93 | - * |
|
94 | - */ |
|
87 | + * Executes the SQL statements to get the spotter information |
|
88 | + * |
|
89 | + * @param String $query the SQL query |
|
90 | + * @param Array $params parameter of the query |
|
91 | + * @param String $limitQuery the limit query |
|
92 | + * @return Array the spotter information |
|
93 | + * |
|
94 | + */ |
|
95 | 95 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
96 | 96 | { |
97 | 97 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
256 | 256 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
257 | 257 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
258 | - } else { |
|
259 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
258 | + } else { |
|
259 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
260 | 260 | $temp_array['aircraft_name'] = 'N/A'; |
261 | 261 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
262 | - } |
|
262 | + } |
|
263 | 263 | } |
264 | 264 | $fromsource = NULL; |
265 | 265 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -455,11 +455,11 @@ discard block |
||
455 | 455 | |
456 | 456 | |
457 | 457 | /** |
458 | - * Gets all the spotter information |
|
459 | - * |
|
460 | - * @return Array the spotter information |
|
461 | - * |
|
462 | - */ |
|
458 | + * Gets all the spotter information |
|
459 | + * |
|
460 | + * @return Array the spotter information |
|
461 | + * |
|
462 | + */ |
|
463 | 463 | 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()) |
464 | 464 | { |
465 | 465 | global $globalTimezone, $globalDBdriver; |
@@ -806,11 +806,11 @@ discard block |
||
806 | 806 | |
807 | 807 | |
808 | 808 | /** |
809 | - * Gets all the spotter information based on the latest data entry |
|
810 | - * |
|
811 | - * @return Array the spotter information |
|
812 | - * |
|
813 | - */ |
|
809 | + * Gets all the spotter information based on the latest data entry |
|
810 | + * |
|
811 | + * @return Array the spotter information |
|
812 | + * |
|
813 | + */ |
|
814 | 814 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
815 | 815 | { |
816 | 816 | global $global_query; |
@@ -849,12 +849,12 @@ discard block |
||
849 | 849 | } |
850 | 850 | |
851 | 851 | |
852 | - /** |
|
853 | - * Gets all the spotter information based on a user's latitude and longitude |
|
854 | - * |
|
855 | - * @return Array the spotter information |
|
856 | - * |
|
857 | - */ |
|
852 | + /** |
|
853 | + * Gets all the spotter information based on a user's latitude and longitude |
|
854 | + * |
|
855 | + * @return Array the spotter information |
|
856 | + * |
|
857 | + */ |
|
858 | 858 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
859 | 859 | { |
860 | 860 | date_default_timezone_set('UTC'); |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | return false; |
883 | 883 | } |
884 | 884 | } |
885 | - $additional_query = ''; |
|
885 | + $additional_query = ''; |
|
886 | 886 | if ($interval != "") |
887 | 887 | { |
888 | 888 | if (!is_string($interval)) |
@@ -922,12 +922,12 @@ discard block |
||
922 | 922 | } |
923 | 923 | |
924 | 924 | |
925 | - /** |
|
926 | - * Gets all the spotter information sorted by the newest aircraft type |
|
927 | - * |
|
928 | - * @return Array the spotter information |
|
929 | - * |
|
930 | - */ |
|
925 | + /** |
|
926 | + * Gets all the spotter information sorted by the newest aircraft type |
|
927 | + * |
|
928 | + * @return Array the spotter information |
|
929 | + * |
|
930 | + */ |
|
931 | 931 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
932 | 932 | { |
933 | 933 | global $global_query; |
@@ -968,11 +968,11 @@ discard block |
||
968 | 968 | |
969 | 969 | |
970 | 970 | /** |
971 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
972 | - * |
|
973 | - * @return Array the spotter information |
|
974 | - * |
|
975 | - */ |
|
971 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
972 | + * |
|
973 | + * @return Array the spotter information |
|
974 | + * |
|
975 | + */ |
|
976 | 976 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
977 | 977 | { |
978 | 978 | global $global_query; |
@@ -1012,11 +1012,11 @@ discard block |
||
1012 | 1012 | |
1013 | 1013 | |
1014 | 1014 | /** |
1015 | - * Gets all the spotter information sorted by the newest airline |
|
1016 | - * |
|
1017 | - * @return Array the spotter information |
|
1018 | - * |
|
1019 | - */ |
|
1015 | + * Gets all the spotter information sorted by the newest airline |
|
1016 | + * |
|
1017 | + * @return Array the spotter information |
|
1018 | + * |
|
1019 | + */ |
|
1020 | 1020 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
1021 | 1021 | { |
1022 | 1022 | global $global_query; |
@@ -1055,12 +1055,12 @@ discard block |
||
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
1058 | - /** |
|
1059 | - * Gets all the spotter information sorted by the newest departure airport |
|
1060 | - * |
|
1061 | - * @return Array the spotter information |
|
1062 | - * |
|
1063 | - */ |
|
1058 | + /** |
|
1059 | + * Gets all the spotter information sorted by the newest departure airport |
|
1060 | + * |
|
1061 | + * @return Array the spotter information |
|
1062 | + * |
|
1063 | + */ |
|
1064 | 1064 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
1065 | 1065 | { |
1066 | 1066 | global $global_query; |
@@ -1102,11 +1102,11 @@ discard block |
||
1102 | 1102 | |
1103 | 1103 | |
1104 | 1104 | /** |
1105 | - * Gets all the spotter information sorted by the newest arrival airport |
|
1106 | - * |
|
1107 | - * @return Array the spotter information |
|
1108 | - * |
|
1109 | - */ |
|
1105 | + * Gets all the spotter information sorted by the newest arrival airport |
|
1106 | + * |
|
1107 | + * @return Array the spotter information |
|
1108 | + * |
|
1109 | + */ |
|
1110 | 1110 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
1111 | 1111 | { |
1112 | 1112 | global $global_query; |
@@ -1145,11 +1145,11 @@ discard block |
||
1145 | 1145 | |
1146 | 1146 | |
1147 | 1147 | /** |
1148 | - * Gets all the spotter information based on the spotter id |
|
1149 | - * |
|
1150 | - * @return Array the spotter information |
|
1151 | - * |
|
1152 | - */ |
|
1148 | + * Gets all the spotter information based on the spotter id |
|
1149 | + * |
|
1150 | + * @return Array the spotter information |
|
1151 | + * |
|
1152 | + */ |
|
1153 | 1153 | public function getSpotterDataByID($id = '') |
1154 | 1154 | { |
1155 | 1155 | global $global_query; |
@@ -1171,11 +1171,11 @@ discard block |
||
1171 | 1171 | |
1172 | 1172 | |
1173 | 1173 | /** |
1174 | - * Gets all the spotter information based on the callsign |
|
1175 | - * |
|
1176 | - * @return Array the spotter information |
|
1177 | - * |
|
1178 | - */ |
|
1174 | + * Gets all the spotter information based on the callsign |
|
1175 | + * |
|
1176 | + * @return Array the spotter information |
|
1177 | + * |
|
1178 | + */ |
|
1179 | 1179 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
1180 | 1180 | { |
1181 | 1181 | global $global_query; |
@@ -1228,11 +1228,11 @@ discard block |
||
1228 | 1228 | |
1229 | 1229 | |
1230 | 1230 | /** |
1231 | - * Gets all the spotter information based on the aircraft type |
|
1232 | - * |
|
1233 | - * @return Array the spotter information |
|
1234 | - * |
|
1235 | - */ |
|
1231 | + * Gets all the spotter information based on the aircraft type |
|
1232 | + * |
|
1233 | + * @return Array the spotter information |
|
1234 | + * |
|
1235 | + */ |
|
1236 | 1236 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
1237 | 1237 | { |
1238 | 1238 | global $global_query; |
@@ -1286,11 +1286,11 @@ discard block |
||
1286 | 1286 | |
1287 | 1287 | |
1288 | 1288 | /** |
1289 | - * Gets all the spotter information based on the aircraft registration |
|
1290 | - * |
|
1291 | - * @return Array the spotter information |
|
1292 | - * |
|
1293 | - */ |
|
1289 | + * Gets all the spotter information based on the aircraft registration |
|
1290 | + * |
|
1291 | + * @return Array the spotter information |
|
1292 | + * |
|
1293 | + */ |
|
1294 | 1294 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
1295 | 1295 | { |
1296 | 1296 | global $global_query; |
@@ -1347,11 +1347,11 @@ discard block |
||
1347 | 1347 | |
1348 | 1348 | |
1349 | 1349 | /** |
1350 | - * Gets all the spotter information based on the airline |
|
1351 | - * |
|
1352 | - * @return Array the spotter information |
|
1353 | - * |
|
1354 | - */ |
|
1350 | + * Gets all the spotter information based on the airline |
|
1351 | + * |
|
1352 | + * @return Array the spotter information |
|
1353 | + * |
|
1354 | + */ |
|
1355 | 1355 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
1356 | 1356 | { |
1357 | 1357 | global $global_query; |
@@ -1404,11 +1404,11 @@ discard block |
||
1404 | 1404 | |
1405 | 1405 | |
1406 | 1406 | /** |
1407 | - * Gets all the spotter information based on the airport |
|
1408 | - * |
|
1409 | - * @return Array the spotter information |
|
1410 | - * |
|
1411 | - */ |
|
1407 | + * Gets all the spotter information based on the airport |
|
1408 | + * |
|
1409 | + * @return Array the spotter information |
|
1410 | + * |
|
1411 | + */ |
|
1412 | 1412 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
1413 | 1413 | { |
1414 | 1414 | global $global_query; |
@@ -1462,11 +1462,11 @@ discard block |
||
1462 | 1462 | |
1463 | 1463 | |
1464 | 1464 | /** |
1465 | - * Gets all the spotter information based on the date |
|
1466 | - * |
|
1467 | - * @return Array the spotter information |
|
1468 | - * |
|
1469 | - */ |
|
1465 | + * Gets all the spotter information based on the date |
|
1466 | + * |
|
1467 | + * @return Array the spotter information |
|
1468 | + * |
|
1469 | + */ |
|
1470 | 1470 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
1471 | 1471 | { |
1472 | 1472 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1530,11 +1530,11 @@ discard block |
||
1530 | 1530 | |
1531 | 1531 | |
1532 | 1532 | /** |
1533 | - * Gets all the spotter information based on the country name |
|
1534 | - * |
|
1535 | - * @return Array the spotter information |
|
1536 | - * |
|
1537 | - */ |
|
1533 | + * Gets all the spotter information based on the country name |
|
1534 | + * |
|
1535 | + * @return Array the spotter information |
|
1536 | + * |
|
1537 | + */ |
|
1538 | 1538 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
1539 | 1539 | { |
1540 | 1540 | global $global_query; |
@@ -1588,11 +1588,11 @@ discard block |
||
1588 | 1588 | |
1589 | 1589 | |
1590 | 1590 | /** |
1591 | - * Gets all the spotter information based on the manufacturer name |
|
1592 | - * |
|
1593 | - * @return Array the spotter information |
|
1594 | - * |
|
1595 | - */ |
|
1591 | + * Gets all the spotter information based on the manufacturer name |
|
1592 | + * |
|
1593 | + * @return Array the spotter information |
|
1594 | + * |
|
1595 | + */ |
|
1596 | 1596 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
1597 | 1597 | { |
1598 | 1598 | global $global_query; |
@@ -1648,13 +1648,13 @@ discard block |
||
1648 | 1648 | |
1649 | 1649 | |
1650 | 1650 | /** |
1651 | - * Gets a list of all aircraft that take a route |
|
1652 | - * |
|
1653 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
1654 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
1655 | - * @return Array the spotter information |
|
1656 | - * |
|
1657 | - */ |
|
1651 | + * Gets a list of all aircraft that take a route |
|
1652 | + * |
|
1653 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
1654 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
1655 | + * @return Array the spotter information |
|
1656 | + * |
|
1657 | + */ |
|
1658 | 1658 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
1659 | 1659 | { |
1660 | 1660 | global $global_query; |
@@ -1723,11 +1723,11 @@ discard block |
||
1723 | 1723 | |
1724 | 1724 | |
1725 | 1725 | /** |
1726 | - * Gets all the spotter information based on the special column in the table |
|
1727 | - * |
|
1728 | - * @return Array the spotter information |
|
1729 | - * |
|
1730 | - */ |
|
1726 | + * Gets all the spotter information based on the special column in the table |
|
1727 | + * |
|
1728 | + * @return Array the spotter information |
|
1729 | + * |
|
1730 | + */ |
|
1731 | 1731 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
1732 | 1732 | { |
1733 | 1733 | global $global_query; |
@@ -1766,11 +1766,11 @@ discard block |
||
1766 | 1766 | } |
1767 | 1767 | |
1768 | 1768 | /** |
1769 | - * Gets all the highlight based on a aircraft registration |
|
1770 | - * |
|
1771 | - * @return String the highlight text |
|
1772 | - * |
|
1773 | - */ |
|
1769 | + * Gets all the highlight based on a aircraft registration |
|
1770 | + * |
|
1771 | + * @return String the highlight text |
|
1772 | + * |
|
1773 | + */ |
|
1774 | 1774 | public function getHighlightByRegistration($registration,$filter = array()) |
1775 | 1775 | { |
1776 | 1776 | global $global_query; |
@@ -1792,13 +1792,13 @@ discard block |
||
1792 | 1792 | |
1793 | 1793 | |
1794 | 1794 | /** |
1795 | - * Gets the squawk usage from squawk code |
|
1796 | - * |
|
1797 | - * @param String $squawk squawk code |
|
1798 | - * @param String $country country |
|
1799 | - * @return String usage |
|
1800 | - * |
|
1801 | - */ |
|
1795 | + * Gets the squawk usage from squawk code |
|
1796 | + * |
|
1797 | + * @param String $squawk squawk code |
|
1798 | + * @param String $country country |
|
1799 | + * @return String usage |
|
1800 | + * |
|
1801 | + */ |
|
1802 | 1802 | public function getSquawkUsage($squawk = '',$country = 'FR') |
1803 | 1803 | { |
1804 | 1804 | |
@@ -1819,12 +1819,12 @@ discard block |
||
1819 | 1819 | } |
1820 | 1820 | |
1821 | 1821 | /** |
1822 | - * Gets the airport icao from the iata |
|
1823 | - * |
|
1824 | - * @param String $airport_iata the iata code of the airport |
|
1825 | - * @return String airport iata |
|
1826 | - * |
|
1827 | - */ |
|
1822 | + * Gets the airport icao from the iata |
|
1823 | + * |
|
1824 | + * @param String $airport_iata the iata code of the airport |
|
1825 | + * @return String airport iata |
|
1826 | + * |
|
1827 | + */ |
|
1828 | 1828 | public function getAirportIcao($airport_iata = '') |
1829 | 1829 | { |
1830 | 1830 | |
@@ -1844,14 +1844,14 @@ discard block |
||
1844 | 1844 | } |
1845 | 1845 | |
1846 | 1846 | /** |
1847 | - * Gets the airport distance |
|
1848 | - * |
|
1849 | - * @param String $airport_icao the icao code of the airport |
|
1850 | - * @param Float $latitude the latitude |
|
1851 | - * @param Float $longitude the longitude |
|
1852 | - * @return Float distance to the airport |
|
1853 | - * |
|
1854 | - */ |
|
1847 | + * Gets the airport distance |
|
1848 | + * |
|
1849 | + * @param String $airport_icao the icao code of the airport |
|
1850 | + * @param Float $latitude the latitude |
|
1851 | + * @param Float $longitude the longitude |
|
1852 | + * @return Float distance to the airport |
|
1853 | + * |
|
1854 | + */ |
|
1855 | 1855 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
1856 | 1856 | { |
1857 | 1857 | |
@@ -1872,12 +1872,12 @@ discard block |
||
1872 | 1872 | } |
1873 | 1873 | |
1874 | 1874 | /** |
1875 | - * Gets the airport info based on the icao |
|
1876 | - * |
|
1877 | - * @param String $airport the icao code of the airport |
|
1878 | - * @return Array airport information |
|
1879 | - * |
|
1880 | - */ |
|
1875 | + * Gets the airport info based on the icao |
|
1876 | + * |
|
1877 | + * @param String $airport the icao code of the airport |
|
1878 | + * @return Array airport information |
|
1879 | + * |
|
1880 | + */ |
|
1881 | 1881 | public function getAllAirportInfo($airport = '') |
1882 | 1882 | { |
1883 | 1883 | |
@@ -1923,12 +1923,12 @@ discard block |
||
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | /** |
1926 | - * Gets the airport info based on the country |
|
1927 | - * |
|
1928 | - * @param Array $countries Airports countries |
|
1929 | - * @return Array airport information |
|
1930 | - * |
|
1931 | - */ |
|
1926 | + * Gets the airport info based on the country |
|
1927 | + * |
|
1928 | + * @param Array $countries Airports countries |
|
1929 | + * @return Array airport information |
|
1930 | + * |
|
1931 | + */ |
|
1932 | 1932 | public function getAllAirportInfobyCountry($countries) |
1933 | 1933 | { |
1934 | 1934 | $lst_countries = ''; |
@@ -1966,12 +1966,12 @@ discard block |
||
1966 | 1966 | } |
1967 | 1967 | |
1968 | 1968 | /** |
1969 | - * Gets airports info based on the coord |
|
1970 | - * |
|
1971 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
1972 | - * @return Array airport information |
|
1973 | - * |
|
1974 | - */ |
|
1969 | + * Gets airports info based on the coord |
|
1970 | + * |
|
1971 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
1972 | + * @return Array airport information |
|
1973 | + * |
|
1974 | + */ |
|
1975 | 1975 | public function getAllAirportInfobyCoord($coord) |
1976 | 1976 | { |
1977 | 1977 | global $globalDBdriver; |
@@ -2002,12 +2002,12 @@ discard block |
||
2002 | 2002 | } |
2003 | 2003 | |
2004 | 2004 | /** |
2005 | - * Gets waypoints info based on the coord |
|
2006 | - * |
|
2007 | - * @param Array $coord waypoints coord |
|
2008 | - * @return Array airport information |
|
2009 | - * |
|
2010 | - */ |
|
2005 | + * Gets waypoints info based on the coord |
|
2006 | + * |
|
2007 | + * @param Array $coord waypoints coord |
|
2008 | + * @return Array airport information |
|
2009 | + * |
|
2010 | + */ |
|
2011 | 2011 | public function getAllWaypointsInfobyCoord($coord) |
2012 | 2012 | { |
2013 | 2013 | if (is_array($coord)) { |
@@ -2041,12 +2041,12 @@ discard block |
||
2041 | 2041 | |
2042 | 2042 | |
2043 | 2043 | /** |
2044 | - * Gets the airline info based on the icao code or iata code |
|
2045 | - * |
|
2046 | - * @param String $airline_icao the iata code of the airport |
|
2047 | - * @return Array airport information |
|
2048 | - * |
|
2049 | - */ |
|
2044 | + * Gets the airline info based on the icao code or iata code |
|
2045 | + * |
|
2046 | + * @param String $airline_icao the iata code of the airport |
|
2047 | + * @return Array airport information |
|
2048 | + * |
|
2049 | + */ |
|
2050 | 2050 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
2051 | 2051 | { |
2052 | 2052 | global $globalUseRealAirlines; |
@@ -2077,7 +2077,7 @@ discard block |
||
2077 | 2077 | } else { |
2078 | 2078 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
2079 | 2079 | } |
2080 | - /* |
|
2080 | + /* |
|
2081 | 2081 | $airline_array = array(); |
2082 | 2082 | $temp_array = array(); |
2083 | 2083 | |
@@ -2109,12 +2109,12 @@ discard block |
||
2109 | 2109 | |
2110 | 2110 | |
2111 | 2111 | /** |
2112 | - * Gets the aircraft info based on the aircraft type |
|
2113 | - * |
|
2114 | - * @param String $aircraft_type the aircraft type |
|
2115 | - * @return Array aircraft information |
|
2116 | - * |
|
2117 | - */ |
|
2112 | + * Gets the aircraft info based on the aircraft type |
|
2113 | + * |
|
2114 | + * @param String $aircraft_type the aircraft type |
|
2115 | + * @return Array aircraft information |
|
2116 | + * |
|
2117 | + */ |
|
2118 | 2118 | public function getAllAircraftInfo($aircraft_type) |
2119 | 2119 | { |
2120 | 2120 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2146,12 +2146,12 @@ discard block |
||
2146 | 2146 | } |
2147 | 2147 | |
2148 | 2148 | /** |
2149 | - * Gets the aircraft icao based on the aircraft name/type |
|
2150 | - * |
|
2151 | - * @param String $aircraft_type the aircraft type |
|
2152 | - * @return String aircraft information |
|
2153 | - * |
|
2154 | - */ |
|
2149 | + * Gets the aircraft icao based on the aircraft name/type |
|
2150 | + * |
|
2151 | + * @param String $aircraft_type the aircraft type |
|
2152 | + * @return String aircraft information |
|
2153 | + * |
|
2154 | + */ |
|
2155 | 2155 | public function getAircraftIcao($aircraft_type) |
2156 | 2156 | { |
2157 | 2157 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2176,12 +2176,12 @@ discard block |
||
2176 | 2176 | } |
2177 | 2177 | |
2178 | 2178 | /** |
2179 | - * Gets the aircraft info based on the aircraft modes |
|
2180 | - * |
|
2181 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
2182 | - * @return String aircraft type |
|
2183 | - * |
|
2184 | - */ |
|
2179 | + * Gets the aircraft info based on the aircraft modes |
|
2180 | + * |
|
2181 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
2182 | + * @return String aircraft type |
|
2183 | + * |
|
2184 | + */ |
|
2185 | 2185 | public function getAllAircraftType($aircraft_modes) |
2186 | 2186 | { |
2187 | 2187 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2199,12 +2199,12 @@ discard block |
||
2199 | 2199 | } |
2200 | 2200 | |
2201 | 2201 | /** |
2202 | - * Gets the aircraft info based on the aircraft registration |
|
2203 | - * |
|
2204 | - * @param String $registration the aircraft registration |
|
2205 | - * @return String aircraft type |
|
2206 | - * |
|
2207 | - */ |
|
2202 | + * Gets the aircraft info based on the aircraft registration |
|
2203 | + * |
|
2204 | + * @param String $registration the aircraft registration |
|
2205 | + * @return String aircraft type |
|
2206 | + * |
|
2207 | + */ |
|
2208 | 2208 | public function getAllAircraftTypeByRegistration($registration) |
2209 | 2209 | { |
2210 | 2210 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2222,12 +2222,12 @@ discard block |
||
2222 | 2222 | } |
2223 | 2223 | |
2224 | 2224 | /** |
2225 | - * Gets correct aircraft operator corde |
|
2226 | - * |
|
2227 | - * @param String $operator the aircraft operator code (callsign) |
|
2228 | - * @return String aircraft operator code |
|
2229 | - * |
|
2230 | - */ |
|
2225 | + * Gets correct aircraft operator corde |
|
2226 | + * |
|
2227 | + * @param String $operator the aircraft operator code (callsign) |
|
2228 | + * @return String aircraft operator code |
|
2229 | + * |
|
2230 | + */ |
|
2231 | 2231 | public function getOperator($operator) |
2232 | 2232 | { |
2233 | 2233 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2244,16 +2244,16 @@ discard block |
||
2244 | 2244 | } |
2245 | 2245 | |
2246 | 2246 | /** |
2247 | - * Gets the aircraft route based on the aircraft callsign |
|
2248 | - * |
|
2249 | - * @param String $callsign the aircraft callsign |
|
2250 | - * @return Array aircraft type |
|
2251 | - * |
|
2252 | - */ |
|
2247 | + * Gets the aircraft route based on the aircraft callsign |
|
2248 | + * |
|
2249 | + * @param String $callsign the aircraft callsign |
|
2250 | + * @return Array aircraft type |
|
2251 | + * |
|
2252 | + */ |
|
2253 | 2253 | public function getRouteInfo($callsign) |
2254 | 2254 | { |
2255 | 2255 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
2256 | - if ($callsign == '') return array(); |
|
2256 | + if ($callsign == '') return array(); |
|
2257 | 2257 | $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"; |
2258 | 2258 | |
2259 | 2259 | $sth = $this->db->prepare($query); |
@@ -2267,12 +2267,12 @@ discard block |
||
2267 | 2267 | } |
2268 | 2268 | |
2269 | 2269 | /** |
2270 | - * Gets the aircraft info based on the aircraft registration |
|
2271 | - * |
|
2272 | - * @param String $registration the aircraft registration |
|
2273 | - * @return Array aircraft information |
|
2274 | - * |
|
2275 | - */ |
|
2270 | + * Gets the aircraft info based on the aircraft registration |
|
2271 | + * |
|
2272 | + * @param String $registration the aircraft registration |
|
2273 | + * @return Array aircraft information |
|
2274 | + * |
|
2275 | + */ |
|
2276 | 2276 | public function getAircraftInfoByRegistration($registration) |
2277 | 2277 | { |
2278 | 2278 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2299,12 +2299,12 @@ discard block |
||
2299 | 2299 | } |
2300 | 2300 | |
2301 | 2301 | /** |
2302 | - * Gets the aircraft owner & base based on the aircraft registration |
|
2303 | - * |
|
2304 | - * @param String $registration the aircraft registration |
|
2305 | - * @return Array aircraft information |
|
2306 | - * |
|
2307 | - */ |
|
2302 | + * Gets the aircraft owner & base based on the aircraft registration |
|
2303 | + * |
|
2304 | + * @param String $registration the aircraft registration |
|
2305 | + * @return Array aircraft information |
|
2306 | + * |
|
2307 | + */ |
|
2308 | 2308 | public function getAircraftOwnerByRegistration($registration) |
2309 | 2309 | { |
2310 | 2310 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2321,11 +2321,11 @@ discard block |
||
2321 | 2321 | |
2322 | 2322 | |
2323 | 2323 | /** |
2324 | - * Gets all flights (but with only little info) |
|
2325 | - * |
|
2326 | - * @return Array basic flight information |
|
2327 | - * |
|
2328 | - */ |
|
2324 | + * Gets all flights (but with only little info) |
|
2325 | + * |
|
2326 | + * @return Array basic flight information |
|
2327 | + * |
|
2328 | + */ |
|
2329 | 2329 | public function getAllFlightsforSitemap() |
2330 | 2330 | { |
2331 | 2331 | //$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 "; |
@@ -2333,7 +2333,7 @@ discard block |
||
2333 | 2333 | |
2334 | 2334 | $sth = $this->db->prepare($query); |
2335 | 2335 | $sth->execute(); |
2336 | - /* |
|
2336 | + /* |
|
2337 | 2337 | $flight_array = array(); |
2338 | 2338 | $temp_array = array(); |
2339 | 2339 | |
@@ -2355,11 +2355,11 @@ discard block |
||
2355 | 2355 | } |
2356 | 2356 | |
2357 | 2357 | /** |
2358 | - * Gets a list of all aircraft manufacturers |
|
2359 | - * |
|
2360 | - * @return Array list of aircraft types |
|
2361 | - * |
|
2362 | - */ |
|
2358 | + * Gets a list of all aircraft manufacturers |
|
2359 | + * |
|
2360 | + * @return Array list of aircraft types |
|
2361 | + * |
|
2362 | + */ |
|
2363 | 2363 | public function getAllManufacturers() |
2364 | 2364 | { |
2365 | 2365 | /* |
@@ -2388,11 +2388,11 @@ discard block |
||
2388 | 2388 | |
2389 | 2389 | |
2390 | 2390 | /** |
2391 | - * Gets a list of all aircraft types |
|
2392 | - * |
|
2393 | - * @return Array list of aircraft types |
|
2394 | - * |
|
2395 | - */ |
|
2391 | + * Gets a list of all aircraft types |
|
2392 | + * |
|
2393 | + * @return Array list of aircraft types |
|
2394 | + * |
|
2395 | + */ |
|
2396 | 2396 | public function getAllAircraftTypes($filters = array()) |
2397 | 2397 | { |
2398 | 2398 | /* |
@@ -2427,11 +2427,11 @@ discard block |
||
2427 | 2427 | |
2428 | 2428 | |
2429 | 2429 | /** |
2430 | - * Gets a list of all aircraft registrations |
|
2431 | - * |
|
2432 | - * @return Array list of aircraft registrations |
|
2433 | - * |
|
2434 | - */ |
|
2430 | + * Gets a list of all aircraft registrations |
|
2431 | + * |
|
2432 | + * @return Array list of aircraft registrations |
|
2433 | + * |
|
2434 | + */ |
|
2435 | 2435 | public function getAllAircraftRegistrations($filters = array()) |
2436 | 2436 | { |
2437 | 2437 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2456,12 +2456,12 @@ discard block |
||
2456 | 2456 | } |
2457 | 2457 | |
2458 | 2458 | /** |
2459 | - * Gets all source name |
|
2460 | - * |
|
2461 | - * @param String type format of source |
|
2462 | - * @return Array list of source name |
|
2463 | - * |
|
2464 | - */ |
|
2459 | + * Gets all source name |
|
2460 | + * |
|
2461 | + * @param String type format of source |
|
2462 | + * @return Array list of source name |
|
2463 | + * |
|
2464 | + */ |
|
2465 | 2465 | public function getAllSourceName($type = '',$filters = array()) |
2466 | 2466 | { |
2467 | 2467 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2492,11 +2492,11 @@ discard block |
||
2492 | 2492 | |
2493 | 2493 | |
2494 | 2494 | /** |
2495 | - * Gets a list of all airline names |
|
2496 | - * |
|
2497 | - * @return Array list of airline names |
|
2498 | - * |
|
2499 | - */ |
|
2495 | + * Gets a list of all airline names |
|
2496 | + * |
|
2497 | + * @return Array list of airline names |
|
2498 | + * |
|
2499 | + */ |
|
2500 | 2500 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
2501 | 2501 | { |
2502 | 2502 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2546,11 +2546,11 @@ discard block |
||
2546 | 2546 | |
2547 | 2547 | |
2548 | 2548 | /** |
2549 | - * Gets a list of all airline countries |
|
2550 | - * |
|
2551 | - * @return Array list of airline countries |
|
2552 | - * |
|
2553 | - */ |
|
2549 | + * Gets a list of all airline countries |
|
2550 | + * |
|
2551 | + * @return Array list of airline countries |
|
2552 | + * |
|
2553 | + */ |
|
2554 | 2554 | public function getAllAirlineCountries($filters = array()) |
2555 | 2555 | { |
2556 | 2556 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2578,11 +2578,11 @@ discard block |
||
2578 | 2578 | |
2579 | 2579 | |
2580 | 2580 | /** |
2581 | - * Gets a list of all departure & arrival names |
|
2582 | - * |
|
2583 | - * @return Array list of airport names |
|
2584 | - * |
|
2585 | - */ |
|
2581 | + * Gets a list of all departure & arrival names |
|
2582 | + * |
|
2583 | + * @return Array list of airport names |
|
2584 | + * |
|
2585 | + */ |
|
2586 | 2586 | public function getAllAirportNames($filters = array()) |
2587 | 2587 | { |
2588 | 2588 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2631,11 +2631,11 @@ discard block |
||
2631 | 2631 | |
2632 | 2632 | |
2633 | 2633 | /** |
2634 | - * Gets a list of all departure & arrival airport countries |
|
2635 | - * |
|
2636 | - * @return Array list of airport countries |
|
2637 | - * |
|
2638 | - */ |
|
2634 | + * Gets a list of all departure & arrival airport countries |
|
2635 | + * |
|
2636 | + * @return Array list of airport countries |
|
2637 | + * |
|
2638 | + */ |
|
2639 | 2639 | public function getAllAirportCountries($filters = array()) |
2640 | 2640 | { |
2641 | 2641 | $airport_array = array(); |
@@ -2683,11 +2683,11 @@ discard block |
||
2683 | 2683 | |
2684 | 2684 | |
2685 | 2685 | /** |
2686 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
2687 | - * |
|
2688 | - * @return Array list of countries |
|
2689 | - * |
|
2690 | - */ |
|
2686 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
2687 | + * |
|
2688 | + * @return Array list of countries |
|
2689 | + * |
|
2690 | + */ |
|
2691 | 2691 | public function getAllCountries($filters = array()) |
2692 | 2692 | { |
2693 | 2693 | $Connection= new Connection($this->db); |
@@ -2764,11 +2764,11 @@ discard block |
||
2764 | 2764 | |
2765 | 2765 | |
2766 | 2766 | /** |
2767 | - * Gets a list of all idents/callsigns |
|
2768 | - * |
|
2769 | - * @return Array list of ident/callsign names |
|
2770 | - * |
|
2771 | - */ |
|
2767 | + * Gets a list of all idents/callsigns |
|
2768 | + * |
|
2769 | + * @return Array list of ident/callsign names |
|
2770 | + * |
|
2771 | + */ |
|
2772 | 2772 | public function getAllIdents($filters = array()) |
2773 | 2773 | { |
2774 | 2774 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2792,9 +2792,9 @@ discard block |
||
2792 | 2792 | } |
2793 | 2793 | |
2794 | 2794 | /** |
2795 | - * Get a list of flights from airport since 7 days |
|
2796 | - * @return Array number, icao, name and city of airports |
|
2797 | - */ |
|
2795 | + * Get a list of flights from airport since 7 days |
|
2796 | + * @return Array number, icao, name and city of airports |
|
2797 | + */ |
|
2798 | 2798 | |
2799 | 2799 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
2800 | 2800 | global $globalTimezone, $globalDBdriver; |
@@ -2825,9 +2825,9 @@ discard block |
||
2825 | 2825 | } |
2826 | 2826 | |
2827 | 2827 | /** |
2828 | - * Get a list of flights from airport since 7 days |
|
2829 | - * @return Array number, icao, name and city of airports |
|
2830 | - */ |
|
2828 | + * Get a list of flights from airport since 7 days |
|
2829 | + * @return Array number, icao, name and city of airports |
|
2830 | + */ |
|
2831 | 2831 | |
2832 | 2832 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
2833 | 2833 | global $globalTimezone, $globalDBdriver; |
@@ -2857,9 +2857,9 @@ discard block |
||
2857 | 2857 | } |
2858 | 2858 | |
2859 | 2859 | /** |
2860 | - * Get a list of flights from detected airport since 7 days |
|
2861 | - * @return Array number, icao, name and city of airports |
|
2862 | - */ |
|
2860 | + * Get a list of flights from detected airport since 7 days |
|
2861 | + * @return Array number, icao, name and city of airports |
|
2862 | + */ |
|
2863 | 2863 | |
2864 | 2864 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
2865 | 2865 | global $globalTimezone, $globalDBdriver; |
@@ -2897,9 +2897,9 @@ discard block |
||
2897 | 2897 | } |
2898 | 2898 | |
2899 | 2899 | /** |
2900 | - * Get a list of flights from detected airport since 7 days |
|
2901 | - * @return Array number, icao, name and city of airports |
|
2902 | - */ |
|
2900 | + * Get a list of flights from detected airport since 7 days |
|
2901 | + * @return Array number, icao, name and city of airports |
|
2902 | + */ |
|
2903 | 2903 | |
2904 | 2904 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
2905 | 2905 | global $globalTimezone, $globalDBdriver; |
@@ -2941,9 +2941,9 @@ discard block |
||
2941 | 2941 | |
2942 | 2942 | |
2943 | 2943 | /** |
2944 | - * Get a list of flights to airport since 7 days |
|
2945 | - * @return Array number, icao, name and city of airports |
|
2946 | - */ |
|
2944 | + * Get a list of flights to airport since 7 days |
|
2945 | + * @return Array number, icao, name and city of airports |
|
2946 | + */ |
|
2947 | 2947 | |
2948 | 2948 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
2949 | 2949 | global $globalTimezone, $globalDBdriver; |
@@ -2976,9 +2976,9 @@ discard block |
||
2976 | 2976 | |
2977 | 2977 | |
2978 | 2978 | /** |
2979 | - * Get a list of flights detected to airport since 7 days |
|
2980 | - * @return Array number, icao, name and city of airports |
|
2981 | - */ |
|
2979 | + * Get a list of flights detected to airport since 7 days |
|
2980 | + * @return Array number, icao, name and city of airports |
|
2981 | + */ |
|
2982 | 2982 | |
2983 | 2983 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
2984 | 2984 | global $globalTimezone, $globalDBdriver; |
@@ -3019,9 +3019,9 @@ discard block |
||
3019 | 3019 | |
3020 | 3020 | |
3021 | 3021 | /** |
3022 | - * Get a list of flights to airport since 7 days |
|
3023 | - * @return Array number, icao, name and city of airports |
|
3024 | - */ |
|
3022 | + * Get a list of flights to airport since 7 days |
|
3023 | + * @return Array number, icao, name and city of airports |
|
3024 | + */ |
|
3025 | 3025 | |
3026 | 3026 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
3027 | 3027 | global $globalTimezone, $globalDBdriver; |
@@ -3053,9 +3053,9 @@ discard block |
||
3053 | 3053 | |
3054 | 3054 | |
3055 | 3055 | /** |
3056 | - * Get a list of flights detected to airport since 7 days |
|
3057 | - * @return Array number, icao, name and city of airports |
|
3058 | - */ |
|
3056 | + * Get a list of flights detected to airport since 7 days |
|
3057 | + * @return Array number, icao, name and city of airports |
|
3058 | + */ |
|
3059 | 3059 | |
3060 | 3060 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
3061 | 3061 | global $globalTimezone, $globalDBdriver; |
@@ -3099,11 +3099,11 @@ discard block |
||
3099 | 3099 | |
3100 | 3100 | |
3101 | 3101 | /** |
3102 | - * Gets a list of all dates |
|
3103 | - * |
|
3104 | - * @return Array list of date names |
|
3105 | - * |
|
3106 | - */ |
|
3102 | + * Gets a list of all dates |
|
3103 | + * |
|
3104 | + * @return Array list of date names |
|
3105 | + * |
|
3106 | + */ |
|
3107 | 3107 | public function getAllDates() |
3108 | 3108 | { |
3109 | 3109 | global $globalTimezone, $globalDBdriver; |
@@ -3144,11 +3144,11 @@ discard block |
||
3144 | 3144 | |
3145 | 3145 | |
3146 | 3146 | /** |
3147 | - * Gets all route combinations |
|
3148 | - * |
|
3149 | - * @return Array the route list |
|
3150 | - * |
|
3151 | - */ |
|
3147 | + * Gets all route combinations |
|
3148 | + * |
|
3149 | + * @return Array the route list |
|
3150 | + * |
|
3151 | + */ |
|
3152 | 3152 | public function getAllRoutes() |
3153 | 3153 | { |
3154 | 3154 | $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 |
@@ -3174,13 +3174,13 @@ discard block |
||
3174 | 3174 | } |
3175 | 3175 | |
3176 | 3176 | /** |
3177 | - * Update ident spotter data |
|
3178 | - * |
|
3179 | - * @param String $flightaware_id the ID from flightaware |
|
3180 | - * @param String $ident the flight ident |
|
3181 | - * @return String success or false |
|
3182 | - * |
|
3183 | - */ |
|
3177 | + * Update ident spotter data |
|
3178 | + * |
|
3179 | + * @param String $flightaware_id the ID from flightaware |
|
3180 | + * @param String $ident the flight ident |
|
3181 | + * @return String success or false |
|
3182 | + * |
|
3183 | + */ |
|
3184 | 3184 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
3185 | 3185 | { |
3186 | 3186 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3201,14 +3201,14 @@ discard block |
||
3201 | 3201 | } else { |
3202 | 3202 | $airline_array = $this->getAllAirlineInfo("NA"); |
3203 | 3203 | } |
3204 | - $airline_name = $airline_array[0]['name']; |
|
3205 | - $airline_icao = $airline_array[0]['icao']; |
|
3206 | - $airline_country = $airline_array[0]['country']; |
|
3207 | - $airline_type = $airline_array[0]['type']; |
|
3204 | + $airline_name = $airline_array[0]['name']; |
|
3205 | + $airline_icao = $airline_array[0]['icao']; |
|
3206 | + $airline_country = $airline_array[0]['country']; |
|
3207 | + $airline_type = $airline_array[0]['type']; |
|
3208 | 3208 | |
3209 | 3209 | |
3210 | 3210 | $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'; |
3211 | - $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); |
|
3211 | + $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); |
|
3212 | 3212 | |
3213 | 3213 | try { |
3214 | 3214 | $sth = $this->db->prepare($query); |
@@ -3221,19 +3221,19 @@ discard block |
||
3221 | 3221 | |
3222 | 3222 | } |
3223 | 3223 | /** |
3224 | - * Update latest spotter data |
|
3225 | - * |
|
3226 | - * @param String $flightaware_id the ID from flightaware |
|
3227 | - * @param String $ident the flight ident |
|
3228 | - * @param String $arrival_airport_icao the arrival airport |
|
3229 | - * @return String success or false |
|
3230 | - * |
|
3231 | - */ |
|
3224 | + * Update latest spotter data |
|
3225 | + * |
|
3226 | + * @param String $flightaware_id the ID from flightaware |
|
3227 | + * @param String $ident the flight ident |
|
3228 | + * @param String $arrival_airport_icao the arrival airport |
|
3229 | + * @return String success or false |
|
3230 | + * |
|
3231 | + */ |
|
3232 | 3232 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
3233 | 3233 | { |
3234 | 3234 | if ($groundspeed == '') $groundspeed = NULL; |
3235 | 3235 | $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'; |
3236 | - $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); |
|
3236 | + $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); |
|
3237 | 3237 | |
3238 | 3238 | try { |
3239 | 3239 | $sth = $this->db->prepare($query); |
@@ -3247,32 +3247,32 @@ discard block |
||
3247 | 3247 | } |
3248 | 3248 | |
3249 | 3249 | /** |
3250 | - * Adds a new spotter data |
|
3251 | - * |
|
3252 | - * @param String $flightaware_id the ID from flightaware |
|
3253 | - * @param String $ident the flight ident |
|
3254 | - * @param String $aircraft_icao the aircraft type |
|
3255 | - * @param String $departure_airport_icao the departure airport |
|
3256 | - * @param String $arrival_airport_icao the arrival airport |
|
3257 | - * @param String $latitude latitude of flight |
|
3258 | - * @param String $longitude latitude of flight |
|
3259 | - * @param String $waypoints waypoints of flight |
|
3260 | - * @param String $altitude altitude of flight |
|
3261 | - * @param String $heading heading of flight |
|
3262 | - * @param String $groundspeed speed of flight |
|
3263 | - * @param String $date date of flight |
|
3264 | - * @param String $departure_airport_time departure time of flight |
|
3265 | - * @param String $arrival_airport_time arrival time of flight |
|
3266 | - * @param String $squawk squawk code of flight |
|
3267 | - * @param String $route_stop route stop of flight |
|
3268 | - * @param String $highlight highlight or not |
|
3269 | - * @param String $ModeS ModesS code of flight |
|
3270 | - * @param String $registration registration code of flight |
|
3271 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
3272 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
3273 | - * @param String $verticalrate vertival rate of flight |
|
3274 | - * @return String success or false |
|
3275 | - */ |
|
3250 | + * Adds a new spotter data |
|
3251 | + * |
|
3252 | + * @param String $flightaware_id the ID from flightaware |
|
3253 | + * @param String $ident the flight ident |
|
3254 | + * @param String $aircraft_icao the aircraft type |
|
3255 | + * @param String $departure_airport_icao the departure airport |
|
3256 | + * @param String $arrival_airport_icao the arrival airport |
|
3257 | + * @param String $latitude latitude of flight |
|
3258 | + * @param String $longitude latitude of flight |
|
3259 | + * @param String $waypoints waypoints of flight |
|
3260 | + * @param String $altitude altitude of flight |
|
3261 | + * @param String $heading heading of flight |
|
3262 | + * @param String $groundspeed speed of flight |
|
3263 | + * @param String $date date of flight |
|
3264 | + * @param String $departure_airport_time departure time of flight |
|
3265 | + * @param String $arrival_airport_time arrival time of flight |
|
3266 | + * @param String $squawk squawk code of flight |
|
3267 | + * @param String $route_stop route stop of flight |
|
3268 | + * @param String $highlight highlight or not |
|
3269 | + * @param String $ModeS ModesS code of flight |
|
3270 | + * @param String $registration registration code of flight |
|
3271 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
3272 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
3273 | + * @param String $verticalrate vertival rate of flight |
|
3274 | + * @return String success or false |
|
3275 | + */ |
|
3276 | 3276 | 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 = '') |
3277 | 3277 | { |
3278 | 3278 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
@@ -3487,8 +3487,8 @@ discard block |
||
3487 | 3487 | |
3488 | 3488 | if ($globalIVAO && $aircraft_icao != '') |
3489 | 3489 | { |
3490 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3491 | - else $airline_icao = ''; |
|
3490 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3491 | + else $airline_icao = ''; |
|
3492 | 3492 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
3493 | 3493 | if (!isset($image_array[0]['registration'])) |
3494 | 3494 | { |
@@ -3519,53 +3519,53 @@ discard block |
||
3519 | 3519 | |
3520 | 3520 | if (count($airline_array) == 0) |
3521 | 3521 | { |
3522 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
3523 | - } |
|
3524 | - if (count($aircraft_array) == 0) |
|
3525 | - { |
|
3526 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
3527 | - } |
|
3528 | - if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
3529 | - { |
|
3530 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
3531 | - } |
|
3532 | - if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
3533 | - { |
|
3534 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
3535 | - } |
|
3536 | - if ($registration == '') $registration = 'NA'; |
|
3537 | - if ($latitude == '' && $longitude == '') { |
|
3538 | - $latitude = 0; |
|
3539 | - $longitude = 0; |
|
3540 | - } |
|
3541 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3542 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3543 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3544 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3545 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
3546 | - $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) |
|
3522 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
3523 | + } |
|
3524 | + if (count($aircraft_array) == 0) |
|
3525 | + { |
|
3526 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
3527 | + } |
|
3528 | + if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
3529 | + { |
|
3530 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
3531 | + } |
|
3532 | + if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
3533 | + { |
|
3534 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
3535 | + } |
|
3536 | + if ($registration == '') $registration = 'NA'; |
|
3537 | + if ($latitude == '' && $longitude == '') { |
|
3538 | + $latitude = 0; |
|
3539 | + $longitude = 0; |
|
3540 | + } |
|
3541 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3542 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3543 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3544 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3545 | + if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
3546 | + $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) |
|
3547 | 3547 | 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)"; |
3548 | 3548 | |
3549 | - $airline_name = $airline_array[0]['name']; |
|
3550 | - $airline_icao = $airline_array[0]['icao']; |
|
3551 | - $airline_country = $airline_array[0]['country']; |
|
3552 | - $airline_type = $airline_array[0]['type']; |
|
3549 | + $airline_name = $airline_array[0]['name']; |
|
3550 | + $airline_icao = $airline_array[0]['icao']; |
|
3551 | + $airline_country = $airline_array[0]['country']; |
|
3552 | + $airline_type = $airline_array[0]['type']; |
|
3553 | 3553 | if ($airline_type == '') { |
3554 | 3554 | $timeelapsed = microtime(true); |
3555 | 3555 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3556 | 3556 | if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
3557 | 3557 | } |
3558 | 3558 | if ($airline_type == null) $airline_type = ''; |
3559 | - $aircraft_type = $aircraft_array[0]['type']; |
|
3560 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
3561 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
3562 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
3563 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
3559 | + $aircraft_type = $aircraft_array[0]['type']; |
|
3560 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
3561 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
3562 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
3563 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
3564 | 3564 | |
3565 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
3566 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
3567 | - $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
3568 | - $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); |
|
3565 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
3566 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
3567 | + $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
3568 | + $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); |
|
3569 | 3569 | |
3570 | 3570 | try { |
3571 | 3571 | |
@@ -3573,7 +3573,7 @@ discard block |
||
3573 | 3573 | $sth->execute($query_values); |
3574 | 3574 | $this->db = null; |
3575 | 3575 | } catch (PDOException $e) { |
3576 | - return "error : ".$e->getMessage(); |
|
3576 | + return "error : ".$e->getMessage(); |
|
3577 | 3577 | } |
3578 | 3578 | |
3579 | 3579 | return "success"; |
@@ -3582,11 +3582,11 @@ discard block |
||
3582 | 3582 | |
3583 | 3583 | |
3584 | 3584 | /** |
3585 | - * Gets the aircraft ident within the last hour |
|
3586 | - * |
|
3587 | - * @return String the ident |
|
3588 | - * |
|
3589 | - */ |
|
3585 | + * Gets the aircraft ident within the last hour |
|
3586 | + * |
|
3587 | + * @return String the ident |
|
3588 | + * |
|
3589 | + */ |
|
3590 | 3590 | public function getIdentFromLastHour($ident) |
3591 | 3591 | { |
3592 | 3592 | global $globalDBdriver, $globalTimezone; |
@@ -3602,11 +3602,11 @@ discard block |
||
3602 | 3602 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
3603 | 3603 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
3604 | 3604 | $query_data = array(':ident' => $ident); |
3605 | - } |
|
3605 | + } |
|
3606 | 3606 | |
3607 | 3607 | $sth = $this->db->prepare($query); |
3608 | 3608 | $sth->execute($query_data); |
3609 | - $ident_result=''; |
|
3609 | + $ident_result=''; |
|
3610 | 3610 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
3611 | 3611 | { |
3612 | 3612 | $ident_result = $row['ident']; |
@@ -3617,11 +3617,11 @@ discard block |
||
3617 | 3617 | |
3618 | 3618 | |
3619 | 3619 | /** |
3620 | - * Gets the aircraft data from the last 20 seconds |
|
3621 | - * |
|
3622 | - * @return Array the spotter data |
|
3623 | - * |
|
3624 | - */ |
|
3620 | + * Gets the aircraft data from the last 20 seconds |
|
3621 | + * |
|
3622 | + * @return Array the spotter data |
|
3623 | + * |
|
3624 | + */ |
|
3625 | 3625 | public function getRealTimeData($q = '') |
3626 | 3626 | { |
3627 | 3627 | global $globalDBdriver; |
@@ -3665,11 +3665,11 @@ discard block |
||
3665 | 3665 | |
3666 | 3666 | |
3667 | 3667 | /** |
3668 | - * Gets all airlines that have flown over |
|
3669 | - * |
|
3670 | - * @return Array the airline list |
|
3671 | - * |
|
3672 | - */ |
|
3668 | + * Gets all airlines that have flown over |
|
3669 | + * |
|
3670 | + * @return Array the airline list |
|
3671 | + * |
|
3672 | + */ |
|
3673 | 3673 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3674 | 3674 | { |
3675 | 3675 | global $globalDBdriver; |
@@ -3683,7 +3683,7 @@ discard block |
||
3683 | 3683 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3684 | 3684 | } |
3685 | 3685 | } |
3686 | - if ($sincedate != '') { |
|
3686 | + if ($sincedate != '') { |
|
3687 | 3687 | if ($globalDBdriver == 'mysql') { |
3688 | 3688 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3689 | 3689 | } else { |
@@ -3710,26 +3710,26 @@ discard block |
||
3710 | 3710 | } |
3711 | 3711 | |
3712 | 3712 | /** |
3713 | - * Gets all pilots that have flown over |
|
3714 | - * |
|
3715 | - * @return Array the pilots list |
|
3716 | - * |
|
3717 | - */ |
|
3713 | + * Gets all pilots that have flown over |
|
3714 | + * |
|
3715 | + * @return Array the pilots list |
|
3716 | + * |
|
3717 | + */ |
|
3718 | 3718 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3719 | 3719 | { |
3720 | 3720 | global $globalDBdriver; |
3721 | 3721 | $filter_query = $this->getFilter($filters,true,true); |
3722 | 3722 | $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
3723 | 3723 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
3724 | - if ($olderthanmonths > 0) { |
|
3725 | - if ($globalDBdriver == 'mysql') { |
|
3724 | + if ($olderthanmonths > 0) { |
|
3725 | + if ($globalDBdriver == 'mysql') { |
|
3726 | 3726 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3727 | 3727 | } else { |
3728 | 3728 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3729 | 3729 | } |
3730 | 3730 | } |
3731 | - if ($sincedate != '') { |
|
3732 | - if ($globalDBdriver == 'mysql') { |
|
3731 | + if ($sincedate != '') { |
|
3732 | + if ($globalDBdriver == 'mysql') { |
|
3733 | 3733 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3734 | 3734 | } else { |
3735 | 3735 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3757,25 +3757,25 @@ discard block |
||
3757 | 3757 | } |
3758 | 3758 | |
3759 | 3759 | /** |
3760 | - * Gets all pilots that have flown over |
|
3761 | - * |
|
3762 | - * @return Array the pilots list |
|
3763 | - * |
|
3764 | - */ |
|
3760 | + * Gets all pilots that have flown over |
|
3761 | + * |
|
3762 | + * @return Array the pilots list |
|
3763 | + * |
|
3764 | + */ |
|
3765 | 3765 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
3766 | 3766 | { |
3767 | 3767 | global $globalDBdriver; |
3768 | 3768 | $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 |
3769 | 3769 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
3770 | - if ($olderthanmonths > 0) { |
|
3771 | - if ($globalDBdriver == 'mysql') { |
|
3770 | + if ($olderthanmonths > 0) { |
|
3771 | + if ($globalDBdriver == 'mysql') { |
|
3772 | 3772 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3773 | 3773 | } else { |
3774 | 3774 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3775 | 3775 | } |
3776 | 3776 | } |
3777 | - if ($sincedate != '') { |
|
3778 | - if ($globalDBdriver == 'mysql') { |
|
3777 | + if ($sincedate != '') { |
|
3778 | + if ($globalDBdriver == 'mysql') { |
|
3779 | 3779 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3780 | 3780 | } else { |
3781 | 3781 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3804,26 +3804,26 @@ discard block |
||
3804 | 3804 | } |
3805 | 3805 | |
3806 | 3806 | /** |
3807 | - * Gets all owner that have flown over |
|
3808 | - * |
|
3809 | - * @return Array the pilots list |
|
3810 | - * |
|
3811 | - */ |
|
3807 | + * Gets all owner that have flown over |
|
3808 | + * |
|
3809 | + * @return Array the pilots list |
|
3810 | + * |
|
3811 | + */ |
|
3812 | 3812 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3813 | 3813 | { |
3814 | 3814 | global $globalDBdriver; |
3815 | 3815 | $filter_query = $this->getFilter($filters,true,true); |
3816 | 3816 | $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
3817 | 3817 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3818 | - if ($olderthanmonths > 0) { |
|
3819 | - if ($globalDBdriver == 'mysql') { |
|
3818 | + if ($olderthanmonths > 0) { |
|
3819 | + if ($globalDBdriver == 'mysql') { |
|
3820 | 3820 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3821 | 3821 | } else { |
3822 | 3822 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3823 | 3823 | } |
3824 | 3824 | } |
3825 | - if ($sincedate != '') { |
|
3826 | - if ($globalDBdriver == 'mysql') { |
|
3825 | + if ($sincedate != '') { |
|
3826 | + if ($globalDBdriver == 'mysql') { |
|
3827 | 3827 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3828 | 3828 | } else { |
3829 | 3829 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3849,26 +3849,26 @@ discard block |
||
3849 | 3849 | } |
3850 | 3850 | |
3851 | 3851 | /** |
3852 | - * Gets all owner that have flown over |
|
3853 | - * |
|
3854 | - * @return Array the pilots list |
|
3855 | - * |
|
3856 | - */ |
|
3852 | + * Gets all owner that have flown over |
|
3853 | + * |
|
3854 | + * @return Array the pilots list |
|
3855 | + * |
|
3856 | + */ |
|
3857 | 3857 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3858 | 3858 | { |
3859 | 3859 | global $globalDBdriver; |
3860 | 3860 | $filter_query = $this->getFilter($filters,true,true); |
3861 | 3861 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
3862 | 3862 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3863 | - if ($olderthanmonths > 0) { |
|
3864 | - if ($globalDBdriver == 'mysql') { |
|
3863 | + if ($olderthanmonths > 0) { |
|
3864 | + if ($globalDBdriver == 'mysql') { |
|
3865 | 3865 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3866 | 3866 | } else { |
3867 | 3867 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3868 | 3868 | } |
3869 | 3869 | } |
3870 | - if ($sincedate != '') { |
|
3871 | - if ($globalDBdriver == 'mysql') { |
|
3870 | + if ($sincedate != '') { |
|
3871 | + if ($globalDBdriver == 'mysql') { |
|
3872 | 3872 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3873 | 3873 | } else { |
3874 | 3874 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3895,11 +3895,11 @@ discard block |
||
3895 | 3895 | } |
3896 | 3896 | |
3897 | 3897 | /** |
3898 | - * Gets all airlines that have flown over by aircraft |
|
3899 | - * |
|
3900 | - * @return Array the airline list |
|
3901 | - * |
|
3902 | - */ |
|
3898 | + * Gets all airlines that have flown over by aircraft |
|
3899 | + * |
|
3900 | + * @return Array the airline list |
|
3901 | + * |
|
3902 | + */ |
|
3903 | 3903 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
3904 | 3904 | { |
3905 | 3905 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3931,11 +3931,11 @@ discard block |
||
3931 | 3931 | |
3932 | 3932 | |
3933 | 3933 | /** |
3934 | - * Gets all airline countries that have flown over by aircraft |
|
3935 | - * |
|
3936 | - * @return Array the airline country list |
|
3937 | - * |
|
3938 | - */ |
|
3934 | + * Gets all airline countries that have flown over by aircraft |
|
3935 | + * |
|
3936 | + * @return Array the airline country list |
|
3937 | + * |
|
3938 | + */ |
|
3939 | 3939 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
3940 | 3940 | { |
3941 | 3941 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3967,11 +3967,11 @@ discard block |
||
3967 | 3967 | |
3968 | 3968 | |
3969 | 3969 | /** |
3970 | - * Gets all airlines that have flown over by airport |
|
3971 | - * |
|
3972 | - * @return Array the airline list |
|
3973 | - * |
|
3974 | - */ |
|
3970 | + * Gets all airlines that have flown over by airport |
|
3971 | + * |
|
3972 | + * @return Array the airline list |
|
3973 | + * |
|
3974 | + */ |
|
3975 | 3975 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
3976 | 3976 | { |
3977 | 3977 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4002,11 +4002,11 @@ discard block |
||
4002 | 4002 | |
4003 | 4003 | |
4004 | 4004 | /** |
4005 | - * Gets all airline countries that have flown over by airport icao |
|
4006 | - * |
|
4007 | - * @return Array the airline country list |
|
4008 | - * |
|
4009 | - */ |
|
4005 | + * Gets all airline countries that have flown over by airport icao |
|
4006 | + * |
|
4007 | + * @return Array the airline country list |
|
4008 | + * |
|
4009 | + */ |
|
4010 | 4010 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
4011 | 4011 | { |
4012 | 4012 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4036,11 +4036,11 @@ discard block |
||
4036 | 4036 | |
4037 | 4037 | |
4038 | 4038 | /** |
4039 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
4040 | - * |
|
4041 | - * @return Array the airline list |
|
4042 | - * |
|
4043 | - */ |
|
4039 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
4040 | + * |
|
4041 | + * @return Array the airline list |
|
4042 | + * |
|
4043 | + */ |
|
4044 | 4044 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
4045 | 4045 | { |
4046 | 4046 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4071,11 +4071,11 @@ discard block |
||
4071 | 4071 | |
4072 | 4072 | |
4073 | 4073 | /** |
4074 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
4075 | - * |
|
4076 | - * @return Array the airline country list |
|
4077 | - * |
|
4078 | - */ |
|
4074 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
4075 | + * |
|
4076 | + * @return Array the airline country list |
|
4077 | + * |
|
4078 | + */ |
|
4079 | 4079 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
4080 | 4080 | { |
4081 | 4081 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4104,11 +4104,11 @@ discard block |
||
4104 | 4104 | |
4105 | 4105 | |
4106 | 4106 | /** |
4107 | - * Gets all airlines that have flown over by date |
|
4108 | - * |
|
4109 | - * @return Array the airline list |
|
4110 | - * |
|
4111 | - */ |
|
4107 | + * Gets all airlines that have flown over by date |
|
4108 | + * |
|
4109 | + * @return Array the airline list |
|
4110 | + * |
|
4111 | + */ |
|
4112 | 4112 | public function countAllAirlinesByDate($date,$filters = array()) |
4113 | 4113 | { |
4114 | 4114 | global $globalTimezone, $globalDBdriver; |
@@ -4152,11 +4152,11 @@ discard block |
||
4152 | 4152 | |
4153 | 4153 | |
4154 | 4154 | /** |
4155 | - * Gets all airline countries that have flown over by date |
|
4156 | - * |
|
4157 | - * @return Array the airline country list |
|
4158 | - * |
|
4159 | - */ |
|
4155 | + * Gets all airline countries that have flown over by date |
|
4156 | + * |
|
4157 | + * @return Array the airline country list |
|
4158 | + * |
|
4159 | + */ |
|
4160 | 4160 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
4161 | 4161 | { |
4162 | 4162 | global $globalTimezone, $globalDBdriver; |
@@ -4199,11 +4199,11 @@ discard block |
||
4199 | 4199 | |
4200 | 4200 | |
4201 | 4201 | /** |
4202 | - * Gets all airlines that have flown over by ident/callsign |
|
4203 | - * |
|
4204 | - * @return Array the airline list |
|
4205 | - * |
|
4206 | - */ |
|
4202 | + * Gets all airlines that have flown over by ident/callsign |
|
4203 | + * |
|
4204 | + * @return Array the airline list |
|
4205 | + * |
|
4206 | + */ |
|
4207 | 4207 | public function countAllAirlinesByIdent($ident,$filters = array()) |
4208 | 4208 | { |
4209 | 4209 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4233,11 +4233,11 @@ discard block |
||
4233 | 4233 | } |
4234 | 4234 | |
4235 | 4235 | /** |
4236 | - * Gets all airlines that have flown over by route |
|
4237 | - * |
|
4238 | - * @return Array the airline list |
|
4239 | - * |
|
4240 | - */ |
|
4236 | + * Gets all airlines that have flown over by route |
|
4237 | + * |
|
4238 | + * @return Array the airline list |
|
4239 | + * |
|
4240 | + */ |
|
4241 | 4241 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
4242 | 4242 | { |
4243 | 4243 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4269,11 +4269,11 @@ discard block |
||
4269 | 4269 | } |
4270 | 4270 | |
4271 | 4271 | /** |
4272 | - * Gets all airline countries that have flown over by route |
|
4273 | - * |
|
4274 | - * @return Array the airline country list |
|
4275 | - * |
|
4276 | - */ |
|
4272 | + * Gets all airline countries that have flown over by route |
|
4273 | + * |
|
4274 | + * @return Array the airline country list |
|
4275 | + * |
|
4276 | + */ |
|
4277 | 4277 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
4278 | 4278 | { |
4279 | 4279 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4305,11 +4305,11 @@ discard block |
||
4305 | 4305 | |
4306 | 4306 | |
4307 | 4307 | /** |
4308 | - * Gets all airlines that have flown over by country |
|
4309 | - * |
|
4310 | - * @return Array the airline list |
|
4311 | - * |
|
4312 | - */ |
|
4308 | + * Gets all airlines that have flown over by country |
|
4309 | + * |
|
4310 | + * @return Array the airline list |
|
4311 | + * |
|
4312 | + */ |
|
4313 | 4313 | public function countAllAirlinesByCountry($country,$filters = array()) |
4314 | 4314 | { |
4315 | 4315 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4339,11 +4339,11 @@ discard block |
||
4339 | 4339 | |
4340 | 4340 | |
4341 | 4341 | /** |
4342 | - * Gets all airline countries that have flown over by country |
|
4343 | - * |
|
4344 | - * @return Array the airline country list |
|
4345 | - * |
|
4346 | - */ |
|
4342 | + * Gets all airline countries that have flown over by country |
|
4343 | + * |
|
4344 | + * @return Array the airline country list |
|
4345 | + * |
|
4346 | + */ |
|
4347 | 4347 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
4348 | 4348 | { |
4349 | 4349 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4372,11 +4372,11 @@ discard block |
||
4372 | 4372 | |
4373 | 4373 | |
4374 | 4374 | /** |
4375 | - * Gets all airlines countries |
|
4376 | - * |
|
4377 | - * @return Array the airline country list |
|
4378 | - * |
|
4379 | - */ |
|
4375 | + * Gets all airlines countries |
|
4376 | + * |
|
4377 | + * @return Array the airline country list |
|
4378 | + * |
|
4379 | + */ |
|
4380 | 4380 | public function countAllAirlineCountries($limit = true, $filters = array()) |
4381 | 4381 | { |
4382 | 4382 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4402,11 +4402,11 @@ discard block |
||
4402 | 4402 | } |
4403 | 4403 | |
4404 | 4404 | /** |
4405 | - * Gets all number of flight over countries |
|
4406 | - * |
|
4407 | - * @return Array the airline country list |
|
4408 | - * |
|
4409 | - */ |
|
4405 | + * Gets all number of flight over countries |
|
4406 | + * |
|
4407 | + * @return Array the airline country list |
|
4408 | + * |
|
4409 | + */ |
|
4410 | 4410 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
4411 | 4411 | { |
4412 | 4412 | global $globalDBdriver; |
@@ -4428,15 +4428,15 @@ discard block |
||
4428 | 4428 | $SpotterLive = new SpotterLive(); |
4429 | 4429 | $filter_query = $SpotterLive->getFilter($filters,true,true); |
4430 | 4430 | $filter_query .= ' over_country IS NOT NULL'; |
4431 | - if ($olderthanmonths > 0) { |
|
4431 | + if ($olderthanmonths > 0) { |
|
4432 | 4432 | if ($globalDBdriver == 'mysql') { |
4433 | 4433 | $filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
4434 | 4434 | } else { |
4435 | 4435 | $filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
4436 | 4436 | } |
4437 | 4437 | } |
4438 | - if ($sincedate != '') { |
|
4439 | - if ($globalDBdriver == 'mysql') { |
|
4438 | + if ($sincedate != '') { |
|
4439 | + if ($globalDBdriver == 'mysql') { |
|
4440 | 4440 | $filter_query .= " AND spotter_live.date > '".$sincedate."' "; |
4441 | 4441 | } else { |
4442 | 4442 | $filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4466,11 +4466,11 @@ discard block |
||
4466 | 4466 | |
4467 | 4467 | |
4468 | 4468 | /** |
4469 | - * Gets all aircraft types that have flown over |
|
4470 | - * |
|
4471 | - * @return Array the aircraft list |
|
4472 | - * |
|
4473 | - */ |
|
4469 | + * Gets all aircraft types that have flown over |
|
4470 | + * |
|
4471 | + * @return Array the aircraft list |
|
4472 | + * |
|
4473 | + */ |
|
4474 | 4474 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
4475 | 4475 | { |
4476 | 4476 | global $globalDBdriver; |
@@ -4513,11 +4513,11 @@ discard block |
||
4513 | 4513 | } |
4514 | 4514 | |
4515 | 4515 | /** |
4516 | - * Gets all aircraft types that have flown over by airline |
|
4517 | - * |
|
4518 | - * @return Array the aircraft list |
|
4519 | - * |
|
4520 | - */ |
|
4516 | + * Gets all aircraft types that have flown over by airline |
|
4517 | + * |
|
4518 | + * @return Array the aircraft list |
|
4519 | + * |
|
4520 | + */ |
|
4521 | 4521 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
4522 | 4522 | { |
4523 | 4523 | global $globalDBdriver; |
@@ -4560,11 +4560,11 @@ discard block |
||
4560 | 4560 | } |
4561 | 4561 | |
4562 | 4562 | /** |
4563 | - * Gets all aircraft types that have flown over by months |
|
4564 | - * |
|
4565 | - * @return Array the aircraft list |
|
4566 | - * |
|
4567 | - */ |
|
4563 | + * Gets all aircraft types that have flown over by months |
|
4564 | + * |
|
4565 | + * @return Array the aircraft list |
|
4566 | + * |
|
4567 | + */ |
|
4568 | 4568 | public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
4569 | 4569 | { |
4570 | 4570 | global $globalDBdriver; |
@@ -4608,11 +4608,11 @@ discard block |
||
4608 | 4608 | |
4609 | 4609 | |
4610 | 4610 | /** |
4611 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
4612 | - * |
|
4613 | - * @return Array the aircraft list |
|
4614 | - * |
|
4615 | - */ |
|
4611 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
4612 | + * |
|
4613 | + * @return Array the aircraft list |
|
4614 | + * |
|
4615 | + */ |
|
4616 | 4616 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
4617 | 4617 | { |
4618 | 4618 | $Image = new Image($this->db); |
@@ -4651,11 +4651,11 @@ discard block |
||
4651 | 4651 | |
4652 | 4652 | |
4653 | 4653 | /** |
4654 | - * Gets all aircraft types that have flown over by airline icao |
|
4655 | - * |
|
4656 | - * @return Array the aircraft list |
|
4657 | - * |
|
4658 | - */ |
|
4654 | + * Gets all aircraft types that have flown over by airline icao |
|
4655 | + * |
|
4656 | + * @return Array the aircraft list |
|
4657 | + * |
|
4658 | + */ |
|
4659 | 4659 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
4660 | 4660 | { |
4661 | 4661 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4684,11 +4684,11 @@ discard block |
||
4684 | 4684 | |
4685 | 4685 | |
4686 | 4686 | /** |
4687 | - * Gets all aircraft registration that have flown over by airline icao |
|
4688 | - * |
|
4689 | - * @return Array the aircraft list |
|
4690 | - * |
|
4691 | - */ |
|
4687 | + * Gets all aircraft registration that have flown over by airline icao |
|
4688 | + * |
|
4689 | + * @return Array the aircraft list |
|
4690 | + * |
|
4691 | + */ |
|
4692 | 4692 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
4693 | 4693 | { |
4694 | 4694 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4726,11 +4726,11 @@ discard block |
||
4726 | 4726 | |
4727 | 4727 | |
4728 | 4728 | /** |
4729 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
4730 | - * |
|
4731 | - * @return Array the aircraft list |
|
4732 | - * |
|
4733 | - */ |
|
4729 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
4730 | + * |
|
4731 | + * @return Array the aircraft list |
|
4732 | + * |
|
4733 | + */ |
|
4734 | 4734 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
4735 | 4735 | { |
4736 | 4736 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4758,11 +4758,11 @@ discard block |
||
4758 | 4758 | |
4759 | 4759 | |
4760 | 4760 | /** |
4761 | - * Gets all aircraft types that have flown over by airline icao |
|
4762 | - * |
|
4763 | - * @return Array the aircraft list |
|
4764 | - * |
|
4765 | - */ |
|
4761 | + * Gets all aircraft types that have flown over by airline icao |
|
4762 | + * |
|
4763 | + * @return Array the aircraft list |
|
4764 | + * |
|
4765 | + */ |
|
4766 | 4766 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
4767 | 4767 | { |
4768 | 4768 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4791,11 +4791,11 @@ discard block |
||
4791 | 4791 | |
4792 | 4792 | |
4793 | 4793 | /** |
4794 | - * Gets all aircraft registration that have flown over by airport icao |
|
4795 | - * |
|
4796 | - * @return Array the aircraft list |
|
4797 | - * |
|
4798 | - */ |
|
4794 | + * Gets all aircraft registration that have flown over by airport icao |
|
4795 | + * |
|
4796 | + * @return Array the aircraft list |
|
4797 | + * |
|
4798 | + */ |
|
4799 | 4799 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
4800 | 4800 | { |
4801 | 4801 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4832,11 +4832,11 @@ discard block |
||
4832 | 4832 | |
4833 | 4833 | |
4834 | 4834 | /** |
4835 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
4836 | - * |
|
4837 | - * @return Array the aircraft list |
|
4838 | - * |
|
4839 | - */ |
|
4835 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
4836 | + * |
|
4837 | + * @return Array the aircraft list |
|
4838 | + * |
|
4839 | + */ |
|
4840 | 4840 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
4841 | 4841 | { |
4842 | 4842 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4862,11 +4862,11 @@ discard block |
||
4862 | 4862 | } |
4863 | 4863 | |
4864 | 4864 | /** |
4865 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
4866 | - * |
|
4867 | - * @return Array the aircraft list |
|
4868 | - * |
|
4869 | - */ |
|
4865 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
4866 | + * |
|
4867 | + * @return Array the aircraft list |
|
4868 | + * |
|
4869 | + */ |
|
4870 | 4870 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
4871 | 4871 | { |
4872 | 4872 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4893,11 +4893,11 @@ discard block |
||
4893 | 4893 | |
4894 | 4894 | |
4895 | 4895 | /** |
4896 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
4897 | - * |
|
4898 | - * @return Array the aircraft list |
|
4899 | - * |
|
4900 | - */ |
|
4896 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
4897 | + * |
|
4898 | + * @return Array the aircraft list |
|
4899 | + * |
|
4900 | + */ |
|
4901 | 4901 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
4902 | 4902 | { |
4903 | 4903 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4933,11 +4933,11 @@ discard block |
||
4933 | 4933 | } |
4934 | 4934 | |
4935 | 4935 | /** |
4936 | - * Gets all aircraft types that have flown over by date |
|
4937 | - * |
|
4938 | - * @return Array the aircraft list |
|
4939 | - * |
|
4940 | - */ |
|
4936 | + * Gets all aircraft types that have flown over by date |
|
4937 | + * |
|
4938 | + * @return Array the aircraft list |
|
4939 | + * |
|
4940 | + */ |
|
4941 | 4941 | public function countAllAircraftTypesByDate($date,$filters = array()) |
4942 | 4942 | { |
4943 | 4943 | global $globalTimezone, $globalDBdriver; |
@@ -4979,11 +4979,11 @@ discard block |
||
4979 | 4979 | |
4980 | 4980 | |
4981 | 4981 | /** |
4982 | - * Gets all aircraft registration that have flown over by date |
|
4983 | - * |
|
4984 | - * @return Array the aircraft list |
|
4985 | - * |
|
4986 | - */ |
|
4982 | + * Gets all aircraft registration that have flown over by date |
|
4983 | + * |
|
4984 | + * @return Array the aircraft list |
|
4985 | + * |
|
4986 | + */ |
|
4987 | 4987 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
4988 | 4988 | { |
4989 | 4989 | global $globalTimezone, $globalDBdriver; |
@@ -5034,11 +5034,11 @@ discard block |
||
5034 | 5034 | |
5035 | 5035 | |
5036 | 5036 | /** |
5037 | - * Gets all aircraft manufacturer that have flown over by date |
|
5038 | - * |
|
5039 | - * @return Array the aircraft manufacturer list |
|
5040 | - * |
|
5041 | - */ |
|
5037 | + * Gets all aircraft manufacturer that have flown over by date |
|
5038 | + * |
|
5039 | + * @return Array the aircraft manufacturer list |
|
5040 | + * |
|
5041 | + */ |
|
5042 | 5042 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
5043 | 5043 | { |
5044 | 5044 | global $globalTimezone, $globalDBdriver; |
@@ -5080,11 +5080,11 @@ discard block |
||
5080 | 5080 | |
5081 | 5081 | |
5082 | 5082 | /** |
5083 | - * Gets all aircraft types that have flown over by ident/callsign |
|
5084 | - * |
|
5085 | - * @return Array the aircraft list |
|
5086 | - * |
|
5087 | - */ |
|
5083 | + * Gets all aircraft types that have flown over by ident/callsign |
|
5084 | + * |
|
5085 | + * @return Array the aircraft list |
|
5086 | + * |
|
5087 | + */ |
|
5088 | 5088 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
5089 | 5089 | { |
5090 | 5090 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5113,11 +5113,11 @@ discard block |
||
5113 | 5113 | |
5114 | 5114 | |
5115 | 5115 | /** |
5116 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
5117 | - * |
|
5118 | - * @return Array the aircraft list |
|
5119 | - * |
|
5120 | - */ |
|
5116 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
5117 | + * |
|
5118 | + * @return Array the aircraft list |
|
5119 | + * |
|
5120 | + */ |
|
5121 | 5121 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
5122 | 5122 | { |
5123 | 5123 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5157,11 +5157,11 @@ discard block |
||
5157 | 5157 | |
5158 | 5158 | |
5159 | 5159 | /** |
5160 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
5161 | - * |
|
5162 | - * @return Array the aircraft manufacturer list |
|
5163 | - * |
|
5164 | - */ |
|
5160 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
5161 | + * |
|
5162 | + * @return Array the aircraft manufacturer list |
|
5163 | + * |
|
5164 | + */ |
|
5165 | 5165 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
5166 | 5166 | { |
5167 | 5167 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5187,11 +5187,11 @@ discard block |
||
5187 | 5187 | |
5188 | 5188 | |
5189 | 5189 | /** |
5190 | - * Gets all aircraft types that have flown over by route |
|
5191 | - * |
|
5192 | - * @return Array the aircraft list |
|
5193 | - * |
|
5194 | - */ |
|
5190 | + * Gets all aircraft types that have flown over by route |
|
5191 | + * |
|
5192 | + * @return Array the aircraft list |
|
5193 | + * |
|
5194 | + */ |
|
5195 | 5195 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
5196 | 5196 | { |
5197 | 5197 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5220,11 +5220,11 @@ discard block |
||
5220 | 5220 | } |
5221 | 5221 | |
5222 | 5222 | /** |
5223 | - * Gets all aircraft registration that have flown over by route |
|
5224 | - * |
|
5225 | - * @return Array the aircraft list |
|
5226 | - * |
|
5227 | - */ |
|
5223 | + * Gets all aircraft registration that have flown over by route |
|
5224 | + * |
|
5225 | + * @return Array the aircraft list |
|
5226 | + * |
|
5227 | + */ |
|
5228 | 5228 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
5229 | 5229 | { |
5230 | 5230 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5266,11 +5266,11 @@ discard block |
||
5266 | 5266 | |
5267 | 5267 | |
5268 | 5268 | /** |
5269 | - * Gets all aircraft manufacturer that have flown over by route |
|
5270 | - * |
|
5271 | - * @return Array the aircraft manufacturer list |
|
5272 | - * |
|
5273 | - */ |
|
5269 | + * Gets all aircraft manufacturer that have flown over by route |
|
5270 | + * |
|
5271 | + * @return Array the aircraft manufacturer list |
|
5272 | + * |
|
5273 | + */ |
|
5274 | 5274 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
5275 | 5275 | { |
5276 | 5276 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5304,11 +5304,11 @@ discard block |
||
5304 | 5304 | |
5305 | 5305 | |
5306 | 5306 | /** |
5307 | - * Gets all aircraft types that have flown over by country |
|
5308 | - * |
|
5309 | - * @return Array the aircraft list |
|
5310 | - * |
|
5311 | - */ |
|
5307 | + * Gets all aircraft types that have flown over by country |
|
5308 | + * |
|
5309 | + * @return Array the aircraft list |
|
5310 | + * |
|
5311 | + */ |
|
5312 | 5312 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
5313 | 5313 | { |
5314 | 5314 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5339,11 +5339,11 @@ discard block |
||
5339 | 5339 | |
5340 | 5340 | |
5341 | 5341 | /** |
5342 | - * Gets all aircraft registration that have flown over by country |
|
5343 | - * |
|
5344 | - * @return Array the aircraft list |
|
5345 | - * |
|
5346 | - */ |
|
5342 | + * Gets all aircraft registration that have flown over by country |
|
5343 | + * |
|
5344 | + * @return Array the aircraft list |
|
5345 | + * |
|
5346 | + */ |
|
5347 | 5347 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
5348 | 5348 | { |
5349 | 5349 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5383,11 +5383,11 @@ discard block |
||
5383 | 5383 | |
5384 | 5384 | |
5385 | 5385 | /** |
5386 | - * Gets all aircraft manufacturer that have flown over by country |
|
5387 | - * |
|
5388 | - * @return Array the aircraft manufacturer list |
|
5389 | - * |
|
5390 | - */ |
|
5386 | + * Gets all aircraft manufacturer that have flown over by country |
|
5387 | + * |
|
5388 | + * @return Array the aircraft manufacturer list |
|
5389 | + * |
|
5390 | + */ |
|
5391 | 5391 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
5392 | 5392 | { |
5393 | 5393 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5418,17 +5418,17 @@ discard block |
||
5418 | 5418 | |
5419 | 5419 | |
5420 | 5420 | /** |
5421 | - * Gets all aircraft manufacturers that have flown over |
|
5422 | - * |
|
5423 | - * @return Array the aircraft list |
|
5424 | - * |
|
5425 | - */ |
|
5421 | + * Gets all aircraft manufacturers that have flown over |
|
5422 | + * |
|
5423 | + * @return Array the aircraft list |
|
5424 | + * |
|
5425 | + */ |
|
5426 | 5426 | public function countAllAircraftManufacturers($filters = array()) |
5427 | 5427 | { |
5428 | 5428 | $filter_query = $this->getFilter($filters,true,true); |
5429 | 5429 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
5430 | 5430 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
5431 | - $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
5431 | + $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
5432 | 5432 | ORDER BY aircraft_manufacturer_count DESC |
5433 | 5433 | LIMIT 10"; |
5434 | 5434 | |
@@ -5453,11 +5453,11 @@ discard block |
||
5453 | 5453 | |
5454 | 5454 | |
5455 | 5455 | /** |
5456 | - * Gets all aircraft registrations that have flown over |
|
5457 | - * |
|
5458 | - * @return Array the aircraft list |
|
5459 | - * |
|
5460 | - */ |
|
5456 | + * Gets all aircraft registrations that have flown over |
|
5457 | + * |
|
5458 | + * @return Array the aircraft list |
|
5459 | + * |
|
5460 | + */ |
|
5461 | 5461 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
5462 | 5462 | { |
5463 | 5463 | global $globalDBdriver; |
@@ -5465,15 +5465,15 @@ discard block |
||
5465 | 5465 | $filter_query = $this->getFilter($filters,true,true); |
5466 | 5466 | $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 |
5467 | 5467 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
5468 | - if ($olderthanmonths > 0) { |
|
5469 | - if ($globalDBdriver == 'mysql') { |
|
5468 | + if ($olderthanmonths > 0) { |
|
5469 | + if ($globalDBdriver == 'mysql') { |
|
5470 | 5470 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
5471 | 5471 | } else { |
5472 | 5472 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
5473 | 5473 | } |
5474 | 5474 | } |
5475 | - if ($sincedate != '') { |
|
5476 | - if ($globalDBdriver == 'mysql') { |
|
5475 | + if ($sincedate != '') { |
|
5476 | + if ($globalDBdriver == 'mysql') { |
|
5477 | 5477 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
5478 | 5478 | } else { |
5479 | 5479 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5482,7 +5482,7 @@ discard block |
||
5482 | 5482 | |
5483 | 5483 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5484 | 5484 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5485 | - $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
5485 | + $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
5486 | 5486 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5487 | 5487 | |
5488 | 5488 | $sth = $this->db->prepare($query); |
@@ -5513,11 +5513,11 @@ discard block |
||
5513 | 5513 | |
5514 | 5514 | |
5515 | 5515 | /** |
5516 | - * Gets all aircraft registrations that have flown over |
|
5517 | - * |
|
5518 | - * @return Array the aircraft list |
|
5519 | - * |
|
5520 | - */ |
|
5516 | + * Gets all aircraft registrations that have flown over |
|
5517 | + * |
|
5518 | + * @return Array the aircraft list |
|
5519 | + * |
|
5520 | + */ |
|
5521 | 5521 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
5522 | 5522 | { |
5523 | 5523 | global $globalDBdriver; |
@@ -5525,15 +5525,15 @@ discard block |
||
5525 | 5525 | $Image = new Image($this->db); |
5526 | 5526 | $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 |
5527 | 5527 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
5528 | - if ($olderthanmonths > 0) { |
|
5529 | - if ($globalDBdriver == 'mysql') { |
|
5528 | + if ($olderthanmonths > 0) { |
|
5529 | + if ($globalDBdriver == 'mysql') { |
|
5530 | 5530 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
5531 | 5531 | } else { |
5532 | 5532 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
5533 | 5533 | } |
5534 | 5534 | } |
5535 | - if ($sincedate != '') { |
|
5536 | - if ($globalDBdriver == 'mysql') { |
|
5535 | + if ($sincedate != '') { |
|
5536 | + if ($globalDBdriver == 'mysql') { |
|
5537 | 5537 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
5538 | 5538 | } else { |
5539 | 5539 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5542,7 +5542,7 @@ discard block |
||
5542 | 5542 | |
5543 | 5543 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5544 | 5544 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5545 | - $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"; |
|
5545 | + $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"; |
|
5546 | 5546 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5547 | 5547 | |
5548 | 5548 | $sth = $this->db->prepare($query); |
@@ -5574,35 +5574,35 @@ discard block |
||
5574 | 5574 | |
5575 | 5575 | |
5576 | 5576 | /** |
5577 | - * Gets all departure airports of the airplanes that have flown over |
|
5578 | - * |
|
5579 | - * @return Array the airport list |
|
5580 | - * |
|
5581 | - */ |
|
5577 | + * Gets all departure airports of the airplanes that have flown over |
|
5578 | + * |
|
5579 | + * @return Array the airport list |
|
5580 | + * |
|
5581 | + */ |
|
5582 | 5582 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5583 | 5583 | { |
5584 | 5584 | global $globalDBdriver; |
5585 | 5585 | $filter_query = $this->getFilter($filters,true,true); |
5586 | 5586 | $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 |
5587 | 5587 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
5588 | - if ($olderthanmonths > 0) { |
|
5589 | - if ($globalDBdriver == 'mysql') { |
|
5588 | + if ($olderthanmonths > 0) { |
|
5589 | + if ($globalDBdriver == 'mysql') { |
|
5590 | 5590 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
5591 | 5591 | } else { |
5592 | 5592 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
5593 | 5593 | } |
5594 | - } |
|
5595 | - if ($sincedate != '') { |
|
5596 | - if ($globalDBdriver == 'mysql') { |
|
5594 | + } |
|
5595 | + if ($sincedate != '') { |
|
5596 | + if ($globalDBdriver == 'mysql') { |
|
5597 | 5597 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
5598 | 5598 | } else { |
5599 | 5599 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
5600 | 5600 | } |
5601 | 5601 | } |
5602 | 5602 | |
5603 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5604 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5605 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5603 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5604 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5605 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5606 | 5606 | ORDER BY airport_departure_icao_count DESC"; |
5607 | 5607 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5608 | 5608 | |
@@ -5626,35 +5626,35 @@ discard block |
||
5626 | 5626 | } |
5627 | 5627 | |
5628 | 5628 | /** |
5629 | - * Gets all departure airports of the airplanes that have flown over |
|
5630 | - * |
|
5631 | - * @return Array the airport list |
|
5632 | - * |
|
5633 | - */ |
|
5629 | + * Gets all departure airports of the airplanes that have flown over |
|
5630 | + * |
|
5631 | + * @return Array the airport list |
|
5632 | + * |
|
5633 | + */ |
|
5634 | 5634 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5635 | 5635 | { |
5636 | 5636 | global $globalDBdriver; |
5637 | 5637 | $filter_query = $this->getFilter($filters,true,true); |
5638 | 5638 | $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 |
5639 | 5639 | 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 <> '' "; |
5640 | - if ($olderthanmonths > 0) { |
|
5641 | - if ($globalDBdriver == 'mysql') { |
|
5640 | + if ($olderthanmonths > 0) { |
|
5641 | + if ($globalDBdriver == 'mysql') { |
|
5642 | 5642 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
5643 | 5643 | } else { |
5644 | 5644 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
5645 | 5645 | } |
5646 | - } |
|
5647 | - if ($sincedate != '') { |
|
5648 | - if ($globalDBdriver == 'mysql') { |
|
5646 | + } |
|
5647 | + if ($sincedate != '') { |
|
5648 | + if ($globalDBdriver == 'mysql') { |
|
5649 | 5649 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
5650 | 5650 | } else { |
5651 | 5651 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
5652 | 5652 | } |
5653 | 5653 | } |
5654 | 5654 | |
5655 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5656 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5657 | - $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 |
|
5655 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5656 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5657 | + $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 |
|
5658 | 5658 | ORDER BY airport_departure_icao_count DESC"; |
5659 | 5659 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5660 | 5660 | |
@@ -5679,37 +5679,37 @@ discard block |
||
5679 | 5679 | } |
5680 | 5680 | |
5681 | 5681 | /** |
5682 | - * Gets all detected departure airports of the airplanes that have flown over |
|
5683 | - * |
|
5684 | - * @return Array the airport list |
|
5685 | - * |
|
5686 | - */ |
|
5682 | + * Gets all detected departure airports of the airplanes that have flown over |
|
5683 | + * |
|
5684 | + * @return Array the airport list |
|
5685 | + * |
|
5686 | + */ |
|
5687 | 5687 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5688 | 5688 | { |
5689 | 5689 | global $globalDBdriver; |
5690 | 5690 | $filter_query = $this->getFilter($filters,true,true); |
5691 | 5691 | $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 |
5692 | 5692 | 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"; |
5693 | - if ($olderthanmonths > 0) { |
|
5694 | - if ($globalDBdriver == 'mysql') { |
|
5693 | + if ($olderthanmonths > 0) { |
|
5694 | + if ($globalDBdriver == 'mysql') { |
|
5695 | 5695 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
5696 | 5696 | } else { |
5697 | 5697 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
5698 | 5698 | } |
5699 | - } |
|
5700 | - if ($sincedate != '') { |
|
5701 | - if ($globalDBdriver == 'mysql') { |
|
5699 | + } |
|
5700 | + if ($sincedate != '') { |
|
5701 | + if ($globalDBdriver == 'mysql') { |
|
5702 | 5702 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
5703 | 5703 | } else { |
5704 | 5704 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
5705 | 5705 | } |
5706 | 5706 | } |
5707 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5708 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5709 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5707 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5708 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5709 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5710 | 5710 | ORDER BY airport_departure_icao_count DESC"; |
5711 | 5711 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5712 | - //echo $query; |
|
5712 | + //echo $query; |
|
5713 | 5713 | $sth = $this->db->prepare($query); |
5714 | 5714 | $sth->execute(); |
5715 | 5715 | |
@@ -5730,35 +5730,35 @@ discard block |
||
5730 | 5730 | } |
5731 | 5731 | |
5732 | 5732 | /** |
5733 | - * Gets all detected departure airports of the airplanes that have flown over |
|
5734 | - * |
|
5735 | - * @return Array the airport list |
|
5736 | - * |
|
5737 | - */ |
|
5733 | + * Gets all detected departure airports of the airplanes that have flown over |
|
5734 | + * |
|
5735 | + * @return Array the airport list |
|
5736 | + * |
|
5737 | + */ |
|
5738 | 5738 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5739 | 5739 | { |
5740 | 5740 | global $globalDBdriver; |
5741 | 5741 | $filter_query = $this->getFilter($filters,true,true); |
5742 | 5742 | $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 |
5743 | 5743 | 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 "; |
5744 | - if ($olderthanmonths > 0) { |
|
5745 | - if ($globalDBdriver == 'mysql') { |
|
5744 | + if ($olderthanmonths > 0) { |
|
5745 | + if ($globalDBdriver == 'mysql') { |
|
5746 | 5746 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
5747 | 5747 | } else { |
5748 | 5748 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
5749 | 5749 | } |
5750 | - } |
|
5751 | - if ($sincedate != '') { |
|
5752 | - if ($globalDBdriver == 'mysql') { |
|
5750 | + } |
|
5751 | + if ($sincedate != '') { |
|
5752 | + if ($globalDBdriver == 'mysql') { |
|
5753 | 5753 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
5754 | 5754 | } else { |
5755 | 5755 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
5756 | 5756 | } |
5757 | 5757 | } |
5758 | 5758 | |
5759 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5760 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5761 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5759 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5760 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5761 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5762 | 5762 | ORDER BY airport_departure_icao_count DESC"; |
5763 | 5763 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5764 | 5764 | |
@@ -5783,11 +5783,11 @@ discard block |
||
5783 | 5783 | } |
5784 | 5784 | |
5785 | 5785 | /** |
5786 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
5787 | - * |
|
5788 | - * @return Array the airport list |
|
5789 | - * |
|
5790 | - */ |
|
5786 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
5787 | + * |
|
5788 | + * @return Array the airport list |
|
5789 | + * |
|
5790 | + */ |
|
5791 | 5791 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
5792 | 5792 | { |
5793 | 5793 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5821,11 +5821,11 @@ discard block |
||
5821 | 5821 | |
5822 | 5822 | |
5823 | 5823 | /** |
5824 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
5825 | - * |
|
5826 | - * @return Array the airport list |
|
5827 | - * |
|
5828 | - */ |
|
5824 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
5825 | + * |
|
5826 | + * @return Array the airport list |
|
5827 | + * |
|
5828 | + */ |
|
5829 | 5829 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
5830 | 5830 | { |
5831 | 5831 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5856,11 +5856,11 @@ discard block |
||
5856 | 5856 | |
5857 | 5857 | |
5858 | 5858 | /** |
5859 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
5860 | - * |
|
5861 | - * @return Array the airport list |
|
5862 | - * |
|
5863 | - */ |
|
5859 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
5860 | + * |
|
5861 | + * @return Array the airport list |
|
5862 | + * |
|
5863 | + */ |
|
5864 | 5864 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
5865 | 5865 | { |
5866 | 5866 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5893,11 +5893,11 @@ discard block |
||
5893 | 5893 | |
5894 | 5894 | |
5895 | 5895 | /** |
5896 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
5897 | - * |
|
5898 | - * @return Array the airport list |
|
5899 | - * |
|
5900 | - */ |
|
5896 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
5897 | + * |
|
5898 | + * @return Array the airport list |
|
5899 | + * |
|
5900 | + */ |
|
5901 | 5901 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
5902 | 5902 | { |
5903 | 5903 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5927,11 +5927,11 @@ discard block |
||
5927 | 5927 | |
5928 | 5928 | |
5929 | 5929 | /** |
5930 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
5931 | - * |
|
5932 | - * @return Array the airport list |
|
5933 | - * |
|
5934 | - */ |
|
5930 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
5931 | + * |
|
5932 | + * @return Array the airport list |
|
5933 | + * |
|
5934 | + */ |
|
5935 | 5935 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
5936 | 5936 | { |
5937 | 5937 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5964,11 +5964,11 @@ discard block |
||
5964 | 5964 | |
5965 | 5965 | |
5966 | 5966 | /** |
5967 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
5968 | - * |
|
5969 | - * @return Array the airport list |
|
5970 | - * |
|
5971 | - */ |
|
5967 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
5968 | + * |
|
5969 | + * @return Array the airport list |
|
5970 | + * |
|
5971 | + */ |
|
5972 | 5972 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
5973 | 5973 | { |
5974 | 5974 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5998,11 +5998,11 @@ discard block |
||
5998 | 5998 | |
5999 | 5999 | |
6000 | 6000 | /** |
6001 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
6002 | - * |
|
6003 | - * @return Array the airport list |
|
6004 | - * |
|
6005 | - */ |
|
6001 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
6002 | + * |
|
6003 | + * @return Array the airport list |
|
6004 | + * |
|
6005 | + */ |
|
6006 | 6006 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
6007 | 6007 | { |
6008 | 6008 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6035,11 +6035,11 @@ discard block |
||
6035 | 6035 | |
6036 | 6036 | |
6037 | 6037 | /** |
6038 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
6039 | - * |
|
6040 | - * @return Array the airport list |
|
6041 | - * |
|
6042 | - */ |
|
6038 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
6039 | + * |
|
6040 | + * @return Array the airport list |
|
6041 | + * |
|
6042 | + */ |
|
6043 | 6043 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
6044 | 6044 | { |
6045 | 6045 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6070,11 +6070,11 @@ discard block |
||
6070 | 6070 | |
6071 | 6071 | |
6072 | 6072 | /** |
6073 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
6074 | - * |
|
6075 | - * @return Array the airport list |
|
6076 | - * |
|
6077 | - */ |
|
6073 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
6074 | + * |
|
6075 | + * @return Array the airport list |
|
6076 | + * |
|
6077 | + */ |
|
6078 | 6078 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
6079 | 6079 | { |
6080 | 6080 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6107,11 +6107,11 @@ discard block |
||
6107 | 6107 | |
6108 | 6108 | |
6109 | 6109 | /** |
6110 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
6111 | - * |
|
6112 | - * @return Array the airport list |
|
6113 | - * |
|
6114 | - */ |
|
6110 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
6111 | + * |
|
6112 | + * @return Array the airport list |
|
6113 | + * |
|
6114 | + */ |
|
6115 | 6115 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
6116 | 6116 | { |
6117 | 6117 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6141,11 +6141,11 @@ discard block |
||
6141 | 6141 | |
6142 | 6142 | |
6143 | 6143 | /** |
6144 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
6145 | - * |
|
6146 | - * @return Array the airport list |
|
6147 | - * |
|
6148 | - */ |
|
6144 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
6145 | + * |
|
6146 | + * @return Array the airport list |
|
6147 | + * |
|
6148 | + */ |
|
6149 | 6149 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
6150 | 6150 | { |
6151 | 6151 | global $globalTimezone, $globalDBdriver; |
@@ -6191,11 +6191,11 @@ discard block |
||
6191 | 6191 | |
6192 | 6192 | |
6193 | 6193 | /** |
6194 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
6195 | - * |
|
6196 | - * @return Array the airport list |
|
6197 | - * |
|
6198 | - */ |
|
6194 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
6195 | + * |
|
6196 | + * @return Array the airport list |
|
6197 | + * |
|
6198 | + */ |
|
6199 | 6199 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
6200 | 6200 | { |
6201 | 6201 | global $globalTimezone, $globalDBdriver; |
@@ -6238,11 +6238,11 @@ discard block |
||
6238 | 6238 | |
6239 | 6239 | |
6240 | 6240 | /** |
6241 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
6242 | - * |
|
6243 | - * @return Array the airport list |
|
6244 | - * |
|
6245 | - */ |
|
6241 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
6242 | + * |
|
6243 | + * @return Array the airport list |
|
6244 | + * |
|
6245 | + */ |
|
6246 | 6246 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
6247 | 6247 | { |
6248 | 6248 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6276,11 +6276,11 @@ discard block |
||
6276 | 6276 | |
6277 | 6277 | |
6278 | 6278 | /** |
6279 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
6280 | - * |
|
6281 | - * @return Array the airport list |
|
6282 | - * |
|
6283 | - */ |
|
6279 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
6280 | + * |
|
6281 | + * @return Array the airport list |
|
6282 | + * |
|
6283 | + */ |
|
6284 | 6284 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
6285 | 6285 | { |
6286 | 6286 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6311,11 +6311,11 @@ discard block |
||
6311 | 6311 | |
6312 | 6312 | |
6313 | 6313 | /** |
6314 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
6315 | - * |
|
6316 | - * @return Array the airport list |
|
6317 | - * |
|
6318 | - */ |
|
6314 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
6315 | + * |
|
6316 | + * @return Array the airport list |
|
6317 | + * |
|
6318 | + */ |
|
6319 | 6319 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
6320 | 6320 | { |
6321 | 6321 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6349,11 +6349,11 @@ discard block |
||
6349 | 6349 | |
6350 | 6350 | |
6351 | 6351 | /** |
6352 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
6353 | - * |
|
6354 | - * @return Array the airport list |
|
6355 | - * |
|
6356 | - */ |
|
6352 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
6353 | + * |
|
6354 | + * @return Array the airport list |
|
6355 | + * |
|
6356 | + */ |
|
6357 | 6357 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
6358 | 6358 | { |
6359 | 6359 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6383,40 +6383,40 @@ discard block |
||
6383 | 6383 | |
6384 | 6384 | |
6385 | 6385 | /** |
6386 | - * Gets all arrival airports of the airplanes that have flown over |
|
6387 | - * |
|
6388 | - * @param Boolean $limit Limit result to 10 or not |
|
6389 | - * @param Integer $olderthanmonths Only show result older than x months |
|
6390 | - * @param String $sincedate Only show result since x date |
|
6391 | - * @param Boolean $icaoaskey Show result by ICAO |
|
6392 | - * @param Array $filters Filter used here |
|
6393 | - * @return Array the airport list |
|
6394 | - * |
|
6395 | - */ |
|
6386 | + * Gets all arrival airports of the airplanes that have flown over |
|
6387 | + * |
|
6388 | + * @param Boolean $limit Limit result to 10 or not |
|
6389 | + * @param Integer $olderthanmonths Only show result older than x months |
|
6390 | + * @param String $sincedate Only show result since x date |
|
6391 | + * @param Boolean $icaoaskey Show result by ICAO |
|
6392 | + * @param Array $filters Filter used here |
|
6393 | + * @return Array the airport list |
|
6394 | + * |
|
6395 | + */ |
|
6396 | 6396 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
6397 | 6397 | { |
6398 | 6398 | global $globalDBdriver; |
6399 | 6399 | $filter_query = $this->getFilter($filters,true,true); |
6400 | 6400 | $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 |
6401 | 6401 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
6402 | - if ($olderthanmonths > 0) { |
|
6403 | - if ($globalDBdriver == 'mysql') { |
|
6402 | + if ($olderthanmonths > 0) { |
|
6403 | + if ($globalDBdriver == 'mysql') { |
|
6404 | 6404 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
6405 | 6405 | } else { |
6406 | 6406 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
6407 | 6407 | } |
6408 | 6408 | } |
6409 | - if ($sincedate != '') { |
|
6410 | - if ($globalDBdriver == 'mysql') { |
|
6409 | + if ($sincedate != '') { |
|
6410 | + if ($globalDBdriver == 'mysql') { |
|
6411 | 6411 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6412 | 6412 | } else { |
6413 | 6413 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6414 | 6414 | } |
6415 | 6415 | } |
6416 | 6416 | |
6417 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6418 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6419 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6417 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6418 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6419 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6420 | 6420 | ORDER BY airport_arrival_icao_count DESC"; |
6421 | 6421 | if ($limit) $query .= " LIMIT 10"; |
6422 | 6422 | |
@@ -6445,35 +6445,35 @@ discard block |
||
6445 | 6445 | } |
6446 | 6446 | |
6447 | 6447 | /** |
6448 | - * Gets all arrival airports of the airplanes that have flown over |
|
6449 | - * |
|
6450 | - * @return Array the airport list |
|
6451 | - * |
|
6452 | - */ |
|
6448 | + * Gets all arrival airports of the airplanes that have flown over |
|
6449 | + * |
|
6450 | + * @return Array the airport list |
|
6451 | + * |
|
6452 | + */ |
|
6453 | 6453 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
6454 | 6454 | { |
6455 | 6455 | global $globalDBdriver; |
6456 | 6456 | $filter_query = $this->getFilter($filters,true,true); |
6457 | 6457 | $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 |
6458 | 6458 | 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 <> '' "; |
6459 | - if ($olderthanmonths > 0) { |
|
6460 | - if ($globalDBdriver == 'mysql') { |
|
6459 | + if ($olderthanmonths > 0) { |
|
6460 | + if ($globalDBdriver == 'mysql') { |
|
6461 | 6461 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
6462 | 6462 | } else { |
6463 | 6463 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
6464 | 6464 | } |
6465 | 6465 | } |
6466 | - if ($sincedate != '') { |
|
6467 | - if ($globalDBdriver == 'mysql') { |
|
6466 | + if ($sincedate != '') { |
|
6467 | + if ($globalDBdriver == 'mysql') { |
|
6468 | 6468 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6469 | 6469 | } else { |
6470 | 6470 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6471 | 6471 | } |
6472 | 6472 | } |
6473 | 6473 | |
6474 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6475 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6476 | - $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 |
|
6474 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6475 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6476 | + $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 |
|
6477 | 6477 | ORDER BY airport_arrival_icao_count DESC"; |
6478 | 6478 | if ($limit) $query .= " LIMIT 10"; |
6479 | 6479 | |
@@ -6504,34 +6504,34 @@ discard block |
||
6504 | 6504 | |
6505 | 6505 | |
6506 | 6506 | /** |
6507 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
6508 | - * |
|
6509 | - * @return Array the airport list |
|
6510 | - * |
|
6511 | - */ |
|
6507 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
6508 | + * |
|
6509 | + * @return Array the airport list |
|
6510 | + * |
|
6511 | + */ |
|
6512 | 6512 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
6513 | 6513 | { |
6514 | 6514 | global $globalDBdriver; |
6515 | 6515 | $filter_query = $this->getFilter($filters,true,true); |
6516 | 6516 | $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 |
6517 | 6517 | 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"; |
6518 | - if ($olderthanmonths > 0) { |
|
6519 | - if ($globalDBdriver == 'mysql') { |
|
6518 | + if ($olderthanmonths > 0) { |
|
6519 | + if ($globalDBdriver == 'mysql') { |
|
6520 | 6520 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
6521 | 6521 | } else { |
6522 | 6522 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
6523 | 6523 | } |
6524 | 6524 | } |
6525 | - if ($sincedate != '') { |
|
6526 | - if ($globalDBdriver == 'mysql') { |
|
6525 | + if ($sincedate != '') { |
|
6526 | + if ($globalDBdriver == 'mysql') { |
|
6527 | 6527 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6528 | 6528 | } else { |
6529 | 6529 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6530 | 6530 | } |
6531 | 6531 | } |
6532 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6533 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6534 | - $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6532 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6533 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6534 | + $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6535 | 6535 | ORDER BY airport_arrival_icao_count DESC"; |
6536 | 6536 | if ($limit) $query .= " LIMIT 10"; |
6537 | 6537 | |
@@ -6560,35 +6560,35 @@ discard block |
||
6560 | 6560 | } |
6561 | 6561 | |
6562 | 6562 | /** |
6563 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
6564 | - * |
|
6565 | - * @return Array the airport list |
|
6566 | - * |
|
6567 | - */ |
|
6563 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
6564 | + * |
|
6565 | + * @return Array the airport list |
|
6566 | + * |
|
6567 | + */ |
|
6568 | 6568 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
6569 | 6569 | { |
6570 | 6570 | global $globalDBdriver; |
6571 | 6571 | $filter_query = $this->getFilter($filters,true,true); |
6572 | 6572 | $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 |
6573 | 6573 | 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 "; |
6574 | - if ($olderthanmonths > 0) { |
|
6575 | - if ($globalDBdriver == 'mysql') { |
|
6574 | + if ($olderthanmonths > 0) { |
|
6575 | + if ($globalDBdriver == 'mysql') { |
|
6576 | 6576 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
6577 | 6577 | } else { |
6578 | 6578 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
6579 | 6579 | } |
6580 | 6580 | } |
6581 | - if ($sincedate != '') { |
|
6582 | - if ($globalDBdriver == 'mysql') { |
|
6581 | + if ($sincedate != '') { |
|
6582 | + if ($globalDBdriver == 'mysql') { |
|
6583 | 6583 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6584 | 6584 | } else { |
6585 | 6585 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6586 | 6586 | } |
6587 | 6587 | } |
6588 | 6588 | |
6589 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6590 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6591 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6589 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6590 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6591 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6592 | 6592 | ORDER BY airport_arrival_icao_count DESC"; |
6593 | 6593 | if ($limit) $query .= " LIMIT 10"; |
6594 | 6594 | |
@@ -6618,11 +6618,11 @@ discard block |
||
6618 | 6618 | } |
6619 | 6619 | |
6620 | 6620 | /** |
6621 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
6622 | - * |
|
6623 | - * @return Array the airport list |
|
6624 | - * |
|
6625 | - */ |
|
6621 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
6622 | + * |
|
6623 | + * @return Array the airport list |
|
6624 | + * |
|
6625 | + */ |
|
6626 | 6626 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
6627 | 6627 | { |
6628 | 6628 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6654,11 +6654,11 @@ discard block |
||
6654 | 6654 | |
6655 | 6655 | |
6656 | 6656 | /** |
6657 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
6658 | - * |
|
6659 | - * @return Array the airport list |
|
6660 | - * |
|
6661 | - */ |
|
6657 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
6658 | + * |
|
6659 | + * @return Array the airport list |
|
6660 | + * |
|
6661 | + */ |
|
6662 | 6662 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
6663 | 6663 | { |
6664 | 6664 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6689,11 +6689,11 @@ discard block |
||
6689 | 6689 | |
6690 | 6690 | |
6691 | 6691 | /** |
6692 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
6693 | - * |
|
6694 | - * @return Array the airport list |
|
6695 | - * |
|
6696 | - */ |
|
6692 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
6693 | + * |
|
6694 | + * @return Array the airport list |
|
6695 | + * |
|
6696 | + */ |
|
6697 | 6697 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
6698 | 6698 | { |
6699 | 6699 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6727,11 +6727,11 @@ discard block |
||
6727 | 6727 | |
6728 | 6728 | |
6729 | 6729 | /** |
6730 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
6731 | - * |
|
6732 | - * @return Array the airport list |
|
6733 | - * |
|
6734 | - */ |
|
6730 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
6731 | + * |
|
6732 | + * @return Array the airport list |
|
6733 | + * |
|
6734 | + */ |
|
6735 | 6735 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
6736 | 6736 | { |
6737 | 6737 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6761,11 +6761,11 @@ discard block |
||
6761 | 6761 | |
6762 | 6762 | |
6763 | 6763 | /** |
6764 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
6765 | - * |
|
6766 | - * @return Array the airport list |
|
6767 | - * |
|
6768 | - */ |
|
6764 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
6765 | + * |
|
6766 | + * @return Array the airport list |
|
6767 | + * |
|
6768 | + */ |
|
6769 | 6769 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
6770 | 6770 | { |
6771 | 6771 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6799,11 +6799,11 @@ discard block |
||
6799 | 6799 | |
6800 | 6800 | |
6801 | 6801 | /** |
6802 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
6803 | - * |
|
6804 | - * @return Array the airport list |
|
6805 | - * |
|
6806 | - */ |
|
6802 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
6803 | + * |
|
6804 | + * @return Array the airport list |
|
6805 | + * |
|
6806 | + */ |
|
6807 | 6807 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
6808 | 6808 | { |
6809 | 6809 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6834,11 +6834,11 @@ discard block |
||
6834 | 6834 | |
6835 | 6835 | |
6836 | 6836 | /** |
6837 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
6838 | - * |
|
6839 | - * @return Array the airport list |
|
6840 | - * |
|
6841 | - */ |
|
6837 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
6838 | + * |
|
6839 | + * @return Array the airport list |
|
6840 | + * |
|
6841 | + */ |
|
6842 | 6842 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
6843 | 6843 | { |
6844 | 6844 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6871,11 +6871,11 @@ discard block |
||
6871 | 6871 | |
6872 | 6872 | |
6873 | 6873 | /** |
6874 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
6875 | - * |
|
6876 | - * @return Array the airport list |
|
6877 | - * |
|
6878 | - */ |
|
6874 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
6875 | + * |
|
6876 | + * @return Array the airport list |
|
6877 | + * |
|
6878 | + */ |
|
6879 | 6879 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
6880 | 6880 | { |
6881 | 6881 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6905,11 +6905,11 @@ discard block |
||
6905 | 6905 | |
6906 | 6906 | |
6907 | 6907 | /** |
6908 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
6909 | - * |
|
6910 | - * @return Array the airport list |
|
6911 | - * |
|
6912 | - */ |
|
6908 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
6909 | + * |
|
6910 | + * @return Array the airport list |
|
6911 | + * |
|
6912 | + */ |
|
6913 | 6913 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
6914 | 6914 | { |
6915 | 6915 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6943,11 +6943,11 @@ discard block |
||
6943 | 6943 | |
6944 | 6944 | |
6945 | 6945 | /** |
6946 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
6947 | - * |
|
6948 | - * @return Array the airport list |
|
6949 | - * |
|
6950 | - */ |
|
6946 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
6947 | + * |
|
6948 | + * @return Array the airport list |
|
6949 | + * |
|
6950 | + */ |
|
6951 | 6951 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
6952 | 6952 | { |
6953 | 6953 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6978,11 +6978,11 @@ discard block |
||
6978 | 6978 | |
6979 | 6979 | |
6980 | 6980 | /** |
6981 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
6982 | - * |
|
6983 | - * @return Array the airport list |
|
6984 | - * |
|
6985 | - */ |
|
6981 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
6982 | + * |
|
6983 | + * @return Array the airport list |
|
6984 | + * |
|
6985 | + */ |
|
6986 | 6986 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
6987 | 6987 | { |
6988 | 6988 | global $globalTimezone, $globalDBdriver; |
@@ -7028,11 +7028,11 @@ discard block |
||
7028 | 7028 | |
7029 | 7029 | |
7030 | 7030 | /** |
7031 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
7032 | - * |
|
7033 | - * @return Array the airport list |
|
7034 | - * |
|
7035 | - */ |
|
7031 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
7032 | + * |
|
7033 | + * @return Array the airport list |
|
7034 | + * |
|
7035 | + */ |
|
7036 | 7036 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
7037 | 7037 | { |
7038 | 7038 | global $globalTimezone, $globalDBdriver; |
@@ -7075,11 +7075,11 @@ discard block |
||
7075 | 7075 | |
7076 | 7076 | |
7077 | 7077 | /** |
7078 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
7079 | - * |
|
7080 | - * @return Array the airport list |
|
7081 | - * |
|
7082 | - */ |
|
7078 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
7079 | + * |
|
7080 | + * @return Array the airport list |
|
7081 | + * |
|
7082 | + */ |
|
7083 | 7083 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
7084 | 7084 | { |
7085 | 7085 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7112,11 +7112,11 @@ discard block |
||
7112 | 7112 | |
7113 | 7113 | |
7114 | 7114 | /** |
7115 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
7116 | - * |
|
7117 | - * @return Array the airport list |
|
7118 | - * |
|
7119 | - */ |
|
7115 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
7116 | + * |
|
7117 | + * @return Array the airport list |
|
7118 | + * |
|
7119 | + */ |
|
7120 | 7120 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
7121 | 7121 | { |
7122 | 7122 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7147,11 +7147,11 @@ discard block |
||
7147 | 7147 | |
7148 | 7148 | |
7149 | 7149 | /** |
7150 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
7151 | - * |
|
7152 | - * @return Array the airport list |
|
7153 | - * |
|
7154 | - */ |
|
7150 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
7151 | + * |
|
7152 | + * @return Array the airport list |
|
7153 | + * |
|
7154 | + */ |
|
7155 | 7155 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
7156 | 7156 | { |
7157 | 7157 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7184,11 +7184,11 @@ discard block |
||
7184 | 7184 | |
7185 | 7185 | |
7186 | 7186 | /** |
7187 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
7188 | - * |
|
7189 | - * @return Array the airport list |
|
7190 | - * |
|
7191 | - */ |
|
7187 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
7188 | + * |
|
7189 | + * @return Array the airport list |
|
7190 | + * |
|
7191 | + */ |
|
7192 | 7192 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
7193 | 7193 | { |
7194 | 7194 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7219,11 +7219,11 @@ discard block |
||
7219 | 7219 | |
7220 | 7220 | |
7221 | 7221 | /** |
7222 | - * Counts all airport departure countries |
|
7223 | - * |
|
7224 | - * @return Array the airport departure list |
|
7225 | - * |
|
7226 | - */ |
|
7222 | + * Counts all airport departure countries |
|
7223 | + * |
|
7224 | + * @return Array the airport departure list |
|
7225 | + * |
|
7226 | + */ |
|
7227 | 7227 | public function countAllDepartureCountries($filters = array()) |
7228 | 7228 | { |
7229 | 7229 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7253,11 +7253,11 @@ discard block |
||
7253 | 7253 | |
7254 | 7254 | |
7255 | 7255 | /** |
7256 | - * Counts all airport arrival countries |
|
7257 | - * |
|
7258 | - * @return Array the airport arrival list |
|
7259 | - * |
|
7260 | - */ |
|
7256 | + * Counts all airport arrival countries |
|
7257 | + * |
|
7258 | + * @return Array the airport arrival list |
|
7259 | + * |
|
7260 | + */ |
|
7261 | 7261 | public function countAllArrivalCountries($limit = true,$filters = array()) |
7262 | 7262 | { |
7263 | 7263 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7290,11 +7290,11 @@ discard block |
||
7290 | 7290 | |
7291 | 7291 | |
7292 | 7292 | /** |
7293 | - * Gets all route combinations |
|
7294 | - * |
|
7295 | - * @return Array the route list |
|
7296 | - * |
|
7297 | - */ |
|
7293 | + * Gets all route combinations |
|
7294 | + * |
|
7295 | + * @return Array the route list |
|
7296 | + * |
|
7297 | + */ |
|
7298 | 7298 | public function countAllRoutes($filters = array()) |
7299 | 7299 | { |
7300 | 7300 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7333,11 +7333,11 @@ discard block |
||
7333 | 7333 | |
7334 | 7334 | |
7335 | 7335 | /** |
7336 | - * Gets all route combinations based on an aircraft |
|
7337 | - * |
|
7338 | - * @return Array the route list |
|
7339 | - * |
|
7340 | - */ |
|
7336 | + * Gets all route combinations based on an aircraft |
|
7337 | + * |
|
7338 | + * @return Array the route list |
|
7339 | + * |
|
7340 | + */ |
|
7341 | 7341 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
7342 | 7342 | { |
7343 | 7343 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7373,11 +7373,11 @@ discard block |
||
7373 | 7373 | |
7374 | 7374 | |
7375 | 7375 | /** |
7376 | - * Gets all route combinations based on an aircraft registration |
|
7377 | - * |
|
7378 | - * @return Array the route list |
|
7379 | - * |
|
7380 | - */ |
|
7376 | + * Gets all route combinations based on an aircraft registration |
|
7377 | + * |
|
7378 | + * @return Array the route list |
|
7379 | + * |
|
7380 | + */ |
|
7381 | 7381 | public function countAllRoutesByRegistration($registration, $filters = array()) |
7382 | 7382 | { |
7383 | 7383 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7415,11 +7415,11 @@ discard block |
||
7415 | 7415 | |
7416 | 7416 | |
7417 | 7417 | /** |
7418 | - * Gets all route combinations based on an airline |
|
7419 | - * |
|
7420 | - * @return Array the route list |
|
7421 | - * |
|
7422 | - */ |
|
7418 | + * Gets all route combinations based on an airline |
|
7419 | + * |
|
7420 | + * @return Array the route list |
|
7421 | + * |
|
7422 | + */ |
|
7423 | 7423 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
7424 | 7424 | { |
7425 | 7425 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7457,11 +7457,11 @@ discard block |
||
7457 | 7457 | |
7458 | 7458 | |
7459 | 7459 | /** |
7460 | - * Gets all route combinations based on an airport |
|
7461 | - * |
|
7462 | - * @return Array the route list |
|
7463 | - * |
|
7464 | - */ |
|
7460 | + * Gets all route combinations based on an airport |
|
7461 | + * |
|
7462 | + * @return Array the route list |
|
7463 | + * |
|
7464 | + */ |
|
7465 | 7465 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
7466 | 7466 | { |
7467 | 7467 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7498,11 +7498,11 @@ discard block |
||
7498 | 7498 | |
7499 | 7499 | |
7500 | 7500 | /** |
7501 | - * Gets all route combinations based on an country |
|
7502 | - * |
|
7503 | - * @return Array the route list |
|
7504 | - * |
|
7505 | - */ |
|
7501 | + * Gets all route combinations based on an country |
|
7502 | + * |
|
7503 | + * @return Array the route list |
|
7504 | + * |
|
7505 | + */ |
|
7506 | 7506 | public function countAllRoutesByCountry($country, $filters = array()) |
7507 | 7507 | { |
7508 | 7508 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7538,11 +7538,11 @@ discard block |
||
7538 | 7538 | |
7539 | 7539 | |
7540 | 7540 | /** |
7541 | - * Gets all route combinations based on an date |
|
7542 | - * |
|
7543 | - * @return Array the route list |
|
7544 | - * |
|
7545 | - */ |
|
7541 | + * Gets all route combinations based on an date |
|
7542 | + * |
|
7543 | + * @return Array the route list |
|
7544 | + * |
|
7545 | + */ |
|
7546 | 7546 | public function countAllRoutesByDate($date, $filters = array()) |
7547 | 7547 | { |
7548 | 7548 | global $globalTimezone, $globalDBdriver; |
@@ -7592,11 +7592,11 @@ discard block |
||
7592 | 7592 | |
7593 | 7593 | |
7594 | 7594 | /** |
7595 | - * Gets all route combinations based on an ident/callsign |
|
7596 | - * |
|
7597 | - * @return Array the route list |
|
7598 | - * |
|
7599 | - */ |
|
7595 | + * Gets all route combinations based on an ident/callsign |
|
7596 | + * |
|
7597 | + * @return Array the route list |
|
7598 | + * |
|
7599 | + */ |
|
7600 | 7600 | public function countAllRoutesByIdent($ident, $filters = array()) |
7601 | 7601 | { |
7602 | 7602 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7633,11 +7633,11 @@ discard block |
||
7633 | 7633 | |
7634 | 7634 | |
7635 | 7635 | /** |
7636 | - * Gets all route combinations based on an manufacturer |
|
7637 | - * |
|
7638 | - * @return Array the route list |
|
7639 | - * |
|
7640 | - */ |
|
7636 | + * Gets all route combinations based on an manufacturer |
|
7637 | + * |
|
7638 | + * @return Array the route list |
|
7639 | + * |
|
7640 | + */ |
|
7641 | 7641 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
7642 | 7642 | { |
7643 | 7643 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7675,11 +7675,11 @@ discard block |
||
7675 | 7675 | |
7676 | 7676 | |
7677 | 7677 | /** |
7678 | - * Gets all route combinations with waypoints |
|
7679 | - * |
|
7680 | - * @return Array the route list |
|
7681 | - * |
|
7682 | - */ |
|
7678 | + * Gets all route combinations with waypoints |
|
7679 | + * |
|
7680 | + * @return Array the route list |
|
7681 | + * |
|
7682 | + */ |
|
7683 | 7683 | public function countAllRoutesWithWaypoints($filters = array()) |
7684 | 7684 | { |
7685 | 7685 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7716,11 +7716,11 @@ discard block |
||
7716 | 7716 | } |
7717 | 7717 | |
7718 | 7718 | /** |
7719 | - * Gets all callsigns that have flown over |
|
7720 | - * |
|
7721 | - * @return Array the callsign list |
|
7722 | - * |
|
7723 | - */ |
|
7719 | + * Gets all callsigns that have flown over |
|
7720 | + * |
|
7721 | + * @return Array the callsign list |
|
7722 | + * |
|
7723 | + */ |
|
7724 | 7724 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
7725 | 7725 | { |
7726 | 7726 | global $globalDBdriver; |
@@ -7758,11 +7758,11 @@ discard block |
||
7758 | 7758 | } |
7759 | 7759 | |
7760 | 7760 | /** |
7761 | - * Gets all callsigns that have flown over |
|
7762 | - * |
|
7763 | - * @return Array the callsign list |
|
7764 | - * |
|
7765 | - */ |
|
7761 | + * Gets all callsigns that have flown over |
|
7762 | + * |
|
7763 | + * @return Array the callsign list |
|
7764 | + * |
|
7765 | + */ |
|
7766 | 7766 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
7767 | 7767 | { |
7768 | 7768 | global $globalDBdriver; |
@@ -7803,11 +7803,11 @@ discard block |
||
7803 | 7803 | |
7804 | 7804 | |
7805 | 7805 | /** |
7806 | - * Counts all dates |
|
7807 | - * |
|
7808 | - * @return Array the date list |
|
7809 | - * |
|
7810 | - */ |
|
7806 | + * Counts all dates |
|
7807 | + * |
|
7808 | + * @return Array the date list |
|
7809 | + * |
|
7810 | + */ |
|
7811 | 7811 | public function countAllDates($filters = array()) |
7812 | 7812 | { |
7813 | 7813 | global $globalTimezone, $globalDBdriver; |
@@ -7852,11 +7852,11 @@ discard block |
||
7852 | 7852 | } |
7853 | 7853 | |
7854 | 7854 | /** |
7855 | - * Counts all dates |
|
7856 | - * |
|
7857 | - * @return Array the date list |
|
7858 | - * |
|
7859 | - */ |
|
7855 | + * Counts all dates |
|
7856 | + * |
|
7857 | + * @return Array the date list |
|
7858 | + * |
|
7859 | + */ |
|
7860 | 7860 | public function countAllDatesByAirlines($filters = array()) |
7861 | 7861 | { |
7862 | 7862 | global $globalTimezone, $globalDBdriver; |
@@ -7901,11 +7901,11 @@ discard block |
||
7901 | 7901 | } |
7902 | 7902 | |
7903 | 7903 | /** |
7904 | - * Counts all dates during the last 7 days |
|
7905 | - * |
|
7906 | - * @return Array the date list |
|
7907 | - * |
|
7908 | - */ |
|
7904 | + * Counts all dates during the last 7 days |
|
7905 | + * |
|
7906 | + * @return Array the date list |
|
7907 | + * |
|
7908 | + */ |
|
7909 | 7909 | public function countAllDatesLast7Days($filters = array()) |
7910 | 7910 | { |
7911 | 7911 | global $globalTimezone, $globalDBdriver; |
@@ -7927,7 +7927,7 @@ discard block |
||
7927 | 7927 | $query .= " GROUP BY date_name |
7928 | 7928 | ORDER BY date_name ASC"; |
7929 | 7929 | $query_data = array(':offset' => $offset); |
7930 | - } |
|
7930 | + } |
|
7931 | 7931 | |
7932 | 7932 | $sth = $this->db->prepare($query); |
7933 | 7933 | $sth->execute($query_data); |
@@ -7947,11 +7947,11 @@ discard block |
||
7947 | 7947 | } |
7948 | 7948 | |
7949 | 7949 | /** |
7950 | - * Counts all dates during the last month |
|
7951 | - * |
|
7952 | - * @return Array the date list |
|
7953 | - * |
|
7954 | - */ |
|
7950 | + * Counts all dates during the last month |
|
7951 | + * |
|
7952 | + * @return Array the date list |
|
7953 | + * |
|
7954 | + */ |
|
7955 | 7955 | public function countAllDatesLastMonth($filters = array()) |
7956 | 7956 | { |
7957 | 7957 | global $globalTimezone, $globalDBdriver; |
@@ -7973,7 +7973,7 @@ discard block |
||
7973 | 7973 | $query .= " GROUP BY date_name |
7974 | 7974 | ORDER BY date_name ASC"; |
7975 | 7975 | $query_data = array(':offset' => $offset); |
7976 | - } |
|
7976 | + } |
|
7977 | 7977 | |
7978 | 7978 | $sth = $this->db->prepare($query); |
7979 | 7979 | $sth->execute($query_data); |
@@ -7994,11 +7994,11 @@ discard block |
||
7994 | 7994 | |
7995 | 7995 | |
7996 | 7996 | /** |
7997 | - * Counts all dates during the last month |
|
7998 | - * |
|
7999 | - * @return Array the date list |
|
8000 | - * |
|
8001 | - */ |
|
7997 | + * Counts all dates during the last month |
|
7998 | + * |
|
7999 | + * @return Array the date list |
|
8000 | + * |
|
8001 | + */ |
|
8002 | 8002 | public function countAllDatesLastMonthByAirlines($filters = array()) |
8003 | 8003 | { |
8004 | 8004 | global $globalTimezone, $globalDBdriver; |
@@ -8021,7 +8021,7 @@ discard block |
||
8021 | 8021 | GROUP BY spotter_output.airline_icao, date_name |
8022 | 8022 | ORDER BY date_name ASC"; |
8023 | 8023 | $query_data = array(':offset' => $offset); |
8024 | - } |
|
8024 | + } |
|
8025 | 8025 | |
8026 | 8026 | $sth = $this->db->prepare($query); |
8027 | 8027 | $sth->execute($query_data); |
@@ -8043,11 +8043,11 @@ discard block |
||
8043 | 8043 | |
8044 | 8044 | |
8045 | 8045 | /** |
8046 | - * Counts all month |
|
8047 | - * |
|
8048 | - * @return Array the month list |
|
8049 | - * |
|
8050 | - */ |
|
8046 | + * Counts all month |
|
8047 | + * |
|
8048 | + * @return Array the month list |
|
8049 | + * |
|
8050 | + */ |
|
8051 | 8051 | public function countAllMonths($filters = array()) |
8052 | 8052 | { |
8053 | 8053 | global $globalTimezone, $globalDBdriver; |
@@ -8089,11 +8089,11 @@ discard block |
||
8089 | 8089 | } |
8090 | 8090 | |
8091 | 8091 | /** |
8092 | - * Counts all month |
|
8093 | - * |
|
8094 | - * @return Array the month list |
|
8095 | - * |
|
8096 | - */ |
|
8092 | + * Counts all month |
|
8093 | + * |
|
8094 | + * @return Array the month list |
|
8095 | + * |
|
8096 | + */ |
|
8097 | 8097 | public function countAllMonthsByAirlines($filters = array()) |
8098 | 8098 | { |
8099 | 8099 | global $globalTimezone, $globalDBdriver; |
@@ -8138,11 +8138,11 @@ discard block |
||
8138 | 8138 | } |
8139 | 8139 | |
8140 | 8140 | /** |
8141 | - * Counts all military month |
|
8142 | - * |
|
8143 | - * @return Array the month list |
|
8144 | - * |
|
8145 | - */ |
|
8141 | + * Counts all military month |
|
8142 | + * |
|
8143 | + * @return Array the month list |
|
8144 | + * |
|
8145 | + */ |
|
8146 | 8146 | public function countAllMilitaryMonths($filters = array()) |
8147 | 8147 | { |
8148 | 8148 | global $globalTimezone, $globalDBdriver; |
@@ -8183,11 +8183,11 @@ discard block |
||
8183 | 8183 | } |
8184 | 8184 | |
8185 | 8185 | /** |
8186 | - * Counts all month owners |
|
8187 | - * |
|
8188 | - * @return Array the month list |
|
8189 | - * |
|
8190 | - */ |
|
8186 | + * Counts all month owners |
|
8187 | + * |
|
8188 | + * @return Array the month list |
|
8189 | + * |
|
8190 | + */ |
|
8191 | 8191 | public function countAllMonthsOwners($filters = array()) |
8192 | 8192 | { |
8193 | 8193 | global $globalTimezone, $globalDBdriver; |
@@ -8229,11 +8229,11 @@ discard block |
||
8229 | 8229 | } |
8230 | 8230 | |
8231 | 8231 | /** |
8232 | - * Counts all month owners |
|
8233 | - * |
|
8234 | - * @return Array the month list |
|
8235 | - * |
|
8236 | - */ |
|
8232 | + * Counts all month owners |
|
8233 | + * |
|
8234 | + * @return Array the month list |
|
8235 | + * |
|
8236 | + */ |
|
8237 | 8237 | public function countAllMonthsOwnersByAirlines($filters = array()) |
8238 | 8238 | { |
8239 | 8239 | global $globalTimezone, $globalDBdriver; |
@@ -8276,11 +8276,11 @@ discard block |
||
8276 | 8276 | } |
8277 | 8277 | |
8278 | 8278 | /** |
8279 | - * Counts all month pilot |
|
8280 | - * |
|
8281 | - * @return Array the month list |
|
8282 | - * |
|
8283 | - */ |
|
8279 | + * Counts all month pilot |
|
8280 | + * |
|
8281 | + * @return Array the month list |
|
8282 | + * |
|
8283 | + */ |
|
8284 | 8284 | public function countAllMonthsPilots($filters = array()) |
8285 | 8285 | { |
8286 | 8286 | global $globalTimezone, $globalDBdriver; |
@@ -8322,11 +8322,11 @@ discard block |
||
8322 | 8322 | } |
8323 | 8323 | |
8324 | 8324 | /** |
8325 | - * Counts all month pilot |
|
8326 | - * |
|
8327 | - * @return Array the month list |
|
8328 | - * |
|
8329 | - */ |
|
8325 | + * Counts all month pilot |
|
8326 | + * |
|
8327 | + * @return Array the month list |
|
8328 | + * |
|
8329 | + */ |
|
8330 | 8330 | public function countAllMonthsPilotsByAirlines($filters = array()) |
8331 | 8331 | { |
8332 | 8332 | global $globalTimezone, $globalDBdriver; |
@@ -8369,11 +8369,11 @@ discard block |
||
8369 | 8369 | } |
8370 | 8370 | |
8371 | 8371 | /** |
8372 | - * Counts all month airline |
|
8373 | - * |
|
8374 | - * @return Array the month list |
|
8375 | - * |
|
8376 | - */ |
|
8372 | + * Counts all month airline |
|
8373 | + * |
|
8374 | + * @return Array the month list |
|
8375 | + * |
|
8376 | + */ |
|
8377 | 8377 | public function countAllMonthsAirlines($filters = array()) |
8378 | 8378 | { |
8379 | 8379 | global $globalTimezone, $globalDBdriver; |
@@ -8415,11 +8415,11 @@ discard block |
||
8415 | 8415 | } |
8416 | 8416 | |
8417 | 8417 | /** |
8418 | - * Counts all month aircraft |
|
8419 | - * |
|
8420 | - * @return Array the month list |
|
8421 | - * |
|
8422 | - */ |
|
8418 | + * Counts all month aircraft |
|
8419 | + * |
|
8420 | + * @return Array the month list |
|
8421 | + * |
|
8422 | + */ |
|
8423 | 8423 | public function countAllMonthsAircrafts($filters = array()) |
8424 | 8424 | { |
8425 | 8425 | global $globalTimezone, $globalDBdriver; |
@@ -8462,11 +8462,11 @@ discard block |
||
8462 | 8462 | |
8463 | 8463 | |
8464 | 8464 | /** |
8465 | - * Counts all month aircraft |
|
8466 | - * |
|
8467 | - * @return Array the month list |
|
8468 | - * |
|
8469 | - */ |
|
8465 | + * Counts all month aircraft |
|
8466 | + * |
|
8467 | + * @return Array the month list |
|
8468 | + * |
|
8469 | + */ |
|
8470 | 8470 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
8471 | 8471 | { |
8472 | 8472 | global $globalTimezone, $globalDBdriver; |
@@ -8509,11 +8509,11 @@ discard block |
||
8509 | 8509 | } |
8510 | 8510 | |
8511 | 8511 | /** |
8512 | - * Counts all month real arrival |
|
8513 | - * |
|
8514 | - * @return Array the month list |
|
8515 | - * |
|
8516 | - */ |
|
8512 | + * Counts all month real arrival |
|
8513 | + * |
|
8514 | + * @return Array the month list |
|
8515 | + * |
|
8516 | + */ |
|
8517 | 8517 | public function countAllMonthsRealArrivals($filters = array()) |
8518 | 8518 | { |
8519 | 8519 | global $globalTimezone, $globalDBdriver; |
@@ -8556,11 +8556,11 @@ discard block |
||
8556 | 8556 | |
8557 | 8557 | |
8558 | 8558 | /** |
8559 | - * Counts all month real arrival |
|
8560 | - * |
|
8561 | - * @return Array the month list |
|
8562 | - * |
|
8563 | - */ |
|
8559 | + * Counts all month real arrival |
|
8560 | + * |
|
8561 | + * @return Array the month list |
|
8562 | + * |
|
8563 | + */ |
|
8564 | 8564 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
8565 | 8565 | { |
8566 | 8566 | global $globalTimezone, $globalDBdriver; |
@@ -8604,11 +8604,11 @@ discard block |
||
8604 | 8604 | |
8605 | 8605 | |
8606 | 8606 | /** |
8607 | - * Counts all dates during the last year |
|
8608 | - * |
|
8609 | - * @return Array the date list |
|
8610 | - * |
|
8611 | - */ |
|
8607 | + * Counts all dates during the last year |
|
8608 | + * |
|
8609 | + * @return Array the date list |
|
8610 | + * |
|
8611 | + */ |
|
8612 | 8612 | public function countAllMonthsLastYear($filters) |
8613 | 8613 | { |
8614 | 8614 | global $globalTimezone, $globalDBdriver; |
@@ -8630,7 +8630,7 @@ discard block |
||
8630 | 8630 | $query .= " GROUP BY year_name, month_name |
8631 | 8631 | ORDER BY year_name, month_name ASC"; |
8632 | 8632 | $query_data = array(':offset' => $offset); |
8633 | - } |
|
8633 | + } |
|
8634 | 8634 | |
8635 | 8635 | $sth = $this->db->prepare($query); |
8636 | 8636 | $sth->execute($query_data); |
@@ -8653,11 +8653,11 @@ discard block |
||
8653 | 8653 | |
8654 | 8654 | |
8655 | 8655 | /** |
8656 | - * Counts all hours |
|
8657 | - * |
|
8658 | - * @return Array the hour list |
|
8659 | - * |
|
8660 | - */ |
|
8656 | + * Counts all hours |
|
8657 | + * |
|
8658 | + * @return Array the hour list |
|
8659 | + * |
|
8660 | + */ |
|
8661 | 8661 | public function countAllHours($orderby,$filters = array()) |
8662 | 8662 | { |
8663 | 8663 | global $globalTimezone, $globalDBdriver; |
@@ -8718,11 +8718,11 @@ discard block |
||
8718 | 8718 | } |
8719 | 8719 | |
8720 | 8720 | /** |
8721 | - * Counts all hours |
|
8722 | - * |
|
8723 | - * @return Array the hour list |
|
8724 | - * |
|
8725 | - */ |
|
8721 | + * Counts all hours |
|
8722 | + * |
|
8723 | + * @return Array the hour list |
|
8724 | + * |
|
8725 | + */ |
|
8726 | 8726 | public function countAllHoursByAirlines($orderby, $filters = array()) |
8727 | 8727 | { |
8728 | 8728 | global $globalTimezone, $globalDBdriver; |
@@ -8785,11 +8785,11 @@ discard block |
||
8785 | 8785 | |
8786 | 8786 | |
8787 | 8787 | /** |
8788 | - * Counts all hours by airline |
|
8789 | - * |
|
8790 | - * @return Array the hour list |
|
8791 | - * |
|
8792 | - */ |
|
8788 | + * Counts all hours by airline |
|
8789 | + * |
|
8790 | + * @return Array the hour list |
|
8791 | + * |
|
8792 | + */ |
|
8793 | 8793 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
8794 | 8794 | { |
8795 | 8795 | global $globalTimezone, $globalDBdriver; |
@@ -8835,11 +8835,11 @@ discard block |
||
8835 | 8835 | |
8836 | 8836 | |
8837 | 8837 | /** |
8838 | - * Counts all hours by aircraft |
|
8839 | - * |
|
8840 | - * @return Array the hour list |
|
8841 | - * |
|
8842 | - */ |
|
8838 | + * Counts all hours by aircraft |
|
8839 | + * |
|
8840 | + * @return Array the hour list |
|
8841 | + * |
|
8842 | + */ |
|
8843 | 8843 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
8844 | 8844 | { |
8845 | 8845 | global $globalTimezone, $globalDBdriver; |
@@ -8882,11 +8882,11 @@ discard block |
||
8882 | 8882 | |
8883 | 8883 | |
8884 | 8884 | /** |
8885 | - * Counts all hours by aircraft registration |
|
8886 | - * |
|
8887 | - * @return Array the hour list |
|
8888 | - * |
|
8889 | - */ |
|
8885 | + * Counts all hours by aircraft registration |
|
8886 | + * |
|
8887 | + * @return Array the hour list |
|
8888 | + * |
|
8889 | + */ |
|
8890 | 8890 | public function countAllHoursByRegistration($registration, $filters = array()) |
8891 | 8891 | { |
8892 | 8892 | global $globalTimezone, $globalDBdriver; |
@@ -8929,11 +8929,11 @@ discard block |
||
8929 | 8929 | |
8930 | 8930 | |
8931 | 8931 | /** |
8932 | - * Counts all hours by airport |
|
8933 | - * |
|
8934 | - * @return Array the hour list |
|
8935 | - * |
|
8936 | - */ |
|
8932 | + * Counts all hours by airport |
|
8933 | + * |
|
8934 | + * @return Array the hour list |
|
8935 | + * |
|
8936 | + */ |
|
8937 | 8937 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
8938 | 8938 | { |
8939 | 8939 | global $globalTimezone, $globalDBdriver; |
@@ -8977,11 +8977,11 @@ discard block |
||
8977 | 8977 | |
8978 | 8978 | |
8979 | 8979 | /** |
8980 | - * Counts all hours by manufacturer |
|
8981 | - * |
|
8982 | - * @return Array the hour list |
|
8983 | - * |
|
8984 | - */ |
|
8980 | + * Counts all hours by manufacturer |
|
8981 | + * |
|
8982 | + * @return Array the hour list |
|
8983 | + * |
|
8984 | + */ |
|
8985 | 8985 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
8986 | 8986 | { |
8987 | 8987 | global $globalTimezone, $globalDBdriver; |
@@ -9025,11 +9025,11 @@ discard block |
||
9025 | 9025 | |
9026 | 9026 | |
9027 | 9027 | /** |
9028 | - * Counts all hours by date |
|
9029 | - * |
|
9030 | - * @return Array the hour list |
|
9031 | - * |
|
9032 | - */ |
|
9028 | + * Counts all hours by date |
|
9029 | + * |
|
9030 | + * @return Array the hour list |
|
9031 | + * |
|
9032 | + */ |
|
9033 | 9033 | public function countAllHoursByDate($date, $filters = array()) |
9034 | 9034 | { |
9035 | 9035 | global $globalTimezone, $globalDBdriver; |
@@ -9073,11 +9073,11 @@ discard block |
||
9073 | 9073 | |
9074 | 9074 | |
9075 | 9075 | /** |
9076 | - * Counts all hours by a ident/callsign |
|
9077 | - * |
|
9078 | - * @return Array the hour list |
|
9079 | - * |
|
9080 | - */ |
|
9076 | + * Counts all hours by a ident/callsign |
|
9077 | + * |
|
9078 | + * @return Array the hour list |
|
9079 | + * |
|
9080 | + */ |
|
9081 | 9081 | public function countAllHoursByIdent($ident, $filters = array()) |
9082 | 9082 | { |
9083 | 9083 | global $globalTimezone, $globalDBdriver; |
@@ -9122,11 +9122,11 @@ discard block |
||
9122 | 9122 | |
9123 | 9123 | |
9124 | 9124 | /** |
9125 | - * Counts all hours by route |
|
9126 | - * |
|
9127 | - * @return Array the hour list |
|
9128 | - * |
|
9129 | - */ |
|
9125 | + * Counts all hours by route |
|
9126 | + * |
|
9127 | + * @return Array the hour list |
|
9128 | + * |
|
9129 | + */ |
|
9130 | 9130 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
9131 | 9131 | { |
9132 | 9132 | global $globalTimezone, $globalDBdriver; |
@@ -9170,11 +9170,11 @@ discard block |
||
9170 | 9170 | |
9171 | 9171 | |
9172 | 9172 | /** |
9173 | - * Counts all hours by country |
|
9174 | - * |
|
9175 | - * @return Array the hour list |
|
9176 | - * |
|
9177 | - */ |
|
9173 | + * Counts all hours by country |
|
9174 | + * |
|
9175 | + * @return Array the hour list |
|
9176 | + * |
|
9177 | + */ |
|
9178 | 9178 | public function countAllHoursByCountry($country, $filters = array()) |
9179 | 9179 | { |
9180 | 9180 | global $globalTimezone, $globalDBdriver; |
@@ -9219,11 +9219,11 @@ discard block |
||
9219 | 9219 | |
9220 | 9220 | |
9221 | 9221 | /** |
9222 | - * Counts all aircraft that have flown over |
|
9223 | - * |
|
9224 | - * @return Integer the number of aircrafts |
|
9225 | - * |
|
9226 | - */ |
|
9222 | + * Counts all aircraft that have flown over |
|
9223 | + * |
|
9224 | + * @return Integer the number of aircrafts |
|
9225 | + * |
|
9226 | + */ |
|
9227 | 9227 | public function countOverallAircrafts($filters = array()) |
9228 | 9228 | { |
9229 | 9229 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9235,11 +9235,11 @@ discard block |
||
9235 | 9235 | } |
9236 | 9236 | |
9237 | 9237 | /** |
9238 | - * Counts all flight that really arrival |
|
9239 | - * |
|
9240 | - * @return Integer the number of aircrafts |
|
9241 | - * |
|
9242 | - */ |
|
9238 | + * Counts all flight that really arrival |
|
9239 | + * |
|
9240 | + * @return Integer the number of aircrafts |
|
9241 | + * |
|
9242 | + */ |
|
9243 | 9243 | public function countOverallArrival($filters = array()) |
9244 | 9244 | { |
9245 | 9245 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9252,11 +9252,11 @@ discard block |
||
9252 | 9252 | } |
9253 | 9253 | |
9254 | 9254 | /** |
9255 | - * Counts all pilots that have flown over |
|
9256 | - * |
|
9257 | - * @return Integer the number of pilots |
|
9258 | - * |
|
9259 | - */ |
|
9255 | + * Counts all pilots that have flown over |
|
9256 | + * |
|
9257 | + * @return Integer the number of pilots |
|
9258 | + * |
|
9259 | + */ |
|
9260 | 9260 | public function countOverallPilots($filters = array()) |
9261 | 9261 | { |
9262 | 9262 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9268,11 +9268,11 @@ discard block |
||
9268 | 9268 | } |
9269 | 9269 | |
9270 | 9270 | /** |
9271 | - * Counts all owners that have flown over |
|
9272 | - * |
|
9273 | - * @return Integer the number of owners |
|
9274 | - * |
|
9275 | - */ |
|
9271 | + * Counts all owners that have flown over |
|
9272 | + * |
|
9273 | + * @return Integer the number of owners |
|
9274 | + * |
|
9275 | + */ |
|
9276 | 9276 | public function countOverallOwners($filters = array()) |
9277 | 9277 | { |
9278 | 9278 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9285,11 +9285,11 @@ discard block |
||
9285 | 9285 | |
9286 | 9286 | |
9287 | 9287 | /** |
9288 | - * Counts all flights that have flown over |
|
9289 | - * |
|
9290 | - * @return Integer the number of flights |
|
9291 | - * |
|
9292 | - */ |
|
9288 | + * Counts all flights that have flown over |
|
9289 | + * |
|
9290 | + * @return Integer the number of flights |
|
9291 | + * |
|
9292 | + */ |
|
9293 | 9293 | public function countOverallFlights($filters = array()) |
9294 | 9294 | { |
9295 | 9295 | $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
@@ -9302,11 +9302,11 @@ discard block |
||
9302 | 9302 | } |
9303 | 9303 | |
9304 | 9304 | /** |
9305 | - * Counts all military flights that have flown over |
|
9306 | - * |
|
9307 | - * @return Integer the number of flights |
|
9308 | - * |
|
9309 | - */ |
|
9305 | + * Counts all military flights that have flown over |
|
9306 | + * |
|
9307 | + * @return Integer the number of flights |
|
9308 | + * |
|
9309 | + */ |
|
9310 | 9310 | public function countOverallMilitaryFlights($filters = array()) |
9311 | 9311 | { |
9312 | 9312 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9321,11 +9321,11 @@ discard block |
||
9321 | 9321 | |
9322 | 9322 | |
9323 | 9323 | /** |
9324 | - * Counts all airlines that have flown over |
|
9325 | - * |
|
9326 | - * @return Integer the number of airlines |
|
9327 | - * |
|
9328 | - */ |
|
9324 | + * Counts all airlines that have flown over |
|
9325 | + * |
|
9326 | + * @return Integer the number of airlines |
|
9327 | + * |
|
9328 | + */ |
|
9329 | 9329 | public function countOverallAirlines($filters = array()) |
9330 | 9330 | { |
9331 | 9331 | $query = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
@@ -9339,11 +9339,11 @@ discard block |
||
9339 | 9339 | |
9340 | 9340 | |
9341 | 9341 | /** |
9342 | - * Counts all hours of today |
|
9343 | - * |
|
9344 | - * @return Array the hour list |
|
9345 | - * |
|
9346 | - */ |
|
9342 | + * Counts all hours of today |
|
9343 | + * |
|
9344 | + * @return Array the hour list |
|
9345 | + * |
|
9346 | + */ |
|
9347 | 9347 | public function countAllHoursFromToday($filters = array()) |
9348 | 9348 | { |
9349 | 9349 | global $globalTimezone, $globalDBdriver; |
@@ -9383,11 +9383,11 @@ discard block |
||
9383 | 9383 | } |
9384 | 9384 | |
9385 | 9385 | /** |
9386 | - * Gets all the spotter information based on calculated upcoming flights |
|
9387 | - * |
|
9388 | - * @return Array the spotter information |
|
9389 | - * |
|
9390 | - */ |
|
9386 | + * Gets all the spotter information based on calculated upcoming flights |
|
9387 | + * |
|
9388 | + * @return Array the spotter information |
|
9389 | + * |
|
9390 | + */ |
|
9391 | 9391 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
9392 | 9392 | { |
9393 | 9393 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -9462,12 +9462,12 @@ discard block |
||
9462 | 9462 | } |
9463 | 9463 | |
9464 | 9464 | |
9465 | - /** |
|
9466 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
9467 | - * |
|
9468 | - * @return Integer the Barrie Spotter ID |
|
9465 | + /** |
|
9466 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
9467 | + * |
|
9468 | + * @return Integer the Barrie Spotter ID |
|
9469 | 9469 | q * |
9470 | - */ |
|
9470 | + */ |
|
9471 | 9471 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
9472 | 9472 | { |
9473 | 9473 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -9488,13 +9488,13 @@ discard block |
||
9488 | 9488 | |
9489 | 9489 | |
9490 | 9490 | /** |
9491 | - * Parses a date string |
|
9492 | - * |
|
9493 | - * @param String $dateString the date string |
|
9494 | - * @param String $timezone the timezone of a user |
|
9495 | - * @return Array the time information |
|
9496 | - * |
|
9497 | - */ |
|
9491 | + * Parses a date string |
|
9492 | + * |
|
9493 | + * @param String $dateString the date string |
|
9494 | + * @param String $timezone the timezone of a user |
|
9495 | + * @return Array the time information |
|
9496 | + * |
|
9497 | + */ |
|
9498 | 9498 | public function parseDateString($dateString, $timezone = '') |
9499 | 9499 | { |
9500 | 9500 | $time_array = array(); |
@@ -9530,12 +9530,12 @@ discard block |
||
9530 | 9530 | |
9531 | 9531 | |
9532 | 9532 | /** |
9533 | - * Parses the direction degrees to working |
|
9534 | - * |
|
9535 | - * @param Float $direction the direction in degrees |
|
9536 | - * @return Array the direction information |
|
9537 | - * |
|
9538 | - */ |
|
9533 | + * Parses the direction degrees to working |
|
9534 | + * |
|
9535 | + * @param Float $direction the direction in degrees |
|
9536 | + * @return Array the direction information |
|
9537 | + * |
|
9538 | + */ |
|
9539 | 9539 | public function parseDirection($direction = 0) |
9540 | 9540 | { |
9541 | 9541 | if ($direction == '') $direction = 0; |
@@ -9614,12 +9614,12 @@ discard block |
||
9614 | 9614 | |
9615 | 9615 | |
9616 | 9616 | /** |
9617 | - * Gets the aircraft registration |
|
9618 | - * |
|
9619 | - * @param String $flightaware_id the flight aware id |
|
9620 | - * @return String the aircraft registration |
|
9621 | - * |
|
9622 | - */ |
|
9617 | + * Gets the aircraft registration |
|
9618 | + * |
|
9619 | + * @param String $flightaware_id the flight aware id |
|
9620 | + * @return String the aircraft registration |
|
9621 | + * |
|
9622 | + */ |
|
9623 | 9623 | |
9624 | 9624 | public function getAircraftRegistration($flightaware_id) |
9625 | 9625 | { |
@@ -9648,12 +9648,12 @@ discard block |
||
9648 | 9648 | |
9649 | 9649 | |
9650 | 9650 | /** |
9651 | - * Gets the aircraft registration from ModeS |
|
9652 | - * |
|
9653 | - * @param String $aircraft_modes the flight ModeS in hex |
|
9654 | - * @return String the aircraft registration |
|
9655 | - * |
|
9656 | - */ |
|
9651 | + * Gets the aircraft registration from ModeS |
|
9652 | + * |
|
9653 | + * @param String $aircraft_modes the flight ModeS in hex |
|
9654 | + * @return String the aircraft registration |
|
9655 | + * |
|
9656 | + */ |
|
9657 | 9657 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
9658 | 9658 | { |
9659 | 9659 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9666,19 +9666,19 @@ discard block |
||
9666 | 9666 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
9667 | 9667 | $sth->closeCursor(); |
9668 | 9668 | if (count($row) > 0) { |
9669 | - //return $row['Registration']; |
|
9670 | - return $row['registration']; |
|
9669 | + //return $row['Registration']; |
|
9670 | + return $row['registration']; |
|
9671 | 9671 | } else return ''; |
9672 | 9672 | |
9673 | 9673 | } |
9674 | 9674 | |
9675 | 9675 | /** |
9676 | - * Gets the aircraft type from ModeS |
|
9677 | - * |
|
9678 | - * @param String $aircraft_modes the flight ModeS in hex |
|
9679 | - * @return String the aircraft type |
|
9680 | - * |
|
9681 | - */ |
|
9676 | + * Gets the aircraft type from ModeS |
|
9677 | + * |
|
9678 | + * @param String $aircraft_modes the flight ModeS in hex |
|
9679 | + * @return String the aircraft type |
|
9680 | + * |
|
9681 | + */ |
|
9682 | 9682 | public function getAircraftTypeBymodeS($aircraft_modes) |
9683 | 9683 | { |
9684 | 9684 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9691,19 +9691,19 @@ discard block |
||
9691 | 9691 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
9692 | 9692 | $sth->closeCursor(); |
9693 | 9693 | if (count($row) > 0) { |
9694 | - if ($row['type_flight'] == null) return ''; |
|
9695 | - else return $row['type_flight']; |
|
9694 | + if ($row['type_flight'] == null) return ''; |
|
9695 | + else return $row['type_flight']; |
|
9696 | 9696 | } else return ''; |
9697 | 9697 | |
9698 | 9698 | } |
9699 | 9699 | |
9700 | 9700 | /** |
9701 | - * Gets Country from latitude/longitude |
|
9702 | - * |
|
9703 | - * @param Float $latitude latitute of the flight |
|
9704 | - * @param Float $longitude longitute of the flight |
|
9705 | - * @return String the countrie |
|
9706 | - */ |
|
9701 | + * Gets Country from latitude/longitude |
|
9702 | + * |
|
9703 | + * @param Float $latitude latitute of the flight |
|
9704 | + * @param Float $longitude longitute of the flight |
|
9705 | + * @return String the countrie |
|
9706 | + */ |
|
9707 | 9707 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
9708 | 9708 | { |
9709 | 9709 | global $globalDBdriver, $globalDebug; |
@@ -9740,11 +9740,11 @@ discard block |
||
9740 | 9740 | } |
9741 | 9741 | |
9742 | 9742 | /** |
9743 | - * Gets Country from iso2 |
|
9744 | - * |
|
9745 | - * @param String $iso2 ISO2 country code |
|
9746 | - * @return String the countrie |
|
9747 | - */ |
|
9743 | + * Gets Country from iso2 |
|
9744 | + * |
|
9745 | + * @param String $iso2 ISO2 country code |
|
9746 | + * @return String the countrie |
|
9747 | + */ |
|
9748 | 9748 | public function getCountryFromISO2($iso2) |
9749 | 9749 | { |
9750 | 9750 | global $globalDBdriver, $globalDebug; |
@@ -9772,12 +9772,12 @@ discard block |
||
9772 | 9772 | } |
9773 | 9773 | |
9774 | 9774 | /** |
9775 | - * converts the registration code using the country prefix |
|
9776 | - * |
|
9777 | - * @param String $registration the aircraft registration |
|
9778 | - * @return String the aircraft registration |
|
9779 | - * |
|
9780 | - */ |
|
9775 | + * converts the registration code using the country prefix |
|
9776 | + * |
|
9777 | + * @param String $registration the aircraft registration |
|
9778 | + * @return String the aircraft registration |
|
9779 | + * |
|
9780 | + */ |
|
9781 | 9781 | public function convertAircraftRegistration($registration) |
9782 | 9782 | { |
9783 | 9783 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9829,12 +9829,12 @@ discard block |
||
9829 | 9829 | } |
9830 | 9830 | |
9831 | 9831 | /** |
9832 | - * Country from the registration code |
|
9833 | - * |
|
9834 | - * @param String $registration the aircraft registration |
|
9835 | - * @return String the country |
|
9836 | - * |
|
9837 | - */ |
|
9832 | + * Country from the registration code |
|
9833 | + * |
|
9834 | + * @param String $registration the aircraft registration |
|
9835 | + * @return String the country |
|
9836 | + * |
|
9837 | + */ |
|
9838 | 9838 | public function countryFromAircraftRegistration($registration) |
9839 | 9839 | { |
9840 | 9840 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9853,8 +9853,8 @@ discard block |
||
9853 | 9853 | $country = $row['country']; |
9854 | 9854 | } |
9855 | 9855 | } else { |
9856 | - $registration_1 = substr($registration, 0, 1); |
|
9857 | - $registration_2 = substr($registration, 0, 2); |
|
9856 | + $registration_1 = substr($registration, 0, 1); |
|
9857 | + $registration_2 = substr($registration, 0, 2); |
|
9858 | 9858 | |
9859 | 9859 | $country = ''; |
9860 | 9860 | //first get the prefix based on two characters |
@@ -9890,12 +9890,12 @@ discard block |
||
9890 | 9890 | } |
9891 | 9891 | |
9892 | 9892 | /** |
9893 | - * Country from the registration code |
|
9894 | - * |
|
9895 | - * @param String $registration the aircraft registration |
|
9896 | - * @return String the country |
|
9897 | - * |
|
9898 | - */ |
|
9893 | + * Country from the registration code |
|
9894 | + * |
|
9895 | + * @param String $registration the aircraft registration |
|
9896 | + * @return String the country |
|
9897 | + * |
|
9898 | + */ |
|
9899 | 9899 | public function countryFromAircraftRegistrationCode($registration) |
9900 | 9900 | { |
9901 | 9901 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9912,11 +9912,11 @@ discard block |
||
9912 | 9912 | } |
9913 | 9913 | |
9914 | 9914 | /** |
9915 | - * Set a new highlight value for a flight |
|
9916 | - * |
|
9917 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
9918 | - * @param String $highlight New highlight value |
|
9919 | - */ |
|
9915 | + * Set a new highlight value for a flight |
|
9916 | + * |
|
9917 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
9918 | + * @param String $highlight New highlight value |
|
9919 | + */ |
|
9920 | 9920 | public function setHighlightFlight($flightaware_id,$highlight) { |
9921 | 9921 | |
9922 | 9922 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -9925,12 +9925,12 @@ discard block |
||
9925 | 9925 | } |
9926 | 9926 | |
9927 | 9927 | /** |
9928 | - * Gets the short url from bit.ly |
|
9929 | - * |
|
9930 | - * @param String $url the full url |
|
9931 | - * @return String the bit.ly url |
|
9932 | - * |
|
9933 | - */ |
|
9928 | + * Gets the short url from bit.ly |
|
9929 | + * |
|
9930 | + * @param String $url the full url |
|
9931 | + * @return String the bit.ly url |
|
9932 | + * |
|
9933 | + */ |
|
9934 | 9934 | public function getBitlyURL($url) |
9935 | 9935 | { |
9936 | 9936 | global $globalBitlyAccessToken; |
@@ -10219,11 +10219,11 @@ discard block |
||
10219 | 10219 | $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 |
10220 | 10220 | 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)) |
10221 | 10221 | 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;"; |
10222 | - } else { |
|
10222 | + } else { |
|
10223 | 10223 | $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 |
10224 | 10224 | 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)) |
10225 | 10225 | 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;"; |
10226 | - } |
|
10226 | + } |
|
10227 | 10227 | $sth = $this->db->prepare($query); |
10228 | 10228 | $sth->execute(); |
10229 | 10229 | return $sth->fetchAll(PDO::FETCH_ASSOC); |