@@ -14,13 +14,17 @@ discard block |
||
| 14 | 14 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
| 15 | 15 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
| 16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
| 17 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 17 | +if (isset($globalTracker) && $globalTracker) { |
|
| 18 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 19 | +} |
|
| 18 | 20 | if (isset($globalMarine) && $globalMarine) { |
| 19 | 21 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
| 20 | 22 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 21 | 23 | } |
| 22 | 24 | |
| 23 | -if (!isset($globalDebug)) $globalDebug = FALSE; |
|
| 25 | +if (!isset($globalDebug)) { |
|
| 26 | + $globalDebug = FALSE; |
|
| 27 | +} |
|
| 24 | 28 | |
| 25 | 29 | // Check if schema is at latest version |
| 26 | 30 | $Connection = new Connection(); |
@@ -59,66 +63,107 @@ discard block |
||
| 59 | 63 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 60 | 64 | if (isset($options['s'])) { |
| 61 | 65 | $globalSources = array(); |
| 62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 63 | - else $globalSources[] = array('host' => $options['s']); |
|
| 64 | -} elseif (isset($options['source'])) { |
|
| 66 | + if (isset($options['format'])) { |
|
| 67 | + $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 68 | + } else { |
|
| 69 | + $globalSources[] = array('host' => $options['s']); |
|
| 70 | + } |
|
| 71 | + } elseif (isset($options['source'])) { |
|
| 65 | 72 | $globalSources = array(); |
| 66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 67 | - else $globalSources[] = array('host' => $options['source']); |
|
| 68 | -} |
|
| 73 | + if (isset($options['format'])) { |
|
| 74 | + $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 75 | + } else { |
|
| 76 | + $globalSources[] = array('host' => $options['source']); |
|
| 77 | + } |
|
| 78 | + } |
|
| 69 | 79 | if (isset($options['aprsserverhost'])) { |
| 70 | 80 | $globalServerAPRS = TRUE; |
| 71 | 81 | $globalServerAPRShost = $options['aprsserverhost']; |
| 72 | 82 | } |
| 73 | -if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport']; |
|
| 74 | -if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 75 | -if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 76 | -if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; |
|
| 83 | +if (isset($options['aprsserverport'])) { |
|
| 84 | + $globalServerAPRSport = $options['aprsserverport']; |
|
| 85 | +} |
|
| 86 | +if (isset($options['aprsserverssid'])) { |
|
| 87 | + $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 88 | +} |
|
| 89 | +if (isset($options['aprsserverpass'])) { |
|
| 90 | + $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 91 | +} |
|
| 92 | +if (isset($options['noaprsserver'])) { |
|
| 93 | + $globalServerAPRS = FALSE; |
|
| 94 | +} |
|
| 77 | 95 | if (isset($options['enable-aircraft'])) { |
| 78 | - if ($globalDebug) echo 'Enable Aircraft mode'."\n"; |
|
| 96 | + if ($globalDebug) { |
|
| 97 | + echo 'Enable Aircraft mode'."\n"; |
|
| 98 | + } |
|
| 79 | 99 | $globalAircraft = TRUE; |
| 80 | 100 | } |
| 81 | 101 | if (isset($options['disable-aircraft'])) { |
| 82 | - if ($globalDebug) echo 'Disable Aircraft mode'."\n"; |
|
| 102 | + if ($globalDebug) { |
|
| 103 | + echo 'Disable Aircraft mode'."\n"; |
|
| 104 | + } |
|
| 83 | 105 | $globalAircraft = FALSE; |
| 84 | 106 | } |
| 85 | 107 | if (isset($options['enable-tracker'])) { |
| 86 | - if ($globalDebug) echo 'Enable Tracker mode'."\n"; |
|
| 108 | + if ($globalDebug) { |
|
| 109 | + echo 'Enable Tracker mode'."\n"; |
|
| 110 | + } |
|
| 87 | 111 | $globalTracker = TRUE; |
| 88 | 112 | } |
| 89 | 113 | if (isset($options['disable-tracker'])) { |
| 90 | - if ($globalDebug) echo 'Disable Tracker mode'."\n"; |
|
| 114 | + if ($globalDebug) { |
|
| 115 | + echo 'Disable Tracker mode'."\n"; |
|
| 116 | + } |
|
| 91 | 117 | $globalTracker = FALSE; |
| 92 | 118 | } |
| 93 | 119 | if (isset($options['enable-marine'])) { |
| 94 | - if ($globalDebug) echo 'Enable Marine mode'."\n"; |
|
| 120 | + if ($globalDebug) { |
|
| 121 | + echo 'Enable Marine mode'."\n"; |
|
| 122 | + } |
|
| 95 | 123 | $globalMarine = TRUE; |
| 96 | 124 | } |
| 97 | 125 | if (isset($options['disable-marine'])) { |
| 98 | - if ($globalDebug) echo 'Disable Marine mode'."\n"; |
|
| 126 | + if ($globalDebug) { |
|
| 127 | + echo 'Disable Marine mode'."\n"; |
|
| 128 | + } |
|
| 99 | 129 | $globalMarine = FALSE; |
| 100 | 130 | } |
| 101 | -if (isset($options['nodaemon'])) $globalDaemon = FALSE; |
|
| 102 | -if (isset($options['server'])) $globalServer = TRUE; |
|
| 103 | -if (isset($options['idsource'])) $id_source = $options['idsource']; |
|
| 104 | -else $id_source = 1; |
|
| 131 | +if (isset($options['nodaemon'])) { |
|
| 132 | + $globalDaemon = FALSE; |
|
| 133 | +} |
|
| 134 | +if (isset($options['server'])) { |
|
| 135 | + $globalServer = TRUE; |
|
| 136 | +} |
|
| 137 | +if (isset($options['idsource'])) { |
|
| 138 | + $id_source = $options['idsource']; |
|
| 139 | +} else { |
|
| 140 | + $id_source = 1; |
|
| 141 | +} |
|
| 105 | 142 | if (isset($globalServer) && $globalServer) { |
| 106 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 143 | + if ($globalDebug) { |
|
| 144 | + echo "Using Server Mode\n"; |
|
| 145 | + } |
|
| 107 | 146 | $SI=new SpotterServer(); |
| 108 | 147 | /* |
| 109 | 148 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 110 | 149 | $SI = new adsb2aprs(); |
| 111 | 150 | $SI->connect(); |
| 112 | 151 | */ |
| 113 | -} else $SI=new SpotterImport($Connection->db); |
|
| 152 | +} else { |
|
| 153 | + $SI=new SpotterImport($Connection->db); |
|
| 154 | +} |
|
| 114 | 155 | |
| 115 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 156 | +if (isset($globalTracker) && $globalTracker) { |
|
| 157 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 158 | +} |
|
| 116 | 159 | if (isset($globalMarine) && $globalMarine) { |
| 117 | 160 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
| 118 | 161 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 119 | 162 | } |
| 120 | 163 | |
| 121 | -if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
|
| 164 | +if (isset($globalTracker) && $globalTracker) { |
|
| 165 | + $TI = new TrackerImport($Connection->db); |
|
| 166 | +} |
|
| 122 | 167 | if (isset($globalMarine) && $globalMarine) { |
| 123 | 168 | $AIS = new AIS(); |
| 124 | 169 | $MI = new MarineImport($Connection->db); |
@@ -141,7 +186,9 @@ discard block |
||
| 141 | 186 | } |
| 142 | 187 | |
| 143 | 188 | // let's try and connect |
| 144 | -if ($globalDebug) echo "Connecting...\n"; |
|
| 189 | +if ($globalDebug) { |
|
| 190 | + echo "Connecting...\n"; |
|
| 191 | +} |
|
| 145 | 192 | $use_aprs = false; |
| 146 | 193 | $aprs_full = false; |
| 147 | 194 | $reset = 0; |
@@ -150,7 +197,9 @@ discard block |
||
| 150 | 197 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
| 151 | 198 | global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
| 152 | 199 | $reset++; |
| 153 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 200 | + if ($globalDebug) { |
|
| 201 | + echo 'Connect to all...'."\n"; |
|
| 202 | + } |
|
| 154 | 203 | foreach ($hosts as $id => $value) { |
| 155 | 204 | $host = $value['host']; |
| 156 | 205 | $globalSources[$id]['last_exec'] = 0; |
@@ -160,22 +209,30 @@ discard block |
||
| 160 | 209 | //$formats[$id] = 'deltadbtxt'; |
| 161 | 210 | $globalSources[$id]['format'] = 'deltadbtxt'; |
| 162 | 211 | //$last_exec['deltadbtxt'] = 0; |
| 163 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 212 | + if ($globalDebug) { |
|
| 213 | + echo "Connect to deltadb source (".$host.")...\n"; |
|
| 214 | + } |
|
| 164 | 215 | } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
| 165 | 216 | //$formats[$id] = 'vatsimtxt'; |
| 166 | 217 | $globalSources[$id]['format'] = 'vatsimtxt'; |
| 167 | 218 | //$last_exec['vatsimtxt'] = 0; |
| 168 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 219 | + if ($globalDebug) { |
|
| 220 | + echo "Connect to vatsim source (".$host.")...\n"; |
|
| 221 | + } |
|
| 169 | 222 | } else if (preg_match('/aircraftlist.json$/i',$host)) { |
| 170 | 223 | //$formats[$id] = 'aircraftlistjson'; |
| 171 | 224 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
| 172 | 225 | //$last_exec['aircraftlistjson'] = 0; |
| 173 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 226 | + if ($globalDebug) { |
|
| 227 | + echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 228 | + } |
|
| 174 | 229 | } else if (preg_match('/opensky/i',$host)) { |
| 175 | 230 | //$formats[$id] = 'aircraftlistjson'; |
| 176 | 231 | $globalSources[$id]['format'] = 'opensky'; |
| 177 | 232 | //$last_exec['aircraftlistjson'] = 0; |
| 178 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 233 | + if ($globalDebug) { |
|
| 234 | + echo "Connect to opensky source (".$host.")...\n"; |
|
| 235 | + } |
|
| 179 | 236 | /* |
| 180 | 237 | // Disabled for now, site change source format |
| 181 | 238 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
@@ -192,7 +249,9 @@ discard block |
||
| 192 | 249 | //$formats[$id] = 'planeupdatefaa'; |
| 193 | 250 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
| 194 | 251 | //$last_exec['planeupdatefaa'] = 0; |
| 195 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 252 | + if ($globalDebug) { |
|
| 253 | + echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 254 | + } |
|
| 196 | 255 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 197 | 256 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 198 | 257 | exit(0); |
@@ -201,32 +260,46 @@ discard block |
||
| 201 | 260 | //$formats[$id] = 'phpvmacars'; |
| 202 | 261 | $globalSources[$id]['format'] = 'phpvmacars'; |
| 203 | 262 | //$last_exec['phpvmacars'] = 0; |
| 204 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 263 | + if ($globalDebug) { |
|
| 264 | + echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 265 | + } |
|
| 205 | 266 | } else if (preg_match('/VAM-json.php$/i',$host)) { |
| 206 | 267 | //$formats[$id] = 'phpvmacars'; |
| 207 | 268 | $globalSources[$id]['format'] = 'vam'; |
| 208 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 269 | + if ($globalDebug) { |
|
| 270 | + echo "Connect to Vam source (".$host.")...\n"; |
|
| 271 | + } |
|
| 209 | 272 | } else if (preg_match('/whazzup/i',$host)) { |
| 210 | 273 | //$formats[$id] = 'whazzup'; |
| 211 | 274 | $globalSources[$id]['format'] = 'whazzup'; |
| 212 | 275 | //$last_exec['whazzup'] = 0; |
| 213 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 276 | + if ($globalDebug) { |
|
| 277 | + echo "Connect to whazzup source (".$host.")...\n"; |
|
| 278 | + } |
|
| 214 | 279 | } else if (preg_match('/blitzortung/i',$host)) { |
| 215 | 280 | $globalSources[$id]['format'] = 'blitzortung'; |
| 216 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 281 | + if ($globalDebug) { |
|
| 282 | + echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 283 | + } |
|
| 217 | 284 | } else if (preg_match('/airwhere/i',$host)) { |
| 218 | 285 | $globalSources[$id]['format'] = 'airwhere'; |
| 219 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
| 286 | + if ($globalDebug) { |
|
| 287 | + echo "Connect to airwhere source (".$host.")...\n"; |
|
| 288 | + } |
|
| 220 | 289 | } else if (preg_match('/recentpireps/i',$host)) { |
| 221 | 290 | //$formats[$id] = 'pirepsjson'; |
| 222 | 291 | $globalSources[$id]['format'] = 'pirepsjson'; |
| 223 | 292 | //$last_exec['pirepsjson'] = 0; |
| 224 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 293 | + if ($globalDebug) { |
|
| 294 | + echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 295 | + } |
|
| 225 | 296 | } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
| 226 | 297 | //$formats[$id] = 'fr24json'; |
| 227 | 298 | $globalSources[$id]['format'] = 'fr24json'; |
| 228 | 299 | //$last_exec['fr24json'] = 0; |
| 229 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 300 | + if ($globalDebug) { |
|
| 301 | + echo "Connect to fr24 source (".$host.")...\n"; |
|
| 302 | + } |
|
| 230 | 303 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 231 | 304 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 232 | 305 | exit(0); |
@@ -235,7 +308,9 @@ discard block |
||
| 235 | 308 | //$formats[$id] = 'fr24json'; |
| 236 | 309 | $globalSources[$id]['format'] = 'myshiptracking'; |
| 237 | 310 | //$last_exec['fr24json'] = 0; |
| 238 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 311 | + if ($globalDebug) { |
|
| 312 | + echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 313 | + } |
|
| 239 | 314 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 240 | 315 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 241 | 316 | exit(0); |
@@ -244,17 +319,24 @@ discard block |
||
| 244 | 319 | } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
| 245 | 320 | //$formats[$id] = 'tsv'; |
| 246 | 321 | $globalSources[$id]['format'] = 'tsv'; |
| 247 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 322 | + if ($globalDebug) { |
|
| 323 | + echo "Connect to tsv source (".$host.")...\n"; |
|
| 324 | + } |
|
| 248 | 325 | } |
| 249 | 326 | } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
| 250 | 327 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
| 251 | 328 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
| 252 | 329 | if ($idf !== false) { |
| 253 | 330 | $httpfeeds[$id] = $idf; |
| 254 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 331 | + if ($globalDebug) { |
|
| 332 | + echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 333 | + } |
|
| 334 | + } elseif ($globalDebug) { |
|
| 335 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 255 | 336 | } |
| 256 | - elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 257 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 337 | + } elseif ($globalDebug) { |
|
| 338 | + echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 339 | + } |
|
| 258 | 340 | } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
| 259 | 341 | $hostport = explode(':',$host); |
| 260 | 342 | if (isset($hostport[1])) { |
@@ -294,17 +376,25 @@ discard block |
||
| 294 | 376 | //$formats[$id] = 'beast'; |
| 295 | 377 | $globalSources[$id]['format'] = 'beast'; |
| 296 | 378 | //} else $formats[$id] = 'sbs'; |
| 297 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 379 | + } else { |
|
| 380 | + $globalSources[$id]['format'] = 'sbs'; |
|
| 381 | + } |
|
| 298 | 382 | //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
| 299 | 383 | } |
| 300 | - if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 384 | + if ($globalDebug) { |
|
| 385 | + echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 386 | + } |
|
| 301 | 387 | } else { |
| 302 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 388 | + if ($globalDebug) { |
|
| 389 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 390 | + } |
|
| 303 | 391 | } |
| 304 | 392 | } |
| 305 | 393 | } |
| 306 | 394 | } |
| 307 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; |
|
| 395 | +if (!isset($globalMinFetch)) { |
|
| 396 | + $globalMinFetch = 15; |
|
| 397 | +} |
|
| 308 | 398 | |
| 309 | 399 | // Initialize all |
| 310 | 400 | $status = array(); |
@@ -313,13 +403,19 @@ discard block |
||
| 313 | 403 | $formats = array(); |
| 314 | 404 | $last_exec = array(); |
| 315 | 405 | $time = time(); |
| 316 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; |
|
| 317 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
|
| 318 | -else $timeout = 20; |
|
| 406 | +if (isset($globalSourcesTimeout)) { |
|
| 407 | + $timeout = $globalSourcesTimeOut; |
|
| 408 | +} else if (isset($globalSBS1TimeOut)) { |
|
| 409 | + $timeout = $globalSBS1TimeOut; |
|
| 410 | +} else { |
|
| 411 | + $timeout = 20; |
|
| 412 | +} |
|
| 319 | 413 | $errno = ''; |
| 320 | 414 | $errstr=''; |
| 321 | 415 | |
| 322 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 416 | +if (!isset($globalDaemon)) { |
|
| 417 | + $globalDaemon = TRUE; |
|
| 418 | +} |
|
| 323 | 419 | /* Initiate connections to all the hosts simultaneously */ |
| 324 | 420 | //connect_all($hosts); |
| 325 | 421 | //connect_all($globalSources); |
@@ -348,7 +444,9 @@ discard block |
||
| 348 | 444 | if (isset($source['format']) && $source['format'] == 'aprs') { |
| 349 | 445 | $aprs_connect = 0; |
| 350 | 446 | $use_aprs = true; |
| 351 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
|
| 447 | + if (isset($source['port']) && $source['port'] == '10152') { |
|
| 448 | + $aprs_full = true; |
|
| 449 | + } |
|
| 352 | 450 | break; |
| 353 | 451 | } |
| 354 | 452 | } |
@@ -359,25 +457,48 @@ discard block |
||
| 359 | 457 | $aprs_connect = 0; |
| 360 | 458 | $aprs_keep = 120; |
| 361 | 459 | $aprs_last_tx = time(); |
| 362 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
| 363 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 364 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
|
| 365 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 366 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
|
| 367 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 368 | - if ($aprs_full) $aprs_filter = ''; |
|
| 369 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
|
| 370 | - else $aprs_pass = '-1'; |
|
| 460 | + if (isset($globalAPRSversion)) { |
|
| 461 | + $aprs_version = $globalAPRSversion; |
|
| 462 | + } else { |
|
| 463 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 464 | + } |
|
| 465 | + if (isset($globalAPRSssid)) { |
|
| 466 | + $aprs_ssid = $globalAPRSssid; |
|
| 467 | + } else { |
|
| 468 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 469 | + } |
|
| 470 | + if (isset($globalAPRSfilter)) { |
|
| 471 | + $aprs_filter = $globalAPRSfilter; |
|
| 472 | + } else { |
|
| 473 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 474 | + } |
|
| 475 | + if ($aprs_full) { |
|
| 476 | + $aprs_filter = ''; |
|
| 477 | + } |
|
| 478 | + if (isset($globalAPRSpass)) { |
|
| 479 | + $aprs_pass = $globalAPRSpass; |
|
| 480 | + } else { |
|
| 481 | + $aprs_pass = '-1'; |
|
| 482 | + } |
|
| 371 | 483 | |
| 372 | - if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 373 | - else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 374 | -} |
|
| 484 | + if ($aprs_filter != '') { |
|
| 485 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 486 | + } else { |
|
| 487 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 488 | + } |
|
| 489 | + } |
|
| 375 | 490 | |
| 376 | 491 | // connected - lets do some work |
| 377 | -if ($globalDebug) echo "Connected!\n"; |
|
| 492 | +if ($globalDebug) { |
|
| 493 | + echo "Connected!\n"; |
|
| 494 | +} |
|
| 378 | 495 | sleep(1); |
| 379 | -if ($globalDebug) echo "SCAN MODE \n\n"; |
|
| 380 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; |
|
| 496 | +if ($globalDebug) { |
|
| 497 | + echo "SCAN MODE \n\n"; |
|
| 498 | +} |
|
| 499 | +if (!isset($globalCronEnd)) { |
|
| 500 | + $globalCronEnd = 60; |
|
| 501 | +} |
|
| 381 | 502 | $endtime = time()+$globalCronEnd; |
| 382 | 503 | $i = 1; |
| 383 | 504 | $tt = array(); |
@@ -391,20 +512,28 @@ discard block |
||
| 391 | 512 | |
| 392 | 513 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 393 | 514 | while ($i > 0) { |
| 394 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 515 | + if (!$globalDaemon) { |
|
| 516 | + $i = $endtime-time(); |
|
| 517 | + } |
|
| 395 | 518 | // Delete old ATC |
| 396 | 519 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 397 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; |
|
| 520 | + if ($globalDebug) { |
|
| 521 | + echo 'Delete old ATC...'."\n"; |
|
| 522 | + } |
|
| 398 | 523 | $ATC->deleteOldATC(); |
| 399 | 524 | } |
| 400 | 525 | |
| 401 | 526 | if (count($last_exec) == count($globalSources)) { |
| 402 | 527 | $max = $globalMinFetch; |
| 403 | 528 | foreach ($last_exec as $last) { |
| 404 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 529 | + if ((time() - $last['last']) < $max) { |
|
| 530 | + $max = time() - $last['last']; |
|
| 531 | + } |
|
| 405 | 532 | } |
| 406 | 533 | if ($max != $globalMinFetch) { |
| 407 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 534 | + if ($globalDebug) { |
|
| 535 | + echo 'Sleeping...'."\n"; |
|
| 536 | + } |
|
| 408 | 537 | sleep($globalMinFetch-$max+2); |
| 409 | 538 | } |
| 410 | 539 | } |
@@ -414,7 +543,9 @@ discard block |
||
| 414 | 543 | foreach ($globalSources as $id => $value) { |
| 415 | 544 | date_default_timezone_set('UTC'); |
| 416 | 545 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
| 417 | - if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
|
| 546 | + if (!isset($last_exec[$id]['last'])) { |
|
| 547 | + $last_exec[$id]['last'] = 0; |
|
| 548 | + } |
|
| 418 | 549 | if ($value['format'] == 'deltadbtxt' && |
| 419 | 550 | ( |
| 420 | 551 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
@@ -423,7 +554,9 @@ discard block |
||
| 423 | 554 | ) { |
| 424 | 555 | //$buffer = $Common->getData($hosts[$id]); |
| 425 | 556 | $buffer = $Common->getData($value['host']); |
| 426 | - if ($buffer != '') $reset = 0; |
|
| 557 | + if ($buffer != '') { |
|
| 558 | + $reset = 0; |
|
| 559 | + } |
|
| 427 | 560 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 428 | 561 | $buffer = explode('\n',$buffer); |
| 429 | 562 | foreach ($buffer as $line) { |
@@ -432,20 +565,41 @@ discard block |
||
| 432 | 565 | $data = array(); |
| 433 | 566 | $data['hex'] = $line[1]; // hex |
| 434 | 567 | $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 |
|
| 568 | + if (isset($line[3])) { |
|
| 569 | + $data['altitude'] = $line[3]; |
|
| 570 | + } |
|
| 571 | + // altitude |
|
| 572 | + if (isset($line[4])) { |
|
| 573 | + $data['speed'] = $line[4]; |
|
| 574 | + } |
|
| 575 | + // speed |
|
| 576 | + if (isset($line[5])) { |
|
| 577 | + $data['heading'] = $line[5]; |
|
| 578 | + } |
|
| 579 | + // heading |
|
| 580 | + if (isset($line[6])) { |
|
| 581 | + $data['latitude'] = $line[6]; |
|
| 582 | + } |
|
| 583 | + // lat |
|
| 584 | + if (isset($line[7])) { |
|
| 585 | + $data['longitude'] = $line[7]; |
|
| 586 | + } |
|
| 587 | + // long |
|
| 440 | 588 | $data['verticalrate'] = ''; // vertical rate |
| 441 | 589 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
| 442 | 590 | $data['emergency'] = ''; // emergency |
| 443 | 591 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 444 | 592 | $data['format_source'] = 'deltadbtxt'; |
| 445 | 593 | $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']; |
|
| 594 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 595 | + $data['source_name'] = $value['name']; |
|
| 596 | + } |
|
| 597 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 598 | + $data['noarchive'] = true; |
|
| 599 | + } |
|
| 600 | + if (isset($value['sourcestats'])) { |
|
| 601 | + $data['sourcestats'] = $value['sourcestats']; |
|
| 602 | + } |
|
| 449 | 603 | $SI->add($data); |
| 450 | 604 | unset($data); |
| 451 | 605 | } |
@@ -460,7 +614,9 @@ discard block |
||
| 460 | 614 | date_default_timezone_set('CET'); |
| 461 | 615 | $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
| 462 | 616 | date_default_timezone_set('UTC'); |
| 463 | - if ($buffer != '') $reset = 0; |
|
| 617 | + if ($buffer != '') { |
|
| 618 | + $reset = 0; |
|
| 619 | + } |
|
| 464 | 620 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 465 | 621 | $buffer = explode('\n',$buffer); |
| 466 | 622 | foreach ($buffer as $line) { |
@@ -469,16 +625,36 @@ discard block |
||
| 469 | 625 | $add = false; |
| 470 | 626 | $ais_data = $AIS->parse_line(trim($line)); |
| 471 | 627 | $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']; |
|
| 628 | + if (isset($ais_data['ident'])) { |
|
| 629 | + $data['ident'] = $ais_data['ident']; |
|
| 630 | + } |
|
| 631 | + if (isset($ais_data['mmsi'])) { |
|
| 632 | + $data['mmsi'] = $ais_data['mmsi']; |
|
| 633 | + } |
|
| 634 | + if (isset($ais_data['speed'])) { |
|
| 635 | + $data['speed'] = $ais_data['speed']; |
|
| 636 | + } |
|
| 637 | + if (isset($ais_data['heading'])) { |
|
| 638 | + $data['heading'] = $ais_data['heading']; |
|
| 639 | + } |
|
| 640 | + if (isset($ais_data['latitude'])) { |
|
| 641 | + $data['latitude'] = $ais_data['latitude']; |
|
| 642 | + } |
|
| 643 | + if (isset($ais_data['longitude'])) { |
|
| 644 | + $data['longitude'] = $ais_data['longitude']; |
|
| 645 | + } |
|
| 646 | + if (isset($ais_data['status'])) { |
|
| 647 | + $data['status'] = $ais_data['status']; |
|
| 648 | + } |
|
| 649 | + if (isset($ais_data['type'])) { |
|
| 650 | + $data['type'] = $ais_data['type']; |
|
| 651 | + } |
|
| 652 | + if (isset($ais_data['imo'])) { |
|
| 653 | + $data['imo'] = $ais_data['imo']; |
|
| 654 | + } |
|
| 655 | + if (isset($ais_data['callsign'])) { |
|
| 656 | + $data['callsign'] = $ais_data['callsign']; |
|
| 657 | + } |
|
| 482 | 658 | if (isset($ais_data['timestamp'])) { |
| 483 | 659 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 484 | 660 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
@@ -492,8 +668,12 @@ discard block |
||
| 492 | 668 | $data['format_source'] = 'aisnmeatxt'; |
| 493 | 669 | $data['id_source'] = $id_source; |
| 494 | 670 | //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); |
|
| 671 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 672 | + $data['noarchive'] = true; |
|
| 673 | + } |
|
| 674 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
| 675 | + $MI->add($data); |
|
| 676 | + } |
|
| 497 | 677 | unset($data); |
| 498 | 678 | } |
| 499 | 679 | } |
@@ -513,20 +693,48 @@ discard block |
||
| 513 | 693 | if ($line != '') { |
| 514 | 694 | $ais_data = $AIS->parse_line(trim($line)); |
| 515 | 695 | $data = array(); |
| 516 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 517 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 518 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 519 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 520 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 521 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 522 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 523 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 524 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 525 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 526 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 527 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 528 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 529 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 696 | + if (isset($ais_data['ident'])) { |
|
| 697 | + $data['ident'] = $ais_data['ident']; |
|
| 698 | + } |
|
| 699 | + if (isset($ais_data['mmsi'])) { |
|
| 700 | + $data['mmsi'] = $ais_data['mmsi']; |
|
| 701 | + } |
|
| 702 | + if (isset($ais_data['speed'])) { |
|
| 703 | + $data['speed'] = $ais_data['speed']; |
|
| 704 | + } |
|
| 705 | + if (isset($ais_data['heading'])) { |
|
| 706 | + $data['heading'] = $ais_data['heading']; |
|
| 707 | + } |
|
| 708 | + if (isset($ais_data['latitude'])) { |
|
| 709 | + $data['latitude'] = $ais_data['latitude']; |
|
| 710 | + } |
|
| 711 | + if (isset($ais_data['longitude'])) { |
|
| 712 | + $data['longitude'] = $ais_data['longitude']; |
|
| 713 | + } |
|
| 714 | + if (isset($ais_data['status'])) { |
|
| 715 | + $data['status'] = $ais_data['status']; |
|
| 716 | + } |
|
| 717 | + if (isset($ais_data['statusid'])) { |
|
| 718 | + $data['status_id'] = $ais_data['statusid']; |
|
| 719 | + } |
|
| 720 | + if (isset($ais_data['type'])) { |
|
| 721 | + $data['type'] = $ais_data['type']; |
|
| 722 | + } |
|
| 723 | + if (isset($ais_data['typeid'])) { |
|
| 724 | + $data['type_id'] = $ais_data['typeid']; |
|
| 725 | + } |
|
| 726 | + if (isset($ais_data['imo'])) { |
|
| 727 | + $data['imo'] = $ais_data['imo']; |
|
| 728 | + } |
|
| 729 | + if (isset($ais_data['callsign'])) { |
|
| 730 | + $data['callsign'] = $ais_data['callsign']; |
|
| 731 | + } |
|
| 732 | + if (isset($ais_data['destination'])) { |
|
| 733 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 734 | + } |
|
| 735 | + if (isset($ais_data['eta_ts'])) { |
|
| 736 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 737 | + } |
|
| 530 | 738 | if (isset($ais_data['timestamp'])) { |
| 531 | 739 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 532 | 740 | } else { |
@@ -534,18 +742,27 @@ discard block |
||
| 534 | 742 | } |
| 535 | 743 | $data['format_source'] = 'aisnmeahttp'; |
| 536 | 744 | $data['id_source'] = $id_source; |
| 537 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 538 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
| 745 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 746 | + $data['noarchive'] = true; |
|
| 747 | + } |
|
| 748 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
| 749 | + $MI->add($data); |
|
| 750 | + } |
|
| 539 | 751 | unset($data); |
| 540 | 752 | } |
| 541 | 753 | } |
| 542 | 754 | } |
| 543 | 755 | } else { |
| 544 | 756 | $format = $value['format']; |
| 545 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 546 | - else $tt[$format] = 0; |
|
| 757 | + if (isset($tt[$format])) { |
|
| 758 | + $tt[$format]++; |
|
| 759 | + } else { |
|
| 760 | + $tt[$format] = 0; |
|
| 761 | + } |
|
| 547 | 762 | if ($tt[$format] > 30) { |
| 548 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
| 763 | + if ($globalDebug) { |
|
| 764 | + echo 'Reconnect...'."\n"; |
|
| 765 | + } |
|
| 549 | 766 | sleep(2); |
| 550 | 767 | $sourceeen[] = $value; |
| 551 | 768 | connect_all($sourceeen); |
@@ -583,7 +800,9 @@ discard block |
||
| 583 | 800 | $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
| 584 | 801 | $data['format_source'] = 'myshiptracking'; |
| 585 | 802 | $data['id_source'] = $id_source; |
| 586 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 803 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 804 | + $data['noarchive'] = true; |
|
| 805 | + } |
|
| 587 | 806 | $MI->add($data); |
| 588 | 807 | unset($data); |
| 589 | 808 | } |
@@ -608,7 +827,9 @@ discard block |
||
| 608 | 827 | $data['callsign'] = $line['callsign']; |
| 609 | 828 | $data['mmsi'] = $line['mmsi']; |
| 610 | 829 | $data['speed'] = $line['sog']; |
| 611 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
| 830 | + if ($line['heading'] != '511') { |
|
| 831 | + $data['heading'] = $line['heading']; |
|
| 832 | + } |
|
| 612 | 833 | $data['latitude'] = $line['latitude']; |
| 613 | 834 | $data['longitude'] = $line['longitude']; |
| 614 | 835 | $data['type_id'] = $line['shiptype']; |
@@ -616,7 +837,9 @@ discard block |
||
| 616 | 837 | $data['datetime'] = $line['time']; |
| 617 | 838 | $data['format_source'] = 'boatbeaconapp'; |
| 618 | 839 | $data['id_source'] = $id_source; |
| 619 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 840 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 841 | + $data['noarchive'] = true; |
|
| 842 | + } |
|
| 620 | 843 | $MI->add($data); |
| 621 | 844 | unset($data); |
| 622 | 845 | } |
@@ -637,22 +860,44 @@ discard block |
||
| 637 | 860 | if (isset($all_data['features'][0]['id'])) { |
| 638 | 861 | foreach ($all_data['features'] as $line) { |
| 639 | 862 | $data = array(); |
| 640 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
|
| 641 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
|
| 642 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = $line['properties']['mmsi']; |
|
| 643 | - if (isset($line['properties']['imo'])) $data['mmsi'] = $line['properties']['imo']; |
|
| 644 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
|
| 645 | - if (isset($line['properties']['heading'])) $data['heading'] = $line['properties']['heading']; |
|
| 863 | + if (isset($line['properties']['name'])) { |
|
| 864 | + $data['ident'] = $line['properties']['name']; |
|
| 865 | + } |
|
| 866 | + if (isset($line['properties']['callsign'])) { |
|
| 867 | + $data['callsign'] = $line['properties']['callsign']; |
|
| 868 | + } |
|
| 869 | + if (isset($line['properties']['mmsi'])) { |
|
| 870 | + $data['mmsi'] = $line['properties']['mmsi']; |
|
| 871 | + } |
|
| 872 | + if (isset($line['properties']['imo'])) { |
|
| 873 | + $data['mmsi'] = $line['properties']['imo']; |
|
| 874 | + } |
|
| 875 | + if (isset($line['properties']['speed'])) { |
|
| 876 | + $data['speed'] = $line['properties']['speed']; |
|
| 877 | + } |
|
| 878 | + if (isset($line['properties']['heading'])) { |
|
| 879 | + $data['heading'] = $line['properties']['heading']; |
|
| 880 | + } |
|
| 646 | 881 | $data['latitude'] = $line['geometry']['coordinates'][1]; |
| 647 | 882 | $data['longitude'] = $line['geometry']['coordinates'][0]; |
| 648 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; |
|
| 649 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; |
|
| 650 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; |
|
| 883 | + if (isset($line['properties']['vesselType'])) { |
|
| 884 | + $data['type'] = $line['properties']['vesselType']; |
|
| 885 | + } |
|
| 886 | + if (isset($line['properties']['destination'])) { |
|
| 887 | + $data['arrival_code'] = $line['properties']['destination']; |
|
| 888 | + } |
|
| 889 | + if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { |
|
| 890 | + $data['arrival_date'] = $line['properties']['eta']; |
|
| 891 | + } |
|
| 651 | 892 | $data['format_source'] = 'boatnerd'; |
| 652 | 893 | $data['id_source'] = $id_source; |
| 653 | 894 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 654 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 655 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
|
| 895 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 896 | + $data['noarchive'] = true; |
|
| 897 | + } |
|
| 898 | + if ($line['properties']['vesselType'] != 'Navigation Aid') { |
|
| 899 | + $MI->add($data); |
|
| 900 | + } |
|
| 656 | 901 | unset($data); |
| 657 | 902 | } |
| 658 | 903 | } |
@@ -668,7 +913,9 @@ discard block |
||
| 668 | 913 | echo 'download...'; |
| 669 | 914 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
| 670 | 915 | echo 'done !'."\n"; |
| 671 | - if ($buffer != '') $reset = 0; |
|
| 916 | + if ($buffer != '') { |
|
| 917 | + $reset = 0; |
|
| 918 | + } |
|
| 672 | 919 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 673 | 920 | $buffer = explode('\n',$buffer); |
| 674 | 921 | foreach ($buffer as $line) { |
@@ -693,7 +940,9 @@ discard block |
||
| 693 | 940 | //$data['etaTime'] = substr($line,135,5); |
| 694 | 941 | $data['format_source'] = 'shipplotter'; |
| 695 | 942 | $data['id_source'] = $id_source; |
| 696 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 943 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 944 | + $data['noarchive'] = true; |
|
| 945 | + } |
|
| 697 | 946 | //print_r($data); |
| 698 | 947 | echo 'Add...'."\n"; |
| 699 | 948 | $MI->add($data); |
@@ -727,16 +976,28 @@ discard block |
||
| 727 | 976 | $line = explode(':', $line); |
| 728 | 977 | if (count($line) > 30 && $line[0] != 'callsign') { |
| 729 | 978 | $data = array(); |
| 730 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 731 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 979 | + if (isset($line[37]) && $line[37] != '') { |
|
| 980 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 981 | + } else { |
|
| 982 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 983 | + } |
|
| 732 | 984 | $data['pilot_id'] = $line[1]; |
| 733 | 985 | $data['pilot_name'] = $line[2]; |
| 734 | 986 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
| 735 | 987 | $data['ident'] = $line[0]; // ident |
| 736 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
|
| 988 | + if ($line[7] != '' && $line[7] != 0) { |
|
| 989 | + $data['altitude'] = $line[7]; |
|
| 990 | + } |
|
| 991 | + // altitude |
|
| 737 | 992 | $data['speed'] = $line[8]; // speed |
| 738 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading |
|
| 739 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
|
| 993 | + if (isset($line[45])) { |
|
| 994 | + $data['heading'] = $line[45]; |
|
| 995 | + } |
|
| 996 | + // heading |
|
| 997 | + elseif (isset($line[38])) { |
|
| 998 | + $data['heading'] = $line[38]; |
|
| 999 | + } |
|
| 1000 | + // heading |
|
| 740 | 1001 | $data['latitude'] = $line[5]; // lat |
| 741 | 1002 | $data['longitude'] = $line[6]; // long |
| 742 | 1003 | $data['verticalrate'] = ''; // vertical rate |
@@ -752,7 +1013,9 @@ discard block |
||
| 752 | 1013 | $data['frequency'] = $line[4]; |
| 753 | 1014 | $data['type'] = $line[18]; |
| 754 | 1015 | $data['range'] = $line[19]; |
| 755 | - if (isset($line[35])) $data['info'] = $line[35]; |
|
| 1016 | + if (isset($line[35])) { |
|
| 1017 | + $data['info'] = $line[35]; |
|
| 1018 | + } |
|
| 756 | 1019 | $data['id_source'] = $id_source; |
| 757 | 1020 | //$data['arrival_airport_time'] = ; |
| 758 | 1021 | if ($line[9] != '') { |
@@ -766,27 +1029,47 @@ discard block |
||
| 766 | 1029 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 767 | 1030 | */ |
| 768 | 1031 | $data['format_source'] = $value['format']; |
| 769 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 770 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 771 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
| 772 | - elseif ($line[3] == 'ATC') { |
|
| 1032 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1033 | + $data['noarchive'] = true; |
|
| 1034 | + } |
|
| 1035 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1036 | + $data['source_name'] = $value['name']; |
|
| 1037 | + } |
|
| 1038 | + if ($line[3] == 'PILOT') { |
|
| 1039 | + $SI->add($data); |
|
| 1040 | + } elseif ($line[3] == 'ATC') { |
|
| 773 | 1041 | //print_r($data); |
| 774 | 1042 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 775 | 1043 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 776 | 1044 | $typec = substr($data['ident'],-3); |
| 777 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
| 778 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
| 779 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
| 780 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
| 781 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
| 782 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
| 783 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 784 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 785 | - elseif ($data['type'] == '') $data['type'] = 'Observer'; |
|
| 786 | - if (!isset($data['source_name'])) $data['source_name'] = ''; |
|
| 1045 | + if ($typec == 'APP') { |
|
| 1046 | + $data['type'] = 'Approach'; |
|
| 1047 | + } elseif ($typec == 'TWR') { |
|
| 1048 | + $data['type'] = 'Tower'; |
|
| 1049 | + } elseif ($typec == 'OBS') { |
|
| 1050 | + $data['type'] = 'Observer'; |
|
| 1051 | + } elseif ($typec == 'GND') { |
|
| 1052 | + $data['type'] = 'Ground'; |
|
| 1053 | + } elseif ($typec == 'DEL') { |
|
| 1054 | + $data['type'] = 'Delivery'; |
|
| 1055 | + } elseif ($typec == 'DEP') { |
|
| 1056 | + $data['type'] = 'Departure'; |
|
| 1057 | + } elseif ($typec == 'FSS') { |
|
| 1058 | + $data['type'] = 'Flight Service Station'; |
|
| 1059 | + } elseif ($typec == 'CTR') { |
|
| 1060 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1061 | + } elseif ($data['type'] == '') { |
|
| 1062 | + $data['type'] = 'Observer'; |
|
| 1063 | + } |
|
| 1064 | + if (!isset($data['source_name'])) { |
|
| 1065 | + $data['source_name'] = ''; |
|
| 1066 | + } |
|
| 787 | 1067 | if (isset($ATC)) { |
| 788 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($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']); |
|
| 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']); |
|
| 1068 | + if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { |
|
| 1069 | + echo $ATC->update($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']); |
|
| 1070 | + } else { |
|
| 1071 | + 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']); |
|
| 1072 | + } |
|
| 790 | 1073 | } |
| 791 | 1074 | } |
| 792 | 1075 | unset($data); |
@@ -813,14 +1096,20 @@ discard block |
||
| 813 | 1096 | $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
| 814 | 1097 | $data['latitude'] = (float)$line['pktLatitude']; |
| 815 | 1098 | $data['longitude'] = (float)$line['pktLongitude']; |
| 816 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
| 817 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
| 1099 | + if ((float)$line['pktTrack'] != 0) { |
|
| 1100 | + $data['heading'] = (float)$line['pktTrack']; |
|
| 1101 | + } |
|
| 1102 | + if ((int)$line['pktSpeed'] != 0) { |
|
| 1103 | + $data['speed'] = (int)$line['pktSpeed']; |
|
| 1104 | + } |
|
| 818 | 1105 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
| 819 | 1106 | $data['altitude_relative'] = 'AMSL'; |
| 820 | 1107 | $data['pilot_id'] = (int)$line['pktPilotID']; |
| 821 | 1108 | $data['aircraft_icao'] = 'PARAGLIDER'; |
| 822 | 1109 | $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
| 823 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
|
| 1110 | + if (isset($pilot_data[4])) { |
|
| 1111 | + $data['pilot_name'] = $pilot_data[4]; |
|
| 1112 | + } |
|
| 824 | 1113 | $data['format_source'] = $value['format']; |
| 825 | 1114 | $SI->add($data); |
| 826 | 1115 | unset($data); |
@@ -868,25 +1157,59 @@ discard block |
||
| 868 | 1157 | foreach ($all_data['acList'] as $line) { |
| 869 | 1158 | $data = array(); |
| 870 | 1159 | $data['hex'] = $line['Icao']; // hex |
| 871 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 872 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 873 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 874 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 875 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 876 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 1160 | + if (isset($line['Call'])) { |
|
| 1161 | + $data['ident'] = $line['Call']; |
|
| 1162 | + } |
|
| 1163 | + // ident |
|
| 1164 | + if (isset($line['Alt'])) { |
|
| 1165 | + $data['altitude'] = $line['Alt']; |
|
| 1166 | + } |
|
| 1167 | + // altitude |
|
| 1168 | + if (isset($line['Spd'])) { |
|
| 1169 | + $data['speed'] = $line['Spd']; |
|
| 1170 | + } |
|
| 1171 | + // speed |
|
| 1172 | + if (isset($line['Trak'])) { |
|
| 1173 | + $data['heading'] = $line['Trak']; |
|
| 1174 | + } |
|
| 1175 | + // heading |
|
| 1176 | + if (isset($line['Lat'])) { |
|
| 1177 | + $data['latitude'] = $line['Lat']; |
|
| 1178 | + } |
|
| 1179 | + // lat |
|
| 1180 | + if (isset($line['Long'])) { |
|
| 1181 | + $data['longitude'] = $line['Long']; |
|
| 1182 | + } |
|
| 1183 | + // long |
|
| 877 | 1184 | //$data['verticalrate'] = $line['']; // verticale rate |
| 878 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 1185 | + if (isset($line['Sqk'])) { |
|
| 1186 | + $data['squawk'] = $line['Sqk']; |
|
| 1187 | + } |
|
| 1188 | + // squawk |
|
| 879 | 1189 | $data['emergency'] = ''; // emergency |
| 880 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 881 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 882 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1190 | + if (isset($line['Reg'])) { |
|
| 1191 | + $data['registration'] = $line['Reg']; |
|
| 1192 | + } |
|
| 1193 | + if (isset($line['PosTime'])) { |
|
| 1194 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1195 | + } else { |
|
| 1196 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1197 | + } |
|
| 883 | 1198 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 884 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 1199 | + if (isset($line['Type'])) { |
|
| 1200 | + $data['aircraft_icao'] = $line['Type']; |
|
| 1201 | + } |
|
| 885 | 1202 | $data['format_source'] = 'aircraftlistjson'; |
| 886 | 1203 | $data['id_source'] = $id_source; |
| 887 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 888 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 889 | - if (isset($data['latitude'])) $SI->add($data); |
|
| 1204 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1205 | + $data['source_name'] = $value['name']; |
|
| 1206 | + } |
|
| 1207 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1208 | + $data['noarchive'] = true; |
|
| 1209 | + } |
|
| 1210 | + if (isset($data['latitude'])) { |
|
| 1211 | + $SI->add($data); |
|
| 1212 | + } |
|
| 890 | 1213 | unset($data); |
| 891 | 1214 | } |
| 892 | 1215 | } elseif (is_array($all_data)) { |
@@ -903,17 +1226,26 @@ discard block |
||
| 903 | 1226 | $data['verticalrate'] = $line['vrt']; // verticale rate |
| 904 | 1227 | $data['squawk'] = $line['squawk']; // squawk |
| 905 | 1228 | $data['emergency'] = ''; // emergency |
| 906 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 907 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1229 | + if (isset($line['PosTime'])) { |
|
| 1230 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1231 | + } else { |
|
| 1232 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1233 | + } |
|
| 908 | 1234 | $data['format_source'] = 'aircraftlistjson'; |
| 909 | 1235 | $data['id_source'] = $id_source; |
| 910 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 911 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1236 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1237 | + $data['noarchive'] = true; |
|
| 1238 | + } |
|
| 1239 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1240 | + $data['source_name'] = $value['name']; |
|
| 1241 | + } |
|
| 912 | 1242 | $SI->add($data); |
| 913 | 1243 | unset($data); |
| 914 | 1244 | } |
| 915 | 1245 | } |
| 916 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
| 1246 | + } elseif ($globalDebug) { |
|
| 1247 | + echo 'No data'."\n"; |
|
| 1248 | + } |
|
| 917 | 1249 | //$last_exec['aircraftlistjson'] = time(); |
| 918 | 1250 | $last_exec[$id]['last'] = time(); |
| 919 | 1251 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
@@ -949,8 +1281,12 @@ discard block |
||
| 949 | 1281 | $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
| 950 | 1282 | $data['format_source'] = 'planeupdatefaa'; |
| 951 | 1283 | $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']; |
|
| 1284 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1285 | + $data['noarchive'] = true; |
|
| 1286 | + } |
|
| 1287 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1288 | + $data['source_name'] = $value['name']; |
|
| 1289 | + } |
|
| 954 | 1290 | $SI->add($data); |
| 955 | 1291 | unset($data); |
| 956 | 1292 | } |
@@ -984,7 +1320,9 @@ discard block |
||
| 984 | 1320 | $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
| 985 | 1321 | $data['format_source'] = 'opensky'; |
| 986 | 1322 | $data['id_source'] = $id_source; |
| 987 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1323 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1324 | + $data['noarchive'] = true; |
|
| 1325 | + } |
|
| 988 | 1326 | $SI->add($data); |
| 989 | 1327 | unset($data); |
| 990 | 1328 | } |
@@ -1001,7 +1339,9 @@ discard block |
||
| 1001 | 1339 | //$buffer = $Common->getData($hosts[$id]); |
| 1002 | 1340 | $buffer = $Common->getData($value['host']); |
| 1003 | 1341 | $all_data = json_decode($buffer,true); |
| 1004 | - if (!empty($all_data)) $reset = 0; |
|
| 1342 | + if (!empty($all_data)) { |
|
| 1343 | + $reset = 0; |
|
| 1344 | + } |
|
| 1005 | 1345 | foreach ($all_data as $key => $line) { |
| 1006 | 1346 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 1007 | 1347 | $data = array(); |
@@ -1022,8 +1362,12 @@ discard block |
||
| 1022 | 1362 | $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
| 1023 | 1363 | $data['format_source'] = 'fr24json'; |
| 1024 | 1364 | $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']; |
|
| 1365 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1366 | + $data['noarchive'] = true; |
|
| 1367 | + } |
|
| 1368 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1369 | + $data['source_name'] = $value['name']; |
|
| 1370 | + } |
|
| 1027 | 1371 | $SI->add($data); |
| 1028 | 1372 | unset($data); |
| 1029 | 1373 | } |
@@ -1052,24 +1396,42 @@ discard block |
||
| 1052 | 1396 | if (isset($line['inf'])) { |
| 1053 | 1397 | $data = array(); |
| 1054 | 1398 | $data['hex'] = $line['inf']['ia']; |
| 1055 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
|
| 1399 | + if (isset($line['inf']['cs'])) { |
|
| 1400 | + $data['ident'] = $line['inf']['cs']; |
|
| 1401 | + } |
|
| 1402 | + //$line[13] |
|
| 1056 | 1403 | $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 |
|
| 1404 | + if (isset($line['inf']['gs'])) { |
|
| 1405 | + $data['speed'] = round($line['inf']['gs']*0.539957); |
|
| 1406 | + } |
|
| 1407 | + // speed |
|
| 1408 | + if (isset($line['inf']['tr'])) { |
|
| 1409 | + $data['heading'] = $line['inf']['tr']; |
|
| 1410 | + } |
|
| 1411 | + // heading |
|
| 1059 | 1412 | $data['latitude'] = $line['pt'][0]; // lat |
| 1060 | 1413 | $data['longitude'] = $line['pt'][1]; // long |
| 1061 | 1414 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
| 1062 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 1415 | + if (isset($line['inf']['sq'])) { |
|
| 1416 | + $data['squawk'] = $line['inf']['sq']; |
|
| 1417 | + } |
|
| 1418 | + // squawk |
|
| 1063 | 1419 | //$data['aircraft_icao'] = $line[8]; |
| 1064 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 1420 | + if (isset($line['inf']['rc'])) { |
|
| 1421 | + $data['registration'] = $line['inf']['rc']; |
|
| 1422 | + } |
|
| 1065 | 1423 | //$data['departure_airport_iata'] = $line[11]; |
| 1066 | 1424 | //$data['arrival_airport_iata'] = $line[12]; |
| 1067 | 1425 | //$data['emergency'] = ''; // emergency |
| 1068 | 1426 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 1069 | 1427 | $data['format_source'] = 'radarvirtueljson'; |
| 1070 | 1428 | $data['id_source'] = $id_source; |
| 1071 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1072 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1429 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1430 | + $data['noarchive'] = true; |
|
| 1431 | + } |
|
| 1432 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1433 | + $data['source_name'] = $value['name']; |
|
| 1434 | + } |
|
| 1073 | 1435 | $SI->add($data); |
| 1074 | 1436 | unset($data); |
| 1075 | 1437 | } |
@@ -1095,30 +1457,65 @@ discard block |
||
| 1095 | 1457 | $data['id'] = $line['id']; |
| 1096 | 1458 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
| 1097 | 1459 | $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 |
|
| 1460 | + if (isset($line['pilotid'])) { |
|
| 1461 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1462 | + } |
|
| 1463 | + // pilot id |
|
| 1464 | + if (isset($line['name'])) { |
|
| 1465 | + $data['pilot_name'] = $line['name']; |
|
| 1466 | + } |
|
| 1467 | + // pilot name |
|
| 1468 | + if (isset($line['alt'])) { |
|
| 1469 | + $data['altitude'] = $line['alt']; |
|
| 1470 | + } |
|
| 1471 | + // altitude |
|
| 1472 | + if (isset($line['gs'])) { |
|
| 1473 | + $data['speed'] = $line['gs']; |
|
| 1474 | + } |
|
| 1475 | + // speed |
|
| 1476 | + if (isset($line['heading'])) { |
|
| 1477 | + $data['heading'] = $line['heading']; |
|
| 1478 | + } |
|
| 1479 | + // heading |
|
| 1480 | + if (isset($line['route'])) { |
|
| 1481 | + $data['waypoints'] = $line['route']; |
|
| 1482 | + } |
|
| 1483 | + // route |
|
| 1104 | 1484 | $data['latitude'] = $line['lat']; // lat |
| 1105 | 1485 | $data['longitude'] = $line['lon']; // long |
| 1106 | 1486 | //$data['verticalrate'] = $line['vrt']; // verticale rate |
| 1107 | 1487 | //$data['squawk'] = $line['squawk']; // squawk |
| 1108 | 1488 | //$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']; |
|
| 1489 | + if (isset($line['depicao'])) { |
|
| 1490 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 1491 | + } |
|
| 1492 | + if (isset($line['deptime'])) { |
|
| 1493 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 1494 | + } |
|
| 1495 | + if (isset($line['arricao'])) { |
|
| 1496 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1497 | + } |
|
| 1112 | 1498 | //$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'] = ''; |
|
| 1499 | + if (isset($line['aircraft'])) { |
|
| 1500 | + $data['aircraft_icao'] = $line['aircraft']; |
|
| 1501 | + } |
|
| 1502 | + if (isset($line['transponder'])) { |
|
| 1503 | + $data['squawk'] = $line['transponder']; |
|
| 1504 | + } |
|
| 1505 | + if (isset($line['atis'])) { |
|
| 1506 | + $data['info'] = $line['atis']; |
|
| 1507 | + } else { |
|
| 1508 | + $data['info'] = ''; |
|
| 1509 | + } |
|
| 1117 | 1510 | $data['format_source'] = 'pireps'; |
| 1118 | 1511 | $data['id_source'] = $id_source; |
| 1119 | 1512 | $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']; |
|
| 1513 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1514 | + $data['noarchive'] = true; |
|
| 1515 | + } |
|
| 1516 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1517 | + $data['source_name'] = $value['name']; |
|
| 1518 | + } |
|
| 1122 | 1519 | if ($line['icon'] == 'plane') { |
| 1123 | 1520 | $SI->add($data); |
| 1124 | 1521 | // print_r($data); |
@@ -1127,16 +1524,28 @@ discard block |
||
| 1127 | 1524 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 1128 | 1525 | $typec = substr($data['ident'],-3); |
| 1129 | 1526 | $data['type'] = ''; |
| 1130 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
| 1131 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
| 1132 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
| 1133 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
| 1134 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
| 1135 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
| 1136 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 1137 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 1138 | - else $data['type'] = 'Observer'; |
|
| 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']); |
|
| 1527 | + if ($typec == 'APP') { |
|
| 1528 | + $data['type'] = 'Approach'; |
|
| 1529 | + } elseif ($typec == 'TWR') { |
|
| 1530 | + $data['type'] = 'Tower'; |
|
| 1531 | + } elseif ($typec == 'OBS') { |
|
| 1532 | + $data['type'] = 'Observer'; |
|
| 1533 | + } elseif ($typec == 'GND') { |
|
| 1534 | + $data['type'] = 'Ground'; |
|
| 1535 | + } elseif ($typec == 'DEL') { |
|
| 1536 | + $data['type'] = 'Delivery'; |
|
| 1537 | + } elseif ($typec == 'DEP') { |
|
| 1538 | + $data['type'] = 'Departure'; |
|
| 1539 | + } elseif ($typec == 'FSS') { |
|
| 1540 | + $data['type'] = 'Flight Service Station'; |
|
| 1541 | + } elseif ($typec == 'CTR') { |
|
| 1542 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1543 | + } else { |
|
| 1544 | + $data['type'] = 'Observer'; |
|
| 1545 | + } |
|
| 1546 | + if (isset($ATC)) { |
|
| 1547 | + 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']); |
|
| 1548 | + } |
|
| 1140 | 1549 | } |
| 1141 | 1550 | unset($data); |
| 1142 | 1551 | } |
@@ -1151,7 +1560,9 @@ discard block |
||
| 1151 | 1560 | ) |
| 1152 | 1561 | ) { |
| 1153 | 1562 | //$buffer = $Common->getData($hosts[$id]); |
| 1154 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1563 | + if ($globalDebug) { |
|
| 1564 | + echo 'Get Data...'."\n"; |
|
| 1565 | + } |
|
| 1155 | 1566 | $buffer = $Common->getData($value['host']); |
| 1156 | 1567 | $all_data = json_decode($buffer,true); |
| 1157 | 1568 | if ($buffer != '' && is_array($all_data)) { |
@@ -1159,10 +1570,16 @@ discard block |
||
| 1159 | 1570 | foreach ($all_data as $line) { |
| 1160 | 1571 | $data = array(); |
| 1161 | 1572 | //$data['id'] = $line['id']; // id not usable |
| 1162 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1573 | + if (isset($line['pilotid'])) { |
|
| 1574 | + $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1575 | + } |
|
| 1163 | 1576 | $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']; |
|
| 1577 | + if (isset($line['pilotname'])) { |
|
| 1578 | + $data['pilot_name'] = $line['pilotname']; |
|
| 1579 | + } |
|
| 1580 | + if (isset($line['pilotid'])) { |
|
| 1581 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1582 | + } |
|
| 1166 | 1583 | $data['ident'] = $line['flightnum']; // ident |
| 1167 | 1584 | $data['altitude'] = $line['alt']; // altitude |
| 1168 | 1585 | $data['speed'] = $line['gs']; // speed |
@@ -1178,34 +1595,52 @@ discard block |
||
| 1178 | 1595 | $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
| 1179 | 1596 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1180 | 1597 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1181 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1598 | + } else { |
|
| 1599 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1600 | + } |
|
| 1182 | 1601 | $data['departure_airport_icao'] = $line['depicao']; |
| 1183 | 1602 | $data['departure_airport_time'] = $line['deptime']; |
| 1184 | 1603 | $data['arrival_airport_icao'] = $line['arricao']; |
| 1185 | 1604 | $data['arrival_airport_time'] = $line['arrtime']; |
| 1186 | 1605 | $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 |
|
| 1606 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1607 | + $data['noarchive'] = true; |
|
| 1608 | + } |
|
| 1609 | + if (isset($line['route'])) { |
|
| 1610 | + $data['waypoints'] = $line['route']; |
|
| 1611 | + } |
|
| 1612 | + // route |
|
| 1189 | 1613 | if (isset($line['aircraftname'])) { |
| 1190 | 1614 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1191 | 1615 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 1192 | 1616 | $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 { |
|
| 1617 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { |
|
| 1618 | + $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1619 | + } elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { |
|
| 1620 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1621 | + } else { |
|
| 1196 | 1622 | $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']); |
|
| 1623 | + if (isset($aircraft_data[1])) { |
|
| 1624 | + $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1625 | + } else { |
|
| 1626 | + $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1627 | + } |
|
| 1199 | 1628 | } |
| 1200 | 1629 | } |
| 1201 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 1630 | + if (isset($line['route'])) { |
|
| 1631 | + $data['waypoints'] = $line['route']; |
|
| 1632 | + } |
|
| 1202 | 1633 | $data['id_source'] = $id_source; |
| 1203 | 1634 | $data['format_source'] = 'phpvmacars'; |
| 1204 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1635 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1636 | + $data['source_name'] = $value['name']; |
|
| 1637 | + } |
|
| 1205 | 1638 | $SI->add($data); |
| 1206 | 1639 | unset($data); |
| 1207 | 1640 | } |
| 1208 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1641 | + if ($globalDebug) { |
|
| 1642 | + echo 'No more data...'."\n"; |
|
| 1643 | + } |
|
| 1209 | 1644 | unset($buffer); |
| 1210 | 1645 | unset($all_data); |
| 1211 | 1646 | } |
@@ -1218,7 +1653,9 @@ discard block |
||
| 1218 | 1653 | ) |
| 1219 | 1654 | ) { |
| 1220 | 1655 | //$buffer = $Common->getData($hosts[$id]); |
| 1221 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1656 | + if ($globalDebug) { |
|
| 1657 | + echo 'Get Data...'."\n"; |
|
| 1658 | + } |
|
| 1222 | 1659 | $buffer = $Common->getData($value['host']); |
| 1223 | 1660 | $all_data = json_decode($buffer,true); |
| 1224 | 1661 | if ($buffer != '' && is_array($all_data)) { |
@@ -1247,16 +1684,25 @@ discard block |
||
| 1247 | 1684 | $data['arrival_airport_icao'] = $line['arrival']; |
| 1248 | 1685 | //$data['arrival_airport_time'] = $line['arrival_time']; |
| 1249 | 1686 | //$data['registration'] = $line['aircraft']; |
| 1250 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1687 | + if (isset($line['route'])) { |
|
| 1688 | + $data['waypoints'] = $line['route']; |
|
| 1689 | + } |
|
| 1690 | + // route |
|
| 1251 | 1691 | $data['aircraft_icao'] = $line['plane_type']; |
| 1252 | 1692 | $data['id_source'] = $id_source; |
| 1253 | 1693 | $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']; |
|
| 1694 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1695 | + $data['noarchive'] = true; |
|
| 1696 | + } |
|
| 1697 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1698 | + $data['source_name'] = $value['name']; |
|
| 1699 | + } |
|
| 1256 | 1700 | $SI->add($data); |
| 1257 | 1701 | unset($data); |
| 1258 | 1702 | } |
| 1259 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1703 | + if ($globalDebug) { |
|
| 1704 | + echo 'No more data...'."\n"; |
|
| 1705 | + } |
|
| 1260 | 1706 | unset($buffer); |
| 1261 | 1707 | unset($all_data); |
| 1262 | 1708 | } |
@@ -1269,7 +1715,9 @@ discard block |
||
| 1269 | 1715 | ) |
| 1270 | 1716 | ) { |
| 1271 | 1717 | //$buffer = $Common->getData($hosts[$id]); |
| 1272 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1718 | + if ($globalDebug) { |
|
| 1719 | + echo 'Get Data...'."\n"; |
|
| 1720 | + } |
|
| 1273 | 1721 | $buffer = $Common->getData($value['host']); |
| 1274 | 1722 | $all_data = json_decode($buffer,true); |
| 1275 | 1723 | if ($buffer != '') { |
@@ -1287,18 +1735,24 @@ discard block |
||
| 1287 | 1735 | $data['id_source'] = $id_source; |
| 1288 | 1736 | $data['format_source'] = 'blitzortung'; |
| 1289 | 1737 | $SI->add($data); |
| 1290 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 1738 | + if ($globalDebug) { |
|
| 1739 | + echo '☈ Lightning added'."\n"; |
|
| 1740 | + } |
|
| 1291 | 1741 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
| 1292 | 1742 | unset($data); |
| 1293 | 1743 | } |
| 1294 | 1744 | } |
| 1295 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1745 | + if ($globalDebug) { |
|
| 1746 | + echo 'No more data...'."\n"; |
|
| 1747 | + } |
|
| 1296 | 1748 | unset($buffer); |
| 1297 | 1749 | } |
| 1298 | 1750 | $last_exec[$id]['last'] = time(); |
| 1299 | 1751 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
| 1300 | 1752 | } 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(); |
|
| 1753 | + if (function_exists('pcntl_fork')) { |
|
| 1754 | + pcntl_signal_dispatch(); |
|
| 1755 | + } |
|
| 1302 | 1756 | //$last_exec[$id]['last'] = time(); |
| 1303 | 1757 | |
| 1304 | 1758 | //$read = array( $sockets[$id] ); |
@@ -1306,7 +1760,9 @@ discard block |
||
| 1306 | 1760 | $write = NULL; |
| 1307 | 1761 | $e = NULL; |
| 1308 | 1762 | $n = socket_select($read, $write, $e, $timeout); |
| 1309 | - if ($e != NULL) var_dump($e); |
|
| 1763 | + if ($e != NULL) { |
|
| 1764 | + var_dump($e); |
|
| 1765 | + } |
|
| 1310 | 1766 | if ($n > 0) { |
| 1311 | 1767 | $reset = 0; |
| 1312 | 1768 | foreach ($read as $nb => $r) { |
@@ -1327,12 +1783,16 @@ discard block |
||
| 1327 | 1783 | //$SI::del(); |
| 1328 | 1784 | if ($format == 'vrstcp') { |
| 1329 | 1785 | $buffer = explode('},{',$buffer); |
| 1330 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1786 | + } else { |
|
| 1787 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1788 | + } |
|
| 1331 | 1789 | // SBS format is CSV format |
| 1332 | 1790 | if ($buffer !== FALSE && $buffer != '') { |
| 1333 | 1791 | $tt[$format] = 0; |
| 1334 | 1792 | if ($format == 'acarssbs3') { |
| 1335 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1793 | + if ($globalDebug) { |
|
| 1794 | + echo 'ACARS : '.$buffer."\n"; |
|
| 1795 | + } |
|
| 1336 | 1796 | $ACARS->add(trim($buffer)); |
| 1337 | 1797 | $ACARS->deleteLiveAcarsData(); |
| 1338 | 1798 | } elseif ($format == 'raw') { |
@@ -1341,30 +1801,70 @@ discard block |
||
| 1341 | 1801 | if (is_array($data)) { |
| 1342 | 1802 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1343 | 1803 | $data['format_source'] = 'raw'; |
| 1344 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1345 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1346 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1347 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1804 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 1805 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1806 | + } |
|
| 1807 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 1808 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1809 | + } |
|
| 1810 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1811 | + $data['noarchive'] = true; |
|
| 1812 | + } |
|
| 1813 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 1814 | + $SI->add($data); |
|
| 1815 | + } |
|
| 1348 | 1816 | } |
| 1349 | 1817 | } elseif ($format == 'ais') { |
| 1350 | 1818 | $ais_data = $AIS->parse_line(trim($buffer)); |
| 1351 | 1819 | $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']; |
|
| 1820 | + if (isset($ais_data['ident'])) { |
|
| 1821 | + $data['ident'] = $ais_data['ident']; |
|
| 1822 | + } |
|
| 1823 | + if (isset($ais_data['mmsi'])) { |
|
| 1824 | + $data['mmsi'] = $ais_data['mmsi']; |
|
| 1825 | + } |
|
| 1826 | + if (isset($ais_data['speed'])) { |
|
| 1827 | + $data['speed'] = $ais_data['speed']; |
|
| 1828 | + } |
|
| 1829 | + if (isset($ais_data['heading'])) { |
|
| 1830 | + $data['heading'] = $ais_data['heading']; |
|
| 1831 | + } |
|
| 1832 | + if (isset($ais_data['latitude'])) { |
|
| 1833 | + $data['latitude'] = $ais_data['latitude']; |
|
| 1834 | + } |
|
| 1835 | + if (isset($ais_data['longitude'])) { |
|
| 1836 | + $data['longitude'] = $ais_data['longitude']; |
|
| 1837 | + } |
|
| 1838 | + if (isset($ais_data['status'])) { |
|
| 1839 | + $data['status'] = $ais_data['status']; |
|
| 1840 | + } |
|
| 1841 | + if (isset($ais_data['statusid'])) { |
|
| 1842 | + $data['status_id'] = $ais_data['statusid']; |
|
| 1843 | + } |
|
| 1844 | + if (isset($ais_data['type'])) { |
|
| 1845 | + $data['type'] = $ais_data['type']; |
|
| 1846 | + } |
|
| 1847 | + if (isset($ais_data['imo'])) { |
|
| 1848 | + $data['imo'] = $ais_data['imo']; |
|
| 1849 | + } |
|
| 1850 | + if (isset($ais_data['callsign'])) { |
|
| 1851 | + $data['callsign'] = $ais_data['callsign']; |
|
| 1852 | + } |
|
| 1853 | + if (isset($ais_data['destination'])) { |
|
| 1854 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 1855 | + } |
|
| 1856 | + if (isset($ais_data['eta_ts'])) { |
|
| 1857 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1858 | + } |
|
| 1859 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1860 | + $data['noarchive'] = true; |
|
| 1861 | + } |
|
| 1862 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 1863 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1864 | + } |
|
| 1865 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 1866 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1867 | + } |
|
| 1368 | 1868 | |
| 1369 | 1869 | if (isset($ais_data['timestamp'])) { |
| 1370 | 1870 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
@@ -1373,7 +1873,9 @@ discard block |
||
| 1373 | 1873 | } |
| 1374 | 1874 | $data['format_source'] = 'aisnmea'; |
| 1375 | 1875 | $data['id_source'] = $id_source; |
| 1376 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
| 1876 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
| 1877 | + $MI->add($data); |
|
| 1878 | + } |
|
| 1377 | 1879 | unset($data); |
| 1378 | 1880 | } elseif ($format == 'flightgearsp') { |
| 1379 | 1881 | //echo $buffer."\n"; |
@@ -1391,12 +1893,18 @@ discard block |
||
| 1391 | 1893 | $data['speed'] = round($line[5]*1.94384); |
| 1392 | 1894 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1393 | 1895 | $data['format_source'] = 'flightgearsp'; |
| 1394 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1395 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1896 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1897 | + $data['noarchive'] = true; |
|
| 1898 | + } |
|
| 1899 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 1900 | + $SI->add($data); |
|
| 1901 | + } |
|
| 1396 | 1902 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1397 | 1903 | } |
| 1398 | 1904 | } elseif ($format == 'acars') { |
| 1399 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1905 | + if ($globalDebug) { |
|
| 1906 | + echo 'ACARS : '.$buffer."\n"; |
|
| 1907 | + } |
|
| 1400 | 1908 | $ACARS->add(trim($buffer)); |
| 1401 | 1909 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
| 1402 | 1910 | $ACARS->deleteLiveAcarsData(); |
@@ -1417,8 +1925,12 @@ discard block |
||
| 1417 | 1925 | $aircraft_type = $line[10]; |
| 1418 | 1926 | $aircraft_type = preg_split(':/:',$aircraft_type); |
| 1419 | 1927 | $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); |
|
| 1928 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1929 | + $data['noarchive'] = true; |
|
| 1930 | + } |
|
| 1931 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 1932 | + $SI->add($data); |
|
| 1933 | + } |
|
| 1422 | 1934 | } |
| 1423 | 1935 | } |
| 1424 | 1936 | } elseif ($format == 'beast') { |
@@ -1428,28 +1940,62 @@ discard block |
||
| 1428 | 1940 | foreach($buffer as $all_data) { |
| 1429 | 1941 | $line = json_decode('{'.$all_data.'}',true); |
| 1430 | 1942 | $data = array(); |
| 1431 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
|
| 1432 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 1433 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 1434 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 1435 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 1436 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 1437 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 1943 | + if (isset($line['Icao'])) { |
|
| 1944 | + $data['hex'] = $line['Icao']; |
|
| 1945 | + } |
|
| 1946 | + // hex |
|
| 1947 | + if (isset($line['Call'])) { |
|
| 1948 | + $data['ident'] = $line['Call']; |
|
| 1949 | + } |
|
| 1950 | + // ident |
|
| 1951 | + if (isset($line['Alt'])) { |
|
| 1952 | + $data['altitude'] = $line['Alt']; |
|
| 1953 | + } |
|
| 1954 | + // altitude |
|
| 1955 | + if (isset($line['Spd'])) { |
|
| 1956 | + $data['speed'] = $line['Spd']; |
|
| 1957 | + } |
|
| 1958 | + // speed |
|
| 1959 | + if (isset($line['Trak'])) { |
|
| 1960 | + $data['heading'] = $line['Trak']; |
|
| 1961 | + } |
|
| 1962 | + // heading |
|
| 1963 | + if (isset($line['Lat'])) { |
|
| 1964 | + $data['latitude'] = $line['Lat']; |
|
| 1965 | + } |
|
| 1966 | + // lat |
|
| 1967 | + if (isset($line['Long'])) { |
|
| 1968 | + $data['longitude'] = $line['Long']; |
|
| 1969 | + } |
|
| 1970 | + // long |
|
| 1438 | 1971 | //$data['verticalrate'] = $line['']; // verticale rate |
| 1439 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 1972 | + if (isset($line['Sqk'])) { |
|
| 1973 | + $data['squawk'] = $line['Sqk']; |
|
| 1974 | + } |
|
| 1975 | + // squawk |
|
| 1440 | 1976 | $data['emergency'] = ''; // emergency |
| 1441 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 1977 | + if (isset($line['Reg'])) { |
|
| 1978 | + $data['registration'] = $line['Reg']; |
|
| 1979 | + } |
|
| 1442 | 1980 | /* |
| 1443 | 1981 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 1444 | 1982 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 1445 | 1983 | */ |
| 1446 | 1984 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1447 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 1985 | + if (isset($line['Type'])) { |
|
| 1986 | + $data['aircraft_icao'] = $line['Type']; |
|
| 1987 | + } |
|
| 1448 | 1988 | $data['format_source'] = 'vrstcp'; |
| 1449 | 1989 | $data['id_source'] = $id_source; |
| 1450 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1451 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1452 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
|
| 1990 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1991 | + $data['noarchive'] = true; |
|
| 1992 | + } |
|
| 1993 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1994 | + $data['source_name'] = $value['name']; |
|
| 1995 | + } |
|
| 1996 | + if (isset($data['latitude']) && isset($data['hex'])) { |
|
| 1997 | + $SI->add($data); |
|
| 1998 | + } |
|
| 1453 | 1999 | unset($data); |
| 1454 | 2000 | } |
| 1455 | 2001 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
@@ -1462,22 +2008,46 @@ discard block |
||
| 1462 | 2008 | $data['hex'] = $lined['hexid']; |
| 1463 | 2009 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
| 1464 | 2010 | $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']; |
|
| 2011 | + if (isset($lined['ident'])) { |
|
| 2012 | + $data['ident'] = $lined['ident']; |
|
| 2013 | + } |
|
| 2014 | + if (isset($lined['lat'])) { |
|
| 2015 | + $data['latitude'] = $lined['lat']; |
|
| 2016 | + } |
|
| 2017 | + if (isset($lined['lon'])) { |
|
| 2018 | + $data['longitude'] = $lined['lon']; |
|
| 2019 | + } |
|
| 2020 | + if (isset($lined['speed'])) { |
|
| 2021 | + $data['speed'] = $lined['speed']; |
|
| 2022 | + } |
|
| 2023 | + if (isset($lined['squawk'])) { |
|
| 2024 | + $data['squawk'] = $lined['squawk']; |
|
| 2025 | + } |
|
| 2026 | + if (isset($lined['alt'])) { |
|
| 2027 | + $data['altitude'] = $lined['alt']; |
|
| 2028 | + } |
|
| 2029 | + if (isset($lined['heading'])) { |
|
| 2030 | + $data['heading'] = $lined['heading']; |
|
| 2031 | + } |
|
| 1472 | 2032 | $data['id_source'] = $id_source; |
| 1473 | 2033 | $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 | - 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); |
|
| 2034 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2035 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2036 | + } |
|
| 2037 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2038 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2039 | + } |
|
| 2040 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2041 | + $data['noarchive'] = true; |
|
| 2042 | + } |
|
| 2043 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2044 | + $SI->add($data); |
|
| 2045 | + } |
|
| 1478 | 2046 | unset($lined); |
| 1479 | 2047 | unset($data); |
| 1480 | - } else $error = true; |
|
| 2048 | + } else { |
|
| 2049 | + $error = true; |
|
| 2050 | + } |
|
| 1481 | 2051 | } elseif ($format == 'aprs' && $use_aprs) { |
| 1482 | 2052 | if ($aprs_connect == 0) { |
| 1483 | 2053 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
@@ -1502,62 +2072,120 @@ discard block |
||
| 1502 | 2072 | $aprs_last_tx = time(); |
| 1503 | 2073 | $data = array(); |
| 1504 | 2074 | //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'); |
|
| 2075 | + if (isset($line['address'])) { |
|
| 2076 | + $data['hex'] = $line['address']; |
|
| 2077 | + } |
|
| 2078 | + if (isset($line['mmsi'])) { |
|
| 2079 | + $data['mmsi'] = $line['mmsi']; |
|
| 2080 | + } |
|
| 2081 | + if (isset($line['imo'])) { |
|
| 2082 | + $data['imo'] = $line['imo']; |
|
| 2083 | + } |
|
| 2084 | + if (isset($line['squawk'])) { |
|
| 2085 | + $data['squawk'] = $line['squawk']; |
|
| 2086 | + } |
|
| 2087 | + if (isset($line['arrival_code'])) { |
|
| 2088 | + $data['arrical_code'] = $line['arrival_code']; |
|
| 2089 | + } |
|
| 2090 | + if (isset($line['arrival_date'])) { |
|
| 2091 | + $data['arrical_date'] = $line['arrival_date']; |
|
| 2092 | + } |
|
| 2093 | + if (isset($line['type_id'])) { |
|
| 2094 | + $data['type_id'] = $line['typeid']; |
|
| 2095 | + } |
|
| 2096 | + if (isset($line['status_id'])) { |
|
| 2097 | + $data['status_id'] = $line['statusid']; |
|
| 2098 | + } |
|
| 2099 | + if (isset($line['timestamp'])) { |
|
| 2100 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 2101 | + } else { |
|
| 2102 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2103 | + } |
|
| 1515 | 2104 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1516 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
| 2105 | + if (isset($line['ident'])) { |
|
| 2106 | + $data['ident'] = $line['ident']; |
|
| 2107 | + } |
|
| 1517 | 2108 | $data['latitude'] = $line['latitude']; |
| 1518 | 2109 | $data['longitude'] = $line['longitude']; |
| 1519 | 2110 | //$data['verticalrate'] = $line[16]; |
| 1520 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 2111 | + if (isset($line['speed'])) { |
|
| 2112 | + $data['speed'] = $line['speed']; |
|
| 2113 | + } |
|
| 1521 | 2114 | //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']; |
|
| 2115 | + if (isset($line['altitude'])) { |
|
| 2116 | + $data['altitude'] = $line['altitude']; |
|
| 2117 | + } |
|
| 2118 | + if (isset($line['comment'])) { |
|
| 2119 | + $data['comment'] = $line['comment']; |
|
| 2120 | + } |
|
| 2121 | + if (isset($line['symbol'])) { |
|
| 2122 | + $data['type'] = $line['symbol']; |
|
| 2123 | + } |
|
| 1525 | 2124 | //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
| 1526 | 2125 | |
| 1527 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
| 2126 | + if (isset($line['heading']) && isset($line['format_source'])) { |
|
| 2127 | + $data['heading'] = $line['heading']; |
|
| 2128 | + } |
|
| 1528 | 2129 | //else echo 'No heading...'."\n"; |
| 1529 | 2130 | //else $data['heading'] = 0; |
| 1530 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 2131 | + if (isset($line['stealth'])) { |
|
| 2132 | + $data['aircraft_type'] = $line['stealth']; |
|
| 2133 | + } |
|
| 1531 | 2134 | //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; |
|
| 2135 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { |
|
| 2136 | + $data['noarchive'] = true; |
|
| 2137 | + } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { |
|
| 2138 | + $data['noarchive'] = false; |
|
| 2139 | + } |
|
| 2140 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2141 | + $data['noarchive'] = true; |
|
| 2142 | + } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { |
|
| 2143 | + $data['noarchive'] = false; |
|
| 2144 | + } |
|
| 1536 | 2145 | $data['id_source'] = $id_source; |
| 1537 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
| 1538 | - else $data['format_source'] = 'aprs'; |
|
| 2146 | + if (isset($line['format_source'])) { |
|
| 2147 | + $data['format_source'] = $line['format_source']; |
|
| 2148 | + } else { |
|
| 2149 | + $data['format_source'] = 'aprs'; |
|
| 2150 | + } |
|
| 1539 | 2151 | $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']; |
|
| 2152 | + if (isset($line['source_type'])) { |
|
| 2153 | + $data['source_type'] = $line['source_type']; |
|
| 2154 | + } else { |
|
| 2155 | + $data['source_type'] = 'flarm'; |
|
| 2156 | + } |
|
| 2157 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2158 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2159 | + } |
|
| 1543 | 2160 | $currentdate = date('Y-m-d H:i:s'); |
| 1544 | 2161 | $aprsdate = strtotime($data['datetime']); |
| 1545 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
| 2162 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') { |
|
| 2163 | + $data['altitude_relative'] = 'AMSL'; |
|
| 2164 | + } |
|
| 1546 | 2165 | // Accept data if time <= system time + 20s |
| 1547 | 2166 | //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 | 2167 | 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 | 2168 | $send = $SI->add($data); |
| 1550 | 2169 | } elseif ($data['source_type'] == 'ais') { |
| 1551 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
|
| 2170 | + if (isset($globalMarine) && $globalMarine) { |
|
| 2171 | + $send = $MI->add($data); |
|
| 2172 | + } |
|
| 1552 | 2173 | } elseif (isset($line['stealth'])) { |
| 1553 | - if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
| 1554 | - else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
| 2174 | + if ($line['stealth'] != 0) { |
|
| 2175 | + echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
| 2176 | + } else { |
|
| 2177 | + echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
| 2178 | + } |
|
| 1555 | 2179 | } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1556 | 2180 | //$line['symbol'] == 'Balloon' || |
| 1557 | 2181 | $line['symbol'] == 'Glider' || |
| 1558 | 2182 | $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'; |
|
| 2183 | + if ($line['symbol'] == 'Ballon') { |
|
| 2184 | + $data['aircraft_icao'] = 'BALL'; |
|
| 2185 | + } |
|
| 2186 | + if ($line['symbol'] == 'Glider') { |
|
| 2187 | + $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2188 | + } |
|
| 1561 | 2189 | $send = $SI->add($data); |
| 1562 | 2190 | } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1563 | 2191 | $line['symbol'] == 'Yacht (Sail)' || |
@@ -1588,9 +2216,13 @@ discard block |
||
| 1588 | 2216 | //} 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 | 2217 | // } 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 | 2218 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
| 1591 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
|
| 2219 | + if (isset($globalTracker) && $globalTracker) { |
|
| 2220 | + $send = $TI->add($data); |
|
| 2221 | + } |
|
| 1592 | 2222 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
| 1593 | - if (!isset($data['altitude'])) $data['altitude'] = 0; |
|
| 2223 | + if (!isset($data['altitude'])) { |
|
| 2224 | + $data['altitude'] = 0; |
|
| 2225 | + } |
|
| 1594 | 2226 | $Source->deleteOldLocationByType('gs'); |
| 1595 | 2227 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
| 1596 | 2228 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
@@ -1599,7 +2231,9 @@ discard block |
||
| 1599 | 2231 | } |
| 1600 | 2232 | } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
| 1601 | 2233 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1602 | - if ($globalDebug) echo '# Weather Station added'."\n"; |
|
| 2234 | + if ($globalDebug) { |
|
| 2235 | + echo '# Weather Station added'."\n"; |
|
| 2236 | + } |
|
| 1603 | 2237 | $Source->deleteOldLocationByType('wx'); |
| 1604 | 2238 | $weather_data = json_encode($line); |
| 1605 | 2239 | if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
@@ -1609,7 +2243,9 @@ discard block |
||
| 1609 | 2243 | } |
| 1610 | 2244 | } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) { |
| 1611 | 2245 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1612 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2246 | + if ($globalDebug) { |
|
| 2247 | + echo '☈ Lightning added'."\n"; |
|
| 2248 | + } |
|
| 1613 | 2249 | $Source->deleteOldLocationByType('lightning'); |
| 1614 | 2250 | if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
| 1615 | 2251 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
@@ -1621,8 +2257,7 @@ discard block |
||
| 1621 | 2257 | print_r($line); |
| 1622 | 2258 | } |
| 1623 | 2259 | unset($data); |
| 1624 | - } |
|
| 1625 | - elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 2260 | + } elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 1626 | 2261 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
| 1627 | 2262 | } |
| 1628 | 2263 | /* |
@@ -1631,7 +2266,9 @@ discard block |
||
| 1631 | 2266 | } |
| 1632 | 2267 | */ |
| 1633 | 2268 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 1634 | - elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
|
| 2269 | + elseif ($line == true && $globalDebug) { |
|
| 2270 | + echo '!! Failed : '.$buffer."!!\n"; |
|
| 2271 | + } |
|
| 1635 | 2272 | if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
| 1636 | 2273 | $Source->deleteOldLocationByType('lightning'); |
| 1637 | 2274 | $Source->deleteOldLocationByType('wx'); |
@@ -1667,26 +2304,45 @@ discard block |
||
| 1667 | 2304 | $data['ground'] = $line[21]; |
| 1668 | 2305 | $data['emergency'] = $line[19]; |
| 1669 | 2306 | $data['format_source'] = 'sbs'; |
| 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']; |
|
| 1672 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 2307 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2308 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2309 | + } |
|
| 2310 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2311 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2312 | + } |
|
| 2313 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2314 | + $data['noarchive'] = true; |
|
| 2315 | + } |
|
| 1673 | 2316 | $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; |
|
| 2317 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2318 | + $send = $SI->add($data); |
|
| 2319 | + } else { |
|
| 2320 | + $error = true; |
|
| 2321 | + } |
|
| 1676 | 2322 | unset($data); |
| 1677 | - } else $error = true; |
|
| 2323 | + } else { |
|
| 2324 | + $error = true; |
|
| 2325 | + } |
|
| 1678 | 2326 | if ($error) { |
| 1679 | 2327 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
| 1680 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; |
|
| 2328 | + if ($globalDebug) { |
|
| 2329 | + echo "Not a message. Ignoring... \n"; |
|
| 2330 | + } |
|
| 1681 | 2331 | } else { |
| 1682 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; |
|
| 2332 | + if ($globalDebug) { |
|
| 2333 | + echo "Wrong line format. Ignoring... \n"; |
|
| 2334 | + } |
|
| 1683 | 2335 | if ($globalDebug) { |
| 1684 | 2336 | echo $buffer; |
| 1685 | 2337 | //print_r($line); |
| 1686 | 2338 | } |
| 1687 | 2339 | //socket_close($r); |
| 1688 | - if ($globalDebug) echo "Reconnect after an error...\n"; |
|
| 1689 | - if ($format == 'aprs') $aprs_connect = 0; |
|
| 2340 | + if ($globalDebug) { |
|
| 2341 | + echo "Reconnect after an error...\n"; |
|
| 2342 | + } |
|
| 2343 | + if ($format == 'aprs') { |
|
| 2344 | + $aprs_connect = 0; |
|
| 2345 | + } |
|
| 1690 | 2346 | $sourceer[$nb] = $globalSources[$nb]; |
| 1691 | 2347 | connect_all($sourceer); |
| 1692 | 2348 | $sourceer = array(); |
@@ -1694,10 +2350,14 @@ discard block |
||
| 1694 | 2350 | } |
| 1695 | 2351 | } |
| 1696 | 2352 | // Sleep for xxx microseconds |
| 1697 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
|
| 2353 | + if (isset($globalSBSSleep)) { |
|
| 2354 | + usleep($globalSBSSleep); |
|
| 2355 | + } |
|
| 1698 | 2356 | } else { |
| 1699 | 2357 | if ($format == 'flightgearmp') { |
| 1700 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 2358 | + if ($globalDebug) { |
|
| 2359 | + echo "Reconnect FlightGear MP..."; |
|
| 2360 | + } |
|
| 1701 | 2361 | //@socket_close($r); |
| 1702 | 2362 | sleep($globalMinFetch); |
| 1703 | 2363 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1706,10 +2366,15 @@ discard block |
||
| 1706 | 2366 | break; |
| 1707 | 2367 | |
| 1708 | 2368 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1709 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1710 | - else $tt[$format] = 0; |
|
| 2369 | + if (isset($tt[$format])) { |
|
| 2370 | + $tt[$format]++; |
|
| 2371 | + } else { |
|
| 2372 | + $tt[$format] = 0; |
|
| 2373 | + } |
|
| 1711 | 2374 | if ($tt[$format] > 30) { |
| 1712 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
|
| 2375 | + if ($globalDebug) { |
|
| 2376 | + echo "ERROR : Reconnect ".$format."..."; |
|
| 2377 | + } |
|
| 1713 | 2378 | //@socket_close($r); |
| 1714 | 2379 | sleep(2); |
| 1715 | 2380 | $aprs_connect = 0; |
@@ -1726,11 +2391,17 @@ discard block |
||
| 1726 | 2391 | } else { |
| 1727 | 2392 | $error = socket_strerror(socket_last_error()); |
| 1728 | 2393 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 1729 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 1730 | - if (isset($globalDebug)) echo "Restarting...\n"; |
|
| 2394 | + if ($globalDebug) { |
|
| 2395 | + echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 2396 | + } |
|
| 2397 | + if (isset($globalDebug)) { |
|
| 2398 | + echo "Restarting...\n"; |
|
| 2399 | + } |
|
| 1731 | 2400 | // Restart the script if possible |
| 1732 | 2401 | if (is_array($sockets)) { |
| 1733 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 2402 | + if ($globalDebug) { |
|
| 2403 | + echo "Shutdown all sockets..."; |
|
| 2404 | + } |
|
| 1734 | 2405 | |
| 1735 | 2406 | foreach ($sockets as $sock) { |
| 1736 | 2407 | @socket_shutdown($sock,2); |
@@ -1738,25 +2409,45 @@ discard block |
||
| 1738 | 2409 | } |
| 1739 | 2410 | |
| 1740 | 2411 | } |
| 1741 | - if ($globalDebug) echo "Waiting..."; |
|
| 2412 | + if ($globalDebug) { |
|
| 2413 | + echo "Waiting..."; |
|
| 2414 | + } |
|
| 1742 | 2415 | sleep(2); |
| 1743 | 2416 | $time = time(); |
| 1744 | 2417 | //connect_all($hosts); |
| 1745 | 2418 | $aprs_connect = 0; |
| 1746 | - if ($reset%5 == 0) sleep(20); |
|
| 1747 | - if ($reset%10 == 0) sleep(100); |
|
| 1748 | - if ($reset%20 == 0) sleep(200); |
|
| 1749 | - if ($reset > 100) exit('Too many attempts...'); |
|
| 1750 | - if ($globalDebug) echo "Restart all connections..."; |
|
| 2419 | + if ($reset%5 == 0) { |
|
| 2420 | + sleep(20); |
|
| 2421 | + } |
|
| 2422 | + if ($reset%10 == 0) { |
|
| 2423 | + sleep(100); |
|
| 2424 | + } |
|
| 2425 | + if ($reset%20 == 0) { |
|
| 2426 | + sleep(200); |
|
| 2427 | + } |
|
| 2428 | + if ($reset > 100) { |
|
| 2429 | + exit('Too many attempts...'); |
|
| 2430 | + } |
|
| 2431 | + if ($globalDebug) { |
|
| 2432 | + echo "Restart all connections..."; |
|
| 2433 | + } |
|
| 1751 | 2434 | connect_all($globalSources); |
| 1752 | 2435 | } |
| 1753 | 2436 | } |
| 1754 | 2437 | } |
| 1755 | 2438 | 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(); |
|
| 2439 | + if ($globalDebug) { |
|
| 2440 | + echo 'Check all...'."\n"; |
|
| 2441 | + } |
|
| 2442 | + if (isset($SI)) { |
|
| 2443 | + $SI->checkAll(); |
|
| 2444 | + } |
|
| 2445 | + if (isset($TI)) { |
|
| 2446 | + $TI->checkAll(); |
|
| 2447 | + } |
|
| 2448 | + if (isset($MI)) { |
|
| 2449 | + $MI->checkAll(); |
|
| 2450 | + } |
|
| 1760 | 2451 | } |
| 1761 | 2452 | } |
| 1762 | 2453 | } |