@@ -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); |
@@ -143,7 +188,9 @@ discard block |
||
| 143 | 188 | } |
| 144 | 189 | |
| 145 | 190 | // let's try and connect |
| 146 | -if ($globalDebug) echo "Connecting...\n"; |
|
| 191 | +if ($globalDebug) { |
|
| 192 | + echo "Connecting...\n"; |
|
| 193 | +} |
|
| 147 | 194 | $use_aprs = false; |
| 148 | 195 | $aprs_full = false; |
| 149 | 196 | $reset = 0; |
@@ -152,7 +199,9 @@ discard block |
||
| 152 | 199 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
| 153 | 200 | global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
| 154 | 201 | $reset++; |
| 155 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 202 | + if ($globalDebug) { |
|
| 203 | + echo 'Connect to all...'."\n"; |
|
| 204 | + } |
|
| 156 | 205 | foreach ($hosts as $id => $value) { |
| 157 | 206 | $host = $value['host']; |
| 158 | 207 | $globalSources[$id]['last_exec'] = 0; |
@@ -162,22 +211,30 @@ discard block |
||
| 162 | 211 | //$formats[$id] = 'deltadbtxt'; |
| 163 | 212 | $globalSources[$id]['format'] = 'deltadbtxt'; |
| 164 | 213 | //$last_exec['deltadbtxt'] = 0; |
| 165 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 214 | + if ($globalDebug) { |
|
| 215 | + echo "Connect to deltadb source (".$host.")...\n"; |
|
| 216 | + } |
|
| 166 | 217 | } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
| 167 | 218 | //$formats[$id] = 'vatsimtxt'; |
| 168 | 219 | $globalSources[$id]['format'] = 'vatsimtxt'; |
| 169 | 220 | //$last_exec['vatsimtxt'] = 0; |
| 170 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 221 | + if ($globalDebug) { |
|
| 222 | + echo "Connect to vatsim source (".$host.")...\n"; |
|
| 223 | + } |
|
| 171 | 224 | } else if (preg_match('/aircraftlist.json$/i',$host)) { |
| 172 | 225 | //$formats[$id] = 'aircraftlistjson'; |
| 173 | 226 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
| 174 | 227 | //$last_exec['aircraftlistjson'] = 0; |
| 175 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 228 | + if ($globalDebug) { |
|
| 229 | + echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 230 | + } |
|
| 176 | 231 | } else if (preg_match('/opensky/i',$host)) { |
| 177 | 232 | //$formats[$id] = 'aircraftlistjson'; |
| 178 | 233 | $globalSources[$id]['format'] = 'opensky'; |
| 179 | 234 | //$last_exec['aircraftlistjson'] = 0; |
| 180 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 235 | + if ($globalDebug) { |
|
| 236 | + echo "Connect to opensky source (".$host.")...\n"; |
|
| 237 | + } |
|
| 181 | 238 | /* |
| 182 | 239 | // Disabled for now, site change source format |
| 183 | 240 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
@@ -194,7 +251,9 @@ discard block |
||
| 194 | 251 | //$formats[$id] = 'planeupdatefaa'; |
| 195 | 252 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
| 196 | 253 | //$last_exec['planeupdatefaa'] = 0; |
| 197 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 254 | + if ($globalDebug) { |
|
| 255 | + echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 256 | + } |
|
| 198 | 257 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 199 | 258 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 200 | 259 | exit(0); |
@@ -203,32 +262,46 @@ discard block |
||
| 203 | 262 | //$formats[$id] = 'phpvmacars'; |
| 204 | 263 | $globalSources[$id]['format'] = 'phpvmacars'; |
| 205 | 264 | //$last_exec['phpvmacars'] = 0; |
| 206 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 265 | + if ($globalDebug) { |
|
| 266 | + echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 267 | + } |
|
| 207 | 268 | } else if (preg_match('/VAM-json.php$/i',$host)) { |
| 208 | 269 | //$formats[$id] = 'phpvmacars'; |
| 209 | 270 | $globalSources[$id]['format'] = 'vam'; |
| 210 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 271 | + if ($globalDebug) { |
|
| 272 | + echo "Connect to Vam source (".$host.")...\n"; |
|
| 273 | + } |
|
| 211 | 274 | } else if (preg_match('/whazzup/i',$host)) { |
| 212 | 275 | //$formats[$id] = 'whazzup'; |
| 213 | 276 | $globalSources[$id]['format'] = 'whazzup'; |
| 214 | 277 | //$last_exec['whazzup'] = 0; |
| 215 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 278 | + if ($globalDebug) { |
|
| 279 | + echo "Connect to whazzup source (".$host.")...\n"; |
|
| 280 | + } |
|
| 216 | 281 | } else if (preg_match('/blitzortung/i',$host)) { |
| 217 | 282 | $globalSources[$id]['format'] = 'blitzortung'; |
| 218 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 283 | + if ($globalDebug) { |
|
| 284 | + echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 285 | + } |
|
| 219 | 286 | } else if (preg_match('/airwhere/i',$host)) { |
| 220 | 287 | $globalSources[$id]['format'] = 'airwhere'; |
| 221 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
| 288 | + if ($globalDebug) { |
|
| 289 | + echo "Connect to airwhere source (".$host.")...\n"; |
|
| 290 | + } |
|
| 222 | 291 | } else if (preg_match('/recentpireps/i',$host)) { |
| 223 | 292 | //$formats[$id] = 'pirepsjson'; |
| 224 | 293 | $globalSources[$id]['format'] = 'pirepsjson'; |
| 225 | 294 | //$last_exec['pirepsjson'] = 0; |
| 226 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 295 | + if ($globalDebug) { |
|
| 296 | + echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 297 | + } |
|
| 227 | 298 | } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
| 228 | 299 | //$formats[$id] = 'fr24json'; |
| 229 | 300 | $globalSources[$id]['format'] = 'fr24json'; |
| 230 | 301 | //$last_exec['fr24json'] = 0; |
| 231 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 302 | + if ($globalDebug) { |
|
| 303 | + echo "Connect to fr24 source (".$host.")...\n"; |
|
| 304 | + } |
|
| 232 | 305 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 233 | 306 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 234 | 307 | exit(0); |
@@ -237,7 +310,9 @@ discard block |
||
| 237 | 310 | //$formats[$id] = 'fr24json'; |
| 238 | 311 | $globalSources[$id]['format'] = 'myshiptracking'; |
| 239 | 312 | //$last_exec['fr24json'] = 0; |
| 240 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 313 | + if ($globalDebug) { |
|
| 314 | + echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 315 | + } |
|
| 241 | 316 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 242 | 317 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 243 | 318 | exit(0); |
@@ -246,16 +321,24 @@ discard block |
||
| 246 | 321 | } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
| 247 | 322 | //$formats[$id] = 'tsv'; |
| 248 | 323 | $globalSources[$id]['format'] = 'tsv'; |
| 249 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 324 | + if ($globalDebug) { |
|
| 325 | + echo "Connect to tsv source (".$host.")...\n"; |
|
| 326 | + } |
|
| 250 | 327 | } |
| 251 | 328 | } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
| 252 | 329 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
| 253 | 330 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
| 254 | 331 | if ($idf !== false) { |
| 255 | 332 | $httpfeeds[$id] = $idf; |
| 256 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 257 | - } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 258 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 333 | + if ($globalDebug) { |
|
| 334 | + echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 335 | + } |
|
| 336 | + } elseif ($globalDebug) { |
|
| 337 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 338 | + } |
|
| 339 | + } elseif ($globalDebug) { |
|
| 340 | + echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 341 | + } |
|
| 259 | 342 | } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
| 260 | 343 | $hostport = explode(':',$host); |
| 261 | 344 | if (isset($hostport[1])) { |
@@ -295,17 +378,25 @@ discard block |
||
| 295 | 378 | //$formats[$id] = 'beast'; |
| 296 | 379 | $globalSources[$id]['format'] = 'beast'; |
| 297 | 380 | //} else $formats[$id] = 'sbs'; |
| 298 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 381 | + } else { |
|
| 382 | + $globalSources[$id]['format'] = 'sbs'; |
|
| 383 | + } |
|
| 299 | 384 | //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
| 300 | 385 | } |
| 301 | - if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 386 | + if ($globalDebug) { |
|
| 387 | + echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 388 | + } |
|
| 302 | 389 | } else { |
| 303 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 390 | + if ($globalDebug) { |
|
| 391 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 392 | + } |
|
| 304 | 393 | } |
| 305 | 394 | } |
| 306 | 395 | } |
| 307 | 396 | } |
| 308 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; |
|
| 397 | +if (!isset($globalMinFetch)) { |
|
| 398 | + $globalMinFetch = 15; |
|
| 399 | +} |
|
| 309 | 400 | |
| 310 | 401 | // Initialize all |
| 311 | 402 | $status = array(); |
@@ -314,13 +405,19 @@ discard block |
||
| 314 | 405 | $formats = array(); |
| 315 | 406 | $last_exec = array(); |
| 316 | 407 | $time = time(); |
| 317 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; |
|
| 318 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
|
| 319 | -else $timeout = 20; |
|
| 408 | +if (isset($globalSourcesTimeout)) { |
|
| 409 | + $timeout = $globalSourcesTimeOut; |
|
| 410 | +} else if (isset($globalSBS1TimeOut)) { |
|
| 411 | + $timeout = $globalSBS1TimeOut; |
|
| 412 | +} else { |
|
| 413 | + $timeout = 20; |
|
| 414 | +} |
|
| 320 | 415 | $errno = ''; |
| 321 | 416 | $errstr=''; |
| 322 | 417 | |
| 323 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 418 | +if (!isset($globalDaemon)) { |
|
| 419 | + $globalDaemon = TRUE; |
|
| 420 | +} |
|
| 324 | 421 | /* Initiate connections to all the hosts simultaneously */ |
| 325 | 422 | //connect_all($hosts); |
| 326 | 423 | //connect_all($globalSources); |
@@ -349,7 +446,9 @@ discard block |
||
| 349 | 446 | if (isset($source['format']) && $source['format'] == 'aprs') { |
| 350 | 447 | $aprs_connect = 0; |
| 351 | 448 | $use_aprs = true; |
| 352 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
|
| 449 | + if (isset($source['port']) && $source['port'] == '10152') { |
|
| 450 | + $aprs_full = true; |
|
| 451 | + } |
|
| 353 | 452 | break; |
| 354 | 453 | } |
| 355 | 454 | } |
@@ -360,25 +459,46 @@ discard block |
||
| 360 | 459 | $aprs_connect = 0; |
| 361 | 460 | $aprs_keep = 120; |
| 362 | 461 | $aprs_last_tx = time(); |
| 363 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
| 364 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 365 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
|
| 366 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 367 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
|
| 368 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 369 | - if ($aprs_full) $aprs_filter = ''; |
|
| 370 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
|
| 371 | - else $aprs_pass = '-1'; |
|
| 462 | + if (isset($globalAPRSversion)) { |
|
| 463 | + $aprs_version = $globalAPRSversion; |
|
| 464 | + } else { |
|
| 465 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 466 | + } |
|
| 467 | + if (isset($globalAPRSssid)) { |
|
| 468 | + $aprs_ssid = $globalAPRSssid; |
|
| 469 | + } else { |
|
| 470 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 471 | + } |
|
| 472 | + if (isset($globalAPRSfilter)) { |
|
| 473 | + $aprs_filter = $globalAPRSfilter; |
|
| 474 | + } else { |
|
| 475 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 476 | + } |
|
| 477 | + if ($aprs_full) { |
|
| 478 | + $aprs_filter = ''; |
|
| 479 | + } |
|
| 480 | + if (isset($globalAPRSpass)) { |
|
| 481 | + $aprs_pass = $globalAPRSpass; |
|
| 482 | + } else { |
|
| 483 | + $aprs_pass = '-1'; |
|
| 484 | + } |
|
| 372 | 485 | |
| 373 | - if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 374 | - else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 375 | -} |
|
| 486 | + if ($aprs_filter != '') { |
|
| 487 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 488 | + } else { |
|
| 489 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 490 | + } |
|
| 491 | + } |
|
| 376 | 492 | |
| 377 | 493 | // connected - lets do some work |
| 378 | 494 | //if ($globalDebug) echo "Connected!\n"; |
| 379 | 495 | sleep(1); |
| 380 | -if ($globalDebug) echo "SCAN MODE \n\n"; |
|
| 381 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; |
|
| 496 | +if ($globalDebug) { |
|
| 497 | + echo "SCAN MODE \n\n"; |
|
| 498 | +} |
|
| 499 | +if (!isset($globalCronEnd)) { |
|
| 500 | + $globalCronEnd = 60; |
|
| 501 | +} |
|
| 382 | 502 | $endtime = time()+$globalCronEnd; |
| 383 | 503 | $i = 1; |
| 384 | 504 | $tt = array(); |
@@ -392,20 +512,28 @@ discard block |
||
| 392 | 512 | |
| 393 | 513 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 394 | 514 | while ($i > 0) { |
| 395 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 515 | + if (!$globalDaemon) { |
|
| 516 | + $i = $endtime-time(); |
|
| 517 | + } |
|
| 396 | 518 | // Delete old ATC |
| 397 | 519 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 398 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; |
|
| 520 | + if ($globalDebug) { |
|
| 521 | + echo 'Delete old ATC...'."\n"; |
|
| 522 | + } |
|
| 399 | 523 | $ATC->deleteOldATC(); |
| 400 | 524 | } |
| 401 | 525 | |
| 402 | 526 | if (count($last_exec) == count($globalSources)) { |
| 403 | 527 | $max = $globalMinFetch; |
| 404 | 528 | foreach ($last_exec as $last) { |
| 405 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 529 | + if ((time() - $last['last']) < $max) { |
|
| 530 | + $max = time() - $last['last']; |
|
| 531 | + } |
|
| 406 | 532 | } |
| 407 | 533 | if ($max != $globalMinFetch) { |
| 408 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 534 | + if ($globalDebug) { |
|
| 535 | + echo 'Sleeping...'."\n"; |
|
| 536 | + } |
|
| 409 | 537 | sleep($globalMinFetch-$max+2); |
| 410 | 538 | } |
| 411 | 539 | } |
@@ -415,7 +543,9 @@ discard block |
||
| 415 | 543 | foreach ($globalSources as $id => $value) { |
| 416 | 544 | date_default_timezone_set('UTC'); |
| 417 | 545 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
| 418 | - 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 | + } |
|
| 419 | 549 | if ($value['format'] == 'deltadbtxt' && |
| 420 | 550 | ( |
| 421 | 551 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
@@ -424,7 +554,9 @@ discard block |
||
| 424 | 554 | ) { |
| 425 | 555 | //$buffer = $Common->getData($hosts[$id]); |
| 426 | 556 | $buffer = $Common->getData($value['host']); |
| 427 | - if ($buffer != '') $reset = 0; |
|
| 557 | + if ($buffer != '') { |
|
| 558 | + $reset = 0; |
|
| 559 | + } |
|
| 428 | 560 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 429 | 561 | $buffer = explode('\n',$buffer); |
| 430 | 562 | foreach ($buffer as $line) { |
@@ -433,20 +565,41 @@ discard block |
||
| 433 | 565 | $data = array(); |
| 434 | 566 | $data['hex'] = $line[1]; // hex |
| 435 | 567 | $data['ident'] = $line[2]; // ident |
| 436 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 437 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 438 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 439 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 440 | - 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 |
|
| 441 | 588 | $data['verticalrate'] = ''; // vertical rate |
| 442 | 589 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
| 443 | 590 | $data['emergency'] = ''; // emergency |
| 444 | 591 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 445 | 592 | $data['format_source'] = 'deltadbtxt'; |
| 446 | 593 | $data['id_source'] = $id_source; |
| 447 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 448 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 449 | - 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 | + } |
|
| 450 | 603 | $SI->add($data); |
| 451 | 604 | unset($data); |
| 452 | 605 | } |
@@ -461,7 +614,9 @@ discard block |
||
| 461 | 614 | date_default_timezone_set('CET'); |
| 462 | 615 | $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
| 463 | 616 | date_default_timezone_set('UTC'); |
| 464 | - if ($buffer != '') $reset = 0; |
|
| 617 | + if ($buffer != '') { |
|
| 618 | + $reset = 0; |
|
| 619 | + } |
|
| 465 | 620 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 466 | 621 | $buffer = explode('\n',$buffer); |
| 467 | 622 | foreach ($buffer as $line) { |
@@ -470,16 +625,36 @@ discard block |
||
| 470 | 625 | $add = false; |
| 471 | 626 | $ais_data = $AIS->parse_line(trim($line)); |
| 472 | 627 | $data = array(); |
| 473 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 474 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 475 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 476 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 477 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 478 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 479 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 480 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 481 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 482 | - 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 | + } |
|
| 483 | 658 | if (isset($ais_data['timestamp'])) { |
| 484 | 659 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 485 | 660 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
@@ -493,8 +668,12 @@ discard block |
||
| 493 | 668 | $data['format_source'] = 'aisnmeatxt'; |
| 494 | 669 | $data['id_source'] = $id_source; |
| 495 | 670 | //print_r($data); |
| 496 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 497 | - 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 | + } |
|
| 498 | 677 | unset($data); |
| 499 | 678 | } |
| 500 | 679 | } |
@@ -517,20 +696,48 @@ discard block |
||
| 517 | 696 | if ($line != '') { |
| 518 | 697 | $ais_data = $AIS->parse_line(trim($line)); |
| 519 | 698 | $data = array(); |
| 520 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 521 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 522 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 523 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 524 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 525 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 526 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 527 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 528 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 529 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 530 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 531 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 532 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 533 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 699 | + if (isset($ais_data['ident'])) { |
|
| 700 | + $data['ident'] = $ais_data['ident']; |
|
| 701 | + } |
|
| 702 | + if (isset($ais_data['mmsi'])) { |
|
| 703 | + $data['mmsi'] = $ais_data['mmsi']; |
|
| 704 | + } |
|
| 705 | + if (isset($ais_data['speed'])) { |
|
| 706 | + $data['speed'] = $ais_data['speed']; |
|
| 707 | + } |
|
| 708 | + if (isset($ais_data['heading'])) { |
|
| 709 | + $data['heading'] = $ais_data['heading']; |
|
| 710 | + } |
|
| 711 | + if (isset($ais_data['latitude'])) { |
|
| 712 | + $data['latitude'] = $ais_data['latitude']; |
|
| 713 | + } |
|
| 714 | + if (isset($ais_data['longitude'])) { |
|
| 715 | + $data['longitude'] = $ais_data['longitude']; |
|
| 716 | + } |
|
| 717 | + if (isset($ais_data['status'])) { |
|
| 718 | + $data['status'] = $ais_data['status']; |
|
| 719 | + } |
|
| 720 | + if (isset($ais_data['statusid'])) { |
|
| 721 | + $data['status_id'] = $ais_data['statusid']; |
|
| 722 | + } |
|
| 723 | + if (isset($ais_data['type'])) { |
|
| 724 | + $data['type'] = $ais_data['type']; |
|
| 725 | + } |
|
| 726 | + if (isset($ais_data['typeid'])) { |
|
| 727 | + $data['type_id'] = $ais_data['typeid']; |
|
| 728 | + } |
|
| 729 | + if (isset($ais_data['imo'])) { |
|
| 730 | + $data['imo'] = $ais_data['imo']; |
|
| 731 | + } |
|
| 732 | + if (isset($ais_data['callsign'])) { |
|
| 733 | + $data['callsign'] = $ais_data['callsign']; |
|
| 734 | + } |
|
| 735 | + if (isset($ais_data['destination'])) { |
|
| 736 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 737 | + } |
|
| 738 | + if (isset($ais_data['eta_ts'])) { |
|
| 739 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 740 | + } |
|
| 534 | 741 | if (isset($ais_data['timestamp'])) { |
| 535 | 742 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 536 | 743 | } else { |
@@ -538,18 +745,27 @@ discard block |
||
| 538 | 745 | } |
| 539 | 746 | $data['format_source'] = 'aisnmeahttp'; |
| 540 | 747 | $data['id_source'] = $id_source; |
| 541 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 542 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
| 748 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 749 | + $data['noarchive'] = true; |
|
| 750 | + } |
|
| 751 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
| 752 | + $MI->add($data); |
|
| 753 | + } |
|
| 543 | 754 | unset($data); |
| 544 | 755 | } |
| 545 | 756 | } |
| 546 | 757 | } |
| 547 | 758 | } else { |
| 548 | 759 | $format = $value['format']; |
| 549 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 550 | - else $tt[$format] = 0; |
|
| 760 | + if (isset($tt[$format])) { |
|
| 761 | + $tt[$format]++; |
|
| 762 | + } else { |
|
| 763 | + $tt[$format] = 0; |
|
| 764 | + } |
|
| 551 | 765 | if ($tt[$format] > 30) { |
| 552 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
| 766 | + if ($globalDebug) { |
|
| 767 | + echo 'Reconnect...'."\n"; |
|
| 768 | + } |
|
| 553 | 769 | sleep(2); |
| 554 | 770 | //$sourceeen[] = $value; |
| 555 | 771 | //connect_all($sourceeen); |
@@ -588,7 +804,9 @@ discard block |
||
| 588 | 804 | $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
| 589 | 805 | $data['format_source'] = 'myshiptracking'; |
| 590 | 806 | $data['id_source'] = $id_source; |
| 591 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 807 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 808 | + $data['noarchive'] = true; |
|
| 809 | + } |
|
| 592 | 810 | $MI->add($data); |
| 593 | 811 | unset($data); |
| 594 | 812 | } |
@@ -613,7 +831,9 @@ discard block |
||
| 613 | 831 | $data['callsign'] = $line['callsign']; |
| 614 | 832 | $data['mmsi'] = $line['mmsi']; |
| 615 | 833 | $data['speed'] = $line['sog']; |
| 616 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
| 834 | + if ($line['heading'] != '511') { |
|
| 835 | + $data['heading'] = $line['heading']; |
|
| 836 | + } |
|
| 617 | 837 | $data['latitude'] = $line['latitude']; |
| 618 | 838 | $data['longitude'] = $line['longitude']; |
| 619 | 839 | $data['type_id'] = $line['shiptype']; |
@@ -621,7 +841,9 @@ discard block |
||
| 621 | 841 | $data['datetime'] = $line['time']; |
| 622 | 842 | $data['format_source'] = 'boatbeaconapp'; |
| 623 | 843 | $data['id_source'] = $id_source; |
| 624 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 844 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 845 | + $data['noarchive'] = true; |
|
| 846 | + } |
|
| 625 | 847 | $MI->add($data); |
| 626 | 848 | unset($data); |
| 627 | 849 | } |
@@ -642,22 +864,44 @@ discard block |
||
| 642 | 864 | if (isset($all_data['features'][0]['id'])) { |
| 643 | 865 | foreach ($all_data['features'] as $line) { |
| 644 | 866 | $data = array(); |
| 645 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
|
| 646 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
|
| 647 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = $line['properties']['mmsi']; |
|
| 648 | - if (isset($line['properties']['imo'])) $data['mmsi'] = $line['properties']['imo']; |
|
| 649 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
|
| 650 | - if (isset($line['properties']['heading'])) $data['heading'] = $line['properties']['heading']; |
|
| 867 | + if (isset($line['properties']['name'])) { |
|
| 868 | + $data['ident'] = $line['properties']['name']; |
|
| 869 | + } |
|
| 870 | + if (isset($line['properties']['callsign'])) { |
|
| 871 | + $data['callsign'] = $line['properties']['callsign']; |
|
| 872 | + } |
|
| 873 | + if (isset($line['properties']['mmsi'])) { |
|
| 874 | + $data['mmsi'] = $line['properties']['mmsi']; |
|
| 875 | + } |
|
| 876 | + if (isset($line['properties']['imo'])) { |
|
| 877 | + $data['mmsi'] = $line['properties']['imo']; |
|
| 878 | + } |
|
| 879 | + if (isset($line['properties']['speed'])) { |
|
| 880 | + $data['speed'] = $line['properties']['speed']; |
|
| 881 | + } |
|
| 882 | + if (isset($line['properties']['heading'])) { |
|
| 883 | + $data['heading'] = $line['properties']['heading']; |
|
| 884 | + } |
|
| 651 | 885 | $data['latitude'] = $line['geometry']['coordinates'][1]; |
| 652 | 886 | $data['longitude'] = $line['geometry']['coordinates'][0]; |
| 653 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; |
|
| 654 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; |
|
| 655 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; |
|
| 887 | + if (isset($line['properties']['vesselType'])) { |
|
| 888 | + $data['type'] = $line['properties']['vesselType']; |
|
| 889 | + } |
|
| 890 | + if (isset($line['properties']['destination'])) { |
|
| 891 | + $data['arrival_code'] = $line['properties']['destination']; |
|
| 892 | + } |
|
| 893 | + if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { |
|
| 894 | + $data['arrival_date'] = $line['properties']['eta']; |
|
| 895 | + } |
|
| 656 | 896 | $data['format_source'] = 'boatnerd'; |
| 657 | 897 | $data['id_source'] = $id_source; |
| 658 | 898 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 659 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 660 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
|
| 899 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 900 | + $data['noarchive'] = true; |
|
| 901 | + } |
|
| 902 | + if ($line['properties']['vesselType'] != 'Navigation Aid') { |
|
| 903 | + $MI->add($data); |
|
| 904 | + } |
|
| 661 | 905 | unset($data); |
| 662 | 906 | } |
| 663 | 907 | } |
@@ -673,7 +917,9 @@ discard block |
||
| 673 | 917 | echo 'download...'; |
| 674 | 918 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
| 675 | 919 | echo 'done !'."\n"; |
| 676 | - if ($buffer != '') $reset = 0; |
|
| 920 | + if ($buffer != '') { |
|
| 921 | + $reset = 0; |
|
| 922 | + } |
|
| 677 | 923 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 678 | 924 | $buffer = explode('\n',$buffer); |
| 679 | 925 | foreach ($buffer as $line) { |
@@ -698,7 +944,9 @@ discard block |
||
| 698 | 944 | //$data['etaTime'] = substr($line,135,5); |
| 699 | 945 | $data['format_source'] = 'shipplotter'; |
| 700 | 946 | $data['id_source'] = $id_source; |
| 701 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 947 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 948 | + $data['noarchive'] = true; |
|
| 949 | + } |
|
| 702 | 950 | //print_r($data); |
| 703 | 951 | echo 'Add...'."\n"; |
| 704 | 952 | $MI->add($data); |
@@ -732,16 +980,28 @@ discard block |
||
| 732 | 980 | $line = explode(':', $line); |
| 733 | 981 | if (count($line) > 30 && $line[0] != 'callsign') { |
| 734 | 982 | $data = array(); |
| 735 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 736 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 983 | + if (isset($line[37]) && $line[37] != '') { |
|
| 984 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 985 | + } else { |
|
| 986 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 987 | + } |
|
| 737 | 988 | $data['pilot_id'] = $line[1]; |
| 738 | 989 | $data['pilot_name'] = $line[2]; |
| 739 | 990 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
| 740 | 991 | $data['ident'] = $line[0]; // ident |
| 741 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
|
| 992 | + if ($line[7] != '' && $line[7] != 0) { |
|
| 993 | + $data['altitude'] = $line[7]; |
|
| 994 | + } |
|
| 995 | + // altitude |
|
| 742 | 996 | $data['speed'] = $line[8]; // speed |
| 743 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading |
|
| 744 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
|
| 997 | + if (isset($line[45])) { |
|
| 998 | + $data['heading'] = $line[45]; |
|
| 999 | + } |
|
| 1000 | + // heading |
|
| 1001 | + elseif (isset($line[38])) { |
|
| 1002 | + $data['heading'] = $line[38]; |
|
| 1003 | + } |
|
| 1004 | + // heading |
|
| 745 | 1005 | $data['latitude'] = $line[5]; // lat |
| 746 | 1006 | $data['longitude'] = $line[6]; // long |
| 747 | 1007 | $data['verticalrate'] = ''; // vertical rate |
@@ -757,7 +1017,9 @@ discard block |
||
| 757 | 1017 | $data['frequency'] = $line[4]; |
| 758 | 1018 | $data['type'] = $line[18]; |
| 759 | 1019 | $data['range'] = $line[19]; |
| 760 | - if (isset($line[35])) $data['info'] = $line[35]; |
|
| 1020 | + if (isset($line[35])) { |
|
| 1021 | + $data['info'] = $line[35]; |
|
| 1022 | + } |
|
| 761 | 1023 | $data['id_source'] = $id_source; |
| 762 | 1024 | //$data['arrival_airport_time'] = ; |
| 763 | 1025 | if ($line[9] != '') { |
@@ -771,27 +1033,47 @@ discard block |
||
| 771 | 1033 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 772 | 1034 | */ |
| 773 | 1035 | $data['format_source'] = $value['format']; |
| 774 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 775 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 776 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
| 777 | - elseif ($line[3] == 'ATC') { |
|
| 1036 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1037 | + $data['noarchive'] = true; |
|
| 1038 | + } |
|
| 1039 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1040 | + $data['source_name'] = $value['name']; |
|
| 1041 | + } |
|
| 1042 | + if ($line[3] == 'PILOT') { |
|
| 1043 | + $SI->add($data); |
|
| 1044 | + } elseif ($line[3] == 'ATC') { |
|
| 778 | 1045 | //print_r($data); |
| 779 | 1046 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 780 | 1047 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 781 | 1048 | $typec = substr($data['ident'],-3); |
| 782 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
| 783 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
| 784 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
| 785 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
| 786 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
| 787 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
| 788 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 789 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 790 | - elseif ($data['type'] == '') $data['type'] = 'Observer'; |
|
| 791 | - if (!isset($data['source_name'])) $data['source_name'] = ''; |
|
| 1049 | + if ($typec == 'APP') { |
|
| 1050 | + $data['type'] = 'Approach'; |
|
| 1051 | + } elseif ($typec == 'TWR') { |
|
| 1052 | + $data['type'] = 'Tower'; |
|
| 1053 | + } elseif ($typec == 'OBS') { |
|
| 1054 | + $data['type'] = 'Observer'; |
|
| 1055 | + } elseif ($typec == 'GND') { |
|
| 1056 | + $data['type'] = 'Ground'; |
|
| 1057 | + } elseif ($typec == 'DEL') { |
|
| 1058 | + $data['type'] = 'Delivery'; |
|
| 1059 | + } elseif ($typec == 'DEP') { |
|
| 1060 | + $data['type'] = 'Departure'; |
|
| 1061 | + } elseif ($typec == 'FSS') { |
|
| 1062 | + $data['type'] = 'Flight Service Station'; |
|
| 1063 | + } elseif ($typec == 'CTR') { |
|
| 1064 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1065 | + } elseif ($data['type'] == '') { |
|
| 1066 | + $data['type'] = 'Observer'; |
|
| 1067 | + } |
|
| 1068 | + if (!isset($data['source_name'])) { |
|
| 1069 | + $data['source_name'] = ''; |
|
| 1070 | + } |
|
| 792 | 1071 | if (isset($ATC)) { |
| 793 | - 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']); |
|
| 794 | - 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']); |
|
| 1072 | + if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { |
|
| 1073 | + 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']); |
|
| 1074 | + } else { |
|
| 1075 | + 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']); |
|
| 1076 | + } |
|
| 795 | 1077 | } |
| 796 | 1078 | } |
| 797 | 1079 | unset($data); |
@@ -818,14 +1100,20 @@ discard block |
||
| 818 | 1100 | $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
| 819 | 1101 | $data['latitude'] = (float)$line['pktLatitude']; |
| 820 | 1102 | $data['longitude'] = (float)$line['pktLongitude']; |
| 821 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
| 822 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
| 1103 | + if ((float)$line['pktTrack'] != 0) { |
|
| 1104 | + $data['heading'] = (float)$line['pktTrack']; |
|
| 1105 | + } |
|
| 1106 | + if ((int)$line['pktSpeed'] != 0) { |
|
| 1107 | + $data['speed'] = (int)$line['pktSpeed']; |
|
| 1108 | + } |
|
| 823 | 1109 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
| 824 | 1110 | $data['altitude_relative'] = 'AMSL'; |
| 825 | 1111 | $data['pilot_id'] = (int)$line['pktPilotID']; |
| 826 | 1112 | $data['aircraft_icao'] = 'PARAGLIDER'; |
| 827 | 1113 | $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
| 828 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
|
| 1114 | + if (isset($pilot_data[4])) { |
|
| 1115 | + $data['pilot_name'] = $pilot_data[4]; |
|
| 1116 | + } |
|
| 829 | 1117 | $data['format_source'] = $value['format']; |
| 830 | 1118 | $SI->add($data); |
| 831 | 1119 | unset($data); |
@@ -873,25 +1161,59 @@ discard block |
||
| 873 | 1161 | foreach ($all_data['acList'] as $line) { |
| 874 | 1162 | $data = array(); |
| 875 | 1163 | $data['hex'] = $line['Icao']; // hex |
| 876 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 877 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 878 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 879 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 880 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 881 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 1164 | + if (isset($line['Call'])) { |
|
| 1165 | + $data['ident'] = $line['Call']; |
|
| 1166 | + } |
|
| 1167 | + // ident |
|
| 1168 | + if (isset($line['Alt'])) { |
|
| 1169 | + $data['altitude'] = $line['Alt']; |
|
| 1170 | + } |
|
| 1171 | + // altitude |
|
| 1172 | + if (isset($line['Spd'])) { |
|
| 1173 | + $data['speed'] = $line['Spd']; |
|
| 1174 | + } |
|
| 1175 | + // speed |
|
| 1176 | + if (isset($line['Trak'])) { |
|
| 1177 | + $data['heading'] = $line['Trak']; |
|
| 1178 | + } |
|
| 1179 | + // heading |
|
| 1180 | + if (isset($line['Lat'])) { |
|
| 1181 | + $data['latitude'] = $line['Lat']; |
|
| 1182 | + } |
|
| 1183 | + // lat |
|
| 1184 | + if (isset($line['Long'])) { |
|
| 1185 | + $data['longitude'] = $line['Long']; |
|
| 1186 | + } |
|
| 1187 | + // long |
|
| 882 | 1188 | //$data['verticalrate'] = $line['']; // verticale rate |
| 883 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 1189 | + if (isset($line['Sqk'])) { |
|
| 1190 | + $data['squawk'] = $line['Sqk']; |
|
| 1191 | + } |
|
| 1192 | + // squawk |
|
| 884 | 1193 | $data['emergency'] = ''; // emergency |
| 885 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 886 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 887 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1194 | + if (isset($line['Reg'])) { |
|
| 1195 | + $data['registration'] = $line['Reg']; |
|
| 1196 | + } |
|
| 1197 | + if (isset($line['PosTime'])) { |
|
| 1198 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1199 | + } else { |
|
| 1200 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1201 | + } |
|
| 888 | 1202 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 889 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 1203 | + if (isset($line['Type'])) { |
|
| 1204 | + $data['aircraft_icao'] = $line['Type']; |
|
| 1205 | + } |
|
| 890 | 1206 | $data['format_source'] = 'aircraftlistjson'; |
| 891 | 1207 | $data['id_source'] = $id_source; |
| 892 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 893 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 894 | - if (isset($data['latitude'])) $SI->add($data); |
|
| 1208 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1209 | + $data['source_name'] = $value['name']; |
|
| 1210 | + } |
|
| 1211 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1212 | + $data['noarchive'] = true; |
|
| 1213 | + } |
|
| 1214 | + if (isset($data['latitude'])) { |
|
| 1215 | + $SI->add($data); |
|
| 1216 | + } |
|
| 895 | 1217 | unset($data); |
| 896 | 1218 | } |
| 897 | 1219 | } elseif (is_array($all_data)) { |
@@ -908,17 +1230,26 @@ discard block |
||
| 908 | 1230 | $data['verticalrate'] = $line['vrt']; // verticale rate |
| 909 | 1231 | $data['squawk'] = $line['squawk']; // squawk |
| 910 | 1232 | $data['emergency'] = ''; // emergency |
| 911 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 912 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1233 | + if (isset($line['PosTime'])) { |
|
| 1234 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1235 | + } else { |
|
| 1236 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1237 | + } |
|
| 913 | 1238 | $data['format_source'] = 'aircraftlistjson'; |
| 914 | 1239 | $data['id_source'] = $id_source; |
| 915 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 916 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1240 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1241 | + $data['noarchive'] = true; |
|
| 1242 | + } |
|
| 1243 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1244 | + $data['source_name'] = $value['name']; |
|
| 1245 | + } |
|
| 917 | 1246 | $SI->add($data); |
| 918 | 1247 | unset($data); |
| 919 | 1248 | } |
| 920 | 1249 | } |
| 921 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
| 1250 | + } elseif ($globalDebug) { |
|
| 1251 | + echo 'No data'."\n"; |
|
| 1252 | + } |
|
| 922 | 1253 | //$last_exec['aircraftlistjson'] = time(); |
| 923 | 1254 | $last_exec[$id]['last'] = time(); |
| 924 | 1255 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
@@ -954,8 +1285,12 @@ discard block |
||
| 954 | 1285 | $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
| 955 | 1286 | $data['format_source'] = 'planeupdatefaa'; |
| 956 | 1287 | $data['id_source'] = $id_source; |
| 957 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 958 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1288 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1289 | + $data['noarchive'] = true; |
|
| 1290 | + } |
|
| 1291 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1292 | + $data['source_name'] = $value['name']; |
|
| 1293 | + } |
|
| 959 | 1294 | $SI->add($data); |
| 960 | 1295 | unset($data); |
| 961 | 1296 | } |
@@ -989,7 +1324,9 @@ discard block |
||
| 989 | 1324 | $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
| 990 | 1325 | $data['format_source'] = 'opensky'; |
| 991 | 1326 | $data['id_source'] = $id_source; |
| 992 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1327 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1328 | + $data['noarchive'] = true; |
|
| 1329 | + } |
|
| 993 | 1330 | $SI->add($data); |
| 994 | 1331 | unset($data); |
| 995 | 1332 | } |
@@ -1006,7 +1343,9 @@ discard block |
||
| 1006 | 1343 | //$buffer = $Common->getData($hosts[$id]); |
| 1007 | 1344 | $buffer = $Common->getData($value['host']); |
| 1008 | 1345 | $all_data = json_decode($buffer,true); |
| 1009 | - if (!empty($all_data)) $reset = 0; |
|
| 1346 | + if (!empty($all_data)) { |
|
| 1347 | + $reset = 0; |
|
| 1348 | + } |
|
| 1010 | 1349 | foreach ($all_data as $key => $line) { |
| 1011 | 1350 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 1012 | 1351 | $data = array(); |
@@ -1027,8 +1366,12 @@ discard block |
||
| 1027 | 1366 | $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
| 1028 | 1367 | $data['format_source'] = 'fr24json'; |
| 1029 | 1368 | $data['id_source'] = $id_source; |
| 1030 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1031 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1369 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1370 | + $data['noarchive'] = true; |
|
| 1371 | + } |
|
| 1372 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1373 | + $data['source_name'] = $value['name']; |
|
| 1374 | + } |
|
| 1032 | 1375 | $SI->add($data); |
| 1033 | 1376 | unset($data); |
| 1034 | 1377 | } |
@@ -1057,24 +1400,42 @@ discard block |
||
| 1057 | 1400 | if (isset($line['inf'])) { |
| 1058 | 1401 | $data = array(); |
| 1059 | 1402 | $data['hex'] = $line['inf']['ia']; |
| 1060 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
|
| 1403 | + if (isset($line['inf']['cs'])) { |
|
| 1404 | + $data['ident'] = $line['inf']['cs']; |
|
| 1405 | + } |
|
| 1406 | + //$line[13] |
|
| 1061 | 1407 | $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
| 1062 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 1063 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 1408 | + if (isset($line['inf']['gs'])) { |
|
| 1409 | + $data['speed'] = round($line['inf']['gs']*0.539957); |
|
| 1410 | + } |
|
| 1411 | + // speed |
|
| 1412 | + if (isset($line['inf']['tr'])) { |
|
| 1413 | + $data['heading'] = $line['inf']['tr']; |
|
| 1414 | + } |
|
| 1415 | + // heading |
|
| 1064 | 1416 | $data['latitude'] = $line['pt'][0]; // lat |
| 1065 | 1417 | $data['longitude'] = $line['pt'][1]; // long |
| 1066 | 1418 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
| 1067 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 1419 | + if (isset($line['inf']['sq'])) { |
|
| 1420 | + $data['squawk'] = $line['inf']['sq']; |
|
| 1421 | + } |
|
| 1422 | + // squawk |
|
| 1068 | 1423 | //$data['aircraft_icao'] = $line[8]; |
| 1069 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 1424 | + if (isset($line['inf']['rc'])) { |
|
| 1425 | + $data['registration'] = $line['inf']['rc']; |
|
| 1426 | + } |
|
| 1070 | 1427 | //$data['departure_airport_iata'] = $line[11]; |
| 1071 | 1428 | //$data['arrival_airport_iata'] = $line[12]; |
| 1072 | 1429 | //$data['emergency'] = ''; // emergency |
| 1073 | 1430 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 1074 | 1431 | $data['format_source'] = 'radarvirtueljson'; |
| 1075 | 1432 | $data['id_source'] = $id_source; |
| 1076 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1077 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1433 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1434 | + $data['noarchive'] = true; |
|
| 1435 | + } |
|
| 1436 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1437 | + $data['source_name'] = $value['name']; |
|
| 1438 | + } |
|
| 1078 | 1439 | $SI->add($data); |
| 1079 | 1440 | unset($data); |
| 1080 | 1441 | } |
@@ -1100,30 +1461,65 @@ discard block |
||
| 1100 | 1461 | $data['id'] = $line['id']; |
| 1101 | 1462 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
| 1102 | 1463 | $data['ident'] = $line['callsign']; // ident |
| 1103 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 1104 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 1105 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 1106 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 1107 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1108 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1464 | + if (isset($line['pilotid'])) { |
|
| 1465 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1466 | + } |
|
| 1467 | + // pilot id |
|
| 1468 | + if (isset($line['name'])) { |
|
| 1469 | + $data['pilot_name'] = $line['name']; |
|
| 1470 | + } |
|
| 1471 | + // pilot name |
|
| 1472 | + if (isset($line['alt'])) { |
|
| 1473 | + $data['altitude'] = $line['alt']; |
|
| 1474 | + } |
|
| 1475 | + // altitude |
|
| 1476 | + if (isset($line['gs'])) { |
|
| 1477 | + $data['speed'] = $line['gs']; |
|
| 1478 | + } |
|
| 1479 | + // speed |
|
| 1480 | + if (isset($line['heading'])) { |
|
| 1481 | + $data['heading'] = $line['heading']; |
|
| 1482 | + } |
|
| 1483 | + // heading |
|
| 1484 | + if (isset($line['route'])) { |
|
| 1485 | + $data['waypoints'] = $line['route']; |
|
| 1486 | + } |
|
| 1487 | + // route |
|
| 1109 | 1488 | $data['latitude'] = $line['lat']; // lat |
| 1110 | 1489 | $data['longitude'] = $line['lon']; // long |
| 1111 | 1490 | //$data['verticalrate'] = $line['vrt']; // verticale rate |
| 1112 | 1491 | //$data['squawk'] = $line['squawk']; // squawk |
| 1113 | 1492 | //$data['emergency'] = ''; // emergency |
| 1114 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 1115 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 1116 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1493 | + if (isset($line['depicao'])) { |
|
| 1494 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 1495 | + } |
|
| 1496 | + if (isset($line['deptime'])) { |
|
| 1497 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 1498 | + } |
|
| 1499 | + if (isset($line['arricao'])) { |
|
| 1500 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1501 | + } |
|
| 1117 | 1502 | //$data['arrival_airport_time'] = $line['arrtime']; |
| 1118 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 1119 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 1120 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 1121 | - else $data['info'] = ''; |
|
| 1503 | + if (isset($line['aircraft'])) { |
|
| 1504 | + $data['aircraft_icao'] = $line['aircraft']; |
|
| 1505 | + } |
|
| 1506 | + if (isset($line['transponder'])) { |
|
| 1507 | + $data['squawk'] = $line['transponder']; |
|
| 1508 | + } |
|
| 1509 | + if (isset($line['atis'])) { |
|
| 1510 | + $data['info'] = $line['atis']; |
|
| 1511 | + } else { |
|
| 1512 | + $data['info'] = ''; |
|
| 1513 | + } |
|
| 1122 | 1514 | $data['format_source'] = 'pireps'; |
| 1123 | 1515 | $data['id_source'] = $id_source; |
| 1124 | 1516 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1125 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1126 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1517 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1518 | + $data['noarchive'] = true; |
|
| 1519 | + } |
|
| 1520 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1521 | + $data['source_name'] = $value['name']; |
|
| 1522 | + } |
|
| 1127 | 1523 | if ($line['icon'] == 'plane') { |
| 1128 | 1524 | $SI->add($data); |
| 1129 | 1525 | // print_r($data); |
@@ -1132,16 +1528,28 @@ discard block |
||
| 1132 | 1528 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 1133 | 1529 | $typec = substr($data['ident'],-3); |
| 1134 | 1530 | $data['type'] = ''; |
| 1135 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
| 1136 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
| 1137 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
| 1138 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
| 1139 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
| 1140 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
| 1141 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 1142 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 1143 | - else $data['type'] = 'Observer'; |
|
| 1144 | - 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']); |
|
| 1531 | + if ($typec == 'APP') { |
|
| 1532 | + $data['type'] = 'Approach'; |
|
| 1533 | + } elseif ($typec == 'TWR') { |
|
| 1534 | + $data['type'] = 'Tower'; |
|
| 1535 | + } elseif ($typec == 'OBS') { |
|
| 1536 | + $data['type'] = 'Observer'; |
|
| 1537 | + } elseif ($typec == 'GND') { |
|
| 1538 | + $data['type'] = 'Ground'; |
|
| 1539 | + } elseif ($typec == 'DEL') { |
|
| 1540 | + $data['type'] = 'Delivery'; |
|
| 1541 | + } elseif ($typec == 'DEP') { |
|
| 1542 | + $data['type'] = 'Departure'; |
|
| 1543 | + } elseif ($typec == 'FSS') { |
|
| 1544 | + $data['type'] = 'Flight Service Station'; |
|
| 1545 | + } elseif ($typec == 'CTR') { |
|
| 1546 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1547 | + } else { |
|
| 1548 | + $data['type'] = 'Observer'; |
|
| 1549 | + } |
|
| 1550 | + if (isset($ATC)) { |
|
| 1551 | + 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']); |
|
| 1552 | + } |
|
| 1145 | 1553 | } |
| 1146 | 1554 | unset($data); |
| 1147 | 1555 | } |
@@ -1156,7 +1564,9 @@ discard block |
||
| 1156 | 1564 | ) |
| 1157 | 1565 | ) { |
| 1158 | 1566 | //$buffer = $Common->getData($hosts[$id]); |
| 1159 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1567 | + if ($globalDebug) { |
|
| 1568 | + echo 'Get Data...'."\n"; |
|
| 1569 | + } |
|
| 1160 | 1570 | $buffer = $Common->getData($value['host']); |
| 1161 | 1571 | $all_data = json_decode($buffer,true); |
| 1162 | 1572 | if ($buffer != '' && is_array($all_data)) { |
@@ -1164,10 +1574,16 @@ discard block |
||
| 1164 | 1574 | foreach ($all_data as $line) { |
| 1165 | 1575 | $data = array(); |
| 1166 | 1576 | //$data['id'] = $line['id']; // id not usable |
| 1167 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1577 | + if (isset($line['pilotid'])) { |
|
| 1578 | + $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1579 | + } |
|
| 1168 | 1580 | $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1169 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 1170 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 1581 | + if (isset($line['pilotname'])) { |
|
| 1582 | + $data['pilot_name'] = $line['pilotname']; |
|
| 1583 | + } |
|
| 1584 | + if (isset($line['pilotid'])) { |
|
| 1585 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1586 | + } |
|
| 1171 | 1587 | $data['ident'] = $line['flightnum']; // ident |
| 1172 | 1588 | $data['altitude'] = $line['alt']; // altitude |
| 1173 | 1589 | $data['speed'] = $line['gs']; // speed |
@@ -1183,37 +1599,59 @@ discard block |
||
| 1183 | 1599 | $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
| 1184 | 1600 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1185 | 1601 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1186 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1602 | + } else { |
|
| 1603 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1604 | + } |
|
| 1187 | 1605 | $data['departure_airport_icao'] = $line['depicao']; |
| 1188 | 1606 | $data['departure_airport_time'] = $line['deptime']; |
| 1189 | 1607 | $data['arrival_airport_icao'] = $line['arricao']; |
| 1190 | 1608 | $data['arrival_airport_time'] = $line['arrtime']; |
| 1191 | 1609 | if (isset($line['registration'])) { |
| 1192 | 1610 | $data['registration'] = $line['registration']; |
| 1193 | - if (isset($line['aircraft'])) $data['id'] = $line['aircraft']; |
|
| 1194 | - } else $data['registration'] = $line['aircraft']; |
|
| 1195 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1196 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1611 | + if (isset($line['aircraft'])) { |
|
| 1612 | + $data['id'] = $line['aircraft']; |
|
| 1613 | + } |
|
| 1614 | + } else { |
|
| 1615 | + $data['registration'] = $line['aircraft']; |
|
| 1616 | + } |
|
| 1617 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1618 | + $data['noarchive'] = true; |
|
| 1619 | + } |
|
| 1620 | + if (isset($line['route'])) { |
|
| 1621 | + $data['waypoints'] = $line['route']; |
|
| 1622 | + } |
|
| 1623 | + // route |
|
| 1197 | 1624 | if (isset($line['aircraftname'])) { |
| 1198 | 1625 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1199 | 1626 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 1200 | 1627 | $aircraft_data = explode('-',$line['aircraftname']); |
| 1201 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1202 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1203 | - else { |
|
| 1628 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { |
|
| 1629 | + $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1630 | + } elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { |
|
| 1631 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1632 | + } else { |
|
| 1204 | 1633 | $aircraft_data = explode(' ',$line['aircraftname']); |
| 1205 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1206 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1634 | + if (isset($aircraft_data[1])) { |
|
| 1635 | + $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1636 | + } else { |
|
| 1637 | + $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1638 | + } |
|
| 1207 | 1639 | } |
| 1208 | 1640 | } |
| 1209 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 1641 | + if (isset($line['route'])) { |
|
| 1642 | + $data['waypoints'] = $line['route']; |
|
| 1643 | + } |
|
| 1210 | 1644 | $data['id_source'] = $id_source; |
| 1211 | 1645 | $data['format_source'] = 'phpvmacars'; |
| 1212 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1646 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1647 | + $data['source_name'] = $value['name']; |
|
| 1648 | + } |
|
| 1213 | 1649 | $SI->add($data); |
| 1214 | 1650 | unset($data); |
| 1215 | 1651 | } |
| 1216 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1652 | + if ($globalDebug) { |
|
| 1653 | + echo 'No more data...'."\n"; |
|
| 1654 | + } |
|
| 1217 | 1655 | unset($buffer); |
| 1218 | 1656 | unset($all_data); |
| 1219 | 1657 | } |
@@ -1226,7 +1664,9 @@ discard block |
||
| 1226 | 1664 | ) |
| 1227 | 1665 | ) { |
| 1228 | 1666 | //$buffer = $Common->getData($hosts[$id]); |
| 1229 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1667 | + if ($globalDebug) { |
|
| 1668 | + echo 'Get Data...'."\n"; |
|
| 1669 | + } |
|
| 1230 | 1670 | $buffer = $Common->getData($value['host']); |
| 1231 | 1671 | $all_data = json_decode($buffer,true); |
| 1232 | 1672 | if ($buffer != '' && is_array($all_data)) { |
@@ -1255,16 +1695,25 @@ discard block |
||
| 1255 | 1695 | $data['arrival_airport_icao'] = $line['arrival']; |
| 1256 | 1696 | //$data['arrival_airport_time'] = $line['arrival_time']; |
| 1257 | 1697 | //$data['registration'] = $line['aircraft']; |
| 1258 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1698 | + if (isset($line['route'])) { |
|
| 1699 | + $data['waypoints'] = $line['route']; |
|
| 1700 | + } |
|
| 1701 | + // route |
|
| 1259 | 1702 | $data['aircraft_icao'] = $line['plane_type']; |
| 1260 | 1703 | $data['id_source'] = $id_source; |
| 1261 | 1704 | $data['format_source'] = 'vam'; |
| 1262 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1263 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1705 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1706 | + $data['noarchive'] = true; |
|
| 1707 | + } |
|
| 1708 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1709 | + $data['source_name'] = $value['name']; |
|
| 1710 | + } |
|
| 1264 | 1711 | $SI->add($data); |
| 1265 | 1712 | unset($data); |
| 1266 | 1713 | } |
| 1267 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1714 | + if ($globalDebug) { |
|
| 1715 | + echo 'No more data...'."\n"; |
|
| 1716 | + } |
|
| 1268 | 1717 | unset($buffer); |
| 1269 | 1718 | unset($all_data); |
| 1270 | 1719 | } |
@@ -1277,7 +1726,9 @@ discard block |
||
| 1277 | 1726 | ) |
| 1278 | 1727 | ) { |
| 1279 | 1728 | //$buffer = $Common->getData($hosts[$id]); |
| 1280 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1729 | + if ($globalDebug) { |
|
| 1730 | + echo 'Get Data...'."\n"; |
|
| 1731 | + } |
|
| 1281 | 1732 | $buffer = $Common->getData($value['host']); |
| 1282 | 1733 | $all_data = json_decode($buffer,true); |
| 1283 | 1734 | if ($buffer != '') { |
@@ -1295,18 +1746,24 @@ discard block |
||
| 1295 | 1746 | $data['id_source'] = $id_source; |
| 1296 | 1747 | $data['format_source'] = 'blitzortung'; |
| 1297 | 1748 | $SI->add($data); |
| 1298 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 1749 | + if ($globalDebug) { |
|
| 1750 | + echo '☈ Lightning added'."\n"; |
|
| 1751 | + } |
|
| 1299 | 1752 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
| 1300 | 1753 | unset($data); |
| 1301 | 1754 | } |
| 1302 | 1755 | } |
| 1303 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1756 | + if ($globalDebug) { |
|
| 1757 | + echo 'No more data...'."\n"; |
|
| 1758 | + } |
|
| 1304 | 1759 | unset($buffer); |
| 1305 | 1760 | } |
| 1306 | 1761 | $last_exec[$id]['last'] = time(); |
| 1307 | 1762 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
| 1308 | 1763 | } 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') { |
| 1309 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 1764 | + if (function_exists('pcntl_fork')) { |
|
| 1765 | + pcntl_signal_dispatch(); |
|
| 1766 | + } |
|
| 1310 | 1767 | //$last_exec[$id]['last'] = time(); |
| 1311 | 1768 | |
| 1312 | 1769 | //$read = array( $sockets[$id] ); |
@@ -1314,7 +1771,9 @@ discard block |
||
| 1314 | 1771 | $write = NULL; |
| 1315 | 1772 | $e = NULL; |
| 1316 | 1773 | $n = socket_select($read, $write, $e, $timeout); |
| 1317 | - if ($e != NULL) var_dump($e); |
|
| 1774 | + if ($e != NULL) { |
|
| 1775 | + var_dump($e); |
|
| 1776 | + } |
|
| 1318 | 1777 | if ($n > 0) { |
| 1319 | 1778 | $reset = 0; |
| 1320 | 1779 | foreach ($read as $nb => $r) { |
@@ -1336,13 +1795,17 @@ discard block |
||
| 1336 | 1795 | if ($buffer !== FALSE) { |
| 1337 | 1796 | if ($format == 'vrstcp') { |
| 1338 | 1797 | $buffer = explode('},{',$buffer); |
| 1339 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1798 | + } else { |
|
| 1799 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1800 | + } |
|
| 1340 | 1801 | } |
| 1341 | 1802 | // SBS format is CSV format |
| 1342 | 1803 | if ($buffer !== FALSE && $buffer !== '') { |
| 1343 | 1804 | $tt[$format] = 0; |
| 1344 | 1805 | if ($format == 'acarssbs3') { |
| 1345 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1806 | + if ($globalDebug) { |
|
| 1807 | + echo 'ACARS : '.$buffer."\n"; |
|
| 1808 | + } |
|
| 1346 | 1809 | $ACARS->add(trim($buffer)); |
| 1347 | 1810 | $ACARS->deleteLiveAcarsData(); |
| 1348 | 1811 | } elseif ($format == 'raw') { |
@@ -1351,30 +1814,70 @@ discard block |
||
| 1351 | 1814 | if (is_array($data)) { |
| 1352 | 1815 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1353 | 1816 | $data['format_source'] = 'raw'; |
| 1354 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1355 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1356 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1357 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1817 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 1818 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1819 | + } |
|
| 1820 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 1821 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1822 | + } |
|
| 1823 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1824 | + $data['noarchive'] = true; |
|
| 1825 | + } |
|
| 1826 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 1827 | + $SI->add($data); |
|
| 1828 | + } |
|
| 1358 | 1829 | } |
| 1359 | 1830 | } elseif ($format == 'ais') { |
| 1360 | 1831 | $ais_data = $AIS->parse_line(trim($buffer)); |
| 1361 | 1832 | $data = array(); |
| 1362 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 1363 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 1364 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 1365 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 1366 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 1367 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 1368 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 1369 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 1370 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 1371 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 1372 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 1373 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 1374 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1375 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1376 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1377 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1833 | + if (isset($ais_data['ident'])) { |
|
| 1834 | + $data['ident'] = $ais_data['ident']; |
|
| 1835 | + } |
|
| 1836 | + if (isset($ais_data['mmsi'])) { |
|
| 1837 | + $data['mmsi'] = $ais_data['mmsi']; |
|
| 1838 | + } |
|
| 1839 | + if (isset($ais_data['speed'])) { |
|
| 1840 | + $data['speed'] = $ais_data['speed']; |
|
| 1841 | + } |
|
| 1842 | + if (isset($ais_data['heading'])) { |
|
| 1843 | + $data['heading'] = $ais_data['heading']; |
|
| 1844 | + } |
|
| 1845 | + if (isset($ais_data['latitude'])) { |
|
| 1846 | + $data['latitude'] = $ais_data['latitude']; |
|
| 1847 | + } |
|
| 1848 | + if (isset($ais_data['longitude'])) { |
|
| 1849 | + $data['longitude'] = $ais_data['longitude']; |
|
| 1850 | + } |
|
| 1851 | + if (isset($ais_data['status'])) { |
|
| 1852 | + $data['status'] = $ais_data['status']; |
|
| 1853 | + } |
|
| 1854 | + if (isset($ais_data['statusid'])) { |
|
| 1855 | + $data['status_id'] = $ais_data['statusid']; |
|
| 1856 | + } |
|
| 1857 | + if (isset($ais_data['type'])) { |
|
| 1858 | + $data['type'] = $ais_data['type']; |
|
| 1859 | + } |
|
| 1860 | + if (isset($ais_data['imo'])) { |
|
| 1861 | + $data['imo'] = $ais_data['imo']; |
|
| 1862 | + } |
|
| 1863 | + if (isset($ais_data['callsign'])) { |
|
| 1864 | + $data['callsign'] = $ais_data['callsign']; |
|
| 1865 | + } |
|
| 1866 | + if (isset($ais_data['destination'])) { |
|
| 1867 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 1868 | + } |
|
| 1869 | + if (isset($ais_data['eta_ts'])) { |
|
| 1870 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1871 | + } |
|
| 1872 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1873 | + $data['noarchive'] = true; |
|
| 1874 | + } |
|
| 1875 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 1876 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1877 | + } |
|
| 1878 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 1879 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1880 | + } |
|
| 1378 | 1881 | |
| 1379 | 1882 | if (isset($ais_data['timestamp'])) { |
| 1380 | 1883 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
@@ -1383,7 +1886,9 @@ discard block |
||
| 1383 | 1886 | } |
| 1384 | 1887 | $data['format_source'] = 'aisnmea'; |
| 1385 | 1888 | $data['id_source'] = $id_source; |
| 1386 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
| 1889 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
| 1890 | + $MI->add($data); |
|
| 1891 | + } |
|
| 1387 | 1892 | unset($data); |
| 1388 | 1893 | } elseif ($format == 'flightgearsp') { |
| 1389 | 1894 | //echo $buffer."\n"; |
@@ -1401,12 +1906,18 @@ discard block |
||
| 1401 | 1906 | $data['speed'] = round($line[5]*1.94384); |
| 1402 | 1907 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1403 | 1908 | $data['format_source'] = 'flightgearsp'; |
| 1404 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1405 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1909 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1910 | + $data['noarchive'] = true; |
|
| 1911 | + } |
|
| 1912 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 1913 | + $SI->add($data); |
|
| 1914 | + } |
|
| 1406 | 1915 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1407 | 1916 | } |
| 1408 | 1917 | } elseif ($format == 'acars') { |
| 1409 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1918 | + if ($globalDebug) { |
|
| 1919 | + echo 'ACARS : '.$buffer."\n"; |
|
| 1920 | + } |
|
| 1410 | 1921 | $ACARS->add(trim($buffer)); |
| 1411 | 1922 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
| 1412 | 1923 | $ACARS->deleteLiveAcarsData(); |
@@ -1427,8 +1938,12 @@ discard block |
||
| 1427 | 1938 | $aircraft_type = $line[10]; |
| 1428 | 1939 | $aircraft_type = preg_split(':/:',$aircraft_type); |
| 1429 | 1940 | $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
| 1430 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1431 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1941 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1942 | + $data['noarchive'] = true; |
|
| 1943 | + } |
|
| 1944 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 1945 | + $SI->add($data); |
|
| 1946 | + } |
|
| 1432 | 1947 | } |
| 1433 | 1948 | } |
| 1434 | 1949 | } elseif ($format == 'beast') { |
@@ -1438,28 +1953,62 @@ discard block |
||
| 1438 | 1953 | foreach($buffer as $all_data) { |
| 1439 | 1954 | $line = json_decode('{'.$all_data.'}',true); |
| 1440 | 1955 | $data = array(); |
| 1441 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
|
| 1442 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 1443 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 1444 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 1445 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 1446 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 1447 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 1956 | + if (isset($line['Icao'])) { |
|
| 1957 | + $data['hex'] = $line['Icao']; |
|
| 1958 | + } |
|
| 1959 | + // hex |
|
| 1960 | + if (isset($line['Call'])) { |
|
| 1961 | + $data['ident'] = $line['Call']; |
|
| 1962 | + } |
|
| 1963 | + // ident |
|
| 1964 | + if (isset($line['Alt'])) { |
|
| 1965 | + $data['altitude'] = $line['Alt']; |
|
| 1966 | + } |
|
| 1967 | + // altitude |
|
| 1968 | + if (isset($line['Spd'])) { |
|
| 1969 | + $data['speed'] = $line['Spd']; |
|
| 1970 | + } |
|
| 1971 | + // speed |
|
| 1972 | + if (isset($line['Trak'])) { |
|
| 1973 | + $data['heading'] = $line['Trak']; |
|
| 1974 | + } |
|
| 1975 | + // heading |
|
| 1976 | + if (isset($line['Lat'])) { |
|
| 1977 | + $data['latitude'] = $line['Lat']; |
|
| 1978 | + } |
|
| 1979 | + // lat |
|
| 1980 | + if (isset($line['Long'])) { |
|
| 1981 | + $data['longitude'] = $line['Long']; |
|
| 1982 | + } |
|
| 1983 | + // long |
|
| 1448 | 1984 | //$data['verticalrate'] = $line['']; // verticale rate |
| 1449 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 1985 | + if (isset($line['Sqk'])) { |
|
| 1986 | + $data['squawk'] = $line['Sqk']; |
|
| 1987 | + } |
|
| 1988 | + // squawk |
|
| 1450 | 1989 | $data['emergency'] = ''; // emergency |
| 1451 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 1990 | + if (isset($line['Reg'])) { |
|
| 1991 | + $data['registration'] = $line['Reg']; |
|
| 1992 | + } |
|
| 1452 | 1993 | /* |
| 1453 | 1994 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 1454 | 1995 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 1455 | 1996 | */ |
| 1456 | 1997 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1457 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 1998 | + if (isset($line['Type'])) { |
|
| 1999 | + $data['aircraft_icao'] = $line['Type']; |
|
| 2000 | + } |
|
| 1458 | 2001 | $data['format_source'] = 'vrstcp'; |
| 1459 | 2002 | $data['id_source'] = $id_source; |
| 1460 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1461 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1462 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
|
| 2003 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2004 | + $data['noarchive'] = true; |
|
| 2005 | + } |
|
| 2006 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2007 | + $data['source_name'] = $value['name']; |
|
| 2008 | + } |
|
| 2009 | + if (isset($data['latitude']) && isset($data['hex'])) { |
|
| 2010 | + $SI->add($data); |
|
| 2011 | + } |
|
| 1463 | 2012 | unset($data); |
| 1464 | 2013 | } |
| 1465 | 2014 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
@@ -1472,22 +2021,46 @@ discard block |
||
| 1472 | 2021 | $data['hex'] = $lined['hexid']; |
| 1473 | 2022 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
| 1474 | 2023 | $data['datetime'] = date('Y-m-d H:i:s');; |
| 1475 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1476 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1477 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1478 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1479 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1480 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1481 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 2024 | + if (isset($lined['ident'])) { |
|
| 2025 | + $data['ident'] = $lined['ident']; |
|
| 2026 | + } |
|
| 2027 | + if (isset($lined['lat'])) { |
|
| 2028 | + $data['latitude'] = $lined['lat']; |
|
| 2029 | + } |
|
| 2030 | + if (isset($lined['lon'])) { |
|
| 2031 | + $data['longitude'] = $lined['lon']; |
|
| 2032 | + } |
|
| 2033 | + if (isset($lined['speed'])) { |
|
| 2034 | + $data['speed'] = $lined['speed']; |
|
| 2035 | + } |
|
| 2036 | + if (isset($lined['squawk'])) { |
|
| 2037 | + $data['squawk'] = $lined['squawk']; |
|
| 2038 | + } |
|
| 2039 | + if (isset($lined['alt'])) { |
|
| 2040 | + $data['altitude'] = $lined['alt']; |
|
| 2041 | + } |
|
| 2042 | + if (isset($lined['heading'])) { |
|
| 2043 | + $data['heading'] = $lined['heading']; |
|
| 2044 | + } |
|
| 1482 | 2045 | $data['id_source'] = $id_source; |
| 1483 | 2046 | $data['format_source'] = 'tsv'; |
| 1484 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1485 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1486 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1487 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2047 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2048 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2049 | + } |
|
| 2050 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2051 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2052 | + } |
|
| 2053 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2054 | + $data['noarchive'] = true; |
|
| 2055 | + } |
|
| 2056 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2057 | + $SI->add($data); |
|
| 2058 | + } |
|
| 1488 | 2059 | unset($lined); |
| 1489 | 2060 | unset($data); |
| 1490 | - } else $error = true; |
|
| 2061 | + } else { |
|
| 2062 | + $error = true; |
|
| 2063 | + } |
|
| 1491 | 2064 | } elseif ($format == 'aprs' && $use_aprs) { |
| 1492 | 2065 | if ($aprs_connect == 0) { |
| 1493 | 2066 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
@@ -1513,63 +2086,121 @@ discard block |
||
| 1513 | 2086 | $aprs_last_tx = time(); |
| 1514 | 2087 | $data = array(); |
| 1515 | 2088 | //print_r($line); |
| 1516 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1517 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
| 1518 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
| 1519 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
| 1520 | - if (isset($line['arrival_code'])) $data['arrical_code'] = $line['arrival_code']; |
|
| 1521 | - if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
|
| 1522 | - if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
|
| 1523 | - if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
|
| 1524 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1525 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2089 | + if (isset($line['address'])) { |
|
| 2090 | + $data['hex'] = $line['address']; |
|
| 2091 | + } |
|
| 2092 | + if (isset($line['mmsi'])) { |
|
| 2093 | + $data['mmsi'] = $line['mmsi']; |
|
| 2094 | + } |
|
| 2095 | + if (isset($line['imo'])) { |
|
| 2096 | + $data['imo'] = $line['imo']; |
|
| 2097 | + } |
|
| 2098 | + if (isset($line['squawk'])) { |
|
| 2099 | + $data['squawk'] = $line['squawk']; |
|
| 2100 | + } |
|
| 2101 | + if (isset($line['arrival_code'])) { |
|
| 2102 | + $data['arrical_code'] = $line['arrival_code']; |
|
| 2103 | + } |
|
| 2104 | + if (isset($line['arrival_date'])) { |
|
| 2105 | + $data['arrical_date'] = $line['arrival_date']; |
|
| 2106 | + } |
|
| 2107 | + if (isset($line['type_id'])) { |
|
| 2108 | + $data['type_id'] = $line['typeid']; |
|
| 2109 | + } |
|
| 2110 | + if (isset($line['status_id'])) { |
|
| 2111 | + $data['status_id'] = $line['statusid']; |
|
| 2112 | + } |
|
| 2113 | + if (isset($line['timestamp'])) { |
|
| 2114 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 2115 | + } else { |
|
| 2116 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2117 | + } |
|
| 1526 | 2118 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1527 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
| 2119 | + if (isset($line['ident'])) { |
|
| 2120 | + $data['ident'] = $line['ident']; |
|
| 2121 | + } |
|
| 1528 | 2122 | $data['latitude'] = $line['latitude']; |
| 1529 | 2123 | $data['longitude'] = $line['longitude']; |
| 1530 | 2124 | //$data['verticalrate'] = $line[16]; |
| 1531 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 2125 | + if (isset($line['speed'])) { |
|
| 2126 | + $data['speed'] = $line['speed']; |
|
| 2127 | + } |
|
| 1532 | 2128 | //else $data['speed'] = 0; |
| 1533 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1534 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1535 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 2129 | + if (isset($line['altitude'])) { |
|
| 2130 | + $data['altitude'] = $line['altitude']; |
|
| 2131 | + } |
|
| 2132 | + if (isset($line['comment'])) { |
|
| 2133 | + $data['comment'] = $line['comment']; |
|
| 2134 | + } |
|
| 2135 | + if (isset($line['symbol'])) { |
|
| 2136 | + $data['type'] = $line['symbol']; |
|
| 2137 | + } |
|
| 1536 | 2138 | //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
| 1537 | 2139 | |
| 1538 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
| 2140 | + if (isset($line['heading']) && isset($line['format_source'])) { |
|
| 2141 | + $data['heading'] = $line['heading']; |
|
| 2142 | + } |
|
| 1539 | 2143 | //else echo 'No heading...'."\n"; |
| 1540 | 2144 | //else $data['heading'] = 0; |
| 1541 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 2145 | + if (isset($line['stealth'])) { |
|
| 2146 | + $data['aircraft_type'] = $line['stealth']; |
|
| 2147 | + } |
|
| 1542 | 2148 | //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
| 1543 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
| 1544 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
| 1545 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1546 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
| 2149 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { |
|
| 2150 | + $data['noarchive'] = true; |
|
| 2151 | + } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { |
|
| 2152 | + $data['noarchive'] = false; |
|
| 2153 | + } |
|
| 2154 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2155 | + $data['noarchive'] = true; |
|
| 2156 | + } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { |
|
| 2157 | + $data['noarchive'] = false; |
|
| 2158 | + } |
|
| 1547 | 2159 | $data['id_source'] = $id_source; |
| 1548 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
| 1549 | - else $data['format_source'] = 'aprs'; |
|
| 2160 | + if (isset($line['format_source'])) { |
|
| 2161 | + $data['format_source'] = $line['format_source']; |
|
| 2162 | + } else { |
|
| 2163 | + $data['format_source'] = 'aprs'; |
|
| 2164 | + } |
|
| 1550 | 2165 | $data['source_name'] = $line['source']; |
| 1551 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
| 1552 | - else $data['source_type'] = 'flarm'; |
|
| 1553 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2166 | + if (isset($line['source_type'])) { |
|
| 2167 | + $data['source_type'] = $line['source_type']; |
|
| 2168 | + } else { |
|
| 2169 | + $data['source_type'] = 'flarm'; |
|
| 2170 | + } |
|
| 2171 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2172 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2173 | + } |
|
| 1554 | 2174 | $currentdate = date('Y-m-d H:i:s'); |
| 1555 | 2175 | $aprsdate = strtotime($data['datetime']); |
| 1556 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
| 2176 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') { |
|
| 2177 | + $data['altitude_relative'] = 'AMSL'; |
|
| 2178 | + } |
|
| 1557 | 2179 | // Accept data if time <= system time + 20s |
| 1558 | 2180 | //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'])))) { |
| 1559 | 2181 | 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'])))) { |
| 1560 | 2182 | $send = $SI->add($data); |
| 1561 | 2183 | } elseif ($data['source_type'] == 'ais') { |
| 1562 | 2184 | $data['type'] = ''; |
| 1563 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
|
| 2185 | + if (isset($globalMarine) && $globalMarine) { |
|
| 2186 | + $send = $MI->add($data); |
|
| 2187 | + } |
|
| 1564 | 2188 | } elseif (isset($line['stealth'])) { |
| 1565 | - if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
| 1566 | - else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
| 2189 | + if ($line['stealth'] != 0) { |
|
| 2190 | + echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
| 2191 | + } else { |
|
| 2192 | + echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
| 2193 | + } |
|
| 1567 | 2194 | } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1568 | 2195 | //$line['symbol'] == 'Balloon' || |
| 1569 | 2196 | $line['symbol'] == 'Glider' || |
| 1570 | 2197 | $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) { |
| 1571 | - if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
| 1572 | - if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2198 | + if ($line['symbol'] == 'Ballon') { |
|
| 2199 | + $data['aircraft_icao'] = 'BALL'; |
|
| 2200 | + } |
|
| 2201 | + if ($line['symbol'] == 'Glider') { |
|
| 2202 | + $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2203 | + } |
|
| 1573 | 2204 | $send = $SI->add($data); |
| 1574 | 2205 | } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1575 | 2206 | $line['symbol'] == 'Yacht (Sail)' || |
@@ -1600,9 +2231,13 @@ discard block |
||
| 1600 | 2231 | //} 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') { |
| 1601 | 2232 | // } 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') { |
| 1602 | 2233 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
| 1603 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
|
| 2234 | + if (isset($globalTracker) && $globalTracker) { |
|
| 2235 | + $send = $TI->add($data); |
|
| 2236 | + } |
|
| 1604 | 2237 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
| 1605 | - if (!isset($data['altitude'])) $data['altitude'] = 0; |
|
| 2238 | + if (!isset($data['altitude'])) { |
|
| 2239 | + $data['altitude'] = 0; |
|
| 2240 | + } |
|
| 1606 | 2241 | $Source->deleteOldLocationByType('gs'); |
| 1607 | 2242 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
| 1608 | 2243 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
@@ -1611,7 +2246,9 @@ discard block |
||
| 1611 | 2246 | } |
| 1612 | 2247 | } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
| 1613 | 2248 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1614 | - if ($globalDebug) echo '# Weather Station added'."\n"; |
|
| 2249 | + if ($globalDebug) { |
|
| 2250 | + echo '# Weather Station added'."\n"; |
|
| 2251 | + } |
|
| 1615 | 2252 | $Source->deleteOldLocationByType('wx'); |
| 1616 | 2253 | $weather_data = json_encode($line); |
| 1617 | 2254 | if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
@@ -1621,7 +2258,9 @@ discard block |
||
| 1621 | 2258 | } |
| 1622 | 2259 | } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) { |
| 1623 | 2260 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1624 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2261 | + if ($globalDebug) { |
|
| 2262 | + echo '☈ Lightning added'."\n"; |
|
| 2263 | + } |
|
| 1625 | 2264 | $Source->deleteOldLocationByType('lightning'); |
| 1626 | 2265 | if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
| 1627 | 2266 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
@@ -1633,8 +2272,7 @@ discard block |
||
| 1633 | 2272 | print_r($line); |
| 1634 | 2273 | } |
| 1635 | 2274 | unset($data); |
| 1636 | - } |
|
| 1637 | - elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 2275 | + } elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 1638 | 2276 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
| 1639 | 2277 | } |
| 1640 | 2278 | /* |
@@ -1643,7 +2281,9 @@ discard block |
||
| 1643 | 2281 | } |
| 1644 | 2282 | */ |
| 1645 | 2283 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 1646 | - elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
|
| 2284 | + elseif ($line == true && $globalDebug) { |
|
| 2285 | + echo '!! Failed : '.$buffer."!!\n"; |
|
| 2286 | + } |
|
| 1647 | 2287 | if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
| 1648 | 2288 | $Source->deleteOldLocationByType('lightning'); |
| 1649 | 2289 | $Source->deleteOldLocationByType('wx'); |
@@ -1679,26 +2319,45 @@ discard block |
||
| 1679 | 2319 | $data['ground'] = $line[21]; |
| 1680 | 2320 | $data['emergency'] = $line[19]; |
| 1681 | 2321 | $data['format_source'] = 'sbs'; |
| 1682 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1683 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1684 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 2322 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2323 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2324 | + } |
|
| 2325 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2326 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2327 | + } |
|
| 2328 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2329 | + $data['noarchive'] = true; |
|
| 2330 | + } |
|
| 1685 | 2331 | $data['id_source'] = $id_source; |
| 1686 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1687 | - else $error = true; |
|
| 2332 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2333 | + $send = $SI->add($data); |
|
| 2334 | + } else { |
|
| 2335 | + $error = true; |
|
| 2336 | + } |
|
| 1688 | 2337 | unset($data); |
| 1689 | - } else $error = true; |
|
| 2338 | + } else { |
|
| 2339 | + $error = true; |
|
| 2340 | + } |
|
| 1690 | 2341 | if ($error) { |
| 1691 | 2342 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
| 1692 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; |
|
| 2343 | + if ($globalDebug) { |
|
| 2344 | + echo "Not a message. Ignoring... \n"; |
|
| 2345 | + } |
|
| 1693 | 2346 | } else { |
| 1694 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; |
|
| 2347 | + if ($globalDebug) { |
|
| 2348 | + echo "Wrong line format. Ignoring... \n"; |
|
| 2349 | + } |
|
| 1695 | 2350 | if ($globalDebug) { |
| 1696 | 2351 | echo $buffer; |
| 1697 | 2352 | //print_r($line); |
| 1698 | 2353 | } |
| 1699 | 2354 | //socket_close($r); |
| 1700 | - if ($globalDebug) echo "Reconnect after an error...\n"; |
|
| 1701 | - if ($format == 'aprs') $aprs_connect = 0; |
|
| 2355 | + if ($globalDebug) { |
|
| 2356 | + echo "Reconnect after an error...\n"; |
|
| 2357 | + } |
|
| 2358 | + if ($format == 'aprs') { |
|
| 2359 | + $aprs_connect = 0; |
|
| 2360 | + } |
|
| 1702 | 2361 | $sourceer[$nb] = $globalSources[$nb]; |
| 1703 | 2362 | connect_all($sourceer); |
| 1704 | 2363 | $sourceer = array(); |
@@ -1706,10 +2365,14 @@ discard block |
||
| 1706 | 2365 | } |
| 1707 | 2366 | } |
| 1708 | 2367 | // Sleep for xxx microseconds |
| 1709 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
|
| 2368 | + if (isset($globalSBSSleep)) { |
|
| 2369 | + usleep($globalSBSSleep); |
|
| 2370 | + } |
|
| 1710 | 2371 | } else { |
| 1711 | 2372 | if ($format == 'flightgearmp') { |
| 1712 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 2373 | + if ($globalDebug) { |
|
| 2374 | + echo "Reconnect FlightGear MP..."; |
|
| 2375 | + } |
|
| 1713 | 2376 | //@socket_close($r); |
| 1714 | 2377 | sleep($globalMinFetch); |
| 1715 | 2378 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1718,10 +2381,15 @@ discard block |
||
| 1718 | 2381 | break; |
| 1719 | 2382 | |
| 1720 | 2383 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1721 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1722 | - else $tt[$format] = 0; |
|
| 2384 | + if (isset($tt[$format])) { |
|
| 2385 | + $tt[$format]++; |
|
| 2386 | + } else { |
|
| 2387 | + $tt[$format] = 0; |
|
| 2388 | + } |
|
| 1723 | 2389 | if ($tt[$format] > 30 || $buffer === FALSE) { |
| 1724 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
|
| 2390 | + if ($globalDebug) { |
|
| 2391 | + echo "ERROR : Reconnect ".$format."..."; |
|
| 2392 | + } |
|
| 1725 | 2393 | //@socket_close($r); |
| 1726 | 2394 | sleep(2); |
| 1727 | 2395 | $aprs_connect = 0; |
@@ -1739,11 +2407,17 @@ discard block |
||
| 1739 | 2407 | } else { |
| 1740 | 2408 | $error = socket_strerror(socket_last_error()); |
| 1741 | 2409 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 1742 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 1743 | - if (isset($globalDebug)) echo "Restarting...\n"; |
|
| 2410 | + if ($globalDebug) { |
|
| 2411 | + echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 2412 | + } |
|
| 2413 | + if (isset($globalDebug)) { |
|
| 2414 | + echo "Restarting...\n"; |
|
| 2415 | + } |
|
| 1744 | 2416 | // Restart the script if possible |
| 1745 | 2417 | if (is_array($sockets)) { |
| 1746 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 2418 | + if ($globalDebug) { |
|
| 2419 | + echo "Shutdown all sockets..."; |
|
| 2420 | + } |
|
| 1747 | 2421 | |
| 1748 | 2422 | foreach ($sockets as $sock) { |
| 1749 | 2423 | @socket_shutdown($sock,2); |
@@ -1751,25 +2425,45 @@ discard block |
||
| 1751 | 2425 | } |
| 1752 | 2426 | |
| 1753 | 2427 | } |
| 1754 | - if ($globalDebug) echo "Waiting..."; |
|
| 2428 | + if ($globalDebug) { |
|
| 2429 | + echo "Waiting..."; |
|
| 2430 | + } |
|
| 1755 | 2431 | sleep(2); |
| 1756 | 2432 | $time = time(); |
| 1757 | 2433 | //connect_all($hosts); |
| 1758 | 2434 | $aprs_connect = 0; |
| 1759 | - if ($reset%5 == 0) sleep(20); |
|
| 1760 | - if ($reset%10 == 0) sleep(100); |
|
| 1761 | - if ($reset%20 == 0) sleep(200); |
|
| 1762 | - if ($reset > 100) exit('Too many attempts...'); |
|
| 1763 | - if ($globalDebug) echo "Restart all connections..."; |
|
| 2435 | + if ($reset%5 == 0) { |
|
| 2436 | + sleep(20); |
|
| 2437 | + } |
|
| 2438 | + if ($reset%10 == 0) { |
|
| 2439 | + sleep(100); |
|
| 2440 | + } |
|
| 2441 | + if ($reset%20 == 0) { |
|
| 2442 | + sleep(200); |
|
| 2443 | + } |
|
| 2444 | + if ($reset > 100) { |
|
| 2445 | + exit('Too many attempts...'); |
|
| 2446 | + } |
|
| 2447 | + if ($globalDebug) { |
|
| 2448 | + echo "Restart all connections..."; |
|
| 2449 | + } |
|
| 1764 | 2450 | connect_all($globalSources); |
| 1765 | 2451 | } |
| 1766 | 2452 | } |
| 1767 | 2453 | } |
| 1768 | 2454 | if ($globalDaemon === false) { |
| 1769 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1770 | - if (isset($SI)) $SI->checkAll(); |
|
| 1771 | - if (isset($TI)) $TI->checkAll(); |
|
| 1772 | - if (isset($MI)) $MI->checkAll(); |
|
| 2455 | + if ($globalDebug) { |
|
| 2456 | + echo 'Check all...'."\n"; |
|
| 2457 | + } |
|
| 2458 | + if (isset($SI)) { |
|
| 2459 | + $SI->checkAll(); |
|
| 2460 | + } |
|
| 2461 | + if (isset($TI)) { |
|
| 2462 | + $TI->checkAll(); |
|
| 2463 | + } |
|
| 2464 | + if (isset($MI)) { |
|
| 2465 | + $MI->checkAll(); |
|
| 2466 | + } |
|
| 1773 | 2467 | } |
| 1774 | 2468 | } |
| 1775 | 2469 | } |