@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
17 | 17 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
18 | 18 | if (isset($globalMarine) && $globalMarine) { |
19 | - require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
20 | - require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
19 | + require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
20 | + require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if (!isset($globalDebug)) $globalDebug = FALSE; |
@@ -25,46 +25,46 @@ discard block |
||
25 | 25 | // Check if schema is at latest version |
26 | 26 | $Connection = new Connection(); |
27 | 27 | if ($Connection->connectionExists() === false) { |
28 | - echo "Can't connect to your database. Check DB is running, user/password and database logs."; |
|
29 | - exit(); |
|
28 | + echo "Can't connect to your database. Check DB is running, user/password and database logs."; |
|
29 | + exit(); |
|
30 | 30 | } |
31 | 31 | if ($Connection->latest() === false) { |
32 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
33 | - exit(); |
|
32 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
33 | + exit(); |
|
34 | 34 | } |
35 | 35 | if (PHP_SAPI != 'cli') { |
36 | - echo "This script MUST be called from console, not a web browser."; |
|
36 | + echo "This script MUST be called from console, not a web browser."; |
|
37 | 37 | // exit(); |
38 | 38 | } |
39 | 39 | |
40 | 40 | // This is to be compatible with old version of settings.php |
41 | 41 | if (!isset($globalSources)) { |
42 | - if (isset($globalSBS1Hosts)) { |
|
43 | - //$hosts = $globalSBS1Hosts; |
|
44 | - foreach ($globalSBS1Hosts as $host) { |
|
45 | - $globalSources[] = array('host' => $host); |
|
46 | - } |
|
47 | - } else { |
|
48 | - if (!isset($globalSBS1Host)) { |
|
49 | - echo '$globalSources MUST be defined !'; |
|
50 | - die; |
|
42 | + if (isset($globalSBS1Hosts)) { |
|
43 | + //$hosts = $globalSBS1Hosts; |
|
44 | + foreach ($globalSBS1Hosts as $host) { |
|
45 | + $globalSources[] = array('host' => $host); |
|
46 | + } |
|
47 | + } else { |
|
48 | + if (!isset($globalSBS1Host)) { |
|
49 | + echo '$globalSources MUST be defined !'; |
|
50 | + die; |
|
51 | 51 | } |
52 | 52 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
53 | 53 | $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
54 | - } |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver','enable-aircraft','disable-aircraft','enable-tracker','disable-tracker','enable-marine','disable-marine')); |
58 | 58 | //if (isset($options['s'])) $hosts = array($options['s']); |
59 | 59 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
60 | 60 | if (isset($options['s'])) { |
61 | - $globalSources = array(); |
|
62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
63 | - else $globalSources[] = array('host' => $options['s']); |
|
61 | + $globalSources = array(); |
|
62 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
63 | + else $globalSources[] = array('host' => $options['s']); |
|
64 | 64 | } elseif (isset($options['source'])) { |
65 | - $globalSources = array(); |
|
66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
67 | - else $globalSources[] = array('host' => $options['source']); |
|
65 | + $globalSources = array(); |
|
66 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
67 | + else $globalSources[] = array('host' => $options['source']); |
|
68 | 68 | } |
69 | 69 | if (isset($options['aprsserverhost'])) { |
70 | 70 | $globalServerAPRS = TRUE; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | if (isset($options['idsource'])) $id_source = $options['idsource']; |
104 | 104 | else $id_source = 1; |
105 | 105 | if (isset($globalServer) && $globalServer) { |
106 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
107 | - $SI=new SpotterServer(); |
|
106 | + if ($globalDebug) echo "Using Server Mode\n"; |
|
107 | + $SI=new SpotterServer(); |
|
108 | 108 | /* |
109 | 109 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
110 | 110 | $SI = new adsb2aprs(); |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | |
115 | 115 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
116 | 116 | if (isset($globalMarine) && $globalMarine) { |
117 | - require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
118 | - require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
117 | + require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
118 | + require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
122 | 122 | if (isset($globalMarine) && $globalMarine) { |
123 | - $AIS = new AIS(); |
|
124 | - $MI = new MarineImport($Connection->db); |
|
123 | + $AIS = new AIS(); |
|
124 | + $MI = new MarineImport($Connection->db); |
|
125 | 125 | } |
126 | 126 | //$APRS=new APRS($Connection->db); |
127 | 127 | $SBS=new SBS(); |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | //$servertz = system('date +%Z'); |
133 | 133 | // signal handler - playing nice with sockets and dump1090 |
134 | 134 | if (function_exists('pcntl_fork')) { |
135 | - pcntl_signal(SIGINT, function() { |
|
136 | - global $sockets; |
|
137 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
138 | - die("Bye!\n"); |
|
139 | - }); |
|
140 | - pcntl_signal_dispatch(); |
|
135 | + pcntl_signal(SIGINT, function() { |
|
136 | + global $sockets; |
|
137 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
138 | + die("Bye!\n"); |
|
139 | + }); |
|
140 | + pcntl_signal_dispatch(); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | // let's try and connect |
@@ -147,36 +147,36 @@ discard block |
||
147 | 147 | $reset = 0; |
148 | 148 | |
149 | 149 | function connect_all($hosts) { |
150 | - //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
151 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
152 | - $reset++; |
|
153 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
154 | - foreach ($hosts as $id => $value) { |
|
150 | + //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
151 | + global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
152 | + $reset++; |
|
153 | + if ($globalDebug) echo 'Connect to all...'."\n"; |
|
154 | + foreach ($hosts as $id => $value) { |
|
155 | 155 | $host = $value['host']; |
156 | 156 | $globalSources[$id]['last_exec'] = 0; |
157 | 157 | // Here we check type of source(s) |
158 | 158 | if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
159 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
160 | - //$formats[$id] = 'deltadbtxt'; |
|
161 | - $globalSources[$id]['format'] = 'deltadbtxt'; |
|
162 | - //$last_exec['deltadbtxt'] = 0; |
|
163 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
164 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
165 | - //$formats[$id] = 'vatsimtxt'; |
|
166 | - $globalSources[$id]['format'] = 'vatsimtxt'; |
|
167 | - //$last_exec['vatsimtxt'] = 0; |
|
168 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
169 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
170 | - //$formats[$id] = 'aircraftlistjson'; |
|
171 | - $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
172 | - //$last_exec['aircraftlistjson'] = 0; |
|
173 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
174 | - } else if (preg_match('/opensky/i',$host)) { |
|
175 | - //$formats[$id] = 'aircraftlistjson'; |
|
176 | - $globalSources[$id]['format'] = 'opensky'; |
|
177 | - //$last_exec['aircraftlistjson'] = 0; |
|
178 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
179 | - /* |
|
159 | + if (preg_match('/deltadb.txt$/i',$host)) { |
|
160 | + //$formats[$id] = 'deltadbtxt'; |
|
161 | + $globalSources[$id]['format'] = 'deltadbtxt'; |
|
162 | + //$last_exec['deltadbtxt'] = 0; |
|
163 | + if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
164 | + } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
165 | + //$formats[$id] = 'vatsimtxt'; |
|
166 | + $globalSources[$id]['format'] = 'vatsimtxt'; |
|
167 | + //$last_exec['vatsimtxt'] = 0; |
|
168 | + if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
169 | + } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
170 | + //$formats[$id] = 'aircraftlistjson'; |
|
171 | + $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
172 | + //$last_exec['aircraftlistjson'] = 0; |
|
173 | + if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
174 | + } else if (preg_match('/opensky/i',$host)) { |
|
175 | + //$formats[$id] = 'aircraftlistjson'; |
|
176 | + $globalSources[$id]['format'] = 'opensky'; |
|
177 | + //$last_exec['aircraftlistjson'] = 0; |
|
178 | + if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
179 | + /* |
|
180 | 180 | // Disabled for now, site change source format |
181 | 181 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
182 | 182 | //$formats[$id] = 'radarvirtueljson'; |
@@ -188,121 +188,121 @@ discard block |
||
188 | 188 | exit(0); |
189 | 189 | } |
190 | 190 | */ |
191 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
192 | - //$formats[$id] = 'planeupdatefaa'; |
|
193 | - $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
194 | - //$last_exec['planeupdatefaa'] = 0; |
|
195 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
196 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
197 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
198 | - exit(0); |
|
199 | - } |
|
200 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
201 | - //$formats[$id] = 'phpvmacars'; |
|
202 | - $globalSources[$id]['format'] = 'phpvmacars'; |
|
203 | - //$last_exec['phpvmacars'] = 0; |
|
204 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
205 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
206 | - //$formats[$id] = 'phpvmacars'; |
|
207 | - $globalSources[$id]['format'] = 'vam'; |
|
208 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
209 | - } else if (preg_match('/whazzup/i',$host)) { |
|
210 | - //$formats[$id] = 'whazzup'; |
|
211 | - $globalSources[$id]['format'] = 'whazzup'; |
|
212 | - //$last_exec['whazzup'] = 0; |
|
213 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
214 | - } else if (preg_match('/blitzortung/i',$host)) { |
|
215 | - $globalSources[$id]['format'] = 'blitzortung'; |
|
216 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
217 | - } else if (preg_match('/airwhere/i',$host)) { |
|
218 | - $globalSources[$id]['format'] = 'airwhere'; |
|
219 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
220 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
221 | - //$formats[$id] = 'pirepsjson'; |
|
222 | - $globalSources[$id]['format'] = 'pirepsjson'; |
|
223 | - //$last_exec['pirepsjson'] = 0; |
|
224 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
225 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
226 | - //$formats[$id] = 'fr24json'; |
|
227 | - $globalSources[$id]['format'] = 'fr24json'; |
|
228 | - //$last_exec['fr24json'] = 0; |
|
229 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
230 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
231 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
232 | - exit(0); |
|
233 | - } |
|
234 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
235 | - //$formats[$id] = 'fr24json'; |
|
236 | - $globalSources[$id]['format'] = 'myshiptracking'; |
|
237 | - //$last_exec['fr24json'] = 0; |
|
238 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
239 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
240 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
241 | - exit(0); |
|
242 | - } |
|
243 | - //} else if (preg_match('/10001/',$host)) { |
|
244 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
245 | - //$formats[$id] = 'tsv'; |
|
246 | - $globalSources[$id]['format'] = 'tsv'; |
|
247 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
248 | - } |
|
249 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
250 | - if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
|
251 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
252 | - if ($idf !== false) { |
|
253 | - $httpfeeds[$id] = $idf; |
|
254 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
255 | - } |
|
256 | - elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
257 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
258 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
259 | - $hostport = explode(':',$host); |
|
260 | - if (isset($hostport[1])) { |
|
191 | + } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
192 | + //$formats[$id] = 'planeupdatefaa'; |
|
193 | + $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
194 | + //$last_exec['planeupdatefaa'] = 0; |
|
195 | + if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
196 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
197 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
198 | + exit(0); |
|
199 | + } |
|
200 | + } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
201 | + //$formats[$id] = 'phpvmacars'; |
|
202 | + $globalSources[$id]['format'] = 'phpvmacars'; |
|
203 | + //$last_exec['phpvmacars'] = 0; |
|
204 | + if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
205 | + } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
206 | + //$formats[$id] = 'phpvmacars'; |
|
207 | + $globalSources[$id]['format'] = 'vam'; |
|
208 | + if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
209 | + } else if (preg_match('/whazzup/i',$host)) { |
|
210 | + //$formats[$id] = 'whazzup'; |
|
211 | + $globalSources[$id]['format'] = 'whazzup'; |
|
212 | + //$last_exec['whazzup'] = 0; |
|
213 | + if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
214 | + } else if (preg_match('/blitzortung/i',$host)) { |
|
215 | + $globalSources[$id]['format'] = 'blitzortung'; |
|
216 | + if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
217 | + } else if (preg_match('/airwhere/i',$host)) { |
|
218 | + $globalSources[$id]['format'] = 'airwhere'; |
|
219 | + if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
220 | + } else if (preg_match('/recentpireps/i',$host)) { |
|
221 | + //$formats[$id] = 'pirepsjson'; |
|
222 | + $globalSources[$id]['format'] = 'pirepsjson'; |
|
223 | + //$last_exec['pirepsjson'] = 0; |
|
224 | + if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
225 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
226 | + //$formats[$id] = 'fr24json'; |
|
227 | + $globalSources[$id]['format'] = 'fr24json'; |
|
228 | + //$last_exec['fr24json'] = 0; |
|
229 | + if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
230 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
231 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
232 | + exit(0); |
|
233 | + } |
|
234 | + } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
235 | + //$formats[$id] = 'fr24json'; |
|
236 | + $globalSources[$id]['format'] = 'myshiptracking'; |
|
237 | + //$last_exec['fr24json'] = 0; |
|
238 | + if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
239 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
240 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
241 | + exit(0); |
|
242 | + } |
|
243 | + //} else if (preg_match('/10001/',$host)) { |
|
244 | + } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
245 | + //$formats[$id] = 'tsv'; |
|
246 | + $globalSources[$id]['format'] = 'tsv'; |
|
247 | + if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
248 | + } |
|
249 | + } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
250 | + if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
|
251 | + $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
252 | + if ($idf !== false) { |
|
253 | + $httpfeeds[$id] = $idf; |
|
254 | + if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
255 | + } |
|
256 | + elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
257 | + } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
258 | + } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
259 | + $hostport = explode(':',$host); |
|
260 | + if (isset($hostport[1])) { |
|
261 | 261 | $port = $hostport[1]; |
262 | 262 | $hostn = $hostport[0]; |
263 | - } else { |
|
263 | + } else { |
|
264 | 264 | $port = $globalSources[$id]['port']; |
265 | 265 | $hostn = $globalSources[$id]['host']; |
266 | - } |
|
267 | - $Common = new Common(); |
|
268 | - if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
269 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
270 | - } else { |
|
271 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
272 | - } |
|
273 | - if ($s) { |
|
274 | - $sockets[$id] = $s; |
|
275 | - if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
276 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
266 | + } |
|
267 | + $Common = new Common(); |
|
268 | + if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
269 | + $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
270 | + } else { |
|
271 | + $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
272 | + } |
|
273 | + if ($s) { |
|
274 | + $sockets[$id] = $s; |
|
275 | + if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
276 | + if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
277 | 277 | //$formats[$id] = 'aprs'; |
278 | 278 | $globalSources[$id]['format'] = 'aprs'; |
279 | 279 | //$aprs_connect = 0; |
280 | 280 | //$use_aprs = true; |
281 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
281 | + } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
282 | 282 | $globalSources[$id]['format'] = 'vrstcp'; |
283 | - } elseif ($port == '10001') { |
|
284 | - //$formats[$id] = 'tsv'; |
|
285 | - $globalSources[$id]['format'] = 'tsv'; |
|
286 | - } elseif ($port == '30002') { |
|
287 | - //$formats[$id] = 'raw'; |
|
288 | - $globalSources[$id]['format'] = 'raw'; |
|
289 | - } elseif ($port == '5001') { |
|
290 | - //$formats[$id] = 'raw'; |
|
291 | - $globalSources[$id]['format'] = 'flightgearmp'; |
|
292 | - } elseif ($port == '30005') { |
|
283 | + } elseif ($port == '10001') { |
|
284 | + //$formats[$id] = 'tsv'; |
|
285 | + $globalSources[$id]['format'] = 'tsv'; |
|
286 | + } elseif ($port == '30002') { |
|
287 | + //$formats[$id] = 'raw'; |
|
288 | + $globalSources[$id]['format'] = 'raw'; |
|
289 | + } elseif ($port == '5001') { |
|
290 | + //$formats[$id] = 'raw'; |
|
291 | + $globalSources[$id]['format'] = 'flightgearmp'; |
|
292 | + } elseif ($port == '30005') { |
|
293 | 293 | // Not yet supported |
294 | - //$formats[$id] = 'beast'; |
|
295 | - $globalSources[$id]['format'] = 'beast'; |
|
296 | - //} else $formats[$id] = 'sbs'; |
|
297 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
298 | - //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
294 | + //$formats[$id] = 'beast'; |
|
295 | + $globalSources[$id]['format'] = 'beast'; |
|
296 | + //} else $formats[$id] = 'sbs'; |
|
297 | + } else $globalSources[$id]['format'] = 'sbs'; |
|
298 | + //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
299 | 299 | } |
300 | 300 | if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
301 | - } else { |
|
301 | + } else { |
|
302 | 302 | if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
303 | - } |
|
304 | - } |
|
305 | - } |
|
303 | + } |
|
304 | + } |
|
305 | + } |
|
306 | 306 | } |
307 | 307 | if (!isset($globalMinFetch)) $globalMinFetch = 15; |
308 | 308 | |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | //connect_all($globalSources); |
326 | 326 | |
327 | 327 | if (isset($globalProxy) && $globalProxy) { |
328 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
328 | + $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
329 | 329 | } else { |
330 | - $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
|
330 | + $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | // APRS Configuration |
@@ -336,21 +336,21 @@ discard block |
||
336 | 336 | die; |
337 | 337 | } |
338 | 338 | foreach ($globalSources as $key => $source) { |
339 | - if (!isset($source['format'])) { |
|
340 | - $globalSources[$key]['format'] = 'auto'; |
|
341 | - } |
|
342 | - if (isset($source['callback']) && $source['callback'] === TRUE) { |
|
343 | - unset($globalSources[$key]); |
|
344 | - } |
|
339 | + if (!isset($source['format'])) { |
|
340 | + $globalSources[$key]['format'] = 'auto'; |
|
341 | + } |
|
342 | + if (isset($source['callback']) && $source['callback'] === TRUE) { |
|
343 | + unset($globalSources[$key]); |
|
344 | + } |
|
345 | 345 | } |
346 | 346 | connect_all($globalSources); |
347 | 347 | foreach ($globalSources as $key => $source) { |
348 | - if (isset($source['format']) && $source['format'] == 'aprs') { |
|
348 | + if (isset($source['format']) && $source['format'] == 'aprs') { |
|
349 | 349 | $aprs_connect = 0; |
350 | 350 | $use_aprs = true; |
351 | 351 | if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
352 | 352 | break; |
353 | - } |
|
353 | + } |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | if ($use_aprs) { |
@@ -391,126 +391,126 @@ discard block |
||
391 | 391 | |
392 | 392 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
393 | 393 | while ($i > 0) { |
394 | - if (!$globalDaemon) $i = $endtime-time(); |
|
395 | - // Delete old ATC |
|
396 | - if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
394 | + if (!$globalDaemon) $i = $endtime-time(); |
|
395 | + // Delete old ATC |
|
396 | + if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
397 | 397 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
398 | - $ATC->deleteOldATC(); |
|
399 | - } |
|
398 | + $ATC->deleteOldATC(); |
|
399 | + } |
|
400 | 400 | |
401 | - if (count($last_exec) == count($globalSources)) { |
|
401 | + if (count($last_exec) == count($globalSources)) { |
|
402 | 402 | $max = $globalMinFetch; |
403 | 403 | foreach ($last_exec as $last) { |
404 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
404 | + if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
405 | 405 | } |
406 | 406 | if ($max != $globalMinFetch) { |
407 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
408 | - sleep($globalMinFetch-$max+2); |
|
407 | + if ($globalDebug) echo 'Sleeping...'."\n"; |
|
408 | + sleep($globalMinFetch-$max+2); |
|
409 | + } |
|
409 | 410 | } |
410 | - } |
|
411 | 411 | |
412 | 412 | |
413 | - //foreach ($formats as $id => $value) { |
|
414 | - foreach ($globalSources as $id => $value) { |
|
413 | + //foreach ($formats as $id => $value) { |
|
414 | + foreach ($globalSources as $id => $value) { |
|
415 | 415 | date_default_timezone_set('UTC'); |
416 | 416 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
417 | 417 | if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
418 | 418 | if ($value['format'] == 'deltadbtxt' && |
419 | - ( |
|
419 | + ( |
|
420 | 420 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
421 | 421 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
422 | - ) |
|
422 | + ) |
|
423 | 423 | ) { |
424 | - //$buffer = $Common->getData($hosts[$id]); |
|
425 | - $buffer = $Common->getData($value['host']); |
|
426 | - if ($buffer != '') $reset = 0; |
|
427 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
428 | - $buffer = explode('\n',$buffer); |
|
429 | - foreach ($buffer as $line) { |
|
430 | - if ($line != '' && count($line) > 7) { |
|
431 | - $line = explode(',', $line); |
|
432 | - $data = array(); |
|
433 | - $data['hex'] = $line[1]; // hex |
|
434 | - $data['ident'] = $line[2]; // ident |
|
435 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
436 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
437 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
438 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
439 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
440 | - $data['verticalrate'] = ''; // vertical rate |
|
441 | - //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
442 | - $data['emergency'] = ''; // emergency |
|
443 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
444 | - $data['format_source'] = 'deltadbtxt'; |
|
445 | - $data['id_source'] = $id_source; |
|
446 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
447 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
448 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
449 | - $SI->add($data); |
|
450 | - unset($data); |
|
451 | - } |
|
452 | - } |
|
453 | - $last_exec[$id]['last'] = time(); |
|
424 | + //$buffer = $Common->getData($hosts[$id]); |
|
425 | + $buffer = $Common->getData($value['host']); |
|
426 | + if ($buffer != '') $reset = 0; |
|
427 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
428 | + $buffer = explode('\n',$buffer); |
|
429 | + foreach ($buffer as $line) { |
|
430 | + if ($line != '' && count($line) > 7) { |
|
431 | + $line = explode(',', $line); |
|
432 | + $data = array(); |
|
433 | + $data['hex'] = $line[1]; // hex |
|
434 | + $data['ident'] = $line[2]; // ident |
|
435 | + if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
436 | + if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
437 | + if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
438 | + if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
439 | + if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
440 | + $data['verticalrate'] = ''; // vertical rate |
|
441 | + //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
442 | + $data['emergency'] = ''; // emergency |
|
443 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
444 | + $data['format_source'] = 'deltadbtxt'; |
|
445 | + $data['id_source'] = $id_source; |
|
446 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
447 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
448 | + if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
449 | + $SI->add($data); |
|
450 | + unset($data); |
|
451 | + } |
|
452 | + } |
|
453 | + $last_exec[$id]['last'] = time(); |
|
454 | 454 | } elseif ($value['format'] == 'aisnmeatxt' && |
455 | - ( |
|
455 | + ( |
|
456 | 456 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
457 | 457 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
458 | - ) |
|
458 | + ) |
|
459 | 459 | ) { |
460 | - date_default_timezone_set('CET'); |
|
461 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
462 | - date_default_timezone_set('UTC'); |
|
463 | - if ($buffer != '') $reset = 0; |
|
464 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
465 | - $buffer = explode('\n',$buffer); |
|
466 | - foreach ($buffer as $line) { |
|
460 | + date_default_timezone_set('CET'); |
|
461 | + $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
462 | + date_default_timezone_set('UTC'); |
|
463 | + if ($buffer != '') $reset = 0; |
|
464 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
465 | + $buffer = explode('\n',$buffer); |
|
466 | + foreach ($buffer as $line) { |
|
467 | 467 | if ($line != '') { |
468 | - //echo "'".$line."'\n"; |
|
469 | - $add = false; |
|
470 | - $ais_data = $AIS->parse_line(trim($line)); |
|
471 | - $data = array(); |
|
472 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
473 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
474 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
475 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
476 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
477 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
478 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
479 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
480 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
481 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
482 | - if (isset($ais_data['timestamp'])) { |
|
468 | + //echo "'".$line."'\n"; |
|
469 | + $add = false; |
|
470 | + $ais_data = $AIS->parse_line(trim($line)); |
|
471 | + $data = array(); |
|
472 | + if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
473 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
474 | + if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
475 | + if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
476 | + if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
477 | + if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
478 | + if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
479 | + if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
480 | + if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
481 | + if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
482 | + if (isset($ais_data['timestamp'])) { |
|
483 | 483 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
484 | 484 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
485 | - $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
|
486 | - $add = true; |
|
485 | + $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
|
486 | + $add = true; |
|
487 | 487 | } |
488 | - } else { |
|
488 | + } else { |
|
489 | 489 | $data['datetime'] = date('Y-m-d H:i:s'); |
490 | 490 | $add = true; |
491 | - } |
|
492 | - $data['format_source'] = 'aisnmeatxt'; |
|
493 | - $data['id_source'] = $id_source; |
|
494 | - //print_r($data); |
|
495 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
496 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
497 | - unset($data); |
|
491 | + } |
|
492 | + $data['format_source'] = 'aisnmeatxt'; |
|
493 | + $data['id_source'] = $id_source; |
|
494 | + //print_r($data); |
|
495 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
496 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
497 | + unset($data); |
|
498 | 498 | } |
499 | - } |
|
500 | - $last_exec[$id]['last'] = time(); |
|
499 | + } |
|
500 | + $last_exec[$id]['last'] = time(); |
|
501 | 501 | } elseif ($value['format'] == 'aisnmeahttp') { |
502 | - $arr = $httpfeeds; |
|
503 | - $w = $e = null; |
|
502 | + $arr = $httpfeeds; |
|
503 | + $w = $e = null; |
|
504 | 504 | |
505 | - if (isset($arr[$id])) { |
|
505 | + if (isset($arr[$id])) { |
|
506 | 506 | $nn = stream_select($arr,$w,$e,$timeout); |
507 | 507 | if ($nn > 0) { |
508 | - foreach ($httpfeeds as $feed) { |
|
508 | + foreach ($httpfeeds as $feed) { |
|
509 | 509 | $buffer = stream_get_line($feed,2000,"\n"); |
510 | 510 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
511 | 511 | $buffer = explode('\n',$buffer); |
512 | 512 | foreach ($buffer as $line) { |
513 | - if ($line != '') { |
|
513 | + if ($line != '') { |
|
514 | 514 | $ais_data = $AIS->parse_line(trim($line)); |
515 | 515 | $data = array(); |
516 | 516 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
@@ -528,114 +528,114 @@ discard block |
||
528 | 528 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
529 | 529 | if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
530 | 530 | if (isset($ais_data['timestamp'])) { |
531 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
531 | + $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
532 | 532 | } else { |
533 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
533 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
534 | 534 | } |
535 | 535 | $data['format_source'] = 'aisnmeahttp'; |
536 | 536 | $data['id_source'] = $id_source; |
537 | 537 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
538 | 538 | if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
539 | 539 | unset($data); |
540 | - } |
|
540 | + } |
|
541 | + } |
|
541 | 542 | } |
542 | - } |
|
543 | 543 | } else { |
544 | - $format = $value['format']; |
|
545 | - if (isset($tt[$format])) $tt[$format]++; |
|
546 | - else $tt[$format] = 0; |
|
547 | - if ($tt[$format] > 30) { |
|
544 | + $format = $value['format']; |
|
545 | + if (isset($tt[$format])) $tt[$format]++; |
|
546 | + else $tt[$format] = 0; |
|
547 | + if ($tt[$format] > 30) { |
|
548 | 548 | if ($globalDebug) echo 'Reconnect...'."\n"; |
549 | 549 | sleep(2); |
550 | 550 | $sourceeen[] = $value; |
551 | 551 | connect_all($sourceeen); |
552 | 552 | $sourceeen = array(); |
553 | - } |
|
553 | + } |
|
554 | + } |
|
554 | 555 | } |
555 | - } |
|
556 | 556 | } elseif ($value['format'] == 'myshiptracking' && |
557 | - ( |
|
557 | + ( |
|
558 | 558 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
559 | 559 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
560 | - ) |
|
560 | + ) |
|
561 | 561 | ) { |
562 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
563 | - if ($buffer != '') { |
|
562 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
563 | + if ($buffer != '') { |
|
564 | 564 | //echo $buffer; |
565 | 565 | $all_data = json_decode($buffer,true); |
566 | 566 | //print_r($all_data); |
567 | 567 | if (isset($all_data[0]['DATA'])) { |
568 | - foreach ($all_data[0]['DATA'] as $line) { |
|
568 | + foreach ($all_data[0]['DATA'] as $line) { |
|
569 | 569 | if ($line != '') { |
570 | - $data = array(); |
|
571 | - $data['ident'] = $line['NAME']; |
|
572 | - $data['mmsi'] = $line['MMSI']; |
|
573 | - if (strlen($data['mmsi']) > 9) { |
|
570 | + $data = array(); |
|
571 | + $data['ident'] = $line['NAME']; |
|
572 | + $data['mmsi'] = $line['MMSI']; |
|
573 | + if (strlen($data['mmsi']) > 9) { |
|
574 | 574 | $data['mmsi'] = substr($data['mmsi'],-9); |
575 | - } |
|
576 | - $data['speed'] = $line['SOG']; |
|
577 | - $data['heading'] = $line['COG']; |
|
578 | - $data['latitude'] = $line['LAT']; |
|
579 | - $data['longitude'] = $line['LNG']; |
|
580 | - // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
581 | - $data['imo'] = $line['IMO']; |
|
582 | - //$data['arrival_code'] = $ais_data['destination']; |
|
583 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
584 | - $data['format_source'] = 'myshiptracking'; |
|
585 | - $data['id_source'] = $id_source; |
|
586 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
587 | - $MI->add($data); |
|
588 | - unset($data); |
|
575 | + } |
|
576 | + $data['speed'] = $line['SOG']; |
|
577 | + $data['heading'] = $line['COG']; |
|
578 | + $data['latitude'] = $line['LAT']; |
|
579 | + $data['longitude'] = $line['LNG']; |
|
580 | + // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
581 | + $data['imo'] = $line['IMO']; |
|
582 | + //$data['arrival_code'] = $ais_data['destination']; |
|
583 | + $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
584 | + $data['format_source'] = 'myshiptracking'; |
|
585 | + $data['id_source'] = $id_source; |
|
586 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
587 | + $MI->add($data); |
|
588 | + unset($data); |
|
589 | 589 | } |
590 | - } |
|
590 | + } |
|
591 | + } |
|
591 | 592 | } |
592 | - } |
|
593 | - $last_exec[$id]['last'] = time(); |
|
593 | + $last_exec[$id]['last'] = time(); |
|
594 | 594 | } elseif ($value['format'] == 'boatbeaconapp' && |
595 | - ( |
|
595 | + ( |
|
596 | 596 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
597 | 597 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
598 | - ) |
|
598 | + ) |
|
599 | 599 | ) { |
600 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
601 | - if ($buffer != '') { |
|
600 | + $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
601 | + if ($buffer != '') { |
|
602 | 602 | $all_data = json_decode($buffer,true); |
603 | 603 | if (isset($all_data[0]['mmsi'])) { |
604 | - foreach ($all_data as $line) { |
|
604 | + foreach ($all_data as $line) { |
|
605 | 605 | if ($line != '') { |
606 | - $data = array(); |
|
607 | - $data['ident'] = $line['shipname']; |
|
608 | - $data['callsign'] = $line['callsign']; |
|
609 | - $data['mmsi'] = $line['mmsi']; |
|
610 | - $data['speed'] = $line['sog']; |
|
611 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
612 | - $data['latitude'] = $line['latitude']; |
|
613 | - $data['longitude'] = $line['longitude']; |
|
614 | - $data['type_id'] = $line['shiptype']; |
|
615 | - $data['arrival_code'] = $line['destination']; |
|
616 | - $data['datetime'] = $line['time']; |
|
617 | - $data['format_source'] = 'boatbeaconapp'; |
|
618 | - $data['id_source'] = $id_source; |
|
619 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
620 | - $MI->add($data); |
|
621 | - unset($data); |
|
606 | + $data = array(); |
|
607 | + $data['ident'] = $line['shipname']; |
|
608 | + $data['callsign'] = $line['callsign']; |
|
609 | + $data['mmsi'] = $line['mmsi']; |
|
610 | + $data['speed'] = $line['sog']; |
|
611 | + if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
612 | + $data['latitude'] = $line['latitude']; |
|
613 | + $data['longitude'] = $line['longitude']; |
|
614 | + $data['type_id'] = $line['shiptype']; |
|
615 | + $data['arrival_code'] = $line['destination']; |
|
616 | + $data['datetime'] = $line['time']; |
|
617 | + $data['format_source'] = 'boatbeaconapp'; |
|
618 | + $data['id_source'] = $id_source; |
|
619 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
620 | + $MI->add($data); |
|
621 | + unset($data); |
|
622 | + } |
|
622 | 623 | } |
623 | - } |
|
624 | 624 | } |
625 | 625 | |
626 | - } |
|
627 | - $last_exec[$id]['last'] = time(); |
|
626 | + } |
|
627 | + $last_exec[$id]['last'] = time(); |
|
628 | 628 | } elseif ($value['format'] == 'boatnerd' && |
629 | - ( |
|
629 | + ( |
|
630 | 630 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
631 | 631 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
632 | - ) |
|
632 | + ) |
|
633 | 633 | ) { |
634 | - $buffer = $Common->getData($value['host']); |
|
635 | - if ($buffer != '') { |
|
634 | + $buffer = $Common->getData($value['host']); |
|
635 | + if ($buffer != '') { |
|
636 | 636 | $all_data = json_decode($buffer,true); |
637 | 637 | if (isset($all_data['features'][0]['id'])) { |
638 | - foreach ($all_data['features'] as $line) { |
|
638 | + foreach ($all_data['features'] as $line) { |
|
639 | 639 | $data = array(); |
640 | 640 | if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
641 | 641 | if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
@@ -654,78 +654,78 @@ discard block |
||
654 | 654 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
655 | 655 | if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
656 | 656 | unset($data); |
657 | - } |
|
657 | + } |
|
658 | 658 | } |
659 | 659 | |
660 | - } |
|
661 | - $last_exec[$id]['last'] = time(); |
|
660 | + } |
|
661 | + $last_exec[$id]['last'] = time(); |
|
662 | 662 | } elseif ($value['format'] == 'shipplotter' && |
663 | - ( |
|
663 | + ( |
|
664 | 664 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
665 | 665 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
666 | - ) |
|
666 | + ) |
|
667 | 667 | ) { |
668 | - echo 'download...'; |
|
669 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
670 | - echo 'done !'."\n"; |
|
671 | - if ($buffer != '') $reset = 0; |
|
672 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
673 | - $buffer = explode('\n',$buffer); |
|
674 | - foreach ($buffer as $line) { |
|
668 | + echo 'download...'; |
|
669 | + $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
670 | + echo 'done !'."\n"; |
|
671 | + if ($buffer != '') $reset = 0; |
|
672 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
673 | + $buffer = explode('\n',$buffer); |
|
674 | + foreach ($buffer as $line) { |
|
675 | 675 | if ($line != '') { |
676 | - $data = array(); |
|
677 | - $data['mmsi'] = (int)substr($line,0,9); |
|
678 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
679 | - //$data['status'] = substr($line,21,2); |
|
680 | - //$data['type'] = substr($line,24,3); |
|
681 | - $data['latitude'] = substr($line,29,9); |
|
682 | - $data['longitude'] = substr($line,41,9); |
|
683 | - $data['speed'] = round(substr($line,51,5)); |
|
684 | - //$data['course'] = substr($line,57,5); |
|
685 | - $data['heading'] = round(substr($line,63,3)); |
|
686 | - //$data['draft'] = substr($line,67,4); |
|
687 | - //$data['length'] = substr($line,72,3); |
|
688 | - //$data['beam'] = substr($line,76,2); |
|
689 | - $data['ident'] = trim(utf8_encode(substr($line,79,20))); |
|
690 | - //$data['callsign'] = trim(substr($line,100,7); |
|
691 | - //$data['dest'] = substr($line,108,20); |
|
692 | - //$data['etaDate'] = substr($line,129,5); |
|
693 | - //$data['etaTime'] = substr($line,135,5); |
|
694 | - $data['format_source'] = 'shipplotter'; |
|
695 | - $data['id_source'] = $id_source; |
|
696 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
697 | - //print_r($data); |
|
698 | - echo 'Add...'."\n"; |
|
699 | - $MI->add($data); |
|
700 | - unset($data); |
|
676 | + $data = array(); |
|
677 | + $data['mmsi'] = (int)substr($line,0,9); |
|
678 | + $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
679 | + //$data['status'] = substr($line,21,2); |
|
680 | + //$data['type'] = substr($line,24,3); |
|
681 | + $data['latitude'] = substr($line,29,9); |
|
682 | + $data['longitude'] = substr($line,41,9); |
|
683 | + $data['speed'] = round(substr($line,51,5)); |
|
684 | + //$data['course'] = substr($line,57,5); |
|
685 | + $data['heading'] = round(substr($line,63,3)); |
|
686 | + //$data['draft'] = substr($line,67,4); |
|
687 | + //$data['length'] = substr($line,72,3); |
|
688 | + //$data['beam'] = substr($line,76,2); |
|
689 | + $data['ident'] = trim(utf8_encode(substr($line,79,20))); |
|
690 | + //$data['callsign'] = trim(substr($line,100,7); |
|
691 | + //$data['dest'] = substr($line,108,20); |
|
692 | + //$data['etaDate'] = substr($line,129,5); |
|
693 | + //$data['etaTime'] = substr($line,135,5); |
|
694 | + $data['format_source'] = 'shipplotter'; |
|
695 | + $data['id_source'] = $id_source; |
|
696 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
697 | + //print_r($data); |
|
698 | + echo 'Add...'."\n"; |
|
699 | + $MI->add($data); |
|
700 | + unset($data); |
|
701 | 701 | } |
702 | - } |
|
703 | - $last_exec[$id]['last'] = time(); |
|
702 | + } |
|
703 | + $last_exec[$id]['last'] = time(); |
|
704 | 704 | //} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) { |
705 | 705 | } elseif ( |
706 | - ( |
|
706 | + ( |
|
707 | 707 | $value['format'] == 'whazzup' && |
708 | 708 | ( |
709 | - (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
710 | - (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
709 | + (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
710 | + (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
711 | 711 | ) |
712 | - ) || ( |
|
712 | + ) || ( |
|
713 | 713 | $value['format'] == 'vatsimtxt' && |
714 | 714 | ( |
715 | - (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
716 | - (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
715 | + (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
716 | + (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
717 | + ) |
|
717 | 718 | ) |
718 | - ) |
|
719 | 719 | ) { |
720 | - //$buffer = $Common->getData($hosts[$id]); |
|
721 | - $buffer = $Common->getData($value['host']); |
|
722 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
723 | - $buffer = explode('\n',$buffer); |
|
724 | - $reset = 0; |
|
725 | - foreach ($buffer as $line) { |
|
726 | - if ($line != '') { |
|
727 | - $line = explode(':', $line); |
|
728 | - if (count($line) > 30 && $line[0] != 'callsign') { |
|
720 | + //$buffer = $Common->getData($hosts[$id]); |
|
721 | + $buffer = $Common->getData($value['host']); |
|
722 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
723 | + $buffer = explode('\n',$buffer); |
|
724 | + $reset = 0; |
|
725 | + foreach ($buffer as $line) { |
|
726 | + if ($line != '') { |
|
727 | + $line = explode(':', $line); |
|
728 | + if (count($line) > 30 && $line[0] != 'callsign') { |
|
729 | 729 | $data = array(); |
730 | 730 | if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
731 | 731 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
@@ -738,37 +738,37 @@ discard block |
||
738 | 738 | if (isset($line[45])) $data['heading'] = $line[45]; // heading |
739 | 739 | elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
740 | 740 | $data['latitude'] = $line[5]; // lat |
741 | - $data['longitude'] = $line[6]; // long |
|
742 | - $data['verticalrate'] = ''; // vertical rate |
|
743 | - $data['squawk'] = ''; // squawk |
|
744 | - $data['emergency'] = ''; // emergency |
|
745 | - $data['waypoints'] = $line[30]; |
|
741 | + $data['longitude'] = $line[6]; // long |
|
742 | + $data['verticalrate'] = ''; // vertical rate |
|
743 | + $data['squawk'] = ''; // squawk |
|
744 | + $data['emergency'] = ''; // emergency |
|
745 | + $data['waypoints'] = $line[30]; |
|
746 | 746 | $data['datetime'] = date('Y-m-d H:i:s'); |
747 | 747 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
748 | 748 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
749 | - $data['departure_airport_icao'] = $line[11]; |
|
750 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
751 | - $data['arrival_airport_icao'] = $line[13]; |
|
749 | + $data['departure_airport_icao'] = $line[11]; |
|
750 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
751 | + $data['arrival_airport_icao'] = $line[13]; |
|
752 | 752 | $data['frequency'] = $line[4]; |
753 | 753 | $data['type'] = $line[18]; |
754 | 754 | $data['range'] = $line[19]; |
755 | 755 | if (isset($line[35])) $data['info'] = $line[35]; |
756 | - $data['id_source'] = $id_source; |
|
757 | - //$data['arrival_airport_time'] = ; |
|
758 | - if ($line[9] != '') { |
|
759 | - $aircraft_data = explode('/',$line[9]); |
|
760 | - if (isset($aircraft_data[1])) { |
|
761 | - $data['aircraft_icao'] = $aircraft_data[1]; |
|
762 | - } |
|
763 | - } |
|
764 | - /* |
|
756 | + $data['id_source'] = $id_source; |
|
757 | + //$data['arrival_airport_time'] = ; |
|
758 | + if ($line[9] != '') { |
|
759 | + $aircraft_data = explode('/',$line[9]); |
|
760 | + if (isset($aircraft_data[1])) { |
|
761 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
762 | + } |
|
763 | + } |
|
764 | + /* |
|
765 | 765 | if ($value == 'whazzup') $data['format_source'] = 'whazzup'; |
766 | 766 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
767 | 767 | */ |
768 | - $data['format_source'] = $value['format']; |
|
768 | + $data['format_source'] = $value['format']; |
|
769 | 769 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
770 | 770 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
771 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
771 | + if ($line[3] == 'PILOT') $SI->add($data); |
|
772 | 772 | elseif ($line[3] == 'ATC') { |
773 | 773 | //print_r($data); |
774 | 774 | $data['info'] = str_replace('^§','<br />',$data['info']); |
@@ -789,21 +789,21 @@ discard block |
||
789 | 789 | else 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']); |
790 | 790 | } |
791 | 791 | } |
792 | - unset($data); |
|
793 | - } |
|
794 | - } |
|
795 | - } |
|
796 | - //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
797 | - //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
798 | - $last_exec[$id]['last'] = time(); |
|
799 | - } elseif ($value['format'] == 'airwhere' && |
|
800 | - ( |
|
801 | - (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
802 | - (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
803 | - ) |
|
804 | - ) { |
|
805 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
806 | - if ($buffer != '') { |
|
792 | + unset($data); |
|
793 | + } |
|
794 | + } |
|
795 | + } |
|
796 | + //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
797 | + //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
798 | + $last_exec[$id]['last'] = time(); |
|
799 | + } elseif ($value['format'] == 'airwhere' && |
|
800 | + ( |
|
801 | + (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
802 | + (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
803 | + ) |
|
804 | + ) { |
|
805 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
806 | + if ($buffer != '') { |
|
807 | 807 | $all_data = simplexml_load_string($buffer); |
808 | 808 | foreach($all_data->children() as $childdata) { |
809 | 809 | $data = array(); |
@@ -825,10 +825,10 @@ discard block |
||
825 | 825 | $SI->add($data); |
826 | 826 | unset($data); |
827 | 827 | } |
828 | - } |
|
829 | - $Source->deleteOldLocationByType('gs'); |
|
830 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
831 | - if ($buffer != '') { |
|
828 | + } |
|
829 | + $Source->deleteOldLocationByType('gs'); |
|
830 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
831 | + if ($buffer != '') { |
|
832 | 832 | $all_data = simplexml_load_string($buffer); |
833 | 833 | foreach($all_data->children() as $childdata) { |
834 | 834 | $data = array(); |
@@ -846,8 +846,8 @@ discard block |
||
846 | 846 | } |
847 | 847 | unset($data); |
848 | 848 | } |
849 | - } |
|
850 | - $last_exec[$id]['last'] = time(); |
|
849 | + } |
|
850 | + $last_exec[$id]['last'] = time(); |
|
851 | 851 | /* |
852 | 852 | } if ($value['format'] == 'aircraftlistjson') { |
853 | 853 | print_r($globalSources); |
@@ -855,17 +855,17 @@ discard block |
||
855 | 855 | echo $globalMinFetch; |
856 | 856 | */ |
857 | 857 | } elseif ($value['format'] == 'aircraftlistjson' && |
858 | - ( |
|
858 | + ( |
|
859 | 859 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
860 | 860 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
861 | - ) |
|
861 | + ) |
|
862 | 862 | ) { |
863 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
864 | - if ($buffer != '') { |
|
865 | - $all_data = json_decode($buffer,true); |
|
863 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
864 | + if ($buffer != '') { |
|
865 | + $all_data = json_decode($buffer,true); |
|
866 | 866 | if (isset($all_data['acList'])) { |
867 | - $reset = 0; |
|
868 | - foreach ($all_data['acList'] as $line) { |
|
867 | + $reset = 0; |
|
868 | + foreach ($all_data['acList'] as $line) { |
|
869 | 869 | $data = array(); |
870 | 870 | $data['hex'] = $line['Icao']; // hex |
871 | 871 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -888,10 +888,10 @@ discard block |
||
888 | 888 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
889 | 889 | if (isset($data['latitude'])) $SI->add($data); |
890 | 890 | unset($data); |
891 | - } |
|
891 | + } |
|
892 | 892 | } elseif (is_array($all_data)) { |
893 | - $reset = 0; |
|
894 | - foreach ($all_data as $line) { |
|
893 | + $reset = 0; |
|
894 | + foreach ($all_data as $line) { |
|
895 | 895 | $data = array(); |
896 | 896 | $data['hex'] = $line['hex']; // hex |
897 | 897 | $data['ident'] = $line['flight']; // ident |
@@ -911,218 +911,218 @@ discard block |
||
911 | 911 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
912 | 912 | $SI->add($data); |
913 | 913 | unset($data); |
914 | - } |
|
914 | + } |
|
915 | 915 | } |
916 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
917 | - //$last_exec['aircraftlistjson'] = time(); |
|
918 | - $last_exec[$id]['last'] = time(); |
|
919 | - //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
920 | - } elseif ($value['format'] == 'planeupdatefaa' && |
|
921 | - ( |
|
922 | - (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
923 | - (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
924 | - ) |
|
925 | - ) { |
|
926 | - $buffer = $Common->getData($value['host']); |
|
927 | - $all_data = json_decode($buffer,true); |
|
928 | - if (isset($all_data['planes'])) { |
|
916 | + } elseif ($globalDebug) echo 'No data'."\n"; |
|
917 | + //$last_exec['aircraftlistjson'] = time(); |
|
918 | + $last_exec[$id]['last'] = time(); |
|
919 | + //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
920 | + } elseif ($value['format'] == 'planeupdatefaa' && |
|
921 | + ( |
|
922 | + (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
923 | + (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
924 | + ) |
|
925 | + ) { |
|
926 | + $buffer = $Common->getData($value['host']); |
|
927 | + $all_data = json_decode($buffer,true); |
|
928 | + if (isset($all_data['planes'])) { |
|
929 | 929 | $reset = 0; |
930 | 930 | foreach ($all_data['planes'] as $key => $line) { |
931 | - $data = array(); |
|
932 | - $data['hex'] = $key; // hex |
|
933 | - $data['ident'] = $line[3]; // ident |
|
934 | - $data['altitude'] = $line[6]; // altitude |
|
935 | - $data['speed'] = $line[8]; // speed |
|
936 | - $data['heading'] = $line[7]; // heading |
|
937 | - $data['latitude'] = $line[4]; // lat |
|
938 | - $data['longitude'] = $line[5]; // long |
|
939 | - //$data['verticalrate'] = $line[]; // verticale rate |
|
940 | - $data['squawk'] = $line[10]; // squawk |
|
941 | - $data['emergency'] = ''; // emergency |
|
942 | - $data['registration'] = $line[2]; |
|
943 | - $data['aircraft_icao'] = $line[0]; |
|
944 | - $deparr = explode('-',$line[1]); |
|
945 | - if (count($deparr) == 2) { |
|
931 | + $data = array(); |
|
932 | + $data['hex'] = $key; // hex |
|
933 | + $data['ident'] = $line[3]; // ident |
|
934 | + $data['altitude'] = $line[6]; // altitude |
|
935 | + $data['speed'] = $line[8]; // speed |
|
936 | + $data['heading'] = $line[7]; // heading |
|
937 | + $data['latitude'] = $line[4]; // lat |
|
938 | + $data['longitude'] = $line[5]; // long |
|
939 | + //$data['verticalrate'] = $line[]; // verticale rate |
|
940 | + $data['squawk'] = $line[10]; // squawk |
|
941 | + $data['emergency'] = ''; // emergency |
|
942 | + $data['registration'] = $line[2]; |
|
943 | + $data['aircraft_icao'] = $line[0]; |
|
944 | + $deparr = explode('-',$line[1]); |
|
945 | + if (count($deparr) == 2) { |
|
946 | 946 | $data['departure_airport_icao'] = $deparr[0]; |
947 | 947 | $data['arrival_airport_icao'] = $deparr[1]; |
948 | - } |
|
949 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
950 | - $data['format_source'] = 'planeupdatefaa'; |
|
951 | - $data['id_source'] = $id_source; |
|
952 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
953 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
954 | - $SI->add($data); |
|
955 | - unset($data); |
|
948 | + } |
|
949 | + $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
950 | + $data['format_source'] = 'planeupdatefaa'; |
|
951 | + $data['id_source'] = $id_source; |
|
952 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
953 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
954 | + $SI->add($data); |
|
955 | + unset($data); |
|
956 | + } |
|
956 | 957 | } |
957 | - } |
|
958 | - //$last_exec['planeupdatefaa'] = time(); |
|
959 | - $last_exec[$id]['last'] = time(); |
|
958 | + //$last_exec['planeupdatefaa'] = time(); |
|
959 | + $last_exec[$id]['last'] = time(); |
|
960 | 960 | } elseif ($value['format'] == 'opensky' && |
961 | - ( |
|
961 | + ( |
|
962 | 962 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
963 | 963 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
964 | - ) |
|
964 | + ) |
|
965 | 965 | ) { |
966 | - $buffer = $Common->getData($value['host']); |
|
967 | - $all_data = json_decode($buffer,true); |
|
968 | - if (isset($all_data['states'])) { |
|
966 | + $buffer = $Common->getData($value['host']); |
|
967 | + $all_data = json_decode($buffer,true); |
|
968 | + if (isset($all_data['states'])) { |
|
969 | 969 | $reset = 0; |
970 | 970 | foreach ($all_data['states'] as $key => $line) { |
971 | - $data = array(); |
|
972 | - $data['hex'] = $line[0]; // hex |
|
973 | - $data['ident'] = trim($line[1]); // ident |
|
974 | - $data['altitude'] = round($line[7]*3.28084); // altitude |
|
975 | - $data['speed'] = round($line[9]*1.94384); // speed |
|
976 | - $data['heading'] = round($line[10]); // heading |
|
977 | - $data['latitude'] = $line[6]; // lat |
|
978 | - $data['longitude'] = $line[5]; // long |
|
979 | - $data['verticalrate'] = $line[11]; // verticale rate |
|
980 | - //$data['squawk'] = $line[10]; // squawk |
|
981 | - //$data['emergency'] = ''; // emergency |
|
982 | - //$data['registration'] = $line[2]; |
|
983 | - //$data['aircraft_icao'] = $line[0]; |
|
984 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
985 | - $data['format_source'] = 'opensky'; |
|
986 | - $data['id_source'] = $id_source; |
|
987 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
988 | - $SI->add($data); |
|
989 | - unset($data); |
|
971 | + $data = array(); |
|
972 | + $data['hex'] = $line[0]; // hex |
|
973 | + $data['ident'] = trim($line[1]); // ident |
|
974 | + $data['altitude'] = round($line[7]*3.28084); // altitude |
|
975 | + $data['speed'] = round($line[9]*1.94384); // speed |
|
976 | + $data['heading'] = round($line[10]); // heading |
|
977 | + $data['latitude'] = $line[6]; // lat |
|
978 | + $data['longitude'] = $line[5]; // long |
|
979 | + $data['verticalrate'] = $line[11]; // verticale rate |
|
980 | + //$data['squawk'] = $line[10]; // squawk |
|
981 | + //$data['emergency'] = ''; // emergency |
|
982 | + //$data['registration'] = $line[2]; |
|
983 | + //$data['aircraft_icao'] = $line[0]; |
|
984 | + $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
985 | + $data['format_source'] = 'opensky'; |
|
986 | + $data['id_source'] = $id_source; |
|
987 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
988 | + $SI->add($data); |
|
989 | + unset($data); |
|
990 | 990 | } |
991 | - } |
|
992 | - //$last_exec['planeupdatefaa'] = time(); |
|
993 | - $last_exec[$id]['last'] = time(); |
|
991 | + } |
|
992 | + //$last_exec['planeupdatefaa'] = time(); |
|
993 | + $last_exec[$id]['last'] = time(); |
|
994 | 994 | //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
995 | 995 | } elseif ($value['format'] == 'fr24json' && |
996 | - ( |
|
996 | + ( |
|
997 | 997 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
998 | 998 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
999 | - ) |
|
999 | + ) |
|
1000 | 1000 | ) { |
1001 | - //$buffer = $Common->getData($hosts[$id]); |
|
1002 | - $buffer = $Common->getData($value['host']); |
|
1003 | - $all_data = json_decode($buffer,true); |
|
1004 | - if (!empty($all_data)) $reset = 0; |
|
1005 | - foreach ($all_data as $key => $line) { |
|
1001 | + //$buffer = $Common->getData($hosts[$id]); |
|
1002 | + $buffer = $Common->getData($value['host']); |
|
1003 | + $all_data = json_decode($buffer,true); |
|
1004 | + if (!empty($all_data)) $reset = 0; |
|
1005 | + foreach ($all_data as $key => $line) { |
|
1006 | 1006 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
1007 | - $data = array(); |
|
1008 | - $data['hex'] = $line[0]; |
|
1009 | - $data['ident'] = $line[16]; //$line[13] |
|
1010 | - $data['altitude'] = $line[4]; // altitude |
|
1011 | - $data['speed'] = $line[5]; // speed |
|
1012 | - $data['heading'] = $line[3]; // heading |
|
1013 | - $data['latitude'] = $line[1]; // lat |
|
1014 | - $data['longitude'] = $line[2]; // long |
|
1015 | - $data['verticalrate'] = $line[15]; // verticale rate |
|
1016 | - $data['squawk'] = $line[6]; // squawk |
|
1017 | - $data['aircraft_icao'] = $line[8]; |
|
1018 | - $data['registration'] = $line[9]; |
|
1019 | - $data['departure_airport_iata'] = $line[11]; |
|
1020 | - $data['arrival_airport_iata'] = $line[12]; |
|
1021 | - $data['emergency'] = ''; // emergency |
|
1022 | - $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
1023 | - $data['format_source'] = 'fr24json'; |
|
1024 | - $data['id_source'] = $id_source; |
|
1025 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1026 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1027 | - $SI->add($data); |
|
1028 | - unset($data); |
|
1007 | + $data = array(); |
|
1008 | + $data['hex'] = $line[0]; |
|
1009 | + $data['ident'] = $line[16]; //$line[13] |
|
1010 | + $data['altitude'] = $line[4]; // altitude |
|
1011 | + $data['speed'] = $line[5]; // speed |
|
1012 | + $data['heading'] = $line[3]; // heading |
|
1013 | + $data['latitude'] = $line[1]; // lat |
|
1014 | + $data['longitude'] = $line[2]; // long |
|
1015 | + $data['verticalrate'] = $line[15]; // verticale rate |
|
1016 | + $data['squawk'] = $line[6]; // squawk |
|
1017 | + $data['aircraft_icao'] = $line[8]; |
|
1018 | + $data['registration'] = $line[9]; |
|
1019 | + $data['departure_airport_iata'] = $line[11]; |
|
1020 | + $data['arrival_airport_iata'] = $line[12]; |
|
1021 | + $data['emergency'] = ''; // emergency |
|
1022 | + $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
1023 | + $data['format_source'] = 'fr24json'; |
|
1024 | + $data['id_source'] = $id_source; |
|
1025 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1026 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1027 | + $SI->add($data); |
|
1028 | + unset($data); |
|
1029 | 1029 | } |
1030 | - } |
|
1031 | - //$last_exec['fr24json'] = time(); |
|
1032 | - $last_exec[$id]['last'] = time(); |
|
1030 | + } |
|
1031 | + //$last_exec['fr24json'] = time(); |
|
1032 | + $last_exec[$id]['last'] = time(); |
|
1033 | 1033 | //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
1034 | 1034 | } elseif ($value['format'] == 'radarvirtueljson' && |
1035 | - ( |
|
1035 | + ( |
|
1036 | 1036 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
1037 | 1037 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
1038 | - ) |
|
1038 | + ) |
|
1039 | 1039 | ) { |
1040 | - //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
1041 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
1042 | - //echo $buffer; |
|
1043 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
1044 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
1045 | - $all_data = json_decode($buffer,true); |
|
1046 | - if (json_last_error() != JSON_ERROR_NONE) { |
|
1040 | + //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
1041 | + $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
1042 | + //echo $buffer; |
|
1043 | + $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
1044 | + $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
1045 | + $all_data = json_decode($buffer,true); |
|
1046 | + if (json_last_error() != JSON_ERROR_NONE) { |
|
1047 | 1047 | die(json_last_error_msg()); |
1048 | - } |
|
1049 | - if (isset($all_data['mrkrs'])) { |
|
1048 | + } |
|
1049 | + if (isset($all_data['mrkrs'])) { |
|
1050 | 1050 | $reset = 0; |
1051 | 1051 | foreach ($all_data['mrkrs'] as $key => $line) { |
1052 | - if (isset($line['inf'])) { |
|
1052 | + if (isset($line['inf'])) { |
|
1053 | 1053 | $data = array(); |
1054 | 1054 | $data['hex'] = $line['inf']['ia']; |
1055 | 1055 | if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
1056 | - $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
1057 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
1058 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
1059 | - $data['latitude'] = $line['pt'][0]; // lat |
|
1060 | - $data['longitude'] = $line['pt'][1]; // long |
|
1061 | - //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
1062 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
1063 | - //$data['aircraft_icao'] = $line[8]; |
|
1064 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
1056 | + $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
1057 | + if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
1058 | + if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
1059 | + $data['latitude'] = $line['pt'][0]; // lat |
|
1060 | + $data['longitude'] = $line['pt'][1]; // long |
|
1061 | + //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
1062 | + if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
1063 | + //$data['aircraft_icao'] = $line[8]; |
|
1064 | + if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
1065 | 1065 | //$data['departure_airport_iata'] = $line[11]; |
1066 | 1066 | //$data['arrival_airport_iata'] = $line[12]; |
1067 | - //$data['emergency'] = ''; // emergency |
|
1067 | + //$data['emergency'] = ''; // emergency |
|
1068 | 1068 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
1069 | - $data['format_source'] = 'radarvirtueljson'; |
|
1070 | - $data['id_source'] = $id_source; |
|
1069 | + $data['format_source'] = 'radarvirtueljson'; |
|
1070 | + $data['id_source'] = $id_source; |
|
1071 | 1071 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
1072 | 1072 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
1073 | 1073 | $SI->add($data); |
1074 | 1074 | unset($data); |
1075 | - } |
|
1075 | + } |
|
1076 | + } |
|
1076 | 1077 | } |
1077 | - } |
|
1078 | - //$last_exec['radarvirtueljson'] = time(); |
|
1079 | - $last_exec[$id]['last'] = time(); |
|
1078 | + //$last_exec['radarvirtueljson'] = time(); |
|
1079 | + $last_exec[$id]['last'] = time(); |
|
1080 | 1080 | //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
1081 | 1081 | } elseif ($value['format'] == 'pirepsjson' && |
1082 | - ( |
|
1082 | + ( |
|
1083 | 1083 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
1084 | 1084 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
1085 | - ) |
|
1085 | + ) |
|
1086 | 1086 | ) { |
1087 | - //$buffer = $Common->getData($hosts[$id]); |
|
1088 | - $buffer = $Common->getData($value['host'].'?'.time()); |
|
1089 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
1087 | + //$buffer = $Common->getData($hosts[$id]); |
|
1088 | + $buffer = $Common->getData($value['host'].'?'.time()); |
|
1089 | + $all_data = json_decode(utf8_encode($buffer),true); |
|
1090 | 1090 | |
1091 | - if (isset($all_data['pireps'])) { |
|
1091 | + if (isset($all_data['pireps'])) { |
|
1092 | 1092 | $reset = 0; |
1093 | - foreach ($all_data['pireps'] as $line) { |
|
1094 | - $data = array(); |
|
1095 | - $data['id'] = $line['id']; |
|
1096 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
1097 | - $data['ident'] = $line['callsign']; // ident |
|
1098 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
1099 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
1100 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
1101 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
1102 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
1103 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1104 | - $data['latitude'] = $line['lat']; // lat |
|
1105 | - $data['longitude'] = $line['lon']; // long |
|
1106 | - //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
1107 | - //$data['squawk'] = $line['squawk']; // squawk |
|
1108 | - //$data['emergency'] = ''; // emergency |
|
1109 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
1110 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
1111 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
1112 | - //$data['arrival_airport_time'] = $line['arrtime']; |
|
1113 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
1114 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
1115 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
1116 | - else $data['info'] = ''; |
|
1117 | - $data['format_source'] = 'pireps'; |
|
1118 | - $data['id_source'] = $id_source; |
|
1119 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
1120 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1121 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1122 | - if ($line['icon'] == 'plane') { |
|
1093 | + foreach ($all_data['pireps'] as $line) { |
|
1094 | + $data = array(); |
|
1095 | + $data['id'] = $line['id']; |
|
1096 | + $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
1097 | + $data['ident'] = $line['callsign']; // ident |
|
1098 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
1099 | + if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
1100 | + if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
1101 | + if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
1102 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
1103 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1104 | + $data['latitude'] = $line['lat']; // lat |
|
1105 | + $data['longitude'] = $line['lon']; // long |
|
1106 | + //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
1107 | + //$data['squawk'] = $line['squawk']; // squawk |
|
1108 | + //$data['emergency'] = ''; // emergency |
|
1109 | + if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
1110 | + if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
1111 | + if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
1112 | + //$data['arrival_airport_time'] = $line['arrtime']; |
|
1113 | + if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
1114 | + if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
1115 | + if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
1116 | + else $data['info'] = ''; |
|
1117 | + $data['format_source'] = 'pireps'; |
|
1118 | + $data['id_source'] = $id_source; |
|
1119 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1120 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1121 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1122 | + if ($line['icon'] == 'plane') { |
|
1123 | 1123 | $SI->add($data); |
1124 | - // print_r($data); |
|
1125 | - } elseif ($line['icon'] == 'ct') { |
|
1124 | + // print_r($data); |
|
1125 | + } elseif ($line['icon'] == 'ct') { |
|
1126 | 1126 | $data['info'] = str_replace('^§','<br />',$data['info']); |
1127 | 1127 | $data['info'] = str_replace('&sect;','',$data['info']); |
1128 | 1128 | $typec = substr($data['ident'],-3); |
@@ -1137,148 +1137,148 @@ discard block |
||
1137 | 1137 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
1138 | 1138 | else $data['type'] = 'Observer'; |
1139 | 1139 | if (isset($ATC)) 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']); |
1140 | - } |
|
1141 | - unset($data); |
|
1140 | + } |
|
1141 | + unset($data); |
|
1142 | + } |
|
1142 | 1143 | } |
1143 | - } |
|
1144 | - //$last_exec['pirepsjson'] = time(); |
|
1145 | - $last_exec[$id]['last'] = time(); |
|
1144 | + //$last_exec['pirepsjson'] = time(); |
|
1145 | + $last_exec[$id]['last'] = time(); |
|
1146 | 1146 | //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
1147 | 1147 | } elseif ($value['format'] == 'phpvmacars' && |
1148 | - ( |
|
1148 | + ( |
|
1149 | 1149 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
1150 | 1150 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
1151 | - ) |
|
1151 | + ) |
|
1152 | 1152 | ) { |
1153 | - //$buffer = $Common->getData($hosts[$id]); |
|
1154 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
1155 | - $buffer = $Common->getData($value['host']); |
|
1156 | - $all_data = json_decode($buffer,true); |
|
1157 | - if ($buffer != '' && is_array($all_data)) { |
|
1153 | + //$buffer = $Common->getData($hosts[$id]); |
|
1154 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
1155 | + $buffer = $Common->getData($value['host']); |
|
1156 | + $all_data = json_decode($buffer,true); |
|
1157 | + if ($buffer != '' && is_array($all_data)) { |
|
1158 | 1158 | $reset = 0; |
1159 | 1159 | foreach ($all_data as $line) { |
1160 | - $data = array(); |
|
1161 | - //$data['id'] = $line['id']; // id not usable |
|
1162 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
1163 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1164 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
1165 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
1166 | - $data['ident'] = $line['flightnum']; // ident |
|
1167 | - $data['altitude'] = $line['alt']; // altitude |
|
1168 | - $data['speed'] = $line['gs']; // speed |
|
1169 | - $data['heading'] = $line['heading']; // heading |
|
1170 | - $data['latitude'] = $line['lat']; // lat |
|
1171 | - $data['longitude'] = $line['lng']; // long |
|
1172 | - $data['verticalrate'] = ''; // verticale rate |
|
1173 | - $data['squawk'] = ''; // squawk |
|
1174 | - $data['emergency'] = ''; // emergency |
|
1175 | - //$data['datetime'] = $line['lastupdate']; |
|
1176 | - //$data['last_update'] = $line['lastupdate']; |
|
1177 | - if (isset($value['timezone'])) { |
|
1178 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
1179 | - $datetime->setTimeZone(new DateTimeZone('UTC')); |
|
1180 | - $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
|
1181 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1182 | - $data['departure_airport_icao'] = $line['depicao']; |
|
1183 | - $data['departure_airport_time'] = $line['deptime']; |
|
1184 | - $data['arrival_airport_icao'] = $line['arricao']; |
|
1185 | - $data['arrival_airport_time'] = $line['arrtime']; |
|
1186 | - $data['registration'] = $line['aircraft']; |
|
1187 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1188 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1189 | - if (isset($line['aircraftname'])) { |
|
1160 | + $data = array(); |
|
1161 | + //$data['id'] = $line['id']; // id not usable |
|
1162 | + if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
1163 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1164 | + if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
1165 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
1166 | + $data['ident'] = $line['flightnum']; // ident |
|
1167 | + $data['altitude'] = $line['alt']; // altitude |
|
1168 | + $data['speed'] = $line['gs']; // speed |
|
1169 | + $data['heading'] = $line['heading']; // heading |
|
1170 | + $data['latitude'] = $line['lat']; // lat |
|
1171 | + $data['longitude'] = $line['lng']; // long |
|
1172 | + $data['verticalrate'] = ''; // verticale rate |
|
1173 | + $data['squawk'] = ''; // squawk |
|
1174 | + $data['emergency'] = ''; // emergency |
|
1175 | + //$data['datetime'] = $line['lastupdate']; |
|
1176 | + //$data['last_update'] = $line['lastupdate']; |
|
1177 | + if (isset($value['timezone'])) { |
|
1178 | + $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
1179 | + $datetime->setTimeZone(new DateTimeZone('UTC')); |
|
1180 | + $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
|
1181 | + } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1182 | + $data['departure_airport_icao'] = $line['depicao']; |
|
1183 | + $data['departure_airport_time'] = $line['deptime']; |
|
1184 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
1185 | + $data['arrival_airport_time'] = $line['arrtime']; |
|
1186 | + $data['registration'] = $line['aircraft']; |
|
1187 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1188 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1189 | + if (isset($line['aircraftname'])) { |
|
1190 | 1190 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1191 | 1191 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
1192 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
1193 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
1194 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
1195 | - else { |
|
1196 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
1197 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1198 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1199 | - } |
|
1200 | - } |
|
1201 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
1202 | - $data['id_source'] = $id_source; |
|
1203 | - $data['format_source'] = 'phpvmacars'; |
|
1204 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1205 | - $SI->add($data); |
|
1206 | - unset($data); |
|
1192 | + $aircraft_data = explode('-',$line['aircraftname']); |
|
1193 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
1194 | + elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
1195 | + else { |
|
1196 | + $aircraft_data = explode(' ',$line['aircraftname']); |
|
1197 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1198 | + else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1199 | + } |
|
1200 | + } |
|
1201 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
1202 | + $data['id_source'] = $id_source; |
|
1203 | + $data['format_source'] = 'phpvmacars'; |
|
1204 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1205 | + $SI->add($data); |
|
1206 | + unset($data); |
|
1207 | 1207 | } |
1208 | 1208 | if ($globalDebug) echo 'No more data...'."\n"; |
1209 | 1209 | unset($buffer); |
1210 | 1210 | unset($all_data); |
1211 | - } |
|
1212 | - //$last_exec['phpvmacars'] = time(); |
|
1213 | - $last_exec[$id]['last'] = time(); |
|
1211 | + } |
|
1212 | + //$last_exec['phpvmacars'] = time(); |
|
1213 | + $last_exec[$id]['last'] = time(); |
|
1214 | 1214 | } elseif ($value['format'] == 'vam' && |
1215 | - ( |
|
1215 | + ( |
|
1216 | 1216 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
1217 | 1217 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
1218 | - ) |
|
1218 | + ) |
|
1219 | 1219 | ) { |
1220 | - //$buffer = $Common->getData($hosts[$id]); |
|
1221 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
1222 | - $buffer = $Common->getData($value['host']); |
|
1223 | - $all_data = json_decode($buffer,true); |
|
1224 | - if ($buffer != '' && is_array($all_data)) { |
|
1220 | + //$buffer = $Common->getData($hosts[$id]); |
|
1221 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
1222 | + $buffer = $Common->getData($value['host']); |
|
1223 | + $all_data = json_decode($buffer,true); |
|
1224 | + if ($buffer != '' && is_array($all_data)) { |
|
1225 | 1225 | $reset = 0; |
1226 | 1226 | foreach ($all_data as $line) { |
1227 | - $data = array(); |
|
1228 | - //$data['id'] = $line['id']; // id not usable |
|
1229 | - $data['id'] = trim($line['flight_id']); |
|
1230 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1231 | - $data['pilot_name'] = $line['pilot_name']; |
|
1232 | - $data['pilot_id'] = $line['pilot_id']; |
|
1233 | - $data['ident'] = trim($line['callsign']); // ident |
|
1234 | - $data['altitude'] = $line['altitude']; // altitude |
|
1235 | - $data['speed'] = $line['gs']; // speed |
|
1236 | - $data['heading'] = $line['heading']; // heading |
|
1237 | - $data['latitude'] = $line['latitude']; // lat |
|
1238 | - $data['longitude'] = $line['longitude']; // long |
|
1239 | - $data['verticalrate'] = ''; // verticale rate |
|
1240 | - $data['squawk'] = ''; // squawk |
|
1241 | - $data['emergency'] = ''; // emergency |
|
1242 | - //$data['datetime'] = $line['lastupdate']; |
|
1243 | - $data['last_update'] = $line['last_update']; |
|
1244 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
1245 | - $data['departure_airport_icao'] = $line['departure']; |
|
1246 | - //$data['departure_airport_time'] = $line['departure_time']; |
|
1247 | - $data['arrival_airport_icao'] = $line['arrival']; |
|
1248 | - //$data['arrival_airport_time'] = $line['arrival_time']; |
|
1249 | - //$data['registration'] = $line['aircraft']; |
|
1250 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1251 | - $data['aircraft_icao'] = $line['plane_type']; |
|
1252 | - $data['id_source'] = $id_source; |
|
1253 | - $data['format_source'] = 'vam'; |
|
1254 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1255 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1256 | - $SI->add($data); |
|
1257 | - unset($data); |
|
1227 | + $data = array(); |
|
1228 | + //$data['id'] = $line['id']; // id not usable |
|
1229 | + $data['id'] = trim($line['flight_id']); |
|
1230 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1231 | + $data['pilot_name'] = $line['pilot_name']; |
|
1232 | + $data['pilot_id'] = $line['pilot_id']; |
|
1233 | + $data['ident'] = trim($line['callsign']); // ident |
|
1234 | + $data['altitude'] = $line['altitude']; // altitude |
|
1235 | + $data['speed'] = $line['gs']; // speed |
|
1236 | + $data['heading'] = $line['heading']; // heading |
|
1237 | + $data['latitude'] = $line['latitude']; // lat |
|
1238 | + $data['longitude'] = $line['longitude']; // long |
|
1239 | + $data['verticalrate'] = ''; // verticale rate |
|
1240 | + $data['squawk'] = ''; // squawk |
|
1241 | + $data['emergency'] = ''; // emergency |
|
1242 | + //$data['datetime'] = $line['lastupdate']; |
|
1243 | + $data['last_update'] = $line['last_update']; |
|
1244 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1245 | + $data['departure_airport_icao'] = $line['departure']; |
|
1246 | + //$data['departure_airport_time'] = $line['departure_time']; |
|
1247 | + $data['arrival_airport_icao'] = $line['arrival']; |
|
1248 | + //$data['arrival_airport_time'] = $line['arrival_time']; |
|
1249 | + //$data['registration'] = $line['aircraft']; |
|
1250 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1251 | + $data['aircraft_icao'] = $line['plane_type']; |
|
1252 | + $data['id_source'] = $id_source; |
|
1253 | + $data['format_source'] = 'vam'; |
|
1254 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1255 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1256 | + $SI->add($data); |
|
1257 | + unset($data); |
|
1258 | 1258 | } |
1259 | 1259 | if ($globalDebug) echo 'No more data...'."\n"; |
1260 | 1260 | unset($buffer); |
1261 | 1261 | unset($all_data); |
1262 | - } |
|
1263 | - //$last_exec['phpvmacars'] = time(); |
|
1264 | - $last_exec[$id]['last'] = time(); |
|
1262 | + } |
|
1263 | + //$last_exec['phpvmacars'] = time(); |
|
1264 | + $last_exec[$id]['last'] = time(); |
|
1265 | 1265 | } elseif ($value['format'] == 'blitzortung' && |
1266 | - ( |
|
1266 | + ( |
|
1267 | 1267 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
1268 | 1268 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
1269 | - ) |
|
1269 | + ) |
|
1270 | 1270 | ) { |
1271 | - //$buffer = $Common->getData($hosts[$id]); |
|
1272 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
1273 | - $buffer = $Common->getData($value['host']); |
|
1274 | - $all_data = json_decode($buffer,true); |
|
1275 | - if ($buffer != '') { |
|
1271 | + //$buffer = $Common->getData($hosts[$id]); |
|
1272 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
1273 | + $buffer = $Common->getData($value['host']); |
|
1274 | + $all_data = json_decode($buffer,true); |
|
1275 | + if ($buffer != '') { |
|
1276 | 1276 | $Source->deleteLocationBySource('blitzortung'); |
1277 | 1277 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
1278 | 1278 | $buffer = explode('\n',$buffer); |
1279 | 1279 | foreach ($buffer as $buffer_line) { |
1280 | - $line = json_decode($buffer_line,true); |
|
1281 | - if (isset($line['time'])) { |
|
1280 | + $line = json_decode($buffer_line,true); |
|
1281 | + if (isset($line['time'])) { |
|
1282 | 1282 | $data = array(); |
1283 | 1283 | $data['altitude'] = $line['alt']; // altitude |
1284 | 1284 | $data['latitude'] = $line['lat']; // lat |
@@ -1290,94 +1290,94 @@ discard block |
||
1290 | 1290 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1291 | 1291 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
1292 | 1292 | unset($data); |
1293 | - } |
|
1293 | + } |
|
1294 | 1294 | } |
1295 | 1295 | if ($globalDebug) echo 'No more data...'."\n"; |
1296 | 1296 | unset($buffer); |
1297 | - } |
|
1298 | - $last_exec[$id]['last'] = time(); |
|
1297 | + } |
|
1298 | + $last_exec[$id]['last'] = time(); |
|
1299 | 1299 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
1300 | 1300 | } elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'famaprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais' || $value['format'] == 'vrstcp') { |
1301 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
1302 | - //$last_exec[$id]['last'] = time(); |
|
1301 | + if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
1302 | + //$last_exec[$id]['last'] = time(); |
|
1303 | 1303 | |
1304 | - //$read = array( $sockets[$id] ); |
|
1305 | - $read = $sockets; |
|
1306 | - $write = NULL; |
|
1307 | - $e = NULL; |
|
1308 | - $n = socket_select($read, $write, $e, $timeout); |
|
1309 | - if ($e != NULL) var_dump($e); |
|
1310 | - if ($n > 0) { |
|
1304 | + //$read = array( $sockets[$id] ); |
|
1305 | + $read = $sockets; |
|
1306 | + $write = NULL; |
|
1307 | + $e = NULL; |
|
1308 | + $n = socket_select($read, $write, $e, $timeout); |
|
1309 | + if ($e != NULL) var_dump($e); |
|
1310 | + if ($n > 0) { |
|
1311 | 1311 | $reset = 0; |
1312 | 1312 | foreach ($read as $nb => $r) { |
1313 | - //$value = $formats[$nb]; |
|
1314 | - $format = $globalSources[$nb]['format']; |
|
1315 | - if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
1313 | + //$value = $formats[$nb]; |
|
1314 | + $format = $globalSources[$nb]['format']; |
|
1315 | + if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
1316 | 1316 | $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
1317 | - } elseif ($format == 'vrstcp') { |
|
1317 | + } elseif ($format == 'vrstcp') { |
|
1318 | 1318 | $buffer = @socket_read($r, 6000); |
1319 | - } else { |
|
1319 | + } else { |
|
1320 | 1320 | $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
1321 | - } |
|
1322 | - //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
1323 | - //echo $buffer."\n"; |
|
1324 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
1325 | - //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
1326 | - $error = false; |
|
1327 | - //$SI::del(); |
|
1328 | - if ($format == 'vrstcp') { |
|
1321 | + } |
|
1322 | + //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
1323 | + //echo $buffer."\n"; |
|
1324 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
1325 | + //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
1326 | + $error = false; |
|
1327 | + //$SI::del(); |
|
1328 | + if ($format == 'vrstcp') { |
|
1329 | 1329 | $buffer = explode('},{',$buffer); |
1330 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1331 | - // SBS format is CSV format |
|
1332 | - if ($buffer !== FALSE && $buffer != '') { |
|
1330 | + } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1331 | + // SBS format is CSV format |
|
1332 | + if ($buffer !== FALSE && $buffer != '') { |
|
1333 | 1333 | $tt[$format] = 0; |
1334 | 1334 | if ($format == 'acarssbs3') { |
1335 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
1336 | - $ACARS->add(trim($buffer)); |
|
1337 | - $ACARS->deleteLiveAcarsData(); |
|
1335 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
1336 | + $ACARS->add(trim($buffer)); |
|
1337 | + $ACARS->deleteLiveAcarsData(); |
|
1338 | 1338 | } elseif ($format == 'raw') { |
1339 | - // AVR format |
|
1340 | - $data = $SBS->parse($buffer); |
|
1341 | - if (is_array($data)) { |
|
1339 | + // AVR format |
|
1340 | + $data = $SBS->parse($buffer); |
|
1341 | + if (is_array($data)) { |
|
1342 | 1342 | $data['datetime'] = date('Y-m-d H:i:s'); |
1343 | 1343 | $data['format_source'] = 'raw'; |
1344 | 1344 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
1345 | 1345 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
1346 | 1346 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1347 | 1347 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1348 | - } |
|
1348 | + } |
|
1349 | 1349 | } elseif ($format == 'ais') { |
1350 | - $ais_data = $AIS->parse_line(trim($buffer)); |
|
1351 | - $data = array(); |
|
1352 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
1353 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
1354 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
1355 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
1356 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
1357 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
1358 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
1359 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
1360 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
1361 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
1362 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
1363 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
1364 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1365 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1366 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1367 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1350 | + $ais_data = $AIS->parse_line(trim($buffer)); |
|
1351 | + $data = array(); |
|
1352 | + if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
1353 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
1354 | + if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
1355 | + if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
1356 | + if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
1357 | + if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
1358 | + if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
1359 | + if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
1360 | + if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
1361 | + if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
1362 | + if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
1363 | + if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
1364 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1365 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1366 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1367 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1368 | 1368 | |
1369 | - if (isset($ais_data['timestamp'])) { |
|
1369 | + if (isset($ais_data['timestamp'])) { |
|
1370 | 1370 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
1371 | - } else { |
|
1371 | + } else { |
|
1372 | 1372 | $data['datetime'] = date('Y-m-d H:i:s'); |
1373 | - } |
|
1374 | - $data['format_source'] = 'aisnmea'; |
|
1375 | - $data['id_source'] = $id_source; |
|
1376 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
1377 | - unset($data); |
|
1378 | - } elseif ($format == 'flightgearsp') { |
|
1379 | - //echo $buffer."\n"; |
|
1380 | - if (strlen($buffer) > 5) { |
|
1373 | + } |
|
1374 | + $data['format_source'] = 'aisnmea'; |
|
1375 | + $data['id_source'] = $id_source; |
|
1376 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
1377 | + unset($data); |
|
1378 | + } elseif ($format == 'flightgearsp') { |
|
1379 | + //echo $buffer."\n"; |
|
1380 | + if (strlen($buffer) > 5) { |
|
1381 | 1381 | $line = explode(',',$buffer); |
1382 | 1382 | $data = array(); |
1383 | 1383 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
@@ -1394,38 +1394,38 @@ discard block |
||
1394 | 1394 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1395 | 1395 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1396 | 1396 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
1397 | - } |
|
1398 | - } elseif ($format == 'acars') { |
|
1399 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
1400 | - $ACARS->add(trim($buffer)); |
|
1401 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1402 | - $ACARS->deleteLiveAcarsData(); |
|
1397 | + } |
|
1398 | + } elseif ($format == 'acars') { |
|
1399 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
1400 | + $ACARS->add(trim($buffer)); |
|
1401 | + socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1402 | + $ACARS->deleteLiveAcarsData(); |
|
1403 | 1403 | } elseif ($format == 'flightgearmp') { |
1404 | - if (substr($buffer,0,1) != '#') { |
|
1404 | + if (substr($buffer,0,1) != '#') { |
|
1405 | 1405 | $data = array(); |
1406 | 1406 | //echo $buffer."\n"; |
1407 | 1407 | $line = explode(' ',$buffer); |
1408 | 1408 | if (count($line) == 11) { |
1409 | - $userserver = explode('@',$line[0]); |
|
1410 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1411 | - $data['ident'] = $userserver[0]; |
|
1412 | - $data['registration'] = $userserver[0]; |
|
1413 | - $data['latitude'] = $line[4]; |
|
1414 | - $data['longitude'] = $line[5]; |
|
1415 | - $data['altitude'] = $line[6]; |
|
1416 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
1417 | - $aircraft_type = $line[10]; |
|
1418 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1419 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1420 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1421 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1409 | + $userserver = explode('@',$line[0]); |
|
1410 | + $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1411 | + $data['ident'] = $userserver[0]; |
|
1412 | + $data['registration'] = $userserver[0]; |
|
1413 | + $data['latitude'] = $line[4]; |
|
1414 | + $data['longitude'] = $line[5]; |
|
1415 | + $data['altitude'] = $line[6]; |
|
1416 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1417 | + $aircraft_type = $line[10]; |
|
1418 | + $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1419 | + $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1420 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1421 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1422 | + } |
|
1422 | 1423 | } |
1423 | - } |
|
1424 | 1424 | } elseif ($format == 'beast') { |
1425 | - echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
1426 | - die; |
|
1425 | + echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
1426 | + die; |
|
1427 | 1427 | } elseif ($format == 'vrstcp') { |
1428 | - foreach($buffer as $all_data) { |
|
1428 | + foreach($buffer as $all_data) { |
|
1429 | 1429 | $line = json_decode('{'.$all_data.'}',true); |
1430 | 1430 | $data = array(); |
1431 | 1431 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
@@ -1445,151 +1445,151 @@ discard block |
||
1445 | 1445 | */ |
1446 | 1446 | $data['datetime'] = date('Y-m-d H:i:s'); |
1447 | 1447 | if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
1448 | - $data['format_source'] = 'vrstcp'; |
|
1448 | + $data['format_source'] = 'vrstcp'; |
|
1449 | 1449 | $data['id_source'] = $id_source; |
1450 | 1450 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1451 | 1451 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
1452 | 1452 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
1453 | 1453 | unset($data); |
1454 | - } |
|
1454 | + } |
|
1455 | 1455 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
1456 | - $line = explode("\t", $buffer); |
|
1457 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
1456 | + $line = explode("\t", $buffer); |
|
1457 | + for($k = 0; $k < count($line); $k=$k+2) { |
|
1458 | 1458 | $key = $line[$k]; |
1459 | - $lined[$key] = $line[$k+1]; |
|
1460 | - } |
|
1461 | - if (count($lined) > 3) { |
|
1462 | - $data['hex'] = $lined['hexid']; |
|
1463 | - //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
1464 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
1465 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
1466 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
1467 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
1468 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
1469 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
1470 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
1471 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
1472 | - $data['id_source'] = $id_source; |
|
1473 | - $data['format_source'] = 'tsv'; |
|
1474 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1475 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1459 | + $lined[$key] = $line[$k+1]; |
|
1460 | + } |
|
1461 | + if (count($lined) > 3) { |
|
1462 | + $data['hex'] = $lined['hexid']; |
|
1463 | + //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
1464 | + $data['datetime'] = date('Y-m-d H:i:s');; |
|
1465 | + if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
1466 | + if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
1467 | + if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
1468 | + if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
1469 | + if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
1470 | + if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
1471 | + if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
1472 | + $data['id_source'] = $id_source; |
|
1473 | + $data['format_source'] = 'tsv'; |
|
1474 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1475 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1476 | 1476 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1477 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1478 | - unset($lined); |
|
1479 | - unset($data); |
|
1480 | - } else $error = true; |
|
1477 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1478 | + unset($lined); |
|
1479 | + unset($data); |
|
1480 | + } else $error = true; |
|
1481 | 1481 | } elseif ($format == 'aprs' && $use_aprs) { |
1482 | - if ($aprs_connect == 0) { |
|
1482 | + if ($aprs_connect == 0) { |
|
1483 | 1483 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
1484 | 1484 | $aprs_connect = 1; |
1485 | - } |
|
1485 | + } |
|
1486 | 1486 | |
1487 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1487 | + if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1488 | 1488 | $aprs_last_tx = time(); |
1489 | 1489 | $data_aprs = "# Keep alive"; |
1490 | 1490 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
1491 | - } |
|
1491 | + } |
|
1492 | 1492 | |
1493 | - //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
1494 | - //echo 'APRS data : '.$buffer."\n"; |
|
1495 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
1496 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
1497 | - //echo $buffer."\n"; |
|
1498 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1493 | + //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
1494 | + //echo 'APRS data : '.$buffer."\n"; |
|
1495 | + $buffer = str_replace('APRS <- ','',$buffer); |
|
1496 | + $buffer = str_replace('APRS -> ','',$buffer); |
|
1497 | + //echo $buffer."\n"; |
|
1498 | + if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1499 | 1499 | $line = $APRS->parse($buffer); |
1500 | 1500 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
1501 | 1501 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
1502 | - $aprs_last_tx = time(); |
|
1503 | - $data = array(); |
|
1504 | - //print_r($line); |
|
1505 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
1506 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
1507 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
1508 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
1509 | - if (isset($line['arrival_code'])) $data['arrical_code'] = $line['arrival_code']; |
|
1510 | - if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
|
1511 | - if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
|
1512 | - if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
|
1513 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1514 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1515 | - //$data['datetime'] = date('Y-m-d H:i:s'); |
|
1516 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
1517 | - $data['latitude'] = $line['latitude']; |
|
1518 | - $data['longitude'] = $line['longitude']; |
|
1519 | - //$data['verticalrate'] = $line[16]; |
|
1520 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
1521 | - //else $data['speed'] = 0; |
|
1522 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
1523 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
1524 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
1525 | - //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
|
1502 | + $aprs_last_tx = time(); |
|
1503 | + $data = array(); |
|
1504 | + //print_r($line); |
|
1505 | + if (isset($line['address'])) $data['hex'] = $line['address']; |
|
1506 | + if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
1507 | + if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
1508 | + if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
1509 | + if (isset($line['arrival_code'])) $data['arrical_code'] = $line['arrival_code']; |
|
1510 | + if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
|
1511 | + if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
|
1512 | + if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
|
1513 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1514 | + else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1515 | + //$data['datetime'] = date('Y-m-d H:i:s'); |
|
1516 | + if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
1517 | + $data['latitude'] = $line['latitude']; |
|
1518 | + $data['longitude'] = $line['longitude']; |
|
1519 | + //$data['verticalrate'] = $line[16]; |
|
1520 | + if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
1521 | + //else $data['speed'] = 0; |
|
1522 | + if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
1523 | + if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
1524 | + if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
1525 | + //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
|
1526 | 1526 | |
1527 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
1528 | - //else echo 'No heading...'."\n"; |
|
1529 | - //else $data['heading'] = 0; |
|
1530 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
1531 | - //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
|
1532 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
1533 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
1534 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1535 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
1536 | - $data['id_source'] = $id_source; |
|
1537 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
1538 | - else $data['format_source'] = 'aprs'; |
|
1539 | - $data['source_name'] = $line['source']; |
|
1540 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
1541 | - else $data['source_type'] = 'flarm'; |
|
1542 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1543 | - $currentdate = date('Y-m-d H:i:s'); |
|
1544 | - $aprsdate = strtotime($data['datetime']); |
|
1545 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
1546 | - // Accept data if time <= system time + 20s |
|
1547 | - //if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
1548 | - if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
1527 | + if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
1528 | + //else echo 'No heading...'."\n"; |
|
1529 | + //else $data['heading'] = 0; |
|
1530 | + if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
1531 | + //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
|
1532 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
1533 | + elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
1534 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1535 | + elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
1536 | + $data['id_source'] = $id_source; |
|
1537 | + if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
1538 | + else $data['format_source'] = 'aprs'; |
|
1539 | + $data['source_name'] = $line['source']; |
|
1540 | + if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
1541 | + else $data['source_type'] = 'flarm'; |
|
1542 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1543 | + $currentdate = date('Y-m-d H:i:s'); |
|
1544 | + $aprsdate = strtotime($data['datetime']); |
|
1545 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
1546 | + // Accept data if time <= system time + 20s |
|
1547 | + //if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
1548 | + if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
1549 | 1549 | $send = $SI->add($data); |
1550 | - } elseif ($data['source_type'] == 'ais') { |
|
1550 | + } elseif ($data['source_type'] == 'ais') { |
|
1551 | 1551 | if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
1552 | - } elseif (isset($line['stealth'])) { |
|
1552 | + } elseif (isset($line['stealth'])) { |
|
1553 | 1553 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
1554 | 1554 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
1555 | - } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
1556 | - //$line['symbol'] == 'Balloon' || |
|
1557 | - $line['symbol'] == 'Glider' || |
|
1558 | - $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) { |
|
1559 | - if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
1560 | - if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
1561 | - $send = $SI->add($data); |
|
1562 | - } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
1563 | - $line['symbol'] == 'Yacht (Sail)' || |
|
1564 | - $line['symbol'] == 'Ship (Power Boat)')) { |
|
1565 | - $send = $MI->add($data); |
|
1566 | - } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
1567 | - $line['symbol'] == 'Car' || |
|
1568 | - $line['symbol'] == 'Ambulance' || |
|
1569 | - $line['symbol'] == 'Van' || |
|
1570 | - $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || |
|
1571 | - $line['symbol'] == 'Motorcycle' || |
|
1572 | - $line['symbol'] == 'Tractor' || |
|
1573 | - $line['symbol'] == 'Police' || |
|
1574 | - $line['symbol'] == 'Bike' || |
|
1575 | - $line['symbol'] == 'Jogger' || |
|
1576 | - $line['symbol'] == 'Horse' || |
|
1577 | - $line['symbol'] == 'Bus' || |
|
1578 | - $line['symbol'] == 'Jeep' || |
|
1579 | - $line['symbol'] == 'Recreational Vehicle' || |
|
1580 | - $line['symbol'] == 'Yacht (Sail)' || |
|
1581 | - $line['symbol'] == 'Ship (Power Boat)' || |
|
1582 | - $line['symbol'] == 'Firetruck' || |
|
1583 | - $line['symbol'] == 'Balloon' || $line['symbol'] == 'Glider' || |
|
1584 | - $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter' || |
|
1585 | - $line['symbol'] == 'SUV' || |
|
1586 | - $line['symbol'] == 'Snowmobile' || |
|
1587 | - $line['symbol'] == 'Mobile Satellite Station')) { |
|
1588 | - //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
|
1555 | + } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
1556 | + //$line['symbol'] == 'Balloon' || |
|
1557 | + $line['symbol'] == 'Glider' || |
|
1558 | + $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) { |
|
1559 | + if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
1560 | + if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
1561 | + $send = $SI->add($data); |
|
1562 | + } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
1563 | + $line['symbol'] == 'Yacht (Sail)' || |
|
1564 | + $line['symbol'] == 'Ship (Power Boat)')) { |
|
1565 | + $send = $MI->add($data); |
|
1566 | + } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
1567 | + $line['symbol'] == 'Car' || |
|
1568 | + $line['symbol'] == 'Ambulance' || |
|
1569 | + $line['symbol'] == 'Van' || |
|
1570 | + $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || |
|
1571 | + $line['symbol'] == 'Motorcycle' || |
|
1572 | + $line['symbol'] == 'Tractor' || |
|
1573 | + $line['symbol'] == 'Police' || |
|
1574 | + $line['symbol'] == 'Bike' || |
|
1575 | + $line['symbol'] == 'Jogger' || |
|
1576 | + $line['symbol'] == 'Horse' || |
|
1577 | + $line['symbol'] == 'Bus' || |
|
1578 | + $line['symbol'] == 'Jeep' || |
|
1579 | + $line['symbol'] == 'Recreational Vehicle' || |
|
1580 | + $line['symbol'] == 'Yacht (Sail)' || |
|
1581 | + $line['symbol'] == 'Ship (Power Boat)' || |
|
1582 | + $line['symbol'] == 'Firetruck' || |
|
1583 | + $line['symbol'] == 'Balloon' || $line['symbol'] == 'Glider' || |
|
1584 | + $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter' || |
|
1585 | + $line['symbol'] == 'SUV' || |
|
1586 | + $line['symbol'] == 'Snowmobile' || |
|
1587 | + $line['symbol'] == 'Mobile Satellite Station')) { |
|
1588 | + //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
|
1589 | 1589 | // } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
1590 | 1590 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
1591 | 1591 | if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
1592 | - } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
|
1592 | + } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
|
1593 | 1593 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
1594 | 1594 | $Source->deleteOldLocationByType('gs'); |
1595 | 1595 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
@@ -1597,7 +1597,7 @@ discard block |
||
1597 | 1597 | } else { |
1598 | 1598 | $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
1599 | 1599 | } |
1600 | - } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
|
1600 | + } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
|
1601 | 1601 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1602 | 1602 | if ($globalDebug) echo '# Weather Station added'."\n"; |
1603 | 1603 | $Source->deleteOldLocationByType('wx'); |
@@ -1607,7 +1607,7 @@ discard block |
||
1607 | 1607 | } else { |
1608 | 1608 | $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
1609 | 1609 | } |
1610 | - } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) { |
|
1610 | + } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) { |
|
1611 | 1611 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1612 | 1612 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1613 | 1613 | $Source->deleteOldLocationByType('lightning'); |
@@ -1616,11 +1616,11 @@ discard block |
||
1616 | 1616 | } else { |
1617 | 1617 | $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
1618 | 1618 | } |
1619 | - } elseif ($globalDebug) { |
|
1620 | - echo '/!\ Not added: '.$buffer."\n"; |
|
1621 | - print_r($line); |
|
1622 | - } |
|
1623 | - unset($data); |
|
1619 | + } elseif ($globalDebug) { |
|
1620 | + echo '/!\ Not added: '.$buffer."\n"; |
|
1621 | + print_r($line); |
|
1622 | + } |
|
1623 | + unset($data); |
|
1624 | 1624 | } |
1625 | 1625 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
1626 | 1626 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
@@ -1639,12 +1639,12 @@ discard block |
||
1639 | 1639 | } elseif (!isset($globalSources[$nb]['last_weather_clean'])) { |
1640 | 1640 | $globalSources[$nb]['last_weather_clean'] = time(); |
1641 | 1641 | } |
1642 | - } |
|
1642 | + } |
|
1643 | 1643 | } else { |
1644 | - $line = explode(',', $buffer); |
|
1645 | - if (count($line) > 20) { |
|
1646 | - $data['hex'] = $line[4]; |
|
1647 | - /* |
|
1644 | + $line = explode(',', $buffer); |
|
1645 | + if (count($line) > 20) { |
|
1646 | + $data['hex'] = $line[4]; |
|
1647 | + /* |
|
1648 | 1648 | $data['datetime'] = $line[6].' '.$line[7]; |
1649 | 1649 | date_default_timezone_set($globalTimezone); |
1650 | 1650 | $datetime = new DateTime($data['datetime']); |
@@ -1652,30 +1652,30 @@ discard block |
||
1652 | 1652 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1653 | 1653 | date_default_timezone_set('UTC'); |
1654 | 1654 | */ |
1655 | - // Force datetime to current UTC datetime |
|
1656 | - date_default_timezone_set('UTC'); |
|
1657 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
1658 | - $data['ident'] = trim($line[10]); |
|
1659 | - $data['latitude'] = $line[14]; |
|
1660 | - $data['longitude'] = $line[15]; |
|
1661 | - $data['verticalrate'] = $line[16]; |
|
1662 | - $data['emergency'] = $line[20]; |
|
1663 | - $data['speed'] = $line[12]; |
|
1664 | - $data['squawk'] = $line[17]; |
|
1665 | - $data['altitude'] = $line[11]; |
|
1666 | - $data['heading'] = $line[13]; |
|
1667 | - $data['ground'] = $line[21]; |
|
1668 | - $data['emergency'] = $line[19]; |
|
1669 | - $data['format_source'] = 'sbs'; |
|
1655 | + // Force datetime to current UTC datetime |
|
1656 | + date_default_timezone_set('UTC'); |
|
1657 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1658 | + $data['ident'] = trim($line[10]); |
|
1659 | + $data['latitude'] = $line[14]; |
|
1660 | + $data['longitude'] = $line[15]; |
|
1661 | + $data['verticalrate'] = $line[16]; |
|
1662 | + $data['emergency'] = $line[20]; |
|
1663 | + $data['speed'] = $line[12]; |
|
1664 | + $data['squawk'] = $line[17]; |
|
1665 | + $data['altitude'] = $line[11]; |
|
1666 | + $data['heading'] = $line[13]; |
|
1667 | + $data['ground'] = $line[21]; |
|
1668 | + $data['emergency'] = $line[19]; |
|
1669 | + $data['format_source'] = 'sbs'; |
|
1670 | 1670 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
1671 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1671 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1672 | 1672 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1673 | - $data['id_source'] = $id_source; |
|
1674 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
1675 | - else $error = true; |
|
1676 | - unset($data); |
|
1677 | - } else $error = true; |
|
1678 | - if ($error) { |
|
1673 | + $data['id_source'] = $id_source; |
|
1674 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
1675 | + else $error = true; |
|
1676 | + unset($data); |
|
1677 | + } else $error = true; |
|
1678 | + if ($error) { |
|
1679 | 1679 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
1680 | 1680 | if ($globalDebug) echo "Not a message. Ignoring... \n"; |
1681 | 1681 | } else { |
@@ -1691,13 +1691,13 @@ discard block |
||
1691 | 1691 | connect_all($sourceer); |
1692 | 1692 | $sourceer = array(); |
1693 | 1693 | } |
1694 | - } |
|
1694 | + } |
|
1695 | 1695 | } |
1696 | 1696 | // Sleep for xxx microseconds |
1697 | 1697 | if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
1698 | - } else { |
|
1698 | + } else { |
|
1699 | 1699 | if ($format == 'flightgearmp') { |
1700 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
1700 | + if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
1701 | 1701 | //@socket_close($r); |
1702 | 1702 | sleep($globalMinFetch); |
1703 | 1703 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1706,9 +1706,9 @@ discard block |
||
1706 | 1706 | break; |
1707 | 1707 | |
1708 | 1708 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
1709 | - if (isset($tt[$format])) $tt[$format]++; |
|
1710 | - else $tt[$format] = 0; |
|
1711 | - if ($tt[$format] > 30) { |
|
1709 | + if (isset($tt[$format])) $tt[$format]++; |
|
1710 | + else $tt[$format] = 0; |
|
1711 | + if ($tt[$format] > 30) { |
|
1712 | 1712 | if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
1713 | 1713 | //@socket_close($r); |
1714 | 1714 | sleep(2); |
@@ -1719,23 +1719,23 @@ discard block |
||
1719 | 1719 | //connect_all($globalSources); |
1720 | 1720 | $tt[$format]=0; |
1721 | 1721 | break; |
1722 | - } |
|
1722 | + } |
|
1723 | + } |
|
1723 | 1724 | } |
1724 | - } |
|
1725 | 1725 | } |
1726 | - } else { |
|
1726 | + } else { |
|
1727 | 1727 | $error = socket_strerror(socket_last_error()); |
1728 | 1728 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
1729 | 1729 | if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
1730 | 1730 | if (isset($globalDebug)) echo "Restarting...\n"; |
1731 | 1731 | // Restart the script if possible |
1732 | 1732 | if (is_array($sockets)) { |
1733 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
1733 | + if ($globalDebug) echo "Shutdown all sockets..."; |
|
1734 | 1734 | |
1735 | - foreach ($sockets as $sock) { |
|
1735 | + foreach ($sockets as $sock) { |
|
1736 | 1736 | @socket_shutdown($sock,2); |
1737 | 1737 | @socket_close($sock); |
1738 | - } |
|
1738 | + } |
|
1739 | 1739 | |
1740 | 1740 | } |
1741 | 1741 | if ($globalDebug) echo "Waiting..."; |
@@ -1750,15 +1750,15 @@ discard block |
||
1750 | 1750 | if ($globalDebug) echo "Restart all connections..."; |
1751 | 1751 | connect_all($globalSources); |
1752 | 1752 | } |
1753 | - } |
|
1753 | + } |
|
1754 | 1754 | } |
1755 | 1755 | if ($globalDaemon === false) { |
1756 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
1757 | - if (isset($SI)) $SI->checkAll(); |
|
1758 | - if (isset($TI)) $TI->checkAll(); |
|
1759 | - if (isset($MI)) $MI->checkAll(); |
|
1756 | + if ($globalDebug) echo 'Check all...'."\n"; |
|
1757 | + if (isset($SI)) $SI->checkAll(); |
|
1758 | + if (isset($TI)) $TI->checkAll(); |
|
1759 | + if (isset($MI)) $MI->checkAll(); |
|
1760 | + } |
|
1760 | 1761 | } |
1761 | - } |
|
1762 | 1762 | } |
1763 | 1763 | |
1764 | 1764 | ?> |