@@ -49,7 +49,10 @@ discard block |
||
| 49 | 49 | <?php |
| 50 | 50 | if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
| 51 | 51 | ?> |
| 52 | -<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
|
| 52 | +<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) { |
|
| 53 | + print '?tsk='.$tsk; |
|
| 54 | +} |
|
| 55 | +?>"></script> |
|
| 53 | 56 | <?php |
| 54 | 57 | if (!isset($globalAircraft) || $globalAircraft) { |
| 55 | 58 | ?> |
@@ -163,11 +166,26 @@ discard block |
||
| 163 | 166 | <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li> |
| 164 | 167 | <li><?php echo _("NOTAM scope:"); ?> |
| 165 | 168 | <select class="selectpicker" onchange="notamscope(this);"> |
| 166 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
| 167 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
| 168 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
| 169 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
| 170 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
| 169 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
| 170 | + print ' selected'; |
|
| 171 | +} |
|
| 172 | +?>>All</option> |
|
| 173 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
| 174 | + print ' selected'; |
|
| 175 | +} |
|
| 176 | +?>>Airport/Enroute warning</option> |
|
| 177 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
| 178 | + print ' selected'; |
|
| 179 | +} |
|
| 180 | +?>>Airport warning</option> |
|
| 181 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
| 182 | + print ' selected'; |
|
| 183 | +} |
|
| 184 | +?>>Navigation warning</option> |
|
| 185 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
| 186 | + print ' selected'; |
|
| 187 | +} |
|
| 188 | +?>>Enroute warning</option> |
|
| 171 | 189 | </select |
| 172 | 190 | </li> |
| 173 | 191 | </ul> |
@@ -195,7 +213,12 @@ discard block |
||
| 195 | 213 | <div class="form-group"> |
| 196 | 214 | <label>From (UTC):</label> |
| 197 | 215 | <div class='input-group date' id='datetimepicker1'> |
| 198 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
| 216 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) { |
|
| 217 | + print $_POST['start_date']; |
|
| 218 | +} elseif (isset($_COOKIE['archive_begin'])) { |
|
| 219 | + print date("m/d/Y h:i a",$_COOKIE['archive_begin']); |
|
| 220 | +} |
|
| 221 | +?>" required /> |
|
| 199 | 222 | <span class="input-group-addon"> |
| 200 | 223 | <span class="glyphicon glyphicon-calendar"></span> |
| 201 | 224 | </span> |
@@ -204,7 +227,12 @@ discard block |
||
| 204 | 227 | <div class="form-group"> |
| 205 | 228 | <label>To (UTC):</label> |
| 206 | 229 | <div class='input-group date' id='datetimepicker2'> |
| 207 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
| 230 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) { |
|
| 231 | + print $_POST['end_date']; |
|
| 232 | +} elseif (isset($_COOKIE['archive_end'])) { |
|
| 233 | + print date("m/d/Y h:i a",$_COOKIE['archive_end']); |
|
| 234 | +} |
|
| 235 | +?>" /> |
|
| 208 | 236 | <span class="input-group-addon"> |
| 209 | 237 | <span class="glyphicon glyphicon-calendar"></span> |
| 210 | 238 | </span> |
@@ -229,8 +257,20 @@ discard block |
||
| 229 | 257 | </script> |
| 230 | 258 | <li><?php echo _("Playback speed:"); ?> |
| 231 | 259 | <div class="range"> |
| 232 | - <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
| 233 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
| 260 | + <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
| 261 | + print $_POST['archivespeed']; |
|
| 262 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
| 263 | + print $_COOKIE['archive_speed']; |
|
| 264 | +} else { |
|
| 265 | + print '1'; |
|
| 266 | +} |
|
| 267 | +?>"> |
|
| 268 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
| 269 | + print $_COOKIE['archive_speed']; |
|
| 270 | +} else { |
|
| 271 | + print '1'; |
|
| 272 | +} |
|
| 273 | +?></output> |
|
| 234 | 274 | </div> |
| 235 | 275 | </li> |
| 236 | 276 | <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li> |
@@ -252,25 +292,43 @@ discard block |
||
| 252 | 292 | <li><?php echo _("Type of Map:"); ?> |
| 253 | 293 | <select class="selectpicker" onchange="mapType(this);"> |
| 254 | 294 | <?php |
| 255 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
| 256 | - else $MapType = $_COOKIE['MapType']; |
|
| 295 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
| 296 | + $MapType = $globalMapProvider; |
|
| 297 | + } else { |
|
| 298 | + $MapType = $_COOKIE['MapType']; |
|
| 299 | + } |
|
| 257 | 300 | ?> |
| 258 | 301 | <?php |
| 259 | 302 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
| 260 | 303 | ?> |
| 261 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
| 304 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 305 | + print ' selected'; |
|
| 306 | +} |
|
| 307 | +?>>Natural Earth (local)</option> |
|
| 262 | 308 | <?php |
| 263 | 309 | } else { |
| 264 | 310 | if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
| 265 | 311 | ?> |
| 266 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
| 312 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 313 | + print ' selected'; |
|
| 314 | +} |
|
| 315 | +?>>Natural Earth (local)</option> |
|
| 267 | 316 | <?php |
| 268 | 317 | } |
| 269 | 318 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
| 270 | 319 | ?> |
| 271 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
| 272 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
| 273 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
| 320 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
| 321 | + print ' selected'; |
|
| 322 | +} |
|
| 323 | +?>>Bing-Aerial</option> |
|
| 324 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
| 325 | + print ' selected'; |
|
| 326 | +} |
|
| 327 | +?>>Bing-Hybrid</option> |
|
| 328 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
| 329 | + print ' selected'; |
|
| 330 | +} |
|
| 331 | +?>>Bing-Road</option> |
|
| 274 | 332 | <?php |
| 275 | 333 | } |
| 276 | 334 | ?> |
@@ -280,58 +338,139 @@ discard block |
||
| 280 | 338 | <?php |
| 281 | 339 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
| 282 | 340 | ?> |
| 283 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
| 284 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
| 285 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
| 341 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
| 342 | + print ' selected'; |
|
| 343 | +} |
|
| 344 | +?>>Here-Aerial</option> |
|
| 345 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
| 346 | + print ' selected'; |
|
| 347 | +} |
|
| 348 | +?>>Here-Hybrid</option> |
|
| 349 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
| 350 | + print ' selected'; |
|
| 351 | +} |
|
| 352 | +?>>Here-Road</option> |
|
| 286 | 353 | <?php |
| 287 | 354 | } |
| 288 | 355 | ?> |
| 289 | 356 | <?php |
| 290 | 357 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
| 291 | 358 | ?> |
| 292 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
| 293 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
| 294 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
| 295 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
| 359 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
| 360 | + print ' selected'; |
|
| 361 | +} |
|
| 362 | +?>>Google Roadmap</option> |
|
| 363 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
| 364 | + print ' selected'; |
|
| 365 | +} |
|
| 366 | +?>>Google Satellite</option> |
|
| 367 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
| 368 | + print ' selected'; |
|
| 369 | +} |
|
| 370 | +?>>Google Hybrid</option> |
|
| 371 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
| 372 | + print ' selected'; |
|
| 373 | +} |
|
| 374 | +?>>Google Terrain</option> |
|
| 296 | 375 | <?php |
| 297 | 376 | } |
| 298 | 377 | ?> |
| 299 | 378 | <?php |
| 300 | 379 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
| 301 | 380 | ?> |
| 302 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
| 303 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
| 304 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
| 381 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
| 382 | + print ' selected'; |
|
| 383 | +} |
|
| 384 | +?>>MapQuest-OSM</option> |
|
| 385 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
| 386 | + print ' selected'; |
|
| 387 | +} |
|
| 388 | +?>>MapQuest-Aerial</option> |
|
| 389 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
| 390 | + print ' selected'; |
|
| 391 | +} |
|
| 392 | +?>>MapQuest-Hybrid</option> |
|
| 305 | 393 | <?php |
| 306 | 394 | } |
| 307 | 395 | ?> |
| 308 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
| 309 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
|
| 396 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
| 397 | + print ' selected'; |
|
| 398 | +} |
|
| 399 | +?>>Yandex</option> |
|
| 400 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 401 | + print ' selected'; |
|
| 402 | +} |
|
| 403 | +?>>Natural Earth</option> |
|
| 310 | 404 | <?php |
| 311 | 405 | } |
| 312 | 406 | ?> |
| 313 | 407 | <?php |
| 314 | 408 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
| 315 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
| 316 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 409 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
| 410 | + $MapBoxId = 'default'; |
|
| 411 | + } else { |
|
| 412 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 413 | + } |
|
| 317 | 414 | ?> |
| 318 | - <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
|
| 319 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
| 320 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
| 321 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
| 322 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
| 323 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
| 324 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
| 325 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
| 326 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
| 327 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
| 328 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
| 329 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
| 330 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
| 415 | + <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') { |
|
| 416 | + print ' selected'; |
|
| 417 | +} |
|
| 418 | +?>>Mapbox GL</option> |
|
| 419 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
| 420 | + print ' selected'; |
|
| 421 | +} |
|
| 422 | +?>>Mapbox default</option> |
|
| 423 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
| 424 | + print ' selected'; |
|
| 425 | +} |
|
| 426 | +?>>Mapbox streets</option> |
|
| 427 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
| 428 | + print ' selected'; |
|
| 429 | +} |
|
| 430 | +?>>Mapbox light</option> |
|
| 431 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
| 432 | + print ' selected'; |
|
| 433 | +} |
|
| 434 | +?>>Mapbox dark</option> |
|
| 435 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
| 436 | + print ' selected'; |
|
| 437 | +} |
|
| 438 | +?>>Mapbox satellite</option> |
|
| 439 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
| 440 | + print ' selected'; |
|
| 441 | +} |
|
| 442 | +?>>Mapbox streets-satellite</option> |
|
| 443 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
| 444 | + print ' selected'; |
|
| 445 | +} |
|
| 446 | +?>>Mapbox streets-basic</option> |
|
| 447 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
| 448 | + print ' selected'; |
|
| 449 | +} |
|
| 450 | +?>>Mapbox comic</option> |
|
| 451 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
| 452 | + print ' selected'; |
|
| 453 | +} |
|
| 454 | +?>>Mapbox outdoors</option> |
|
| 455 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
| 456 | + print ' selected'; |
|
| 457 | +} |
|
| 458 | +?>>Mapbox pencil</option> |
|
| 459 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
| 460 | + print ' selected'; |
|
| 461 | +} |
|
| 462 | +?>>Mapbox pirates</option> |
|
| 463 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
| 464 | + print ' selected'; |
|
| 465 | +} |
|
| 466 | +?>>Mapbox emerald</option> |
|
| 331 | 467 | <?php |
| 332 | 468 | } |
| 333 | 469 | ?> |
| 334 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
| 470 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
| 471 | + print ' selected'; |
|
| 472 | +} |
|
| 473 | +?>>OpenStreetMap</option> |
|
| 335 | 474 | <?php |
| 336 | 475 | } |
| 337 | 476 | ?> |
@@ -342,10 +481,22 @@ discard block |
||
| 342 | 481 | ?> |
| 343 | 482 | <li><?php echo _("Type of Terrain:"); ?> |
| 344 | 483 | <select class="selectpicker" onchange="terrainType(this);"> |
| 345 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
| 346 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
| 347 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
| 348 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
| 484 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
| 485 | + print ' selected'; |
|
| 486 | +} |
|
| 487 | +?>>stk terrain</option> |
|
| 488 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
| 489 | + print ' selected'; |
|
| 490 | +} |
|
| 491 | +?>>ellipsoid</option> |
|
| 492 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
| 493 | + print ' selected'; |
|
| 494 | +} |
|
| 495 | +?>>vr terrain</option> |
|
| 496 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
| 497 | + print ' selected'; |
|
| 498 | +} |
|
| 499 | +?>>ArticDEM</option> |
|
| 349 | 500 | </select> |
| 350 | 501 | </li> |
| 351 | 502 | <?php |
@@ -354,38 +505,77 @@ discard block |
||
| 354 | 505 | <?php |
| 355 | 506 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
| 356 | 507 | ?> |
| 357 | - <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if ((isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') || (!isset($_COOKIE['Map2DBuildings']))) print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
| 508 | + <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if ((isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') || (!isset($_COOKIE['Map2DBuildings']))) { |
|
| 509 | + print 'checked'; |
|
| 510 | +} |
|
| 511 | +?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
| 358 | 512 | |
| 359 | 513 | <?php |
| 360 | 514 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 361 | 515 | ?> |
| 362 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
| 363 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 364 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
| 365 | - <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
| 366 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
| 516 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
| 517 | + print 'checked'; |
|
| 518 | +} |
|
| 519 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
| 520 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
| 521 | + print 'checked'; |
|
| 522 | +} |
|
| 523 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 524 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) { |
|
| 525 | + print 'checked'; |
|
| 526 | +} |
|
| 527 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
| 528 | + <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) { |
|
| 529 | + print 'checked'; |
|
| 530 | +} |
|
| 531 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
| 532 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
| 533 | + print 'checked'; |
|
| 534 | +} |
|
| 535 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
| 367 | 536 | <?php |
| 368 | 537 | } |
| 369 | 538 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
| 370 | 539 | ?> |
| 371 | - <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
| 540 | + <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
| 541 | + print 'checked'; |
|
| 542 | +} |
|
| 543 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
| 372 | 544 | <?php |
| 373 | 545 | } |
| 374 | 546 | } |
| 375 | 547 | ?> |
| 376 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
| 377 | - <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
| 378 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
| 379 | - <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
| 548 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) { |
|
| 549 | + print 'checked'; |
|
| 550 | +} |
|
| 551 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
| 552 | + <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
| 553 | + print 'checked'; |
|
| 554 | +} |
|
| 555 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
| 556 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
| 557 | + print 'checked'; |
|
| 558 | +} |
|
| 559 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
| 560 | + <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
| 561 | + print 'checked'; |
|
| 562 | +} |
|
| 563 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
| 380 | 564 | <?php |
| 381 | 565 | if (isset($globalFires)) { |
| 382 | 566 | ?> |
| 383 | - <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
| 567 | + <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
| 568 | + print 'checked'; |
|
| 569 | +} |
|
| 570 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
| 384 | 571 | <?php |
| 385 | 572 | } |
| 386 | 573 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
| 387 | 574 | ?> |
| 388 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
| 575 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
| 576 | + print 'checked'; |
|
| 577 | +} |
|
| 578 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
| 389 | 579 | <?php |
| 390 | 580 | } |
| 391 | 581 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -398,17 +588,25 @@ discard block |
||
| 398 | 588 | if (function_exists('array_column')) { |
| 399 | 589 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
| 400 | 590 | ?> |
| 401 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 591 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 592 | + print 'checked'; |
|
| 593 | +} |
|
| 594 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 402 | 595 | <?php |
| 403 | 596 | } |
| 404 | 597 | } elseif (isset($globalSources)) { |
| 405 | 598 | $dispolar = false; |
| 406 | 599 | foreach ($globalSources as $testsource) { |
| 407 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 600 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
| 601 | + $dispolar = true; |
|
| 602 | + } |
|
| 408 | 603 | } |
| 409 | 604 | if ($dispolar) { |
| 410 | 605 | ?> |
| 411 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 606 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 607 | + print 'checked'; |
|
| 608 | +} |
|
| 609 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 412 | 610 | <?php |
| 413 | 611 | } |
| 414 | 612 | } |
@@ -421,12 +619,22 @@ discard block |
||
| 421 | 619 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 422 | 620 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 423 | 621 | ?> |
| 424 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
| 622 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
| 623 | + print 'checked'; |
|
| 624 | +} |
|
| 625 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
| 425 | 626 | <?php |
| 426 | 627 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
| 427 | 628 | ?> |
| 428 | 629 | <li><?php echo _("Aircraft icon color:"); ?> |
| 429 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> |
|
| 630 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
| 631 | + print $_COOKIE['IconColor']; |
|
| 632 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 633 | + print $globalAircraftIconColor; |
|
| 634 | +} else { |
|
| 635 | + print '1a3151'; |
|
| 636 | +} |
|
| 637 | +?>"> |
|
| 430 | 638 | </li> |
| 431 | 639 | <?php |
| 432 | 640 | } |
@@ -438,7 +646,14 @@ discard block |
||
| 438 | 646 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 439 | 647 | ?> |
| 440 | 648 | <li><?php echo _("Marine icon color:"); ?> |
| 441 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
|
| 649 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
| 650 | + print $_COOKIE['MarineIconColor']; |
|
| 651 | +} elseif (isset($globalMarineIconColor)) { |
|
| 652 | + print $globalMarineIconColor; |
|
| 653 | +} else { |
|
| 654 | + print '1a3151'; |
|
| 655 | +} |
|
| 656 | +?>"> |
|
| 442 | 657 | </li> |
| 443 | 658 | <?php |
| 444 | 659 | } |
@@ -449,7 +664,14 @@ discard block |
||
| 449 | 664 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 450 | 665 | ?> |
| 451 | 666 | <li><?php echo _("Tracker icon color:"); ?> |
| 452 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
|
| 667 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 668 | + print $_COOKIE['TrackerIconColor']; |
|
| 669 | +} elseif (isset($globalTrackerIconColor)) { |
|
| 670 | + print $globalTrackerIconColor; |
|
| 671 | +} else { |
|
| 672 | + print '1a3151'; |
|
| 673 | +} |
|
| 674 | +?>"> |
|
| 453 | 675 | </li> |
| 454 | 676 | <?php |
| 455 | 677 | } |
@@ -460,8 +682,22 @@ discard block |
||
| 460 | 682 | ?> |
| 461 | 683 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
| 462 | 684 | <div class="range"> |
| 463 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
| 464 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
| 685 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 686 | + print $_COOKIE['AirportZoom']; |
|
| 687 | +} elseif (isset($globalAirportZoom)) { |
|
| 688 | + print $globalAirportZoom; |
|
| 689 | +} else { |
|
| 690 | + print '7'; |
|
| 691 | +} |
|
| 692 | +?>"> |
|
| 693 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 694 | + print $_COOKIE['AirportZoom']; |
|
| 695 | +} elseif (isset($globalAirportZoom)) { |
|
| 696 | + print $globalAirportZoom; |
|
| 697 | +} else { |
|
| 698 | + print '7'; |
|
| 699 | +} |
|
| 700 | +?></output> |
|
| 465 | 701 | </div> |
| 466 | 702 | </li> |
| 467 | 703 | <?php |
@@ -473,10 +709,23 @@ discard block |
||
| 473 | 709 | <?php |
| 474 | 710 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 475 | 711 | ?> |
| 476 | - <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> ><?php echo _("Use airlines liveries"); ?></li> |
|
| 477 | - <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li> |
|
| 712 | + <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') { |
|
| 713 | + print 'checked'; |
|
| 714 | +} |
|
| 715 | +?> ><?php echo _("Use airlines liveries"); ?></li> |
|
| 716 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
| 717 | + print 'checked'; |
|
| 718 | +} |
|
| 719 | +?> ><?php echo _("Force Aircraft color"); ?></li> |
|
| 478 | 720 | <li><?php echo _("Aircraft icon color:"); ?> |
| 479 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>"> |
|
| 721 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
| 722 | + print $_COOKIE['IconColor']; |
|
| 723 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 724 | + print $globalAircraftIconColor; |
|
| 725 | +} else { |
|
| 726 | + print 'ff0000'; |
|
| 727 | +} |
|
| 728 | +?>"> |
|
| 480 | 729 | </li> |
| 481 | 730 | <?php |
| 482 | 731 | } |
@@ -484,9 +733,19 @@ discard block |
||
| 484 | 733 | <?php |
| 485 | 734 | if (isset($globalMarine) && $globalMarine === TRUE) { |
| 486 | 735 | ?> |
| 487 | - <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li> |
|
| 736 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
| 737 | + print 'checked'; |
|
| 738 | +} |
|
| 739 | +?> ><?php echo _("Force Marine color"); ?></li> |
|
| 488 | 740 | <li><?php echo _("Marine icon color:"); ?> |
| 489 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>"> |
|
| 741 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
| 742 | + print $_COOKIE['MarineIconColor']; |
|
| 743 | +} elseif (isset($globalMarineIconColor)) { |
|
| 744 | + print $globalMarineIconColor; |
|
| 745 | +} else { |
|
| 746 | + print 'ff0000'; |
|
| 747 | +} |
|
| 748 | +?>"> |
|
| 490 | 749 | </li> |
| 491 | 750 | <?php |
| 492 | 751 | } |
@@ -494,9 +753,19 @@ discard block |
||
| 494 | 753 | <?php |
| 495 | 754 | if (isset($globalTracker) && $globalTracker === TRUE) { |
| 496 | 755 | ?> |
| 497 | - <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?></li> |
|
| 756 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
| 757 | + print 'checked'; |
|
| 758 | +} |
|
| 759 | +?> ><?php echo _("Force Tracker color"); ?></li> |
|
| 498 | 760 | <li><?php echo _("Tracker icon color:"); ?> |
| 499 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>"> |
|
| 761 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 762 | + print $_COOKIE['TrackerIconColor']; |
|
| 763 | +} elseif (isset($globalTrackerIconColor)) { |
|
| 764 | + print $globalTrackerIconColor; |
|
| 765 | +} else { |
|
| 766 | + print 'ff0000'; |
|
| 767 | +} |
|
| 768 | +?>"> |
|
| 500 | 769 | </li> |
| 501 | 770 | <?php |
| 502 | 771 | } |
@@ -504,22 +773,46 @@ discard block |
||
| 504 | 773 | ?> |
| 505 | 774 | <li><?php echo _("Distance unit:"); ?> |
| 506 | 775 | <select class="selectpicker" onchange="unitdistance(this);"> |
| 507 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
| 508 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
| 509 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
| 776 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
| 777 | + echo ' selected'; |
|
| 778 | +} |
|
| 779 | +?>>km</option> |
|
| 780 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
| 781 | + echo ' selected'; |
|
| 782 | +} |
|
| 783 | +?>>nm</option> |
|
| 784 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
| 785 | + echo ' selected'; |
|
| 786 | +} |
|
| 787 | +?>>mi</option> |
|
| 510 | 788 | </select> |
| 511 | 789 | </li> |
| 512 | 790 | <li><?php echo _("Altitude unit:"); ?> |
| 513 | 791 | <select class="selectpicker" onchange="unitaltitude(this);"> |
| 514 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
| 515 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
| 792 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
| 793 | + echo ' selected'; |
|
| 794 | +} |
|
| 795 | +?>>m</option> |
|
| 796 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
| 797 | + echo ' selected'; |
|
| 798 | +} |
|
| 799 | +?>>feet</option> |
|
| 516 | 800 | </select> |
| 517 | 801 | </li> |
| 518 | 802 | <li><?php echo _("Speed unit:"); ?> |
| 519 | 803 | <select class="selectpicker" onchange="unitspeed(this);"> |
| 520 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
| 521 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
| 522 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
| 804 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
| 805 | + echo ' selected'; |
|
| 806 | +} |
|
| 807 | +?>>km/h</option> |
|
| 808 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
| 809 | + echo ' selected'; |
|
| 810 | +} |
|
| 811 | +?>>mph</option> |
|
| 812 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
| 813 | + echo ' selected'; |
|
| 814 | +} |
|
| 815 | +?>>knots</option> |
|
| 523 | 816 | </select> |
| 524 | 817 | </li> |
| 525 | 818 | |
@@ -537,9 +830,18 @@ discard block |
||
| 537 | 830 | <?php |
| 538 | 831 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
| 539 | 832 | ?> |
| 540 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
| 541 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
| 542 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
| 833 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { |
|
| 834 | + print 'checked'; |
|
| 835 | +} |
|
| 836 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
| 837 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { |
|
| 838 | + print 'checked'; |
|
| 839 | +} |
|
| 840 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
| 841 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { |
|
| 842 | + print 'checked'; |
|
| 843 | +} |
|
| 844 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
| 543 | 845 | <?php |
| 544 | 846 | } |
| 545 | 847 | ?> |
@@ -547,10 +849,16 @@ discard block |
||
| 547 | 849 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
| 548 | 850 | ?> |
| 549 | 851 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
| 550 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
| 852 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { |
|
| 853 | + print 'checked'; |
|
| 854 | +} |
|
| 855 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
| 551 | 856 | <?php } ?> |
| 552 | 857 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
| 553 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 858 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
| 859 | + print 'checked'; |
|
| 860 | +} |
|
| 861 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 554 | 862 | <?php } ?> |
| 555 | 863 | <?php |
| 556 | 864 | } |
@@ -567,7 +875,9 @@ discard block |
||
| 567 | 875 | } |
| 568 | 876 | foreach($allairlinenames as $airline) { |
| 569 | 877 | $airline_name = $airline['airline_name']; |
| 570 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
| 878 | + if (strlen($airline_name) > 30) { |
|
| 879 | + $airline_name = substr($airline_name,0,30).'...'; |
|
| 880 | + } |
|
| 571 | 881 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
| 572 | 882 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
| 573 | 883 | } else { |
@@ -585,7 +895,10 @@ discard block |
||
| 585 | 895 | <li><?php echo _("Display alliance:"); ?> |
| 586 | 896 | <br/> |
| 587 | 897 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
| 588 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 898 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
| 899 | + echo ' selected'; |
|
| 900 | +} |
|
| 901 | +?>><?php echo _("All"); ?></option> |
|
| 589 | 902 | <?php |
| 590 | 903 | foreach($allalliancenames as $alliance) { |
| 591 | 904 | $alliance_name = $alliance['alliance']; |
@@ -644,10 +957,22 @@ discard block |
||
| 644 | 957 | ?> |
| 645 | 958 | <li><?php echo _("Display airlines of type:"); ?><br/> |
| 646 | 959 | <select class="selectpicker" onchange="airlinestype(this);"> |
| 647 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 648 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
| 649 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
| 650 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
| 960 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
| 961 | + echo ' selected'; |
|
| 962 | +} |
|
| 963 | +?>><?php echo _("All"); ?></option> |
|
| 964 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
| 965 | + echo ' selected'; |
|
| 966 | +} |
|
| 967 | +?>><?php echo _("Passenger"); ?></option> |
|
| 968 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
| 969 | + echo ' selected'; |
|
| 970 | +} |
|
| 971 | +?>><?php echo _("Cargo"); ?></option> |
|
| 972 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
| 973 | + echo ' selected'; |
|
| 974 | +} |
|
| 975 | +?>><?php echo _("Military"); ?></option> |
|
| 651 | 976 | </select> |
| 652 | 977 | </li> |
| 653 | 978 | <?php |
@@ -661,14 +986,20 @@ discard block |
||
| 661 | 986 | ?> |
| 662 | 987 | <li> |
| 663 | 988 | <?php echo _("Display vessels with MMSI:"); ?> |
| 664 | - <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
|
| 989 | + <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) { |
|
| 990 | + print $_COOKIE['filter_mmsi']; |
|
| 991 | +} |
|
| 992 | +?>" /> |
|
| 665 | 993 | </li> |
| 666 | 994 | <?php |
| 667 | 995 | } |
| 668 | 996 | ?> |
| 669 | 997 | <li> |
| 670 | 998 | <?php echo _("Display with ident:"); ?> |
| 671 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
| 999 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
| 1000 | + print $_COOKIE['filter_ident']; |
|
| 1001 | +} |
|
| 1002 | +?>" /> |
|
| 672 | 1003 | </li> |
| 673 | 1004 | </ul> |
| 674 | 1005 | </form> |
@@ -684,7 +1015,10 @@ discard block |
||
| 684 | 1015 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
| 685 | 1016 | <form> |
| 686 | 1017 | <ul> |
| 687 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 1018 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) { |
|
| 1019 | + print 'checked'; |
|
| 1020 | +} |
|
| 1021 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 688 | 1022 | <li><?php echo _("Type:"); ?> |
| 689 | 1023 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
| 690 | 1024 | <?php |
@@ -692,25 +1026,45 @@ discard block |
||
| 692 | 1026 | $types = $Satellite->get_tle_types(); |
| 693 | 1027 | foreach ($types as $type) { |
| 694 | 1028 | $type_name = $type['tle_type']; |
| 695 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
| 696 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
| 697 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
| 698 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
| 699 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
| 700 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
| 701 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 702 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
| 703 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
| 704 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
| 705 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
| 706 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
| 707 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
| 708 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
| 709 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
| 710 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
| 711 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
| 712 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
| 713 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
| 1029 | + if ($type_name == 'musson') { |
|
| 1030 | + $type_name = 'Russian LEO Navigation'; |
|
| 1031 | + } else if ($type_name == 'nnss') { |
|
| 1032 | + $type_name = 'Navi Navigation Satellite System'; |
|
| 1033 | + } else if ($type_name == 'sbas') { |
|
| 1034 | + $type_name = 'Satellite-Based Augmentation System'; |
|
| 1035 | + } else if ($type_name == 'glo-ops') { |
|
| 1036 | + $type_name = 'Glonass Operational'; |
|
| 1037 | + } else if ($type_name == 'gps-ops') { |
|
| 1038 | + $type_name = 'GPS Operational'; |
|
| 1039 | + } else if ($type_name == 'argos') { |
|
| 1040 | + $type_name = 'ARGOS Data Collection System'; |
|
| 1041 | + } else if ($type_name == 'tdrss') { |
|
| 1042 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 1043 | + } else if ($type_name == 'sarsat') { |
|
| 1044 | + $type_name = 'Search & Rescue'; |
|
| 1045 | + } else if ($type_name == 'dmc') { |
|
| 1046 | + $type_name = 'Disaster Monitoring'; |
|
| 1047 | + } else if ($type_name == 'resource') { |
|
| 1048 | + $type_name = 'Earth Resources'; |
|
| 1049 | + } else if ($type_name == 'stations') { |
|
| 1050 | + $type_name = 'Space Stations'; |
|
| 1051 | + } else if ($type_name == 'geo') { |
|
| 1052 | + $type_name = 'Geostationary'; |
|
| 1053 | + } else if ($type_name == 'amateur') { |
|
| 1054 | + $type_name = 'Amateur Radio'; |
|
| 1055 | + } else if ($type_name == 'x-comm') { |
|
| 1056 | + $type_name = 'Experimental'; |
|
| 1057 | + } else if ($type_name == 'other-comm') { |
|
| 1058 | + $type_name = 'Other Comm'; |
|
| 1059 | + } else if ($type_name == 'science') { |
|
| 1060 | + $type_name = 'Space & Earth Science'; |
|
| 1061 | + } else if ($type_name == 'military') { |
|
| 1062 | + $type_name = 'Miscellaneous Military'; |
|
| 1063 | + } else if ($type_name == 'radar') { |
|
| 1064 | + $type_name = 'Radar Calibration'; |
|
| 1065 | + } else if ($type_name == 'tle-new') { |
|
| 1066 | + $type_name = 'Last 30 days launches'; |
|
| 1067 | + } |
|
| 714 | 1068 | |
| 715 | 1069 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
| 716 | 1070 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -4,11 +4,19 @@ discard block |
||
| 4 | 4 | if (isset($_SESSION['error'])) { |
| 5 | 5 | header('Content-Encoding: none;'); |
| 6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
| 7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
| 8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
| 9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
| 10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
| 11 | -} |
|
| 7 | + if (isset($_SESSION['error'])) { |
|
| 8 | + unset($_SESSION['error']); |
|
| 9 | + } |
|
| 10 | + if (isset($_SESSION['errorlst'])) { |
|
| 11 | + unset($_SESSION['errorlst']); |
|
| 12 | + } |
|
| 13 | + if (isset($_SESSION['next'])) { |
|
| 14 | + unset($_SESSION['next']); |
|
| 15 | + } |
|
| 16 | + if (isset($_SESSION['install'])) { |
|
| 17 | + unset($_SESSION['install']); |
|
| 18 | + } |
|
| 19 | + } |
|
| 12 | 20 | /* |
| 13 | 21 | if (isset($_SESSION['errorlst'])) { |
| 14 | 22 | header('Content-Encoding: none;'); |
@@ -159,45 +167,72 @@ discard block |
||
| 159 | 167 | </div> |
| 160 | 168 | <p> |
| 161 | 169 | <label for="dbhost">Database hostname</label> |
| 162 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
| 170 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
| 171 | + print $globalDBhost; |
|
| 172 | +} |
|
| 173 | +?>" /> |
|
| 163 | 174 | </p> |
| 164 | 175 | <p> |
| 165 | 176 | <label for="dbport">Database port</label> |
| 166 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
| 177 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
| 178 | + print $globalDBport; |
|
| 179 | +} |
|
| 180 | +?>" /> |
|
| 167 | 181 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
| 168 | 182 | </p> |
| 169 | 183 | <p> |
| 170 | 184 | <label for="dbname">Database name</label> |
| 171 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
| 185 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
| 186 | + print $globalDBname; |
|
| 187 | +} |
|
| 188 | +?>" /> |
|
| 172 | 189 | </p> |
| 173 | 190 | <p> |
| 174 | 191 | <label for="dbuser">Database user</label> |
| 175 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
| 192 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
| 193 | + print $globalDBuser; |
|
| 194 | +} |
|
| 195 | +?>" /> |
|
| 176 | 196 | </p> |
| 177 | 197 | <p> |
| 178 | 198 | <label for="dbuserpass">Database user password</label> |
| 179 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
| 199 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
| 200 | + print $globalDBpass; |
|
| 201 | +} |
|
| 202 | +?>" /> |
|
| 180 | 203 | </p> |
| 181 | 204 | </fieldset> |
| 182 | 205 | <fieldset id="site"> |
| 183 | 206 | <legend>Site configuration</legend> |
| 184 | 207 | <p> |
| 185 | 208 | <label for="sitename">Site name</label> |
| 186 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
| 209 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
| 210 | + print $globalName; |
|
| 211 | +} |
|
| 212 | +?>" /> |
|
| 187 | 213 | </p> |
| 188 | 214 | <p> |
| 189 | 215 | <label for="siteurl">Site directory</label> |
| 190 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
| 216 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
| 217 | + print $globalURL; |
|
| 218 | +} |
|
| 219 | +?>" /> |
|
| 191 | 220 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
| 192 | 221 | </p> |
| 193 | 222 | <p> |
| 194 | 223 | <label for="timezone">Timezone</label> |
| 195 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
| 224 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
| 225 | + print $globalTimezone; |
|
| 226 | +} |
|
| 227 | +?>" /> |
|
| 196 | 228 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
| 197 | 229 | </p> |
| 198 | 230 | <p> |
| 199 | 231 | <label for="language">Language</label> |
| 200 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
| 232 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
| 233 | + print $globalLanguage; |
|
| 234 | +} |
|
| 235 | +?>" /> |
|
| 201 | 236 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
| 202 | 237 | </p> |
| 203 | 238 | </fieldset> |
@@ -217,11 +252,17 @@ discard block |
||
| 217 | 252 | <div id="mapbox_data"> |
| 218 | 253 | <p> |
| 219 | 254 | <label for="mapboxid">Mapbox id</label> |
| 220 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
| 255 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
| 256 | + print $globalMapboxId; |
|
| 257 | +} |
|
| 258 | +?>" /> |
|
| 221 | 259 | </p> |
| 222 | 260 | <p> |
| 223 | 261 | <label for="mapboxtoken">Mapbox token</label> |
| 224 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
| 262 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
| 263 | + print $globalMapboxToken; |
|
| 264 | +} |
|
| 265 | +?>" /> |
|
| 225 | 266 | </p> |
| 226 | 267 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
| 227 | 268 | </div> |
@@ -229,7 +270,10 @@ discard block |
||
| 229 | 270 | <div id="google_data"> |
| 230 | 271 | <p> |
| 231 | 272 | <label for="googlekey">Google API key</label> |
| 232 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
| 273 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
| 274 | + print $globalGoogleAPIKey; |
|
| 275 | +} |
|
| 276 | +?>" /> |
|
| 233 | 277 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
| 234 | 278 | </p> |
| 235 | 279 | </div> |
@@ -237,7 +281,10 @@ discard block |
||
| 237 | 281 | <div id="bing_data"> |
| 238 | 282 | <p> |
| 239 | 283 | <label for="bingkey">Bing Map key</label> |
| 240 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
| 284 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
| 285 | + print $globalBingMapKey; |
|
| 286 | +} |
|
| 287 | +?>" /> |
|
| 241 | 288 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
| 242 | 289 | </p> |
| 243 | 290 | </div> |
@@ -245,7 +292,10 @@ discard block |
||
| 245 | 292 | <div id="mapquest_data"> |
| 246 | 293 | <p> |
| 247 | 294 | <label for="mapquestkey">MapQuest key</label> |
| 248 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
| 295 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
| 296 | + print $globalMapQuestKey; |
|
| 297 | +} |
|
| 298 | +?>" /> |
|
| 249 | 299 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
| 250 | 300 | </p> |
| 251 | 301 | </div> |
@@ -253,11 +303,17 @@ discard block |
||
| 253 | 303 | <div id="here_data"> |
| 254 | 304 | <p> |
| 255 | 305 | <label for="hereappid">Here App_Id</label> |
| 256 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
| 306 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
| 307 | + print $globalHereappId; |
|
| 308 | +} |
|
| 309 | +?>" /> |
|
| 257 | 310 | </p> |
| 258 | 311 | <p> |
| 259 | 312 | <label for="hereappcode">Here App_Code</label> |
| 260 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
| 313 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
| 314 | + print $globalHereappCode; |
|
| 315 | +} |
|
| 316 | +?>" /> |
|
| 261 | 317 | </p> |
| 262 | 318 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
| 263 | 319 | </div> |
@@ -265,7 +321,10 @@ discard block |
||
| 265 | 321 | <div id="openweathermap_data"> |
| 266 | 322 | <p> |
| 267 | 323 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
| 268 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
| 324 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
| 325 | + print $globalOpenWeatherMapKey; |
|
| 326 | +} |
|
| 327 | +?>" /> |
|
| 269 | 328 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
| 270 | 329 | </p> |
| 271 | 330 | </div> |
@@ -294,42 +353,86 @@ discard block |
||
| 294 | 353 | <legend>Coverage area</legend> |
| 295 | 354 | <p> |
| 296 | 355 | <label for="latitudemax">The maximum latitude (north)</label> |
| 297 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
| 356 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
| 357 | + print $globalLatitudeMax; |
|
| 358 | +} |
|
| 359 | +?>" /> |
|
| 298 | 360 | </p> |
| 299 | 361 | <p> |
| 300 | 362 | <label for="latitudemin">The minimum latitude (south)</label> |
| 301 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
| 363 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
| 364 | + print $globalLatitudeMin; |
|
| 365 | +} |
|
| 366 | +?>" /> |
|
| 302 | 367 | </p> |
| 303 | 368 | <p> |
| 304 | 369 | <label for="longitudemax">The maximum longitude (west)</label> |
| 305 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
| 370 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
| 371 | + print $globalLongitudeMax; |
|
| 372 | +} |
|
| 373 | +?>" /> |
|
| 306 | 374 | </p> |
| 307 | 375 | <p> |
| 308 | 376 | <label for="longitudemin">The minimum longitude (east)</label> |
| 309 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
| 377 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
| 378 | + print $globalLongitudeMin; |
|
| 379 | +} |
|
| 380 | +?>" /> |
|
| 310 | 381 | </p> |
| 311 | 382 | <p> |
| 312 | 383 | <label for="latitudecenter">The latitude center</label> |
| 313 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
| 384 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
| 385 | + print $globalCenterLatitude; |
|
| 386 | +} |
|
| 387 | +?>" /> |
|
| 314 | 388 | </p> |
| 315 | 389 | <p> |
| 316 | 390 | <label for="longitudecenter">The longitude center</label> |
| 317 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
| 391 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
| 392 | + print $globalCenterLongitude; |
|
| 393 | +} |
|
| 394 | +?>" /> |
|
| 318 | 395 | </p> |
| 319 | 396 | <p> |
| 320 | 397 | <label for="livezoom">Default Zoom on live map</label> |
| 321 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
| 398 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
| 399 | + print $globalLiveZoom; |
|
| 400 | +} else { |
|
| 401 | + print '9'; |
|
| 402 | +} |
|
| 403 | +?>" /> |
|
| 322 | 404 | </p> |
| 323 | 405 | <p> |
| 324 | 406 | <label for="squawk_country">Country for squawk usage</label> |
| 325 | 407 | <select name="squawk_country" id="squawk_country"> |
| 326 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
| 327 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
| 328 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
| 329 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
| 330 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
| 331 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
| 332 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
| 408 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
| 409 | + print ' selected '; |
|
| 410 | +} |
|
| 411 | +?>>UK</option> |
|
| 412 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
| 413 | + print ' selected '; |
|
| 414 | +} |
|
| 415 | +?>>NZ</option> |
|
| 416 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
| 417 | + print ' selected '; |
|
| 418 | +} |
|
| 419 | +?>>US</option> |
|
| 420 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
| 421 | + print ' selected '; |
|
| 422 | +} |
|
| 423 | +?>>AU</option> |
|
| 424 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
| 425 | + print ' selected '; |
|
| 426 | +} |
|
| 427 | +?>>NL</option> |
|
| 428 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
| 429 | + print ' selected '; |
|
| 430 | +} |
|
| 431 | +?>>FR</option> |
|
| 432 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
| 433 | + print ' selected '; |
|
| 434 | +} |
|
| 435 | +?>>TR</option> |
|
| 333 | 436 | </select> |
| 334 | 437 | </p> |
| 335 | 438 | </fieldset> |
@@ -338,15 +441,24 @@ discard block |
||
| 338 | 441 | <p><i>Only put in DB flights that are inside a circle</i></p> |
| 339 | 442 | <p> |
| 340 | 443 | <label for="latitude">Center latitude</label> |
| 341 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
| 444 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
| 445 | + echo $globalDistanceIgnore['latitude']; |
|
| 446 | +} |
|
| 447 | +?>" /> |
|
| 342 | 448 | </p> |
| 343 | 449 | <p> |
| 344 | 450 | <label for="longitude">Center longitude</label> |
| 345 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
| 451 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
| 452 | + echo $globalDistanceIgnore['longitude']; |
|
| 453 | +} |
|
| 454 | +?>" /> |
|
| 346 | 455 | </p> |
| 347 | 456 | <p> |
| 348 | 457 | <label for="Distance">Distance (in km)</label> |
| 349 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
| 458 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
| 459 | + echo $globalDistanceIgnore['distance']; |
|
| 460 | +} |
|
| 461 | +?>" /> |
|
| 350 | 462 | </p> |
| 351 | 463 | </fieldset> |
| 352 | 464 | <fieldset id="sourceloc"> |
@@ -462,11 +574,17 @@ discard block |
||
| 462 | 574 | <div id="flightaware_data"> |
| 463 | 575 | <p> |
| 464 | 576 | <label for="flightawareusername">FlightAware username</label> |
| 465 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 577 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 578 | + print $globalFlightAwareUsername; |
|
| 579 | +} |
|
| 580 | +?>" /> |
|
| 466 | 581 | </p> |
| 467 | 582 | <p> |
| 468 | 583 | <label for="flightawarepassword">FlightAware password/API key</label> |
| 469 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 584 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 585 | + print $globalFlightAwarePassword; |
|
| 586 | +} |
|
| 587 | +?>" /> |
|
| 470 | 588 | </p> |
| 471 | 589 | </div> |
| 472 | 590 | --> |
@@ -508,7 +626,10 @@ discard block |
||
| 508 | 626 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
| 509 | 627 | ?> |
| 510 | 628 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 511 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
| 629 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
| 630 | + print $source['port']; |
|
| 631 | +} |
|
| 632 | +?>" /></td> |
|
| 512 | 633 | <?php |
| 513 | 634 | } else { |
| 514 | 635 | $hostport = explode(':',$source['host']); |
@@ -527,35 +648,110 @@ discard block |
||
| 527 | 648 | ?> |
| 528 | 649 | <td> |
| 529 | 650 | <select name="format[]" id="format"> |
| 530 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
| 531 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
| 532 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
| 533 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
| 534 | - <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option> |
|
| 535 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
| 536 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
| 537 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
| 538 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
| 539 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
| 540 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
| 541 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
| 542 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
| 543 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
| 544 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
| 545 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
| 546 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 547 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
| 548 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
| 549 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
| 550 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
| 551 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
| 651 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
| 652 | + print 'selected'; |
|
| 653 | +} |
|
| 654 | +?>>Auto</option> |
|
| 655 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
| 656 | + print 'selected'; |
|
| 657 | +} |
|
| 658 | +?>>SBS</option> |
|
| 659 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
| 660 | + print 'selected'; |
|
| 661 | +} |
|
| 662 | +?>>TSV</option> |
|
| 663 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
| 664 | + print 'selected'; |
|
| 665 | +} |
|
| 666 | +?>>Raw</option> |
|
| 667 | + <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') { |
|
| 668 | + print 'selected'; |
|
| 669 | +} |
|
| 670 | +?>>Dump1090 aircraft.json</option> |
|
| 671 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 672 | + print 'selected'; |
|
| 673 | +} |
|
| 674 | +?>>APRS</option> |
|
| 675 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
| 676 | + print 'selected'; |
|
| 677 | +} |
|
| 678 | +?>>Radarcape deltadb.txt</option> |
|
| 679 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
| 680 | + print 'selected'; |
|
| 681 | +} |
|
| 682 | +?>>Vatsim</option> |
|
| 683 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
| 684 | + print 'selected'; |
|
| 685 | +} |
|
| 686 | +?>>Virtual Radar Server AircraftList.json</option> |
|
| 687 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
| 688 | + print 'selected'; |
|
| 689 | +} |
|
| 690 | +?>>Virtual Radar Server TCP</option> |
|
| 691 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 692 | + print 'selected'; |
|
| 693 | +} |
|
| 694 | +?>>phpVMS</option> |
|
| 695 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 696 | + print 'selected'; |
|
| 697 | +} |
|
| 698 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
| 699 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
| 700 | + print 'selected'; |
|
| 701 | +} |
|
| 702 | +?>>Virtual Airlines Manager</option> |
|
| 703 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
| 704 | + print 'selected'; |
|
| 705 | +} |
|
| 706 | +?>>IVAO</option> |
|
| 707 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
| 708 | + print 'selected'; |
|
| 709 | +} |
|
| 710 | +?>>FlightGear Multiplayer</option> |
|
| 711 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
| 712 | + print 'selected'; |
|
| 713 | +} |
|
| 714 | +?>>FlightGear Singleplayer</option> |
|
| 715 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
| 716 | + print 'selected'; |
|
| 717 | +} |
|
| 718 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 719 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
| 720 | + print 'selected'; |
|
| 721 | +} |
|
| 722 | +?>>ACARS SBS-3 over TCP</option> |
|
| 723 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
| 724 | + print 'selected'; |
|
| 725 | +} |
|
| 726 | +?>>NMEA AIS over TCP</option> |
|
| 727 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
| 728 | + print 'selected'; |
|
| 729 | +} |
|
| 730 | +?>>AirWhere website</option> |
|
| 731 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
| 732 | + print 'selected'; |
|
| 733 | +} |
|
| 734 | +?>>HidnSeek Callback</option> |
|
| 735 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
| 736 | + print 'selected'; |
|
| 737 | +} |
|
| 738 | +?>>Blitzortung</option> |
|
| 552 | 739 | </select> |
| 553 | 740 | </td> |
| 554 | 741 | <td> |
| 555 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
| 742 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
| 743 | + print $source['name']; |
|
| 744 | +} |
|
| 745 | +?>" /> |
|
| 556 | 746 | </td> |
| 557 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
| 558 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
| 747 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
| 748 | + print 'checked'; |
|
| 749 | +} |
|
| 750 | +?> /></td> |
|
| 751 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
| 752 | + print 'checked'; |
|
| 753 | +} |
|
| 754 | +?> /></td> |
|
| 559 | 755 | <td> |
| 560 | 756 | <select name="timezones[]" id="timezones"> |
| 561 | 757 | <?php |
@@ -565,7 +761,9 @@ discard block |
||
| 565 | 761 | print '<option selected>'.$timezones.'</option>'; |
| 566 | 762 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
| 567 | 763 | print '<option selected>'.$timezones.'</option>'; |
| 568 | - } else print '<option>'.$timezones.'</option>'; |
|
| 764 | + } else { |
|
| 765 | + print '<option>'.$timezones.'</option>'; |
|
| 766 | + } |
|
| 569 | 767 | } |
| 570 | 768 | ?> |
| 571 | 769 | </select> |
@@ -617,7 +815,9 @@ discard block |
||
| 617 | 815 | foreach($timezonelist as $timezones){ |
| 618 | 816 | if ($timezones == 'UTC') { |
| 619 | 817 | print '<option selected>'.$timezones.'</option>'; |
| 620 | - } else print '<option>'.$timezones.'</option>'; |
|
| 818 | + } else { |
|
| 819 | + print '<option>'.$timezones.'</option>'; |
|
| 820 | + } |
|
| 621 | 821 | } |
| 622 | 822 | ?> |
| 623 | 823 | </select> |
@@ -642,11 +842,17 @@ discard block |
||
| 642 | 842 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
| 643 | 843 | <p> |
| 644 | 844 | <label for="acarshost">ACARS UDP host</label> |
| 645 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
| 845 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
| 846 | + print $globalACARSHost; |
|
| 847 | +} |
|
| 848 | +?>" /> |
|
| 646 | 849 | </p> |
| 647 | 850 | <p> |
| 648 | 851 | <label for="acarsport">ACARS UDP port</label> |
| 649 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
| 852 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
| 853 | + print $globalACARSPort; |
|
| 854 | +} |
|
| 855 | +?>" /> |
|
| 650 | 856 | </p> |
| 651 | 857 | </fieldset> |
| 652 | 858 | </div> |
@@ -672,17 +878,38 @@ discard block |
||
| 672 | 878 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
| 673 | 879 | <td> |
| 674 | 880 | <select name="newslang[]"> |
| 675 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
| 676 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
| 881 | + <option value="en"<?php if ($lng == 'en') { |
|
| 882 | + print ' selected'; |
|
| 883 | +} |
|
| 884 | +?>>English</option> |
|
| 885 | + <option value="fr"<?php if ($lng == 'fr') { |
|
| 886 | + print ' selected'; |
|
| 887 | +} |
|
| 888 | +?>>French</option> |
|
| 677 | 889 | </select> |
| 678 | 890 | </td> |
| 679 | 891 | <td> |
| 680 | 892 | <select name="newstype[]"> |
| 681 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
| 682 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
| 683 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
| 684 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
| 685 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
| 893 | + <option value="global"<?php if ($type == 'global') { |
|
| 894 | + print ' selected'; |
|
| 895 | +} |
|
| 896 | +?>>Global</option> |
|
| 897 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
| 898 | + print ' selected'; |
|
| 899 | +} |
|
| 900 | +?>>Aircraft</option> |
|
| 901 | + <option value="marine"<?php if ($type == 'marine') { |
|
| 902 | + print ' selected'; |
|
| 903 | +} |
|
| 904 | +?>>Marine</option> |
|
| 905 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
| 906 | + print ' selected'; |
|
| 907 | +} |
|
| 908 | +?>>Tracker</option> |
|
| 909 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
| 910 | + print ' selected'; |
|
| 911 | +} |
|
| 912 | +?>>Satellite</option> |
|
| 686 | 913 | </select> |
| 687 | 914 | </td> |
| 688 | 915 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -815,13 +1042,19 @@ discard block |
||
| 815 | 1042 | <div id="schedules_options"> |
| 816 | 1043 | <p> |
| 817 | 1044 | <label for="britishairways">British Airways API Key</label> |
| 818 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
| 1045 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
| 1046 | + print $globalBritishAirwaysKey; |
|
| 1047 | +} |
|
| 1048 | +?>" /> |
|
| 819 | 1049 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
| 820 | 1050 | </p> |
| 821 | 1051 | <!-- |
| 822 | 1052 | <p> |
| 823 | 1053 | <label for="transavia">Transavia Test API Consumer Key</label> |
| 824 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
| 1054 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
| 1055 | + print $globalTransaviaKey; |
|
| 1056 | +} |
|
| 1057 | +?>" /> |
|
| 825 | 1058 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
| 826 | 1059 | </p> |
| 827 | 1060 | --> |
@@ -830,10 +1063,16 @@ discard block |
||
| 830 | 1063 | <b>Lufthansa API Key</b> |
| 831 | 1064 | <p> |
| 832 | 1065 | <label for="lufthansakey">Key</label> |
| 833 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
| 1066 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
| 1067 | + print $globalLufthansaKey['key']; |
|
| 1068 | +} |
|
| 1069 | +?>" /> |
|
| 834 | 1070 | </p><p> |
| 835 | 1071 | <label for="lufthansasecret">Secret</label> |
| 836 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
| 1072 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
| 1073 | + print $globalLufthansaKey['secret']; |
|
| 1074 | +} |
|
| 1075 | +?>" /> |
|
| 837 | 1076 | </p> |
| 838 | 1077 | </div> |
| 839 | 1078 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -843,11 +1082,17 @@ discard block |
||
| 843 | 1082 | <b>FlightAware API Key</b> |
| 844 | 1083 | <p> |
| 845 | 1084 | <label for="flightawareusername">Username</label> |
| 846 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 1085 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 1086 | + print $globalFlightAwareUsername; |
|
| 1087 | +} |
|
| 1088 | +?>" /> |
|
| 847 | 1089 | </p> |
| 848 | 1090 | <p> |
| 849 | 1091 | <label for="flightawarepassword">API key</label> |
| 850 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 1092 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 1093 | + print $globalFlightAwarePassword; |
|
| 1094 | +} |
|
| 1095 | +?>" /> |
|
| 851 | 1096 | </p> |
| 852 | 1097 | </div> |
| 853 | 1098 | <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p> |
@@ -864,16 +1109,28 @@ discard block |
||
| 864 | 1109 | <p> |
| 865 | 1110 | <label for="mapmatchingsource">Map Matching source</label> |
| 866 | 1111 | <select name="mapmatchingsource" id="mapmatchingsource"> |
| 867 | - <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option> |
|
| 868 | - <option value="osmr" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>OSMR</option> |
|
| 869 | - <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option> |
|
| 1112 | + <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') { |
|
| 1113 | + print 'selected="selected" '; |
|
| 1114 | +} |
|
| 1115 | +?>>GraphHopper</option> |
|
| 1116 | + <option value="osmr" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') || !isset($globalMatchingSource)) { |
|
| 1117 | + print 'selected="selected" '; |
|
| 1118 | +} |
|
| 1119 | +?>>OSMR</option> |
|
| 1120 | + <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') { |
|
| 1121 | + print 'selected="selected" '; |
|
| 1122 | +} |
|
| 1123 | +?>>Mapbox</option> |
|
| 870 | 1124 | </select> |
| 871 | 1125 | <p class="help-block">Mapbox need the API Key defined in map section</p> |
| 872 | 1126 | </p> |
| 873 | 1127 | <br /> |
| 874 | 1128 | <p> |
| 875 | 1129 | <label for="graphhopper">GraphHopper API Key</label> |
| 876 | - <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" /> |
|
| 1130 | + <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) { |
|
| 1131 | + print $globalGraphHopperKey; |
|
| 1132 | +} |
|
| 1133 | +?>" /> |
|
| 877 | 1134 | <p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p> |
| 878 | 1135 | </p> |
| 879 | 1136 | </div> |
@@ -891,7 +1148,10 @@ discard block |
||
| 891 | 1148 | </p> |
| 892 | 1149 | <p> |
| 893 | 1150 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
| 894 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
| 1151 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
| 1152 | + print $globalNOTAMSource; |
|
| 1153 | +} |
|
| 1154 | +?>" /> |
|
| 895 | 1155 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
| 896 | 1156 | </p> |
| 897 | 1157 | <br /> |
@@ -907,14 +1167,20 @@ discard block |
||
| 907 | 1167 | <div id="metarsrc"> |
| 908 | 1168 | <p> |
| 909 | 1169 | <label for="metarsource">URL of your METAR source</label> |
| 910 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
| 1170 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
| 1171 | + print $globalMETARurl; |
|
| 1172 | +} |
|
| 1173 | +?>" /> |
|
| 911 | 1174 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
| 912 | 1175 | </p> |
| 913 | 1176 | </div> |
| 914 | 1177 | <br /> |
| 915 | 1178 | <p> |
| 916 | 1179 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
| 917 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
| 1180 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
| 1181 | + print $globalBitlyAccessToken; |
|
| 1182 | +} |
|
| 1183 | +?>" /> |
|
| 918 | 1184 | </p> |
| 919 | 1185 | <br /> |
| 920 | 1186 | <p> |
@@ -930,11 +1196,26 @@ discard block |
||
| 930 | 1196 | <p> |
| 931 | 1197 | <label for="geoid_source">Geoid Source</label> |
| 932 | 1198 | <select name="geoid_source" id="geoid_source"> |
| 933 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
| 934 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
| 935 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
| 936 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
| 937 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
| 1199 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
| 1200 | + print ' selected="selected"'; |
|
| 1201 | +} |
|
| 1202 | +?>>EGM96 15' (2.1MB)</option> |
|
| 1203 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
| 1204 | + print ' selected="selected"'; |
|
| 1205 | +} |
|
| 1206 | +?>>EGM96 5' (19MB)</option> |
|
| 1207 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
| 1208 | + print ' selected="selected"'; |
|
| 1209 | +} |
|
| 1210 | +?>>EGM2008 5' (19MB)</option> |
|
| 1211 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
| 1212 | + print ' selected="selected"'; |
|
| 1213 | +} |
|
| 1214 | +?>>EGM2008 2.5' (75MB)</option> |
|
| 1215 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
| 1216 | + print ' selected="selected"'; |
|
| 1217 | +} |
|
| 1218 | +?>>EGM2008 1' (470MB)</option> |
|
| 938 | 1219 | </select> |
| 939 | 1220 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
| 940 | 1221 | </p> |
@@ -956,7 +1237,12 @@ discard block |
||
| 956 | 1237 | </p> |
| 957 | 1238 | <p> |
| 958 | 1239 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
| 959 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
| 1240 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
| 1241 | + print $globalArchiveMonths; |
|
| 1242 | +} else { |
|
| 1243 | + echo '1'; |
|
| 1244 | +} |
|
| 1245 | +?>" /> |
|
| 960 | 1246 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
| 961 | 1247 | </p> |
| 962 | 1248 | <p> |
@@ -966,12 +1252,22 @@ discard block |
||
| 966 | 1252 | </p> |
| 967 | 1253 | <p> |
| 968 | 1254 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
| 969 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
| 1255 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
| 1256 | + print $globalArchiveKeepMonths; |
|
| 1257 | +} else { |
|
| 1258 | + echo '1'; |
|
| 1259 | +} |
|
| 1260 | +?>" /> |
|
| 970 | 1261 | <p class="help-block">0 to disable</p> |
| 971 | 1262 | </p> |
| 972 | 1263 | <p> |
| 973 | 1264 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
| 974 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
| 1265 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
| 1266 | + print $globalArchiveKeepTrackMonths; |
|
| 1267 | +} else { |
|
| 1268 | + echo '1'; |
|
| 1269 | +} |
|
| 1270 | +?>" /> |
|
| 975 | 1271 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
| 976 | 1272 | </p> |
| 977 | 1273 | <br /> |
@@ -981,7 +1277,12 @@ discard block |
||
| 981 | 1277 | <p class="help-block">Uncheck if the script is running as cron job</p> |
| 982 | 1278 | <div id="cronends"> |
| 983 | 1279 | <label for="cronend">Run script for xx seconds</label> |
| 984 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
| 1280 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
| 1281 | + print $globalCronEnd; |
|
| 1282 | +} else { |
|
| 1283 | + print '0'; |
|
| 1284 | +} |
|
| 1285 | +?>" /> |
|
| 985 | 1286 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
| 986 | 1287 | </div> |
| 987 | 1288 | </p> |
@@ -1034,15 +1335,30 @@ discard block |
||
| 1034 | 1335 | <br /> |
| 1035 | 1336 | <p> |
| 1036 | 1337 | <label for="refresh">Show flights detected since xxx seconds</label> |
| 1037 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
| 1338 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
| 1339 | + echo $globalLiveInterval; |
|
| 1340 | +} else { |
|
| 1341 | + echo '200'; |
|
| 1342 | +} |
|
| 1343 | +?>" /> |
|
| 1038 | 1344 | </p> |
| 1039 | 1345 | <p> |
| 1040 | 1346 | <label for="maprefresh">Live map refresh (in seconds)</label> |
| 1041 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
| 1347 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
| 1348 | + echo $globalMapRefresh; |
|
| 1349 | +} else { |
|
| 1350 | + echo '30'; |
|
| 1351 | +} |
|
| 1352 | +?>" /> |
|
| 1042 | 1353 | </p> |
| 1043 | 1354 | <p> |
| 1044 | 1355 | <label for="mapidle">Map idle timeout (in minutes)</label> |
| 1045 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
| 1356 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
| 1357 | + echo $globalMapIdleTimeout; |
|
| 1358 | +} else { |
|
| 1359 | + echo '30'; |
|
| 1360 | +} |
|
| 1361 | +?>" /> |
|
| 1046 | 1362 | <p class="help-block">0 to disable</p> |
| 1047 | 1363 | </p> |
| 1048 | 1364 | <p> |
@@ -1057,12 +1373,20 @@ discard block |
||
| 1057 | 1373 | <br /> |
| 1058 | 1374 | <p> |
| 1059 | 1375 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
| 1060 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
| 1376 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
| 1377 | + echo $globalClosestMinDist; |
|
| 1378 | +} else { |
|
| 1379 | + echo '50'; |
|
| 1380 | +} |
|
| 1381 | +?>" /> |
|
| 1061 | 1382 | </p> |
| 1062 | 1383 | <br /> |
| 1063 | 1384 | <p> |
| 1064 | 1385 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 1065 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1386 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
| 1387 | + echo $globalAircraftSize; |
|
| 1388 | +} |
|
| 1389 | +?>" /> |
|
| 1066 | 1390 | </p> |
| 1067 | 1391 | <br /> |
| 1068 | 1392 | <p> |
@@ -1081,7 +1405,12 @@ discard block |
||
| 1081 | 1405 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 1082 | 1406 | ?> |
| 1083 | 1407 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 1084 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
| 1408 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
| 1409 | + echo $globalAircraftIconColor; |
|
| 1410 | +} else { |
|
| 1411 | + echo '1a3151'; |
|
| 1412 | +} |
|
| 1413 | +?>" /> |
|
| 1085 | 1414 | <?php |
| 1086 | 1415 | if (!is_writable('../cache')) { |
| 1087 | 1416 | ?> |
@@ -1099,14 +1428,27 @@ discard block |
||
| 1099 | 1428 | <p> |
| 1100 | 1429 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
| 1101 | 1430 | <div class="range"> |
| 1102 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
| 1103 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
| 1431 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
| 1432 | + echo $globalAirportZoom; |
|
| 1433 | +} else { |
|
| 1434 | + echo '7'; |
|
| 1435 | +} |
|
| 1436 | +?>" /> |
|
| 1437 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
| 1438 | + echo $globalAirportZoom; |
|
| 1439 | +} else { |
|
| 1440 | + echo '7'; |
|
| 1441 | +} |
|
| 1442 | +?></output> |
|
| 1104 | 1443 | </div> |
| 1105 | 1444 | </p> |
| 1106 | 1445 | <br /> |
| 1107 | 1446 | <p> |
| 1108 | 1447 | <label for="customcss">Custom CSS web path</label> |
| 1109 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
| 1448 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
| 1449 | + echo $globalCustomCSS; |
|
| 1450 | +} |
|
| 1451 | +?>" /> |
|
| 1110 | 1452 | </p> |
| 1111 | 1453 | </fieldset> |
| 1112 | 1454 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1133,8 +1475,12 @@ discard block |
||
| 1133 | 1475 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
| 1134 | 1476 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
| 1135 | 1477 | |
| 1136 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1137 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1478 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
| 1479 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1480 | + } |
|
| 1481 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
| 1482 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1483 | + } |
|
| 1138 | 1484 | |
| 1139 | 1485 | $_SESSION['database_root'] = $dbroot; |
| 1140 | 1486 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1202,15 +1548,23 @@ discard block |
||
| 1202 | 1548 | $source_city = $_POST['source_city']; |
| 1203 | 1549 | $source_country = $_POST['source_country']; |
| 1204 | 1550 | $source_ref = $_POST['source_ref']; |
| 1205 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
| 1206 | - else $source_id = array(); |
|
| 1551 | + if (isset($source_id)) { |
|
| 1552 | + $source_id = $_POST['source_id']; |
|
| 1553 | + } else { |
|
| 1554 | + $source_id = array(); |
|
| 1555 | + } |
|
| 1207 | 1556 | |
| 1208 | 1557 | $sources = array(); |
| 1209 | 1558 | foreach ($source_name as $keys => $name) { |
| 1210 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1211 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1559 | + if (isset($source_id[$keys])) { |
|
| 1560 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1561 | + } else { |
|
| 1562 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1563 | + } |
|
| 1564 | + } |
|
| 1565 | + if (count($sources) > 0) { |
|
| 1566 | + $_SESSION['sources'] = $sources; |
|
| 1212 | 1567 | } |
| 1213 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
| 1214 | 1568 | |
| 1215 | 1569 | $newsurl = $_POST['newsurl']; |
| 1216 | 1570 | $newslng = $_POST['newslang']; |
@@ -1223,7 +1577,9 @@ discard block |
||
| 1223 | 1577 | $lng = $newslng[$newskey]; |
| 1224 | 1578 | if (isset($newsfeeds[$type][$lng])) { |
| 1225 | 1579 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
| 1226 | - } else $newsfeeds[$type][$lng] = array($url); |
|
| 1580 | + } else { |
|
| 1581 | + $newsfeeds[$type][$lng] = array($url); |
|
| 1582 | + } |
|
| 1227 | 1583 | } |
| 1228 | 1584 | } |
| 1229 | 1585 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1247,17 +1603,29 @@ discard block |
||
| 1247 | 1603 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
| 1248 | 1604 | |
| 1249 | 1605 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
| 1250 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1251 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1606 | + if ($globalaircraft == 'aircraft') { |
|
| 1607 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1608 | + } else { |
|
| 1609 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1610 | + } |
|
| 1252 | 1611 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
| 1253 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1254 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1612 | + if ($globaltracker == 'tracker') { |
|
| 1613 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1614 | + } else { |
|
| 1615 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1616 | + } |
|
| 1255 | 1617 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
| 1256 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1257 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1618 | + if ($globalmarine == 'marine') { |
|
| 1619 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1620 | + } else { |
|
| 1621 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1622 | + } |
|
| 1258 | 1623 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
| 1259 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1260 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1624 | + if ($globalsatellite == 'satellite') { |
|
| 1625 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1626 | + } else { |
|
| 1627 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1628 | + } |
|
| 1261 | 1629 | |
| 1262 | 1630 | /* |
| 1263 | 1631 | $globalSBS1Hosts = array(); |
@@ -1279,23 +1647,37 @@ discard block |
||
| 1279 | 1647 | $name = $_POST['name']; |
| 1280 | 1648 | $format = $_POST['format']; |
| 1281 | 1649 | $timezones = $_POST['timezones']; |
| 1282 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
| 1283 | - else $sourcestats = array(); |
|
| 1284 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
| 1285 | - else $noarchive = array(); |
|
| 1650 | + if (isset($_POST['sourcestats'])) { |
|
| 1651 | + $sourcestats = $_POST['sourcestats']; |
|
| 1652 | + } else { |
|
| 1653 | + $sourcestats = array(); |
|
| 1654 | + } |
|
| 1655 | + if (isset($_POST['noarchive'])) { |
|
| 1656 | + $noarchive = $_POST['noarchive']; |
|
| 1657 | + } else { |
|
| 1658 | + $noarchive = array(); |
|
| 1659 | + } |
|
| 1286 | 1660 | $gSources = array(); |
| 1287 | 1661 | $forcepilots = false; |
| 1288 | 1662 | foreach ($host as $key => $h) { |
| 1289 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
| 1290 | - else $cov = 'FALSE'; |
|
| 1291 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
| 1292 | - else $arch = 'FALSE'; |
|
| 1663 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
| 1664 | + $cov = 'TRUE'; |
|
| 1665 | + } else { |
|
| 1666 | + $cov = 'FALSE'; |
|
| 1667 | + } |
|
| 1668 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
| 1669 | + $arch = 'TRUE'; |
|
| 1670 | + } else { |
|
| 1671 | + $arch = 'FALSE'; |
|
| 1672 | + } |
|
| 1293 | 1673 | if (strpos($format[$key],'_callback')) { |
| 1294 | 1674 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
| 1295 | 1675 | } elseif ($h != '' || $name[$key] != '') { |
| 1296 | 1676 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
| 1297 | 1677 | } |
| 1298 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
| 1678 | + if ($format[$key] == 'airwhere') { |
|
| 1679 | + $forcepilots = true; |
|
| 1680 | + } |
|
| 1299 | 1681 | } |
| 1300 | 1682 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
| 1301 | 1683 | |
@@ -1326,7 +1708,9 @@ discard block |
||
| 1326 | 1708 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
| 1327 | 1709 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1328 | 1710 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
| 1329 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1711 | + } else { |
|
| 1712 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1713 | + } |
|
| 1330 | 1714 | |
| 1331 | 1715 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
| 1332 | 1716 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1365,7 +1749,9 @@ discard block |
||
| 1365 | 1749 | |
| 1366 | 1750 | // Create in settings.php keys not yet configurable if not already here |
| 1367 | 1751 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1368 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1752 | + if (!isset($globalDebug)) { |
|
| 1753 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1754 | + } |
|
| 1369 | 1755 | |
| 1370 | 1756 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
| 1371 | 1757 | if ($resetyearstats == 'resetyearstats') { |
@@ -1408,37 +1794,56 @@ discard block |
||
| 1408 | 1794 | } |
| 1409 | 1795 | */ |
| 1410 | 1796 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
| 1411 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1412 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1413 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1414 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1797 | + if ($globalsbs == 'sbs') { |
|
| 1798 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1799 | + } else { |
|
| 1800 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1801 | + } |
|
| 1802 | + if ($globalaprs == 'aprs') { |
|
| 1803 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1804 | + } else { |
|
| 1805 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1806 | + } |
|
| 1415 | 1807 | $va = false; |
| 1416 | 1808 | if ($globalivao == 'ivao') { |
| 1417 | 1809 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
| 1418 | 1810 | $va = true; |
| 1419 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1811 | + } else { |
|
| 1812 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1813 | + } |
|
| 1420 | 1814 | if ($globalvatsim == 'vatsim') { |
| 1421 | 1815 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
| 1422 | 1816 | $va = true; |
| 1423 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1817 | + } else { |
|
| 1818 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1819 | + } |
|
| 1424 | 1820 | if ($globalphpvms == 'phpvms') { |
| 1425 | 1821 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
| 1426 | 1822 | $va = true; |
| 1427 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1823 | + } else { |
|
| 1824 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1825 | + } |
|
| 1428 | 1826 | if ($globalvam == 'vam') { |
| 1429 | 1827 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
| 1430 | 1828 | $va = true; |
| 1431 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1829 | + } else { |
|
| 1830 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1831 | + } |
|
| 1432 | 1832 | if ($va) { |
| 1433 | 1833 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
| 1434 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1834 | + } else { |
|
| 1835 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1836 | + } |
|
| 1435 | 1837 | if ($globalva == 'va' || $va) { |
| 1436 | 1838 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
| 1437 | 1839 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
| 1438 | 1840 | } else { |
| 1439 | 1841 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
| 1440 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1441 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1842 | + if ($forcepilots) { |
|
| 1843 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1844 | + } else { |
|
| 1845 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1846 | + } |
|
| 1442 | 1847 | } |
| 1443 | 1848 | |
| 1444 | 1849 | |
@@ -1661,7 +2066,9 @@ discard block |
||
| 1661 | 2066 | $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
| 1662 | 2067 | $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
| 1663 | 2068 | |
| 1664 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 2069 | + if (!isset($globalTransaction)) { |
|
| 2070 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 2071 | + } |
|
| 1665 | 2072 | |
| 1666 | 2073 | // Set some defaults values... |
| 1667 | 2074 | if (!isset($globalAircraftImageSources)) { |
@@ -1676,15 +2083,23 @@ discard block |
||
| 1676 | 2083 | |
| 1677 | 2084 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1678 | 2085 | |
| 1679 | - if ($error == '') settings::modify_settings($settings); |
|
| 1680 | - if ($error == '') settings::comment_settings($settings_comment); |
|
| 2086 | + if ($error == '') { |
|
| 2087 | + settings::modify_settings($settings); |
|
| 2088 | + } |
|
| 2089 | + if ($error == '') { |
|
| 2090 | + settings::comment_settings($settings_comment); |
|
| 2091 | + } |
|
| 1681 | 2092 | if ($error != '') { |
| 1682 | 2093 | print '<div class="info column">'.$error.'</div>'; |
| 1683 | 2094 | require('../footer.php'); |
| 1684 | 2095 | exit; |
| 1685 | 2096 | } else { |
| 1686 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
| 1687 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
| 2097 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
| 2098 | + $_SESSION['waypoints'] = 1; |
|
| 2099 | + } |
|
| 2100 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
| 2101 | + $_SESSION['owner'] = 1; |
|
| 2102 | + } |
|
| 1688 | 2103 | if (isset($_POST['createdb'])) { |
| 1689 | 2104 | $_SESSION['install'] = 'database_create'; |
| 1690 | 2105 | } else { |
@@ -1721,10 +2136,18 @@ discard block |
||
| 1721 | 2136 | $popw = false; |
| 1722 | 2137 | foreach ($_SESSION['done'] as $done) { |
| 1723 | 2138 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
| 1724 | - if ($done == 'Create database') $pop = true; |
|
| 1725 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1726 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1727 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
| 2139 | + if ($done == 'Create database') { |
|
| 2140 | + $pop = true; |
|
| 2141 | + } |
|
| 2142 | + if ($_SESSION['install'] == 'database_create') { |
|
| 2143 | + $pop = true; |
|
| 2144 | + } |
|
| 2145 | + if ($_SESSION['install'] == 'database_import') { |
|
| 2146 | + $popi = true; |
|
| 2147 | + } |
|
| 2148 | + if ($_SESSION['install'] == 'waypoints') { |
|
| 2149 | + $popw = true; |
|
| 2150 | + } |
|
| 1728 | 2151 | } |
| 1729 | 2152 | if ($pop) { |
| 1730 | 2153 | sleep(5); |
@@ -1735,7 +2158,9 @@ discard block |
||
| 1735 | 2158 | } else if ($popw) { |
| 1736 | 2159 | sleep(5); |
| 1737 | 2160 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
| 1738 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2161 | + } else { |
|
| 2162 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2163 | + } |
|
| 1739 | 2164 | print '</div></ul>'; |
| 1740 | 2165 | print '<div id="error"></div>'; |
| 1741 | 2166 | /* foreach ($_SESSION['done'] as $done) { |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | header('Content-Type: text/javascript'); |
| 18 | 18 | |
| 19 | 19 | |
| 20 | -$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
| 20 | +$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
| 21 | 21 | $output = '{"type": "FeatureCollection","features": ['; |
| 22 | 22 | if (!empty($polar)) { |
| 23 | - foreach($polar as $eachpolar) { |
|
| 23 | + foreach ($polar as $eachpolar) { |
|
| 24 | 24 | $data = json_decode($eachpolar['source_data']); |
| 25 | 25 | $name = $eachpolar['source_name']; |
| 26 | 26 | $coord = $Location->getLocationInfobySourceName($name); |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | $initial_longitude = $globalCenterLongitude; |
| 34 | 34 | } |
| 35 | 35 | $first = ''; |
| 36 | - foreach($data as $value => $key) { |
|
| 37 | - $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key); |
|
| 38 | - if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
| 36 | + foreach ($data as $value => $key) { |
|
| 37 | + $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude, $initial_longitude, $value*22.5, $key); |
|
| 38 | + if ($first == '') $first = '['.round($final_coord['longitude'], 5).','.round($final_coord['latitude'], 5).']'; |
|
| 39 | 39 | $output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],'; |
| 40 | 40 | } |
| 41 | 41 | $output .= $first; |
| 42 | 42 | $output .= ']]}},'; |
| 43 | 43 | } |
| 44 | - $output = substr($output, 0, -1); |
|
| 44 | + $output = substr($output, 0, -1); |
|
| 45 | 45 | } |
| 46 | 46 | $output .= ']}'; |
| 47 | 47 | print $output; |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
| 17 | 17 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
| 18 | 18 | if (isset($globalMarine) && $globalMarine) { |
| 19 | - require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
| 20 | - require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
| 19 | + require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
| 20 | + require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (!isset($globalDebug)) $globalDebug = FALSE; |
@@ -25,46 +25,46 @@ discard block |
||
| 25 | 25 | // Check if schema is at latest version |
| 26 | 26 | $Connection = new Connection(); |
| 27 | 27 | if ($Connection->connectionExists() === false) { |
| 28 | - echo "Can't connect to your database. Check DB is running, user/password and database logs."; |
|
| 29 | - exit(); |
|
| 28 | + echo "Can't connect to your database. Check DB is running, user/password and database logs."; |
|
| 29 | + exit(); |
|
| 30 | 30 | } |
| 31 | 31 | if ($Connection->latest() === false) { |
| 32 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
| 33 | - exit(); |
|
| 32 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
| 33 | + exit(); |
|
| 34 | 34 | } |
| 35 | 35 | if (PHP_SAPI != 'cli') { |
| 36 | - echo "This script MUST be called from console, not a web browser."; |
|
| 36 | + echo "This script MUST be called from console, not a web browser."; |
|
| 37 | 37 | // exit(); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // This is to be compatible with old version of settings.php |
| 41 | 41 | if (!isset($globalSources)) { |
| 42 | - if (isset($globalSBS1Hosts)) { |
|
| 43 | - //$hosts = $globalSBS1Hosts; |
|
| 44 | - foreach ($globalSBS1Hosts as $host) { |
|
| 45 | - $globalSources[] = array('host' => $host); |
|
| 46 | - } |
|
| 47 | - } else { |
|
| 48 | - if (!isset($globalSBS1Host)) { |
|
| 49 | - echo '$globalSources MUST be defined !'; |
|
| 50 | - die; |
|
| 42 | + if (isset($globalSBS1Hosts)) { |
|
| 43 | + //$hosts = $globalSBS1Hosts; |
|
| 44 | + foreach ($globalSBS1Hosts as $host) { |
|
| 45 | + $globalSources[] = array('host' => $host); |
|
| 46 | + } |
|
| 47 | + } else { |
|
| 48 | + if (!isset($globalSBS1Host)) { |
|
| 49 | + echo '$globalSources MUST be defined !'; |
|
| 50 | + die; |
|
| 51 | 51 | } |
| 52 | 52 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
| 53 | 53 | $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver','enable-aircraft','disable-aircraft','enable-tracker','disable-tracker','enable-marine','disable-marine')); |
| 58 | 58 | //if (isset($options['s'])) $hosts = array($options['s']); |
| 59 | 59 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 60 | 60 | if (isset($options['s'])) { |
| 61 | - $globalSources = array(); |
|
| 62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 63 | - else $globalSources[] = array('host' => $options['s']); |
|
| 61 | + $globalSources = array(); |
|
| 62 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 63 | + else $globalSources[] = array('host' => $options['s']); |
|
| 64 | 64 | } elseif (isset($options['source'])) { |
| 65 | - $globalSources = array(); |
|
| 66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 67 | - else $globalSources[] = array('host' => $options['source']); |
|
| 65 | + $globalSources = array(); |
|
| 66 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 67 | + else $globalSources[] = array('host' => $options['source']); |
|
| 68 | 68 | } |
| 69 | 69 | if (isset($options['aprsserverhost'])) { |
| 70 | 70 | $globalServerAPRS = TRUE; |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | if (isset($options['idsource'])) $id_source = $options['idsource']; |
| 104 | 104 | else $id_source = 1; |
| 105 | 105 | if (isset($globalServer) && $globalServer) { |
| 106 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 107 | - $SI=new SpotterServer(); |
|
| 106 | + if ($globalDebug) echo "Using Server Mode\n"; |
|
| 107 | + $SI=new SpotterServer(); |
|
| 108 | 108 | /* |
| 109 | 109 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 110 | 110 | $SI = new adsb2aprs(); |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
| 116 | 116 | if (isset($globalMarine) && $globalMarine) { |
| 117 | - require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
| 118 | - require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
| 117 | + require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
| 118 | + require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
| 122 | 122 | if (isset($globalMarine) && $globalMarine) { |
| 123 | - $AIS = new AIS(); |
|
| 124 | - $MI = new MarineImport($Connection->db); |
|
| 123 | + $AIS = new AIS(); |
|
| 124 | + $MI = new MarineImport($Connection->db); |
|
| 125 | 125 | } |
| 126 | 126 | //$APRS=new APRS($Connection->db); |
| 127 | 127 | $SBS=new SBS(); |
@@ -134,12 +134,12 @@ discard block |
||
| 134 | 134 | //$servertz = system('date +%Z'); |
| 135 | 135 | // signal handler - playing nice with sockets and dump1090 |
| 136 | 136 | if (function_exists('pcntl_fork')) { |
| 137 | - pcntl_signal(SIGINT, function() { |
|
| 138 | - global $sockets; |
|
| 139 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 140 | - die("Bye!\n"); |
|
| 141 | - }); |
|
| 142 | - pcntl_signal_dispatch(); |
|
| 137 | + pcntl_signal(SIGINT, function() { |
|
| 138 | + global $sockets; |
|
| 139 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 140 | + die("Bye!\n"); |
|
| 141 | + }); |
|
| 142 | + pcntl_signal_dispatch(); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | // let's try and connect |
@@ -149,41 +149,41 @@ discard block |
||
| 149 | 149 | $reset = 0; |
| 150 | 150 | |
| 151 | 151 | function connect_all($hosts) { |
| 152 | - //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 153 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
| 154 | - $reset++; |
|
| 155 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 156 | - foreach ($hosts as $id => $value) { |
|
| 152 | + //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 153 | + global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
| 154 | + $reset++; |
|
| 155 | + if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 156 | + foreach ($hosts as $id => $value) { |
|
| 157 | 157 | $host = $value['host']; |
| 158 | 158 | $globalSources[$id]['last_exec'] = 0; |
| 159 | 159 | // Here we check type of source(s) |
| 160 | 160 | if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
| 161 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 162 | - //$formats[$id] = 'deltadbtxt'; |
|
| 163 | - $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 164 | - //$last_exec['deltadbtxt'] = 0; |
|
| 165 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 166 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 167 | - //$formats[$id] = 'vatsimtxt'; |
|
| 168 | - $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 169 | - //$last_exec['vatsimtxt'] = 0; |
|
| 170 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 171 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 172 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 173 | - $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 174 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 175 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 176 | - } else if (preg_match('/aircraft.json$/i',$host)) { |
|
| 177 | - //$formats[$id] = 'aircraftjson'; |
|
| 178 | - $globalSources[$id]['format'] = 'aircraftjson'; |
|
| 179 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 180 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 181 | - } else if (preg_match('/opensky/i',$host)) { |
|
| 182 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 183 | - $globalSources[$id]['format'] = 'opensky'; |
|
| 184 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 185 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 186 | - /* |
|
| 161 | + if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 162 | + //$formats[$id] = 'deltadbtxt'; |
|
| 163 | + $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 164 | + //$last_exec['deltadbtxt'] = 0; |
|
| 165 | + if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 166 | + } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 167 | + //$formats[$id] = 'vatsimtxt'; |
|
| 168 | + $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 169 | + //$last_exec['vatsimtxt'] = 0; |
|
| 170 | + if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 171 | + } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 172 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 173 | + $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 174 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 175 | + if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 176 | + } else if (preg_match('/aircraft.json$/i',$host)) { |
|
| 177 | + //$formats[$id] = 'aircraftjson'; |
|
| 178 | + $globalSources[$id]['format'] = 'aircraftjson'; |
|
| 179 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 180 | + if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 181 | + } else if (preg_match('/opensky/i',$host)) { |
|
| 182 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 183 | + $globalSources[$id]['format'] = 'opensky'; |
|
| 184 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 185 | + if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 186 | + /* |
|
| 187 | 187 | // Disabled for now, site change source format |
| 188 | 188 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
| 189 | 189 | //$formats[$id] = 'radarvirtueljson'; |
@@ -195,125 +195,125 @@ discard block |
||
| 195 | 195 | exit(0); |
| 196 | 196 | } |
| 197 | 197 | */ |
| 198 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 199 | - //$formats[$id] = 'planeupdatefaa'; |
|
| 200 | - $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 201 | - //$last_exec['planeupdatefaa'] = 0; |
|
| 202 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 203 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 204 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 205 | - exit(0); |
|
| 206 | - } |
|
| 207 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 208 | - //$formats[$id] = 'phpvmacars'; |
|
| 209 | - $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 210 | - //$last_exec['phpvmacars'] = 0; |
|
| 211 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 212 | - } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
|
| 213 | - //$formats[$id] = 'phpvmacars'; |
|
| 214 | - $globalSources[$id]['format'] = 'vaos'; |
|
| 215 | - //$last_exec['phpvmacars'] = 0; |
|
| 216 | - if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
|
| 217 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 218 | - //$formats[$id] = 'phpvmacars'; |
|
| 219 | - $globalSources[$id]['format'] = 'vam'; |
|
| 220 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 221 | - } else if (preg_match('/whazzup/i',$host)) { |
|
| 222 | - //$formats[$id] = 'whazzup'; |
|
| 223 | - $globalSources[$id]['format'] = 'whazzup'; |
|
| 224 | - //$last_exec['whazzup'] = 0; |
|
| 225 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 226 | - } else if (preg_match('/blitzortung/i',$host)) { |
|
| 227 | - $globalSources[$id]['format'] = 'blitzortung'; |
|
| 228 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 229 | - } else if (preg_match('/airwhere/i',$host)) { |
|
| 230 | - $globalSources[$id]['format'] = 'airwhere'; |
|
| 231 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
| 232 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
| 233 | - //$formats[$id] = 'pirepsjson'; |
|
| 234 | - $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 235 | - //$last_exec['pirepsjson'] = 0; |
|
| 236 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 237 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 238 | - //$formats[$id] = 'fr24json'; |
|
| 239 | - $globalSources[$id]['format'] = 'fr24json'; |
|
| 240 | - //$last_exec['fr24json'] = 0; |
|
| 241 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 242 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 243 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 244 | - exit(0); |
|
| 245 | - } |
|
| 246 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
| 247 | - //$formats[$id] = 'fr24json'; |
|
| 248 | - $globalSources[$id]['format'] = 'myshiptracking'; |
|
| 249 | - //$last_exec['fr24json'] = 0; |
|
| 250 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 251 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 252 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 253 | - exit(0); |
|
| 254 | - } |
|
| 255 | - //} else if (preg_match('/10001/',$host)) { |
|
| 256 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 257 | - //$formats[$id] = 'tsv'; |
|
| 258 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 259 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 260 | - } |
|
| 261 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 262 | - if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
|
| 263 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
| 264 | - if ($idf !== false) { |
|
| 265 | - $httpfeeds[$id] = $idf; |
|
| 266 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 267 | - } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 268 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 269 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 270 | - $hostport = explode(':',$host); |
|
| 271 | - if (isset($hostport[1])) { |
|
| 198 | + } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 199 | + //$formats[$id] = 'planeupdatefaa'; |
|
| 200 | + $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 201 | + //$last_exec['planeupdatefaa'] = 0; |
|
| 202 | + if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 203 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 204 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 205 | + exit(0); |
|
| 206 | + } |
|
| 207 | + } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 208 | + //$formats[$id] = 'phpvmacars'; |
|
| 209 | + $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 210 | + //$last_exec['phpvmacars'] = 0; |
|
| 211 | + if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 212 | + } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
|
| 213 | + //$formats[$id] = 'phpvmacars'; |
|
| 214 | + $globalSources[$id]['format'] = 'vaos'; |
|
| 215 | + //$last_exec['phpvmacars'] = 0; |
|
| 216 | + if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
|
| 217 | + } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 218 | + //$formats[$id] = 'phpvmacars'; |
|
| 219 | + $globalSources[$id]['format'] = 'vam'; |
|
| 220 | + if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 221 | + } else if (preg_match('/whazzup/i',$host)) { |
|
| 222 | + //$formats[$id] = 'whazzup'; |
|
| 223 | + $globalSources[$id]['format'] = 'whazzup'; |
|
| 224 | + //$last_exec['whazzup'] = 0; |
|
| 225 | + if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 226 | + } else if (preg_match('/blitzortung/i',$host)) { |
|
| 227 | + $globalSources[$id]['format'] = 'blitzortung'; |
|
| 228 | + if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 229 | + } else if (preg_match('/airwhere/i',$host)) { |
|
| 230 | + $globalSources[$id]['format'] = 'airwhere'; |
|
| 231 | + if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
| 232 | + } else if (preg_match('/recentpireps/i',$host)) { |
|
| 233 | + //$formats[$id] = 'pirepsjson'; |
|
| 234 | + $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 235 | + //$last_exec['pirepsjson'] = 0; |
|
| 236 | + if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 237 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 238 | + //$formats[$id] = 'fr24json'; |
|
| 239 | + $globalSources[$id]['format'] = 'fr24json'; |
|
| 240 | + //$last_exec['fr24json'] = 0; |
|
| 241 | + if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 242 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 243 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 244 | + exit(0); |
|
| 245 | + } |
|
| 246 | + } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
| 247 | + //$formats[$id] = 'fr24json'; |
|
| 248 | + $globalSources[$id]['format'] = 'myshiptracking'; |
|
| 249 | + //$last_exec['fr24json'] = 0; |
|
| 250 | + if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 251 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 252 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 253 | + exit(0); |
|
| 254 | + } |
|
| 255 | + //} else if (preg_match('/10001/',$host)) { |
|
| 256 | + } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 257 | + //$formats[$id] = 'tsv'; |
|
| 258 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 259 | + if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 260 | + } |
|
| 261 | + } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 262 | + if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
|
| 263 | + $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
| 264 | + if ($idf !== false) { |
|
| 265 | + $httpfeeds[$id] = $idf; |
|
| 266 | + if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 267 | + } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 268 | + } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 269 | + } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 270 | + $hostport = explode(':',$host); |
|
| 271 | + if (isset($hostport[1])) { |
|
| 272 | 272 | $port = $hostport[1]; |
| 273 | 273 | $hostn = $hostport[0]; |
| 274 | - } else { |
|
| 274 | + } else { |
|
| 275 | 275 | $port = $globalSources[$id]['port']; |
| 276 | 276 | $hostn = $globalSources[$id]['host']; |
| 277 | - } |
|
| 278 | - $Common = new Common(); |
|
| 279 | - if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 280 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
| 281 | - } else { |
|
| 282 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 283 | - } |
|
| 284 | - if ($s) { |
|
| 285 | - $sockets[$id] = $s; |
|
| 286 | - if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 287 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
| 277 | + } |
|
| 278 | + $Common = new Common(); |
|
| 279 | + if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 280 | + $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
| 281 | + } else { |
|
| 282 | + $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 283 | + } |
|
| 284 | + if ($s) { |
|
| 285 | + $sockets[$id] = $s; |
|
| 286 | + if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 287 | + if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
| 288 | 288 | //$formats[$id] = 'aprs'; |
| 289 | 289 | $globalSources[$id]['format'] = 'aprs'; |
| 290 | 290 | //$aprs_connect = 0; |
| 291 | 291 | //$use_aprs = true; |
| 292 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
| 292 | + } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
| 293 | 293 | $globalSources[$id]['format'] = 'vrstcp'; |
| 294 | - } elseif ($port == '10001') { |
|
| 295 | - //$formats[$id] = 'tsv'; |
|
| 296 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 297 | - } elseif ($port == '30002') { |
|
| 298 | - //$formats[$id] = 'raw'; |
|
| 299 | - $globalSources[$id]['format'] = 'raw'; |
|
| 300 | - } elseif ($port == '5001') { |
|
| 301 | - //$formats[$id] = 'raw'; |
|
| 302 | - $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 303 | - } elseif ($port == '30005') { |
|
| 294 | + } elseif ($port == '10001') { |
|
| 295 | + //$formats[$id] = 'tsv'; |
|
| 296 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 297 | + } elseif ($port == '30002') { |
|
| 298 | + //$formats[$id] = 'raw'; |
|
| 299 | + $globalSources[$id]['format'] = 'raw'; |
|
| 300 | + } elseif ($port == '5001') { |
|
| 301 | + //$formats[$id] = 'raw'; |
|
| 302 | + $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 303 | + } elseif ($port == '30005') { |
|
| 304 | 304 | // Not yet supported |
| 305 | - //$formats[$id] = 'beast'; |
|
| 306 | - $globalSources[$id]['format'] = 'beast'; |
|
| 307 | - //} else $formats[$id] = 'sbs'; |
|
| 308 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 309 | - //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 305 | + //$formats[$id] = 'beast'; |
|
| 306 | + $globalSources[$id]['format'] = 'beast'; |
|
| 307 | + //} else $formats[$id] = 'sbs'; |
|
| 308 | + } else $globalSources[$id]['format'] = 'sbs'; |
|
| 309 | + //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 310 | 310 | } |
| 311 | 311 | if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
| 312 | - } else { |
|
| 312 | + } else { |
|
| 313 | 313 | if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
| 314 | - } |
|
| 315 | - } |
|
| 316 | - } |
|
| 314 | + } |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | 317 | } |
| 318 | 318 | if (!isset($globalMinFetch)) $globalMinFetch = 15; |
| 319 | 319 | |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | //connect_all($globalSources); |
| 337 | 337 | |
| 338 | 338 | if (isset($globalProxy) && $globalProxy) { |
| 339 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
| 339 | + $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
| 340 | 340 | } else { |
| 341 | - $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
|
| 341 | + $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | // APRS Configuration |
@@ -347,21 +347,21 @@ discard block |
||
| 347 | 347 | die; |
| 348 | 348 | } |
| 349 | 349 | foreach ($globalSources as $key => $source) { |
| 350 | - if (!isset($source['format'])) { |
|
| 351 | - $globalSources[$key]['format'] = 'auto'; |
|
| 352 | - } |
|
| 353 | - if (isset($source['callback']) && $source['callback'] === TRUE) { |
|
| 354 | - unset($globalSources[$key]); |
|
| 355 | - } |
|
| 350 | + if (!isset($source['format'])) { |
|
| 351 | + $globalSources[$key]['format'] = 'auto'; |
|
| 352 | + } |
|
| 353 | + if (isset($source['callback']) && $source['callback'] === TRUE) { |
|
| 354 | + unset($globalSources[$key]); |
|
| 355 | + } |
|
| 356 | 356 | } |
| 357 | 357 | connect_all($globalSources); |
| 358 | 358 | foreach ($globalSources as $key => $source) { |
| 359 | - if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 359 | + if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 360 | 360 | $aprs_connect = 0; |
| 361 | 361 | $use_aprs = true; |
| 362 | 362 | if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
| 363 | 363 | break; |
| 364 | - } |
|
| 364 | + } |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | if ($use_aprs) { |
@@ -402,133 +402,133 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 404 | 404 | while ($i > 0) { |
| 405 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 405 | + if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 406 | 406 | |
| 407 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 408 | - // Delete old ATC |
|
| 409 | - if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 407 | + if (!$globalDaemon) $i = $endtime-time(); |
|
| 408 | + // Delete old ATC |
|
| 409 | + if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 410 | 410 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
| 411 | - $ATC->deleteOldATC(); |
|
| 412 | - } |
|
| 411 | + $ATC->deleteOldATC(); |
|
| 412 | + } |
|
| 413 | 413 | |
| 414 | - if (count($last_exec) == count($globalSources)) { |
|
| 414 | + if (count($last_exec) == count($globalSources)) { |
|
| 415 | 415 | $max = $globalMinFetch; |
| 416 | 416 | foreach ($last_exec as $last) { |
| 417 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 417 | + if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 418 | 418 | } |
| 419 | 419 | if ($max < $globalMinFetch) { |
| 420 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 421 | - sleep($globalMinFetch-$max+2); |
|
| 420 | + if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 421 | + sleep($globalMinFetch-$max+2); |
|
| 422 | + } |
|
| 422 | 423 | } |
| 423 | - } |
|
| 424 | 424 | |
| 425 | 425 | |
| 426 | - //foreach ($formats as $id => $value) { |
|
| 427 | - foreach ($globalSources as $id => $value) { |
|
| 426 | + //foreach ($formats as $id => $value) { |
|
| 427 | + foreach ($globalSources as $id => $value) { |
|
| 428 | 428 | date_default_timezone_set('UTC'); |
| 429 | 429 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
| 430 | 430 | if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
| 431 | 431 | if ($value['format'] === 'deltadbtxt' && |
| 432 | - ( |
|
| 432 | + ( |
|
| 433 | 433 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 434 | 434 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 435 | - ) |
|
| 435 | + ) |
|
| 436 | 436 | ) { |
| 437 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 438 | - $buffer = $Common->getData($value['host']); |
|
| 439 | - if ($buffer != '') $reset = 0; |
|
| 440 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 441 | - $buffer = explode('\n',$buffer); |
|
| 442 | - foreach ($buffer as $line) { |
|
| 443 | - if ($line != '' && count($line) > 7) { |
|
| 444 | - $line = explode(',', $line); |
|
| 445 | - $data = array(); |
|
| 446 | - $data['hex'] = $line[1]; // hex |
|
| 447 | - $data['ident'] = $line[2]; // ident |
|
| 448 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 449 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 450 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 451 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 452 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 453 | - $data['verticalrate'] = ''; // vertical rate |
|
| 454 | - //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 455 | - $data['emergency'] = ''; // emergency |
|
| 456 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 457 | - $data['format_source'] = 'deltadbtxt'; |
|
| 458 | - $data['id_source'] = $id_source; |
|
| 459 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 460 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 461 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 462 | - $SI->add($data); |
|
| 463 | - unset($data); |
|
| 464 | - } |
|
| 465 | - } |
|
| 466 | - $last_exec[$id]['last'] = time(); |
|
| 437 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 438 | + $buffer = $Common->getData($value['host']); |
|
| 439 | + if ($buffer != '') $reset = 0; |
|
| 440 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 441 | + $buffer = explode('\n',$buffer); |
|
| 442 | + foreach ($buffer as $line) { |
|
| 443 | + if ($line != '' && count($line) > 7) { |
|
| 444 | + $line = explode(',', $line); |
|
| 445 | + $data = array(); |
|
| 446 | + $data['hex'] = $line[1]; // hex |
|
| 447 | + $data['ident'] = $line[2]; // ident |
|
| 448 | + if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 449 | + if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 450 | + if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 451 | + if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 452 | + if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 453 | + $data['verticalrate'] = ''; // vertical rate |
|
| 454 | + //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 455 | + $data['emergency'] = ''; // emergency |
|
| 456 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 457 | + $data['format_source'] = 'deltadbtxt'; |
|
| 458 | + $data['id_source'] = $id_source; |
|
| 459 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 460 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 461 | + if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 462 | + $SI->add($data); |
|
| 463 | + unset($data); |
|
| 464 | + } |
|
| 465 | + } |
|
| 466 | + $last_exec[$id]['last'] = time(); |
|
| 467 | 467 | } elseif ($value['format'] === 'aisnmeatxt' && |
| 468 | - ( |
|
| 468 | + ( |
|
| 469 | 469 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 470 | 470 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
| 471 | - ) |
|
| 471 | + ) |
|
| 472 | 472 | ) { |
| 473 | - date_default_timezone_set('CET'); |
|
| 474 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
| 475 | - date_default_timezone_set('UTC'); |
|
| 476 | - if ($buffer != '') $reset = 0; |
|
| 477 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 478 | - $buffer = explode('\n',$buffer); |
|
| 479 | - foreach ($buffer as $line) { |
|
| 473 | + date_default_timezone_set('CET'); |
|
| 474 | + $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
| 475 | + date_default_timezone_set('UTC'); |
|
| 476 | + if ($buffer != '') $reset = 0; |
|
| 477 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 478 | + $buffer = explode('\n',$buffer); |
|
| 479 | + foreach ($buffer as $line) { |
|
| 480 | 480 | if ($line != '') { |
| 481 | - //echo "'".$line."'\n"; |
|
| 482 | - $add = false; |
|
| 483 | - $ais_data = $AIS->parse_line(trim($line)); |
|
| 484 | - $data = array(); |
|
| 485 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 486 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 487 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 488 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 489 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 490 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 491 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 492 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 493 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 494 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 495 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 496 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 497 | - if (isset($ais_data['timestamp'])) { |
|
| 481 | + //echo "'".$line."'\n"; |
|
| 482 | + $add = false; |
|
| 483 | + $ais_data = $AIS->parse_line(trim($line)); |
|
| 484 | + $data = array(); |
|
| 485 | + if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 486 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 487 | + if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 488 | + if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 489 | + if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 490 | + if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 491 | + if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 492 | + if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 493 | + if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 494 | + if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 495 | + if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 496 | + if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 497 | + if (isset($ais_data['timestamp'])) { |
|
| 498 | 498 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 499 | 499 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
| 500 | - $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
|
| 501 | - $add = true; |
|
| 500 | + $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
|
| 501 | + $add = true; |
|
| 502 | 502 | } |
| 503 | - } else { |
|
| 503 | + } else { |
|
| 504 | 504 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 505 | 505 | $add = true; |
| 506 | - } |
|
| 507 | - $data['format_source'] = 'aisnmeatxt'; |
|
| 508 | - $data['id_source'] = $id_source; |
|
| 509 | - //print_r($data); |
|
| 510 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 511 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 512 | - unset($data); |
|
| 506 | + } |
|
| 507 | + $data['format_source'] = 'aisnmeatxt'; |
|
| 508 | + $data['id_source'] = $id_source; |
|
| 509 | + //print_r($data); |
|
| 510 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 511 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 512 | + unset($data); |
|
| 513 | 513 | } |
| 514 | - } |
|
| 515 | - $last_exec[$id]['last'] = time(); |
|
| 514 | + } |
|
| 515 | + $last_exec[$id]['last'] = time(); |
|
| 516 | 516 | } elseif ($value['format'] === 'aisnmeahttp') { |
| 517 | - $arr = $httpfeeds; |
|
| 518 | - $w = $e = null; |
|
| 517 | + $arr = $httpfeeds; |
|
| 518 | + $w = $e = null; |
|
| 519 | 519 | |
| 520 | - if (isset($arr[$id])) { |
|
| 520 | + if (isset($arr[$id])) { |
|
| 521 | 521 | $nn = stream_select($arr,$w,$e,$timeout); |
| 522 | 522 | if ($nn > 0) { |
| 523 | - foreach ($httpfeeds as $feed) { |
|
| 523 | + foreach ($httpfeeds as $feed) { |
|
| 524 | 524 | $buffer = stream_get_line($feed,2000,"\n"); |
| 525 | 525 | if ($buffer === FALSE) { |
| 526 | - connect_all($globalSources); |
|
| 526 | + connect_all($globalSources); |
|
| 527 | 527 | } |
| 528 | 528 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 529 | 529 | $buffer = explode('\n',$buffer); |
| 530 | 530 | foreach ($buffer as $line) { |
| 531 | - if ($line != '') { |
|
| 531 | + if ($line != '') { |
|
| 532 | 532 | $ais_data = $AIS->parse_line(trim($line)); |
| 533 | 533 | $data = array(); |
| 534 | 534 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
@@ -546,117 +546,117 @@ discard block |
||
| 546 | 546 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
| 547 | 547 | if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
| 548 | 548 | if (isset($ais_data['timestamp'])) { |
| 549 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
| 549 | + $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
| 550 | 550 | } else { |
| 551 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 551 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 552 | 552 | } |
| 553 | 553 | $data['format_source'] = 'aisnmeahttp'; |
| 554 | 554 | $data['id_source'] = $id_source; |
| 555 | 555 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
| 556 | 556 | if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
| 557 | 557 | unset($data); |
| 558 | - } |
|
| 558 | + } |
|
| 559 | + } |
|
| 559 | 560 | } |
| 560 | - } |
|
| 561 | 561 | } else { |
| 562 | - $format = $value['format']; |
|
| 563 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 564 | - else $tt[$format] = 0; |
|
| 565 | - if ($tt[$format] > 30) { |
|
| 562 | + $format = $value['format']; |
|
| 563 | + if (isset($tt[$format])) $tt[$format]++; |
|
| 564 | + else $tt[$format] = 0; |
|
| 565 | + if ($tt[$format] > 30) { |
|
| 566 | 566 | if ($globalDebug) echo 'Reconnect...'."\n"; |
| 567 | 567 | sleep(2); |
| 568 | 568 | //$sourceeen[] = $value; |
| 569 | 569 | //connect_all($sourceeen); |
| 570 | 570 | //$sourceeen = array(); |
| 571 | 571 | connect_all($globalSources); |
| 572 | - } |
|
| 572 | + } |
|
| 573 | + } |
|
| 573 | 574 | } |
| 574 | - } |
|
| 575 | 575 | } elseif ($value['format'] === 'myshiptracking' && |
| 576 | - ( |
|
| 576 | + ( |
|
| 577 | 577 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 578 | 578 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
| 579 | - ) |
|
| 579 | + ) |
|
| 580 | 580 | ) { |
| 581 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 582 | - if ($buffer != '') { |
|
| 581 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 582 | + if ($buffer != '') { |
|
| 583 | 583 | //echo $buffer; |
| 584 | 584 | $all_data = json_decode($buffer,true); |
| 585 | 585 | //print_r($all_data); |
| 586 | 586 | if (isset($all_data[0]['DATA'])) { |
| 587 | - foreach ($all_data[0]['DATA'] as $line) { |
|
| 587 | + foreach ($all_data[0]['DATA'] as $line) { |
|
| 588 | 588 | if ($line != '') { |
| 589 | - $data = array(); |
|
| 590 | - $data['ident'] = $line['NAME']; |
|
| 591 | - $data['mmsi'] = $line['MMSI']; |
|
| 592 | - if (strlen($data['mmsi']) > 9) { |
|
| 589 | + $data = array(); |
|
| 590 | + $data['ident'] = $line['NAME']; |
|
| 591 | + $data['mmsi'] = $line['MMSI']; |
|
| 592 | + if (strlen($data['mmsi']) > 9) { |
|
| 593 | 593 | $data['mmsi'] = substr($data['mmsi'],-9); |
| 594 | - } |
|
| 595 | - $data['speed'] = $line['SOG']; |
|
| 596 | - $data['heading'] = $line['COG']; |
|
| 597 | - $data['latitude'] = $line['LAT']; |
|
| 598 | - $data['longitude'] = $line['LNG']; |
|
| 599 | - // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 600 | - //$data['type_id'] = $line['TYPE']; |
|
| 601 | - $data['imo'] = $line['IMO']; |
|
| 602 | - if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
|
| 603 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 604 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
| 605 | - $data['format_source'] = 'myshiptracking'; |
|
| 606 | - $data['id_source'] = $id_source; |
|
| 607 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 608 | - $MI->add($data); |
|
| 609 | - unset($data); |
|
| 594 | + } |
|
| 595 | + $data['speed'] = $line['SOG']; |
|
| 596 | + $data['heading'] = $line['COG']; |
|
| 597 | + $data['latitude'] = $line['LAT']; |
|
| 598 | + $data['longitude'] = $line['LNG']; |
|
| 599 | + // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 600 | + //$data['type_id'] = $line['TYPE']; |
|
| 601 | + $data['imo'] = $line['IMO']; |
|
| 602 | + if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
|
| 603 | + if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 604 | + $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
| 605 | + $data['format_source'] = 'myshiptracking'; |
|
| 606 | + $data['id_source'] = $id_source; |
|
| 607 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 608 | + $MI->add($data); |
|
| 609 | + unset($data); |
|
| 610 | 610 | } |
| 611 | - } |
|
| 611 | + } |
|
| 612 | + } |
|
| 612 | 613 | } |
| 613 | - } |
|
| 614 | - $last_exec[$id]['last'] = time(); |
|
| 614 | + $last_exec[$id]['last'] = time(); |
|
| 615 | 615 | } elseif ($value['format'] === 'boatbeaconapp' && |
| 616 | - ( |
|
| 616 | + ( |
|
| 617 | 617 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 618 | 618 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
| 619 | - ) |
|
| 619 | + ) |
|
| 620 | 620 | ) { |
| 621 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
| 622 | - if ($buffer != '') { |
|
| 621 | + $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
| 622 | + if ($buffer != '') { |
|
| 623 | 623 | $all_data = json_decode($buffer,true); |
| 624 | 624 | if (isset($all_data[0]['mmsi'])) { |
| 625 | - foreach ($all_data as $line) { |
|
| 625 | + foreach ($all_data as $line) { |
|
| 626 | 626 | if ($line != '') { |
| 627 | - $data = array(); |
|
| 628 | - $data['ident'] = $line['shipname']; |
|
| 629 | - $data['callsign'] = $line['callsign']; |
|
| 630 | - $data['mmsi'] = substr($line['mmsi'],-9); |
|
| 631 | - $data['speed'] = $line['sog']; |
|
| 632 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
| 633 | - $data['latitude'] = $line['latitude']; |
|
| 634 | - $data['longitude'] = $line['longitude']; |
|
| 635 | - $data['type_id'] = $line['shiptype']; |
|
| 636 | - $data['arrival_code'] = $line['destination']; |
|
| 637 | - $data['datetime'] = $line['time']; |
|
| 638 | - $data['format_source'] = 'boatbeaconapp'; |
|
| 639 | - $data['id_source'] = $id_source; |
|
| 640 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 641 | - $MI->add($data); |
|
| 642 | - unset($data); |
|
| 627 | + $data = array(); |
|
| 628 | + $data['ident'] = $line['shipname']; |
|
| 629 | + $data['callsign'] = $line['callsign']; |
|
| 630 | + $data['mmsi'] = substr($line['mmsi'],-9); |
|
| 631 | + $data['speed'] = $line['sog']; |
|
| 632 | + if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
| 633 | + $data['latitude'] = $line['latitude']; |
|
| 634 | + $data['longitude'] = $line['longitude']; |
|
| 635 | + $data['type_id'] = $line['shiptype']; |
|
| 636 | + $data['arrival_code'] = $line['destination']; |
|
| 637 | + $data['datetime'] = $line['time']; |
|
| 638 | + $data['format_source'] = 'boatbeaconapp'; |
|
| 639 | + $data['id_source'] = $id_source; |
|
| 640 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 641 | + $MI->add($data); |
|
| 642 | + unset($data); |
|
| 643 | + } |
|
| 643 | 644 | } |
| 644 | - } |
|
| 645 | 645 | } |
| 646 | 646 | |
| 647 | - } |
|
| 648 | - $last_exec[$id]['last'] = time(); |
|
| 647 | + } |
|
| 648 | + $last_exec[$id]['last'] = time(); |
|
| 649 | 649 | } elseif ($value['format'] === 'boatnerd' && |
| 650 | - ( |
|
| 650 | + ( |
|
| 651 | 651 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 652 | 652 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
| 653 | - ) |
|
| 653 | + ) |
|
| 654 | 654 | ) { |
| 655 | - $buffer = $Common->getData($value['host']); |
|
| 656 | - if ($buffer != '') { |
|
| 655 | + $buffer = $Common->getData($value['host']); |
|
| 656 | + if ($buffer != '') { |
|
| 657 | 657 | $all_data = json_decode($buffer,true); |
| 658 | 658 | if (isset($all_data['features'][0]['id'])) { |
| 659 | - foreach ($all_data['features'] as $line) { |
|
| 659 | + foreach ($all_data['features'] as $line) { |
|
| 660 | 660 | print_r($line); |
| 661 | 661 | $data = array(); |
| 662 | 662 | if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
@@ -676,80 +676,80 @@ discard block |
||
| 676 | 676 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
| 677 | 677 | if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
| 678 | 678 | unset($data); |
| 679 | - } |
|
| 679 | + } |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - } |
|
| 683 | - $last_exec[$id]['last'] = time(); |
|
| 682 | + } |
|
| 683 | + $last_exec[$id]['last'] = time(); |
|
| 684 | 684 | } elseif ($value['format'] === 'shipplotter' && |
| 685 | - ( |
|
| 685 | + ( |
|
| 686 | 686 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 687 | 687 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
| 688 | - ) |
|
| 688 | + ) |
|
| 689 | 689 | ) { |
| 690 | - echo 'download...'; |
|
| 691 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
| 692 | - echo 'done !'."\n"; |
|
| 693 | - // FIXME: Need more work |
|
| 694 | - if ($buffer != '') $reset = 0; |
|
| 695 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 696 | - $buffer = explode('\n',$buffer); |
|
| 697 | - foreach ($buffer as $line) { |
|
| 690 | + echo 'download...'; |
|
| 691 | + $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
| 692 | + echo 'done !'."\n"; |
|
| 693 | + // FIXME: Need more work |
|
| 694 | + if ($buffer != '') $reset = 0; |
|
| 695 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 696 | + $buffer = explode('\n',$buffer); |
|
| 697 | + foreach ($buffer as $line) { |
|
| 698 | 698 | if ($line != '') { |
| 699 | - $data = array(); |
|
| 700 | - echo $line."\n"; |
|
| 701 | - $data['mmsi'] = (int)substr($line,0,9); |
|
| 702 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
| 703 | - $data['status_id'] = substr($line,21,2); |
|
| 704 | - $data['type_id'] = substr($line,24,3); |
|
| 705 | - $data['latitude'] = substr($line,29,9); |
|
| 706 | - $data['longitude'] = substr($line,41,9); |
|
| 707 | - $data['speed'] = round(substr($line,51,5)); |
|
| 708 | - //$data['course'] = substr($line,57,5); |
|
| 709 | - $data['heading'] = round(substr($line,63,3)); |
|
| 710 | - //$data['draft'] = substr($line,67,4); |
|
| 711 | - //$data['length'] = substr($line,72,3); |
|
| 712 | - //$data['beam'] = substr($line,76,2); |
|
| 713 | - $data['ident'] = trim(utf8_encode(substr($line,78,20))); |
|
| 714 | - //$data['callsign'] = trim(substr($line,100,7); |
|
| 715 | - $data['arrival_code'] = substr($line,108,20); |
|
| 716 | - //$data['etaDate'] = substr($line,129,5); |
|
| 717 | - //$data['etaTime'] = substr($line,135,5); |
|
| 718 | - $data['format_source'] = 'shipplotter'; |
|
| 719 | - $data['id_source'] = $id_source; |
|
| 720 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 721 | - //print_r($data); |
|
| 722 | - echo 'Add...'."\n"; |
|
| 723 | - $MI->add($data); |
|
| 724 | - unset($data); |
|
| 699 | + $data = array(); |
|
| 700 | + echo $line."\n"; |
|
| 701 | + $data['mmsi'] = (int)substr($line,0,9); |
|
| 702 | + $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
| 703 | + $data['status_id'] = substr($line,21,2); |
|
| 704 | + $data['type_id'] = substr($line,24,3); |
|
| 705 | + $data['latitude'] = substr($line,29,9); |
|
| 706 | + $data['longitude'] = substr($line,41,9); |
|
| 707 | + $data['speed'] = round(substr($line,51,5)); |
|
| 708 | + //$data['course'] = substr($line,57,5); |
|
| 709 | + $data['heading'] = round(substr($line,63,3)); |
|
| 710 | + //$data['draft'] = substr($line,67,4); |
|
| 711 | + //$data['length'] = substr($line,72,3); |
|
| 712 | + //$data['beam'] = substr($line,76,2); |
|
| 713 | + $data['ident'] = trim(utf8_encode(substr($line,78,20))); |
|
| 714 | + //$data['callsign'] = trim(substr($line,100,7); |
|
| 715 | + $data['arrival_code'] = substr($line,108,20); |
|
| 716 | + //$data['etaDate'] = substr($line,129,5); |
|
| 717 | + //$data['etaTime'] = substr($line,135,5); |
|
| 718 | + $data['format_source'] = 'shipplotter'; |
|
| 719 | + $data['id_source'] = $id_source; |
|
| 720 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 721 | + //print_r($data); |
|
| 722 | + echo 'Add...'."\n"; |
|
| 723 | + $MI->add($data); |
|
| 724 | + unset($data); |
|
| 725 | 725 | } |
| 726 | - } |
|
| 727 | - $last_exec[$id]['last'] = time(); |
|
| 726 | + } |
|
| 727 | + $last_exec[$id]['last'] = time(); |
|
| 728 | 728 | //} elseif (($value === 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value === 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) { |
| 729 | 729 | } elseif ( |
| 730 | - ( |
|
| 730 | + ( |
|
| 731 | 731 | $value['format'] === 'whazzup' && |
| 732 | 732 | ( |
| 733 | - (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
| 734 | - (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
| 733 | + (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
| 734 | + (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
| 735 | 735 | ) |
| 736 | - ) || ( |
|
| 736 | + ) || ( |
|
| 737 | 737 | $value['format'] === 'vatsimtxt' && |
| 738 | 738 | ( |
| 739 | - (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
| 740 | - (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
| 739 | + (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
| 740 | + (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
| 741 | + ) |
|
| 741 | 742 | ) |
| 742 | - ) |
|
| 743 | 743 | ) { |
| 744 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 745 | - $buffer = $Common->getData($value['host']); |
|
| 746 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 747 | - $buffer = explode('\n',$buffer); |
|
| 748 | - $reset = 0; |
|
| 749 | - foreach ($buffer as $line) { |
|
| 750 | - if ($line != '') { |
|
| 751 | - $line = explode(':', $line); |
|
| 752 | - if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 744 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 745 | + $buffer = $Common->getData($value['host']); |
|
| 746 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 747 | + $buffer = explode('\n',$buffer); |
|
| 748 | + $reset = 0; |
|
| 749 | + foreach ($buffer as $line) { |
|
| 750 | + if ($line != '') { |
|
| 751 | + $line = explode(':', $line); |
|
| 752 | + if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 753 | 753 | $data = array(); |
| 754 | 754 | if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
| 755 | 755 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
@@ -762,37 +762,37 @@ discard block |
||
| 762 | 762 | if (isset($line[45])) $data['heading'] = $line[45]; // heading |
| 763 | 763 | elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
| 764 | 764 | $data['latitude'] = $line[5]; // lat |
| 765 | - $data['longitude'] = $line[6]; // long |
|
| 766 | - $data['verticalrate'] = ''; // vertical rate |
|
| 767 | - $data['squawk'] = ''; // squawk |
|
| 768 | - $data['emergency'] = ''; // emergency |
|
| 769 | - $data['waypoints'] = $line[30]; |
|
| 765 | + $data['longitude'] = $line[6]; // long |
|
| 766 | + $data['verticalrate'] = ''; // vertical rate |
|
| 767 | + $data['squawk'] = ''; // squawk |
|
| 768 | + $data['emergency'] = ''; // emergency |
|
| 769 | + $data['waypoints'] = $line[30]; |
|
| 770 | 770 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 771 | 771 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
| 772 | 772 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
| 773 | - $data['departure_airport_icao'] = $line[11]; |
|
| 774 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 775 | - $data['arrival_airport_icao'] = $line[13]; |
|
| 773 | + $data['departure_airport_icao'] = $line[11]; |
|
| 774 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 775 | + $data['arrival_airport_icao'] = $line[13]; |
|
| 776 | 776 | $data['frequency'] = $line[4]; |
| 777 | 777 | $data['type'] = $line[18]; |
| 778 | 778 | $data['range'] = $line[19]; |
| 779 | 779 | if (isset($line[35])) $data['info'] = $line[35]; |
| 780 | - $data['id_source'] = $id_source; |
|
| 781 | - //$data['arrival_airport_time'] = ; |
|
| 782 | - if ($line[9] != '') { |
|
| 783 | - $aircraft_data = explode('/',$line[9]); |
|
| 784 | - if (isset($aircraft_data[1])) { |
|
| 785 | - $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 786 | - } |
|
| 787 | - } |
|
| 788 | - /* |
|
| 780 | + $data['id_source'] = $id_source; |
|
| 781 | + //$data['arrival_airport_time'] = ; |
|
| 782 | + if ($line[9] != '') { |
|
| 783 | + $aircraft_data = explode('/',$line[9]); |
|
| 784 | + if (isset($aircraft_data[1])) { |
|
| 785 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 786 | + } |
|
| 787 | + } |
|
| 788 | + /* |
|
| 789 | 789 | if ($value === 'whazzup') $data['format_source'] = 'whazzup'; |
| 790 | 790 | elseif ($value === 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 791 | 791 | */ |
| 792 | - $data['format_source'] = $value['format']; |
|
| 792 | + $data['format_source'] = $value['format']; |
|
| 793 | 793 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
| 794 | 794 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 795 | - if ($line[3] === 'PILOT') $SI->add($data); |
|
| 795 | + if ($line[3] === 'PILOT') $SI->add($data); |
|
| 796 | 796 | elseif ($line[3] === 'ATC') { |
| 797 | 797 | //print_r($data); |
| 798 | 798 | $data['info'] = str_replace('^§','<br />',$data['info']); |
@@ -813,21 +813,21 @@ discard block |
||
| 813 | 813 | 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']); |
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | - unset($data); |
|
| 817 | - } |
|
| 818 | - } |
|
| 819 | - } |
|
| 820 | - //if ($value === 'whazzup') $last_exec['whazzup'] = time(); |
|
| 821 | - //elseif ($value === 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 822 | - $last_exec[$id]['last'] = time(); |
|
| 823 | - } elseif ($value['format'] === 'airwhere' && |
|
| 824 | - ( |
|
| 825 | - (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
| 826 | - (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
| 827 | - ) |
|
| 828 | - ) { |
|
| 829 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
| 830 | - if ($buffer != '') { |
|
| 816 | + unset($data); |
|
| 817 | + } |
|
| 818 | + } |
|
| 819 | + } |
|
| 820 | + //if ($value === 'whazzup') $last_exec['whazzup'] = time(); |
|
| 821 | + //elseif ($value === 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 822 | + $last_exec[$id]['last'] = time(); |
|
| 823 | + } elseif ($value['format'] === 'airwhere' && |
|
| 824 | + ( |
|
| 825 | + (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
| 826 | + (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
| 827 | + ) |
|
| 828 | + ) { |
|
| 829 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
| 830 | + if ($buffer != '') { |
|
| 831 | 831 | $all_data = simplexml_load_string($buffer); |
| 832 | 832 | foreach($all_data->children() as $childdata) { |
| 833 | 833 | $data = array(); |
@@ -849,10 +849,10 @@ discard block |
||
| 849 | 849 | $SI->add($data); |
| 850 | 850 | unset($data); |
| 851 | 851 | } |
| 852 | - } |
|
| 853 | - $Source->deleteOldLocationByType('gs'); |
|
| 854 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
| 855 | - if ($buffer != '') { |
|
| 852 | + } |
|
| 853 | + $Source->deleteOldLocationByType('gs'); |
|
| 854 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
| 855 | + if ($buffer != '') { |
|
| 856 | 856 | $all_data = simplexml_load_string($buffer); |
| 857 | 857 | foreach($all_data->children() as $childdata) { |
| 858 | 858 | $data = array(); |
@@ -870,8 +870,8 @@ discard block |
||
| 870 | 870 | } |
| 871 | 871 | unset($data); |
| 872 | 872 | } |
| 873 | - } |
|
| 874 | - $last_exec[$id]['last'] = time(); |
|
| 873 | + } |
|
| 874 | + $last_exec[$id]['last'] = time(); |
|
| 875 | 875 | /* |
| 876 | 876 | } if ($value['format'] === 'aircraftlistjson') { |
| 877 | 877 | print_r($globalSources); |
@@ -879,17 +879,17 @@ discard block |
||
| 879 | 879 | echo $globalMinFetch; |
| 880 | 880 | */ |
| 881 | 881 | } elseif ($value['format'] === 'aircraftlistjson' && |
| 882 | - ( |
|
| 882 | + ( |
|
| 883 | 883 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 884 | 884 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 885 | - ) |
|
| 885 | + ) |
|
| 886 | 886 | ) { |
| 887 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 888 | - if ($buffer != '') { |
|
| 889 | - $all_data = json_decode($buffer,true); |
|
| 887 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 888 | + if ($buffer != '') { |
|
| 889 | + $all_data = json_decode($buffer,true); |
|
| 890 | 890 | if (isset($all_data['acList'])) { |
| 891 | - $reset = 0; |
|
| 892 | - foreach ($all_data['acList'] as $line) { |
|
| 891 | + $reset = 0; |
|
| 892 | + foreach ($all_data['acList'] as $line) { |
|
| 893 | 893 | $data = array(); |
| 894 | 894 | $data['hex'] = $line['Icao']; // hex |
| 895 | 895 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -912,10 +912,10 @@ discard block |
||
| 912 | 912 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
| 913 | 913 | if (isset($data['latitude'])) $SI->add($data); |
| 914 | 914 | unset($data); |
| 915 | - } |
|
| 915 | + } |
|
| 916 | 916 | } elseif (is_array($all_data)) { |
| 917 | - $reset = 0; |
|
| 918 | - foreach ($all_data as $line) { |
|
| 917 | + $reset = 0; |
|
| 918 | + foreach ($all_data as $line) { |
|
| 919 | 919 | $data = array(); |
| 920 | 920 | $data['hex'] = $line['hex']; // hex |
| 921 | 921 | $data['ident'] = $line['flight']; // ident |
@@ -935,252 +935,252 @@ discard block |
||
| 935 | 935 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 936 | 936 | $SI->add($data); |
| 937 | 937 | unset($data); |
| 938 | - } |
|
| 938 | + } |
|
| 939 | 939 | } |
| 940 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
| 941 | - //$last_exec['aircraftlistjson'] = time(); |
|
| 942 | - $last_exec[$id]['last'] = time(); |
|
| 943 | - //} elseif ($value === 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 944 | - } elseif ($value['format'] === 'planeupdatefaa' && |
|
| 945 | - ( |
|
| 946 | - (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
| 947 | - (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
| 948 | - ) |
|
| 949 | - ) { |
|
| 950 | - $buffer = $Common->getData($value['host']); |
|
| 951 | - $all_data = json_decode($buffer,true); |
|
| 952 | - if (isset($all_data['planes'])) { |
|
| 940 | + } elseif ($globalDebug) echo 'No data'."\n"; |
|
| 941 | + //$last_exec['aircraftlistjson'] = time(); |
|
| 942 | + $last_exec[$id]['last'] = time(); |
|
| 943 | + //} elseif ($value === 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 944 | + } elseif ($value['format'] === 'planeupdatefaa' && |
|
| 945 | + ( |
|
| 946 | + (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
|
| 947 | + (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
|
| 948 | + ) |
|
| 949 | + ) { |
|
| 950 | + $buffer = $Common->getData($value['host']); |
|
| 951 | + $all_data = json_decode($buffer,true); |
|
| 952 | + if (isset($all_data['planes'])) { |
|
| 953 | 953 | $reset = 0; |
| 954 | 954 | foreach ($all_data['planes'] as $key => $line) { |
| 955 | - $data = array(); |
|
| 956 | - $data['hex'] = $key; // hex |
|
| 957 | - $data['ident'] = $line[3]; // ident |
|
| 958 | - $data['altitude'] = $line[6]; // altitude |
|
| 959 | - $data['speed'] = $line[8]; // speed |
|
| 960 | - $data['heading'] = $line[7]; // heading |
|
| 961 | - $data['latitude'] = $line[4]; // lat |
|
| 962 | - $data['longitude'] = $line[5]; // long |
|
| 963 | - //$data['verticalrate'] = $line[]; // verticale rate |
|
| 964 | - $data['squawk'] = $line[10]; // squawk |
|
| 965 | - $data['emergency'] = ''; // emergency |
|
| 966 | - $data['registration'] = $line[2]; |
|
| 967 | - $data['aircraft_icao'] = $line[0]; |
|
| 968 | - $deparr = explode('-',$line[1]); |
|
| 969 | - if (count($deparr) === 2) { |
|
| 955 | + $data = array(); |
|
| 956 | + $data['hex'] = $key; // hex |
|
| 957 | + $data['ident'] = $line[3]; // ident |
|
| 958 | + $data['altitude'] = $line[6]; // altitude |
|
| 959 | + $data['speed'] = $line[8]; // speed |
|
| 960 | + $data['heading'] = $line[7]; // heading |
|
| 961 | + $data['latitude'] = $line[4]; // lat |
|
| 962 | + $data['longitude'] = $line[5]; // long |
|
| 963 | + //$data['verticalrate'] = $line[]; // verticale rate |
|
| 964 | + $data['squawk'] = $line[10]; // squawk |
|
| 965 | + $data['emergency'] = ''; // emergency |
|
| 966 | + $data['registration'] = $line[2]; |
|
| 967 | + $data['aircraft_icao'] = $line[0]; |
|
| 968 | + $deparr = explode('-',$line[1]); |
|
| 969 | + if (count($deparr) === 2) { |
|
| 970 | 970 | $data['departure_airport_icao'] = $deparr[0]; |
| 971 | 971 | $data['arrival_airport_icao'] = $deparr[1]; |
| 972 | - } |
|
| 973 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 974 | - $data['format_source'] = 'planeupdatefaa'; |
|
| 975 | - $data['id_source'] = $id_source; |
|
| 976 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 977 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 978 | - $SI->add($data); |
|
| 979 | - unset($data); |
|
| 972 | + } |
|
| 973 | + $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 974 | + $data['format_source'] = 'planeupdatefaa'; |
|
| 975 | + $data['id_source'] = $id_source; |
|
| 976 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 977 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 978 | + $SI->add($data); |
|
| 979 | + unset($data); |
|
| 980 | 980 | } |
| 981 | - } |
|
| 982 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 983 | - $last_exec[$id]['last'] = time(); |
|
| 981 | + } |
|
| 982 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 983 | + $last_exec[$id]['last'] = time(); |
|
| 984 | 984 | } elseif ($value['format'] === 'opensky' && |
| 985 | - ( |
|
| 985 | + ( |
|
| 986 | 986 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 987 | 987 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 988 | - ) |
|
| 988 | + ) |
|
| 989 | 989 | ) { |
| 990 | - $buffer = $Common->getData($value['host']); |
|
| 991 | - $all_data = json_decode($buffer,true); |
|
| 992 | - if (isset($all_data['states'])) { |
|
| 990 | + $buffer = $Common->getData($value['host']); |
|
| 991 | + $all_data = json_decode($buffer,true); |
|
| 992 | + if (isset($all_data['states'])) { |
|
| 993 | 993 | $reset = 0; |
| 994 | 994 | foreach ($all_data['states'] as $key => $line) { |
| 995 | - $data = array(); |
|
| 996 | - $data['hex'] = $line[0]; // hex |
|
| 997 | - $data['ident'] = trim($line[1]); // ident |
|
| 998 | - $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 999 | - $data['speed'] = round($line[9]*1.94384); // speed |
|
| 1000 | - $data['heading'] = round($line[10]); // heading |
|
| 1001 | - $data['latitude'] = $line[6]; // lat |
|
| 1002 | - $data['longitude'] = $line[5]; // long |
|
| 1003 | - $data['verticalrate'] = $line[11]; // verticale rate |
|
| 1004 | - //$data['squawk'] = $line[10]; // squawk |
|
| 1005 | - //$data['emergency'] = ''; // emergency |
|
| 1006 | - //$data['registration'] = $line[2]; |
|
| 1007 | - //$data['aircraft_icao'] = $line[0]; |
|
| 1008 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 1009 | - $data['format_source'] = 'opensky'; |
|
| 1010 | - $data['id_source'] = $id_source; |
|
| 1011 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1012 | - $SI->add($data); |
|
| 1013 | - unset($data); |
|
| 995 | + $data = array(); |
|
| 996 | + $data['hex'] = $line[0]; // hex |
|
| 997 | + $data['ident'] = trim($line[1]); // ident |
|
| 998 | + $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 999 | + $data['speed'] = round($line[9]*1.94384); // speed |
|
| 1000 | + $data['heading'] = round($line[10]); // heading |
|
| 1001 | + $data['latitude'] = $line[6]; // lat |
|
| 1002 | + $data['longitude'] = $line[5]; // long |
|
| 1003 | + $data['verticalrate'] = $line[11]; // verticale rate |
|
| 1004 | + //$data['squawk'] = $line[10]; // squawk |
|
| 1005 | + //$data['emergency'] = ''; // emergency |
|
| 1006 | + //$data['registration'] = $line[2]; |
|
| 1007 | + //$data['aircraft_icao'] = $line[0]; |
|
| 1008 | + $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 1009 | + $data['format_source'] = 'opensky'; |
|
| 1010 | + $data['id_source'] = $id_source; |
|
| 1011 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1012 | + $SI->add($data); |
|
| 1013 | + unset($data); |
|
| 1014 | 1014 | } |
| 1015 | - } |
|
| 1016 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 1017 | - $last_exec[$id]['last'] = time(); |
|
| 1015 | + } |
|
| 1016 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 1017 | + $last_exec[$id]['last'] = time(); |
|
| 1018 | 1018 | } elseif ($value['format'] === 'aircraftjson' && |
| 1019 | - ( |
|
| 1019 | + ( |
|
| 1020 | 1020 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 1021 | 1021 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 1022 | - ) |
|
| 1022 | + ) |
|
| 1023 | 1023 | ) { |
| 1024 | - $buffer = $Common->getData($value['host']); |
|
| 1025 | - $all_data = json_decode($buffer,true); |
|
| 1026 | - if (isset($all_data['aircraft'])) { |
|
| 1024 | + $buffer = $Common->getData($value['host']); |
|
| 1025 | + $all_data = json_decode($buffer,true); |
|
| 1026 | + if (isset($all_data['aircraft'])) { |
|
| 1027 | 1027 | $reset = 0; |
| 1028 | 1028 | foreach ($all_data['aircraft'] as $key => $line) { |
| 1029 | - $data = array(); |
|
| 1030 | - if (isset($line['hex'])) $data['hex'] = $line['hex']; // hex |
|
| 1031 | - if (isset($line['ident'])) $data['ident'] = trim($line['ident']); // ident |
|
| 1032 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude |
|
| 1033 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed |
|
| 1034 | - if (isset($line['track'])) $data['heading'] = $line['track']; // heading |
|
| 1035 | - if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat |
|
| 1036 | - if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long |
|
| 1037 | - if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate |
|
| 1038 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk |
|
| 1039 | - //$data['emergency'] = ''; // emergency |
|
| 1040 | - //$data['registration'] = $line[2]; |
|
| 1041 | - //$data['aircraft_icao'] = $line[0]; |
|
| 1042 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1043 | - $data['format_source'] = 'aircraftjson'; |
|
| 1044 | - $data['id_source'] = $id_source; |
|
| 1045 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1046 | - $SI->add($data); |
|
| 1047 | - unset($data); |
|
| 1029 | + $data = array(); |
|
| 1030 | + if (isset($line['hex'])) $data['hex'] = $line['hex']; // hex |
|
| 1031 | + if (isset($line['ident'])) $data['ident'] = trim($line['ident']); // ident |
|
| 1032 | + if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude |
|
| 1033 | + if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed |
|
| 1034 | + if (isset($line['track'])) $data['heading'] = $line['track']; // heading |
|
| 1035 | + if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat |
|
| 1036 | + if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long |
|
| 1037 | + if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate |
|
| 1038 | + if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk |
|
| 1039 | + //$data['emergency'] = ''; // emergency |
|
| 1040 | + //$data['registration'] = $line[2]; |
|
| 1041 | + //$data['aircraft_icao'] = $line[0]; |
|
| 1042 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1043 | + $data['format_source'] = 'aircraftjson'; |
|
| 1044 | + $data['id_source'] = $id_source; |
|
| 1045 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1046 | + $SI->add($data); |
|
| 1047 | + unset($data); |
|
| 1048 | 1048 | } |
| 1049 | - } |
|
| 1050 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 1051 | - $last_exec[$id]['last'] = time(); |
|
| 1049 | + } |
|
| 1050 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 1051 | + $last_exec[$id]['last'] = time(); |
|
| 1052 | 1052 | //} elseif ($value === 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
| 1053 | 1053 | } elseif ($value['format'] === 'fr24json' && |
| 1054 | - ( |
|
| 1054 | + ( |
|
| 1055 | 1055 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 1056 | 1056 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 1057 | - ) |
|
| 1057 | + ) |
|
| 1058 | 1058 | ) { |
| 1059 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 1060 | - $buffer = $Common->getData($value['host']); |
|
| 1061 | - $all_data = json_decode($buffer,true); |
|
| 1062 | - if (!empty($all_data)) $reset = 0; |
|
| 1063 | - foreach ($all_data as $key => $line) { |
|
| 1059 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 1060 | + $buffer = $Common->getData($value['host']); |
|
| 1061 | + $all_data = json_decode($buffer,true); |
|
| 1062 | + if (!empty($all_data)) $reset = 0; |
|
| 1063 | + foreach ($all_data as $key => $line) { |
|
| 1064 | 1064 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 1065 | - $data = array(); |
|
| 1066 | - $data['hex'] = $line[0]; |
|
| 1067 | - $data['ident'] = $line[16]; //$line[13] |
|
| 1068 | - $data['altitude'] = $line[4]; // altitude |
|
| 1069 | - $data['speed'] = $line[5]; // speed |
|
| 1070 | - $data['heading'] = $line[3]; // heading |
|
| 1071 | - $data['latitude'] = $line[1]; // lat |
|
| 1072 | - $data['longitude'] = $line[2]; // long |
|
| 1073 | - $data['verticalrate'] = $line[15]; // verticale rate |
|
| 1074 | - $data['squawk'] = $line[6]; // squawk |
|
| 1075 | - $data['aircraft_icao'] = $line[8]; |
|
| 1076 | - $data['registration'] = $line[9]; |
|
| 1077 | - $data['departure_airport_iata'] = $line[11]; |
|
| 1078 | - $data['arrival_airport_iata'] = $line[12]; |
|
| 1079 | - $data['emergency'] = ''; // emergency |
|
| 1080 | - $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 1081 | - $data['format_source'] = 'fr24json'; |
|
| 1082 | - $data['id_source'] = $id_source; |
|
| 1083 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1084 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1085 | - $SI->add($data); |
|
| 1086 | - unset($data); |
|
| 1065 | + $data = array(); |
|
| 1066 | + $data['hex'] = $line[0]; |
|
| 1067 | + $data['ident'] = $line[16]; //$line[13] |
|
| 1068 | + $data['altitude'] = $line[4]; // altitude |
|
| 1069 | + $data['speed'] = $line[5]; // speed |
|
| 1070 | + $data['heading'] = $line[3]; // heading |
|
| 1071 | + $data['latitude'] = $line[1]; // lat |
|
| 1072 | + $data['longitude'] = $line[2]; // long |
|
| 1073 | + $data['verticalrate'] = $line[15]; // verticale rate |
|
| 1074 | + $data['squawk'] = $line[6]; // squawk |
|
| 1075 | + $data['aircraft_icao'] = $line[8]; |
|
| 1076 | + $data['registration'] = $line[9]; |
|
| 1077 | + $data['departure_airport_iata'] = $line[11]; |
|
| 1078 | + $data['arrival_airport_iata'] = $line[12]; |
|
| 1079 | + $data['emergency'] = ''; // emergency |
|
| 1080 | + $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 1081 | + $data['format_source'] = 'fr24json'; |
|
| 1082 | + $data['id_source'] = $id_source; |
|
| 1083 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1084 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1085 | + $SI->add($data); |
|
| 1086 | + unset($data); |
|
| 1087 | + } |
|
| 1087 | 1088 | } |
| 1088 | - } |
|
| 1089 | - //$last_exec['fr24json'] = time(); |
|
| 1090 | - $last_exec[$id]['last'] = time(); |
|
| 1089 | + //$last_exec['fr24json'] = time(); |
|
| 1090 | + $last_exec[$id]['last'] = time(); |
|
| 1091 | 1091 | //} elseif ($value === 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
| 1092 | 1092 | } elseif ($value['format'] === 'radarvirtueljson' && |
| 1093 | - ( |
|
| 1093 | + ( |
|
| 1094 | 1094 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 1095 | 1095 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 1096 | - ) |
|
| 1096 | + ) |
|
| 1097 | 1097 | ) { |
| 1098 | - //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 1099 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 1100 | - //echo $buffer; |
|
| 1101 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 1102 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 1103 | - $all_data = json_decode($buffer,true); |
|
| 1104 | - if (json_last_error() != JSON_ERROR_NONE) { |
|
| 1098 | + //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 1099 | + $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 1100 | + //echo $buffer; |
|
| 1101 | + $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 1102 | + $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 1103 | + $all_data = json_decode($buffer,true); |
|
| 1104 | + if (json_last_error() != JSON_ERROR_NONE) { |
|
| 1105 | 1105 | die(json_last_error_msg()); |
| 1106 | - } |
|
| 1107 | - if (isset($all_data['mrkrs'])) { |
|
| 1106 | + } |
|
| 1107 | + if (isset($all_data['mrkrs'])) { |
|
| 1108 | 1108 | $reset = 0; |
| 1109 | 1109 | foreach ($all_data['mrkrs'] as $key => $line) { |
| 1110 | - if (isset($line['inf'])) { |
|
| 1110 | + if (isset($line['inf'])) { |
|
| 1111 | 1111 | $data = array(); |
| 1112 | 1112 | $data['hex'] = $line['inf']['ia']; |
| 1113 | 1113 | if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
| 1114 | - $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 1115 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 1116 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 1117 | - $data['latitude'] = $line['pt'][0]; // lat |
|
| 1118 | - $data['longitude'] = $line['pt'][1]; // long |
|
| 1119 | - //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 1120 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 1121 | - //$data['aircraft_icao'] = $line[8]; |
|
| 1122 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 1114 | + $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 1115 | + if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 1116 | + if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 1117 | + $data['latitude'] = $line['pt'][0]; // lat |
|
| 1118 | + $data['longitude'] = $line['pt'][1]; // long |
|
| 1119 | + //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 1120 | + if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 1121 | + //$data['aircraft_icao'] = $line[8]; |
|
| 1122 | + if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 1123 | 1123 | //$data['departure_airport_iata'] = $line[11]; |
| 1124 | 1124 | //$data['arrival_airport_iata'] = $line[12]; |
| 1125 | - //$data['emergency'] = ''; // emergency |
|
| 1125 | + //$data['emergency'] = ''; // emergency |
|
| 1126 | 1126 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 1127 | - $data['format_source'] = 'radarvirtueljson'; |
|
| 1128 | - $data['id_source'] = $id_source; |
|
| 1127 | + $data['format_source'] = 'radarvirtueljson'; |
|
| 1128 | + $data['id_source'] = $id_source; |
|
| 1129 | 1129 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1130 | 1130 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 1131 | 1131 | $SI->add($data); |
| 1132 | 1132 | unset($data); |
| 1133 | - } |
|
| 1133 | + } |
|
| 1134 | + } |
|
| 1134 | 1135 | } |
| 1135 | - } |
|
| 1136 | - //$last_exec['radarvirtueljson'] = time(); |
|
| 1137 | - $last_exec[$id]['last'] = time(); |
|
| 1136 | + //$last_exec['radarvirtueljson'] = time(); |
|
| 1137 | + $last_exec[$id]['last'] = time(); |
|
| 1138 | 1138 | //} elseif ($value === 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
| 1139 | 1139 | } elseif ($value['format'] === 'pirepsjson' && |
| 1140 | - ( |
|
| 1140 | + ( |
|
| 1141 | 1141 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 1142 | 1142 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 1143 | - ) |
|
| 1143 | + ) |
|
| 1144 | 1144 | ) { |
| 1145 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 1146 | - $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 1147 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
| 1145 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 1146 | + $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 1147 | + $all_data = json_decode(utf8_encode($buffer),true); |
|
| 1148 | 1148 | |
| 1149 | - if (isset($all_data['pireps'])) { |
|
| 1149 | + if (isset($all_data['pireps'])) { |
|
| 1150 | 1150 | $reset = 0; |
| 1151 | - foreach ($all_data['pireps'] as $line) { |
|
| 1152 | - $data = array(); |
|
| 1153 | - $data['id'] = $line['id']; |
|
| 1154 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 1155 | - $data['ident'] = $line['callsign']; // ident |
|
| 1156 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 1157 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 1158 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 1159 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 1160 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1161 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1162 | - $data['latitude'] = $line['lat']; // lat |
|
| 1163 | - $data['longitude'] = $line['lon']; // long |
|
| 1164 | - //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 1165 | - //$data['squawk'] = $line['squawk']; // squawk |
|
| 1166 | - //$data['emergency'] = ''; // emergency |
|
| 1167 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 1168 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 1169 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1170 | - //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 1171 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 1172 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 1173 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 1174 | - else $data['info'] = ''; |
|
| 1175 | - $data['format_source'] = 'pireps'; |
|
| 1176 | - $data['id_source'] = $id_source; |
|
| 1177 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1178 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1179 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1180 | - if ($line['icon'] === 'plane') { |
|
| 1151 | + foreach ($all_data['pireps'] as $line) { |
|
| 1152 | + $data = array(); |
|
| 1153 | + $data['id'] = $line['id']; |
|
| 1154 | + $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 1155 | + $data['ident'] = $line['callsign']; // ident |
|
| 1156 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 1157 | + if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 1158 | + if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 1159 | + if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 1160 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1161 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1162 | + $data['latitude'] = $line['lat']; // lat |
|
| 1163 | + $data['longitude'] = $line['lon']; // long |
|
| 1164 | + //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 1165 | + //$data['squawk'] = $line['squawk']; // squawk |
|
| 1166 | + //$data['emergency'] = ''; // emergency |
|
| 1167 | + if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 1168 | + if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 1169 | + if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1170 | + //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 1171 | + if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 1172 | + if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 1173 | + if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 1174 | + else $data['info'] = ''; |
|
| 1175 | + $data['format_source'] = 'pireps'; |
|
| 1176 | + $data['id_source'] = $id_source; |
|
| 1177 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1178 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1179 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1180 | + if ($line['icon'] === 'plane') { |
|
| 1181 | 1181 | $SI->add($data); |
| 1182 | - // print_r($data); |
|
| 1183 | - } elseif ($line['icon'] === 'ct') { |
|
| 1182 | + // print_r($data); |
|
| 1183 | + } elseif ($line['icon'] === 'ct') { |
|
| 1184 | 1184 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 1185 | 1185 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 1186 | 1186 | $typec = substr($data['ident'],-3); |
@@ -1195,209 +1195,209 @@ discard block |
||
| 1195 | 1195 | elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
| 1196 | 1196 | else $data['type'] = 'Observer'; |
| 1197 | 1197 | 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']); |
| 1198 | - } |
|
| 1199 | - unset($data); |
|
| 1198 | + } |
|
| 1199 | + unset($data); |
|
| 1200 | + } |
|
| 1200 | 1201 | } |
| 1201 | - } |
|
| 1202 | - //$last_exec['pirepsjson'] = time(); |
|
| 1203 | - $last_exec[$id]['last'] = time(); |
|
| 1202 | + //$last_exec['pirepsjson'] = time(); |
|
| 1203 | + $last_exec[$id]['last'] = time(); |
|
| 1204 | 1204 | //} elseif ($value === 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
| 1205 | 1205 | } elseif ($value['format'] === 'phpvmacars' && |
| 1206 | - ( |
|
| 1206 | + ( |
|
| 1207 | 1207 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 1208 | 1208 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 1209 | - ) |
|
| 1209 | + ) |
|
| 1210 | 1210 | ) { |
| 1211 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 1212 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1213 | - $buffer = $Common->getData($value['host']); |
|
| 1214 | - $all_data = json_decode($buffer,true); |
|
| 1215 | - if ($buffer != '' && is_array($all_data)) { |
|
| 1211 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 1212 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1213 | + $buffer = $Common->getData($value['host']); |
|
| 1214 | + $all_data = json_decode($buffer,true); |
|
| 1215 | + if ($buffer != '' && is_array($all_data)) { |
|
| 1216 | 1216 | $reset = 0; |
| 1217 | 1217 | foreach ($all_data as $line) { |
| 1218 | - $data = array(); |
|
| 1219 | - //$data['id'] = $line['id']; // id not usable |
|
| 1220 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1221 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1222 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 1223 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 1224 | - $data['ident'] = $line['flightnum']; // ident |
|
| 1225 | - $data['altitude'] = $line['alt']; // altitude |
|
| 1226 | - $data['speed'] = $line['gs']; // speed |
|
| 1227 | - $data['heading'] = $line['heading']; // heading |
|
| 1228 | - $data['latitude'] = $line['lat']; // lat |
|
| 1229 | - $data['longitude'] = $line['lng']; // long |
|
| 1230 | - $data['verticalrate'] = ''; // verticale rate |
|
| 1231 | - $data['squawk'] = ''; // squawk |
|
| 1232 | - $data['emergency'] = ''; // emergency |
|
| 1233 | - //$data['datetime'] = $line['lastupdate']; |
|
| 1234 | - //$data['last_update'] = $line['lastupdate']; |
|
| 1235 | - if (isset($value['timezone'])) { |
|
| 1236 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
| 1237 | - $datetime->setTimeZone(new DateTimeZone('UTC')); |
|
| 1238 | - $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
|
| 1239 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1240 | - $data['departure_airport_icao'] = $line['depicao']; |
|
| 1241 | - $data['departure_airport_time'] = $line['deptime']; |
|
| 1242 | - $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1243 | - $data['arrival_airport_time'] = $line['arrtime']; |
|
| 1244 | - if (isset($line['registration'])) { |
|
| 1245 | - $data['registration'] = $line['registration']; |
|
| 1246 | - //if (isset($line['aircraft'])) $data['id'] = $line['aircraft']; |
|
| 1247 | - } else $data['registration'] = $line['aircraft']; |
|
| 1248 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1249 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1250 | - if (isset($line['aircraftname'])) { |
|
| 1218 | + $data = array(); |
|
| 1219 | + //$data['id'] = $line['id']; // id not usable |
|
| 1220 | + if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1221 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1222 | + if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 1223 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 1224 | + $data['ident'] = $line['flightnum']; // ident |
|
| 1225 | + $data['altitude'] = $line['alt']; // altitude |
|
| 1226 | + $data['speed'] = $line['gs']; // speed |
|
| 1227 | + $data['heading'] = $line['heading']; // heading |
|
| 1228 | + $data['latitude'] = $line['lat']; // lat |
|
| 1229 | + $data['longitude'] = $line['lng']; // long |
|
| 1230 | + $data['verticalrate'] = ''; // verticale rate |
|
| 1231 | + $data['squawk'] = ''; // squawk |
|
| 1232 | + $data['emergency'] = ''; // emergency |
|
| 1233 | + //$data['datetime'] = $line['lastupdate']; |
|
| 1234 | + //$data['last_update'] = $line['lastupdate']; |
|
| 1235 | + if (isset($value['timezone'])) { |
|
| 1236 | + $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
| 1237 | + $datetime->setTimeZone(new DateTimeZone('UTC')); |
|
| 1238 | + $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
|
| 1239 | + } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1240 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 1241 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 1242 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1243 | + $data['arrival_airport_time'] = $line['arrtime']; |
|
| 1244 | + if (isset($line['registration'])) { |
|
| 1245 | + $data['registration'] = $line['registration']; |
|
| 1246 | + //if (isset($line['aircraft'])) $data['id'] = $line['aircraft']; |
|
| 1247 | + } else $data['registration'] = $line['aircraft']; |
|
| 1248 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1249 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1250 | + if (isset($line['aircraftname'])) { |
|
| 1251 | 1251 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1252 | 1252 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 1253 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
| 1254 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1255 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1256 | - else { |
|
| 1257 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 1258 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1259 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1260 | - } |
|
| 1261 | - } |
|
| 1262 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 1263 | - $data['id_source'] = $id_source; |
|
| 1264 | - $data['format_source'] = 'phpvmacars'; |
|
| 1265 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1266 | - $SI->add($data); |
|
| 1267 | - unset($data); |
|
| 1253 | + $aircraft_data = explode('-',$line['aircraftname']); |
|
| 1254 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1255 | + elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1256 | + else { |
|
| 1257 | + $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 1258 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1259 | + else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1260 | + } |
|
| 1261 | + } |
|
| 1262 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 1263 | + $data['id_source'] = $id_source; |
|
| 1264 | + $data['format_source'] = 'phpvmacars'; |
|
| 1265 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1266 | + $SI->add($data); |
|
| 1267 | + unset($data); |
|
| 1268 | 1268 | } |
| 1269 | 1269 | if ($globalDebug) echo 'No more data...'."\n"; |
| 1270 | 1270 | unset($buffer); |
| 1271 | 1271 | unset($all_data); |
| 1272 | - } |
|
| 1273 | - //$last_exec['phpvmacars'] = time(); |
|
| 1274 | - $last_exec[$id]['last'] = time(); |
|
| 1272 | + } |
|
| 1273 | + //$last_exec['phpvmacars'] = time(); |
|
| 1274 | + $last_exec[$id]['last'] = time(); |
|
| 1275 | 1275 | } elseif ($value['format'] === 'vaos' && |
| 1276 | - ( |
|
| 1276 | + ( |
|
| 1277 | 1277 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 1278 | 1278 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 1279 | - ) |
|
| 1279 | + ) |
|
| 1280 | 1280 | ) { |
| 1281 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 1282 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1283 | - $buffer = $Common->getData($value['host']); |
|
| 1284 | - $all_data = json_decode($buffer,true); |
|
| 1285 | - if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
|
| 1281 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 1282 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1283 | + $buffer = $Common->getData($value['host']); |
|
| 1284 | + $all_data = json_decode($buffer,true); |
|
| 1285 | + if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
|
| 1286 | 1286 | $reset = 0; |
| 1287 | 1287 | foreach ($all_data['ACARSData'] as $line) { |
| 1288 | - //print_r($line); |
|
| 1289 | - $data = array(); |
|
| 1290 | - //$data['id'] = $line['id']; // id not usable |
|
| 1291 | - $data['id'] = $line['id']; |
|
| 1292 | - //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1293 | - if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
|
| 1294 | - if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
|
| 1295 | - $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
|
| 1296 | - if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 1297 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 1298 | - $data['speed'] = $line['groundspeed']; // speed |
|
| 1299 | - $data['heading'] = $line['heading']; // heading |
|
| 1300 | - $data['latitude'] = $line['lat']; // lat |
|
| 1301 | - $data['longitude'] = $line['lon']; // long |
|
| 1302 | - //$data['verticalrate'] = ''; // verticale rate |
|
| 1303 | - //$data['squawk'] = ''; // squawk |
|
| 1304 | - //$data['emergency'] = ''; // emergency |
|
| 1305 | - if (isset($value['timezone'])) { |
|
| 1306 | - $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
|
| 1307 | - $datetime->setTimeZone(new DateTimeZone('UTC')); |
|
| 1308 | - $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
|
| 1309 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1288 | + //print_r($line); |
|
| 1289 | + $data = array(); |
|
| 1290 | + //$data['id'] = $line['id']; // id not usable |
|
| 1291 | + $data['id'] = $line['id']; |
|
| 1292 | + //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1293 | + if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
|
| 1294 | + if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
|
| 1295 | + $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
|
| 1296 | + if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 1297 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 1298 | + $data['speed'] = $line['groundspeed']; // speed |
|
| 1299 | + $data['heading'] = $line['heading']; // heading |
|
| 1300 | + $data['latitude'] = $line['lat']; // lat |
|
| 1301 | + $data['longitude'] = $line['lon']; // long |
|
| 1302 | + //$data['verticalrate'] = ''; // verticale rate |
|
| 1303 | + //$data['squawk'] = ''; // squawk |
|
| 1304 | + //$data['emergency'] = ''; // emergency |
|
| 1305 | + if (isset($value['timezone'])) { |
|
| 1306 | + $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
|
| 1307 | + $datetime->setTimeZone(new DateTimeZone('UTC')); |
|
| 1308 | + $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
|
| 1309 | + } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1310 | 1310 | |
| 1311 | - $data['departure_airport_icao'] = $line['bid']['depapt']['icao']; |
|
| 1312 | - $data['departure_airport_time'] = $line['bid']['deptime']; |
|
| 1313 | - $data['arrival_airport_icao'] = $line['bid']['arrapt']['icao']; |
|
| 1314 | - $data['arrival_airport_time'] = $line['bid']['arrtime']; |
|
| 1315 | - $data['registration'] = $line['bid']['aircraft']['registration']; |
|
| 1311 | + $data['departure_airport_icao'] = $line['bid']['depapt']['icao']; |
|
| 1312 | + $data['departure_airport_time'] = $line['bid']['deptime']; |
|
| 1313 | + $data['arrival_airport_icao'] = $line['bid']['arrapt']['icao']; |
|
| 1314 | + $data['arrival_airport_time'] = $line['bid']['arrtime']; |
|
| 1315 | + $data['registration'] = $line['bid']['aircraft']['registration']; |
|
| 1316 | 1316 | |
| 1317 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1318 | - if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route |
|
| 1319 | - $data['aircraft_icao'] = $line['bid']['aircraft']['icao']; |
|
| 1317 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1318 | + if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route |
|
| 1319 | + $data['aircraft_icao'] = $line['bid']['aircraft']['icao']; |
|
| 1320 | 1320 | |
| 1321 | - $data['id_source'] = $id_source; |
|
| 1322 | - $data['format_source'] = 'vaos'; |
|
| 1323 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1324 | - $SI->add($data); |
|
| 1325 | - unset($data); |
|
| 1321 | + $data['id_source'] = $id_source; |
|
| 1322 | + $data['format_source'] = 'vaos'; |
|
| 1323 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1324 | + $SI->add($data); |
|
| 1325 | + unset($data); |
|
| 1326 | 1326 | } |
| 1327 | 1327 | if ($globalDebug) echo 'No more data...'."\n"; |
| 1328 | 1328 | unset($buffer); |
| 1329 | 1329 | unset($all_data); |
| 1330 | - } |
|
| 1331 | - //$last_exec['phpvmacars'] = time(); |
|
| 1332 | - $last_exec[$id]['last'] = time(); |
|
| 1330 | + } |
|
| 1331 | + //$last_exec['phpvmacars'] = time(); |
|
| 1332 | + $last_exec[$id]['last'] = time(); |
|
| 1333 | 1333 | } elseif ($value['format'] === 'vam' && |
| 1334 | - ( |
|
| 1334 | + ( |
|
| 1335 | 1335 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 1336 | 1336 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 1337 | - ) |
|
| 1337 | + ) |
|
| 1338 | 1338 | ) { |
| 1339 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 1340 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1341 | - $buffer = $Common->getData($value['host']); |
|
| 1342 | - $all_data = json_decode($buffer,true); |
|
| 1343 | - if ($buffer != '' && is_array($all_data)) { |
|
| 1339 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 1340 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1341 | + $buffer = $Common->getData($value['host']); |
|
| 1342 | + $all_data = json_decode($buffer,true); |
|
| 1343 | + if ($buffer != '' && is_array($all_data)) { |
|
| 1344 | 1344 | $reset = 0; |
| 1345 | 1345 | foreach ($all_data as $line) { |
| 1346 | - $data = array(); |
|
| 1347 | - //$data['id'] = $line['id']; // id not usable |
|
| 1348 | - $data['id'] = trim($line['flight_id']); |
|
| 1349 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1350 | - $data['pilot_name'] = $line['pilot_name']; |
|
| 1351 | - $data['pilot_id'] = $line['pilot_id']; |
|
| 1352 | - $data['ident'] = trim($line['callsign']); // ident |
|
| 1353 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 1354 | - $data['speed'] = $line['gs']; // speed |
|
| 1355 | - $data['heading'] = $line['heading']; // heading |
|
| 1356 | - $data['latitude'] = $line['latitude']; // lat |
|
| 1357 | - $data['longitude'] = $line['longitude']; // long |
|
| 1358 | - $data['verticalrate'] = ''; // verticale rate |
|
| 1359 | - $data['squawk'] = ''; // squawk |
|
| 1360 | - $data['emergency'] = ''; // emergency |
|
| 1361 | - //$data['datetime'] = $line['lastupdate']; |
|
| 1362 | - $data['last_update'] = $line['last_update']; |
|
| 1363 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1364 | - $data['departure_airport_icao'] = $line['departure']; |
|
| 1365 | - //$data['departure_airport_time'] = $line['departure_time']; |
|
| 1366 | - $data['arrival_airport_icao'] = $line['arrival']; |
|
| 1367 | - //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 1368 | - //$data['registration'] = $line['aircraft']; |
|
| 1369 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1370 | - $data['aircraft_icao'] = $line['plane_type']; |
|
| 1371 | - $data['id_source'] = $id_source; |
|
| 1372 | - $data['format_source'] = 'vam'; |
|
| 1373 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1374 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1375 | - $SI->add($data); |
|
| 1376 | - unset($data); |
|
| 1346 | + $data = array(); |
|
| 1347 | + //$data['id'] = $line['id']; // id not usable |
|
| 1348 | + $data['id'] = trim($line['flight_id']); |
|
| 1349 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1350 | + $data['pilot_name'] = $line['pilot_name']; |
|
| 1351 | + $data['pilot_id'] = $line['pilot_id']; |
|
| 1352 | + $data['ident'] = trim($line['callsign']); // ident |
|
| 1353 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 1354 | + $data['speed'] = $line['gs']; // speed |
|
| 1355 | + $data['heading'] = $line['heading']; // heading |
|
| 1356 | + $data['latitude'] = $line['latitude']; // lat |
|
| 1357 | + $data['longitude'] = $line['longitude']; // long |
|
| 1358 | + $data['verticalrate'] = ''; // verticale rate |
|
| 1359 | + $data['squawk'] = ''; // squawk |
|
| 1360 | + $data['emergency'] = ''; // emergency |
|
| 1361 | + //$data['datetime'] = $line['lastupdate']; |
|
| 1362 | + $data['last_update'] = $line['last_update']; |
|
| 1363 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1364 | + $data['departure_airport_icao'] = $line['departure']; |
|
| 1365 | + //$data['departure_airport_time'] = $line['departure_time']; |
|
| 1366 | + $data['arrival_airport_icao'] = $line['arrival']; |
|
| 1367 | + //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 1368 | + //$data['registration'] = $line['aircraft']; |
|
| 1369 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1370 | + $data['aircraft_icao'] = $line['plane_type']; |
|
| 1371 | + $data['id_source'] = $id_source; |
|
| 1372 | + $data['format_source'] = 'vam'; |
|
| 1373 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1374 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1375 | + $SI->add($data); |
|
| 1376 | + unset($data); |
|
| 1377 | 1377 | } |
| 1378 | 1378 | if ($globalDebug) echo 'No more data...'."\n"; |
| 1379 | 1379 | unset($buffer); |
| 1380 | 1380 | unset($all_data); |
| 1381 | - } |
|
| 1382 | - //$last_exec['phpvmacars'] = time(); |
|
| 1383 | - $last_exec[$id]['last'] = time(); |
|
| 1381 | + } |
|
| 1382 | + //$last_exec['phpvmacars'] = time(); |
|
| 1383 | + $last_exec[$id]['last'] = time(); |
|
| 1384 | 1384 | } elseif ($value['format'] === 'blitzortung' && |
| 1385 | - ( |
|
| 1385 | + ( |
|
| 1386 | 1386 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
| 1387 | 1387 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 1388 | - ) |
|
| 1388 | + ) |
|
| 1389 | 1389 | ) { |
| 1390 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 1391 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1392 | - $buffer = $Common->getData($value['host']); |
|
| 1393 | - $all_data = json_decode($buffer,true); |
|
| 1394 | - if ($buffer != '') { |
|
| 1390 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 1391 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1392 | + $buffer = $Common->getData($value['host']); |
|
| 1393 | + $all_data = json_decode($buffer,true); |
|
| 1394 | + if ($buffer != '') { |
|
| 1395 | 1395 | $Source->deleteLocationBySource('blitzortung'); |
| 1396 | 1396 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 1397 | 1397 | $buffer = explode('\n',$buffer); |
| 1398 | 1398 | foreach ($buffer as $buffer_line) { |
| 1399 | - $line = json_decode($buffer_line,true); |
|
| 1400 | - if (isset($line['time'])) { |
|
| 1399 | + $line = json_decode($buffer_line,true); |
|
| 1400 | + if (isset($line['time'])) { |
|
| 1401 | 1401 | $data = array(); |
| 1402 | 1402 | $data['altitude'] = $line['alt']; // altitude |
| 1403 | 1403 | $data['latitude'] = $line['lat']; // lat |
@@ -1409,94 +1409,94 @@ discard block |
||
| 1409 | 1409 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
| 1410 | 1410 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
| 1411 | 1411 | unset($data); |
| 1412 | - } |
|
| 1412 | + } |
|
| 1413 | 1413 | } |
| 1414 | 1414 | if ($globalDebug) echo 'No more data...'."\n"; |
| 1415 | 1415 | unset($buffer); |
| 1416 | - } |
|
| 1417 | - $last_exec[$id]['last'] = time(); |
|
| 1416 | + } |
|
| 1417 | + $last_exec[$id]['last'] = time(); |
|
| 1418 | 1418 | //} elseif ($value === 'sbs' || $value === 'tsv' || $value === 'raw' || $value === 'aprs' || $value === 'beast') { |
| 1419 | 1419 | } 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') { |
| 1420 | - //$last_exec[$id]['last'] = time(); |
|
| 1421 | - //$read = array( $sockets[$id] ); |
|
| 1422 | - $read = $sockets; |
|
| 1423 | - $write = NULL; |
|
| 1424 | - $e = NULL; |
|
| 1425 | - $n = socket_select($read, $write, $e, $timeout); |
|
| 1426 | - if ($e != NULL) var_dump($e); |
|
| 1427 | - if ($n > 0) { |
|
| 1420 | + //$last_exec[$id]['last'] = time(); |
|
| 1421 | + //$read = array( $sockets[$id] ); |
|
| 1422 | + $read = $sockets; |
|
| 1423 | + $write = NULL; |
|
| 1424 | + $e = NULL; |
|
| 1425 | + $n = socket_select($read, $write, $e, $timeout); |
|
| 1426 | + if ($e != NULL) var_dump($e); |
|
| 1427 | + if ($n > 0) { |
|
| 1428 | 1428 | $reset = 0; |
| 1429 | 1429 | foreach ($read as $nb => $r) { |
| 1430 | - //$value = $formats[$nb]; |
|
| 1431 | - $format = $globalSources[$nb]['format']; |
|
| 1432 | - if ($format === 'sbs' || $format === 'aprs' || $format === 'famaprs' || $format === 'raw' || $format === 'tsv' || $format === 'acarssbs3') { |
|
| 1430 | + //$value = $formats[$nb]; |
|
| 1431 | + $format = $globalSources[$nb]['format']; |
|
| 1432 | + if ($format === 'sbs' || $format === 'aprs' || $format === 'famaprs' || $format === 'raw' || $format === 'tsv' || $format === 'acarssbs3') { |
|
| 1433 | 1433 | $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
| 1434 | - } elseif ($format === 'vrstcp') { |
|
| 1434 | + } elseif ($format === 'vrstcp') { |
|
| 1435 | 1435 | $buffer = @socket_read($r, 6000); |
| 1436 | - } else { |
|
| 1436 | + } else { |
|
| 1437 | 1437 | $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
| 1438 | - } |
|
| 1439 | - //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 1440 | - //echo $buffer."\n"; |
|
| 1441 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 1442 | - //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 1443 | - $error = false; |
|
| 1444 | - //$SI::del(); |
|
| 1445 | - if ($buffer !== FALSE) { |
|
| 1438 | + } |
|
| 1439 | + //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 1440 | + //echo $buffer."\n"; |
|
| 1441 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 1442 | + //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 1443 | + $error = false; |
|
| 1444 | + //$SI::del(); |
|
| 1445 | + if ($buffer !== FALSE) { |
|
| 1446 | 1446 | if ($format === 'vrstcp') { |
| 1447 | - $buffer = explode('},{',$buffer); |
|
| 1447 | + $buffer = explode('},{',$buffer); |
|
| 1448 | 1448 | } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
| 1449 | - } |
|
| 1450 | - // SBS format is CSV format |
|
| 1451 | - if ($buffer !== FALSE && $buffer !== '') { |
|
| 1449 | + } |
|
| 1450 | + // SBS format is CSV format |
|
| 1451 | + if ($buffer !== FALSE && $buffer !== '') { |
|
| 1452 | 1452 | $tt[$format] = 0; |
| 1453 | 1453 | if ($format === 'acarssbs3') { |
| 1454 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1455 | - $ACARS->add(trim($buffer)); |
|
| 1456 | - $ACARS->deleteLiveAcarsData(); |
|
| 1454 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1455 | + $ACARS->add(trim($buffer)); |
|
| 1456 | + $ACARS->deleteLiveAcarsData(); |
|
| 1457 | 1457 | } elseif ($format === 'raw') { |
| 1458 | - // AVR format |
|
| 1459 | - $data = $SBS->parse($buffer); |
|
| 1460 | - if (is_array($data)) { |
|
| 1458 | + // AVR format |
|
| 1459 | + $data = $SBS->parse($buffer); |
|
| 1460 | + if (is_array($data)) { |
|
| 1461 | 1461 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1462 | 1462 | $data['format_source'] = 'raw'; |
| 1463 | 1463 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 1464 | 1464 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
| 1465 | 1465 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1466 | 1466 | if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
| 1467 | - } |
|
| 1467 | + } |
|
| 1468 | 1468 | } elseif ($format === 'ais') { |
| 1469 | - $ais_data = $AIS->parse_line(trim($buffer)); |
|
| 1470 | - $data = array(); |
|
| 1471 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 1472 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 1473 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 1474 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 1475 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 1476 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 1477 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 1478 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 1479 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 1480 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 1481 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 1482 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 1483 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1484 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1485 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1486 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1469 | + $ais_data = $AIS->parse_line(trim($buffer)); |
|
| 1470 | + $data = array(); |
|
| 1471 | + if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 1472 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 1473 | + if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 1474 | + if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 1475 | + if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 1476 | + if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 1477 | + if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 1478 | + if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 1479 | + if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 1480 | + if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 1481 | + if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 1482 | + if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 1483 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1484 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1485 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1486 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1487 | 1487 | |
| 1488 | - if (isset($ais_data['timestamp'])) { |
|
| 1488 | + if (isset($ais_data['timestamp'])) { |
|
| 1489 | 1489 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 1490 | - } else { |
|
| 1490 | + } else { |
|
| 1491 | 1491 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1492 | - } |
|
| 1493 | - $data['format_source'] = 'aisnmea'; |
|
| 1494 | - $data['id_source'] = $id_source; |
|
| 1495 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 1496 | - unset($data); |
|
| 1497 | - } elseif ($format === 'flightgearsp') { |
|
| 1498 | - //echo $buffer."\n"; |
|
| 1499 | - if (strlen($buffer) > 5) { |
|
| 1492 | + } |
|
| 1493 | + $data['format_source'] = 'aisnmea'; |
|
| 1494 | + $data['id_source'] = $id_source; |
|
| 1495 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 1496 | + unset($data); |
|
| 1497 | + } elseif ($format === 'flightgearsp') { |
|
| 1498 | + //echo $buffer."\n"; |
|
| 1499 | + if (strlen($buffer) > 5) { |
|
| 1500 | 1500 | $line = explode(',',$buffer); |
| 1501 | 1501 | $data = array(); |
| 1502 | 1502 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
@@ -1513,38 +1513,38 @@ discard block |
||
| 1513 | 1513 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1514 | 1514 | if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
| 1515 | 1515 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1516 | - } |
|
| 1517 | - } elseif ($format === 'acars') { |
|
| 1518 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1519 | - $ACARS->add(trim($buffer)); |
|
| 1520 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 1521 | - $ACARS->deleteLiveAcarsData(); |
|
| 1516 | + } |
|
| 1517 | + } elseif ($format === 'acars') { |
|
| 1518 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1519 | + $ACARS->add(trim($buffer)); |
|
| 1520 | + socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 1521 | + $ACARS->deleteLiveAcarsData(); |
|
| 1522 | 1522 | } elseif ($format === 'flightgearmp') { |
| 1523 | - if (substr($buffer,0,1) != '#') { |
|
| 1523 | + if (substr($buffer,0,1) != '#') { |
|
| 1524 | 1524 | $data = array(); |
| 1525 | 1525 | //echo $buffer."\n"; |
| 1526 | 1526 | $line = explode(' ',$buffer); |
| 1527 | 1527 | if (count($line) === 11) { |
| 1528 | - $userserver = explode('@',$line[0]); |
|
| 1529 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 1530 | - $data['ident'] = $userserver[0]; |
|
| 1531 | - $data['registration'] = $userserver[0]; |
|
| 1532 | - $data['latitude'] = $line[4]; |
|
| 1533 | - $data['longitude'] = $line[5]; |
|
| 1534 | - $data['altitude'] = $line[6]; |
|
| 1535 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1536 | - $aircraft_type = $line[10]; |
|
| 1537 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 1538 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 1539 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1540 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1528 | + $userserver = explode('@',$line[0]); |
|
| 1529 | + $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 1530 | + $data['ident'] = $userserver[0]; |
|
| 1531 | + $data['registration'] = $userserver[0]; |
|
| 1532 | + $data['latitude'] = $line[4]; |
|
| 1533 | + $data['longitude'] = $line[5]; |
|
| 1534 | + $data['altitude'] = $line[6]; |
|
| 1535 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1536 | + $aircraft_type = $line[10]; |
|
| 1537 | + $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 1538 | + $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 1539 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1540 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1541 | + } |
|
| 1541 | 1542 | } |
| 1542 | - } |
|
| 1543 | 1543 | } elseif ($format === 'beast') { |
| 1544 | - echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 1545 | - die; |
|
| 1544 | + echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 1545 | + die; |
|
| 1546 | 1546 | } elseif ($format === 'vrstcp') { |
| 1547 | - foreach($buffer as $all_data) { |
|
| 1547 | + foreach($buffer as $all_data) { |
|
| 1548 | 1548 | $line = json_decode('{'.$all_data.'}',true); |
| 1549 | 1549 | $data = array(); |
| 1550 | 1550 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
@@ -1564,153 +1564,153 @@ discard block |
||
| 1564 | 1564 | */ |
| 1565 | 1565 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1566 | 1566 | if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
| 1567 | - $data['format_source'] = 'vrstcp'; |
|
| 1567 | + $data['format_source'] = 'vrstcp'; |
|
| 1568 | 1568 | $data['id_source'] = $id_source; |
| 1569 | 1569 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1570 | 1570 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 1571 | 1571 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
| 1572 | 1572 | unset($data); |
| 1573 | - } |
|
| 1573 | + } |
|
| 1574 | 1574 | } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
| 1575 | - $line = explode("\t", $buffer); |
|
| 1576 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
| 1575 | + $line = explode("\t", $buffer); |
|
| 1576 | + for($k = 0; $k < count($line); $k=$k+2) { |
|
| 1577 | 1577 | $key = $line[$k]; |
| 1578 | - $lined[$key] = $line[$k+1]; |
|
| 1579 | - } |
|
| 1580 | - if (count($lined) > 3) { |
|
| 1581 | - $data['hex'] = $lined['hexid']; |
|
| 1582 | - //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 1583 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 1584 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1585 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1586 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1587 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1588 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1589 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1590 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 1591 | - $data['id_source'] = $id_source; |
|
| 1592 | - $data['format_source'] = 'tsv'; |
|
| 1593 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1594 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1578 | + $lined[$key] = $line[$k+1]; |
|
| 1579 | + } |
|
| 1580 | + if (count($lined) > 3) { |
|
| 1581 | + $data['hex'] = $lined['hexid']; |
|
| 1582 | + //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 1583 | + $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 1584 | + if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1585 | + if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1586 | + if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1587 | + if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1588 | + if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1589 | + if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1590 | + if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 1591 | + $data['id_source'] = $id_source; |
|
| 1592 | + $data['format_source'] = 'tsv'; |
|
| 1593 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1594 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1595 | 1595 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1596 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1597 | - unset($lined); |
|
| 1598 | - unset($data); |
|
| 1599 | - } else $error = true; |
|
| 1596 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1597 | + unset($lined); |
|
| 1598 | + unset($data); |
|
| 1599 | + } else $error = true; |
|
| 1600 | 1600 | } elseif ($format === 'aprs' && $use_aprs) { |
| 1601 | - if ($aprs_connect === 0) { |
|
| 1601 | + if ($aprs_connect === 0) { |
|
| 1602 | 1602 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
| 1603 | 1603 | $aprs_connect = 1; |
| 1604 | - } |
|
| 1604 | + } |
|
| 1605 | 1605 | |
| 1606 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 1606 | + if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 1607 | 1607 | $aprs_last_tx = time(); |
| 1608 | 1608 | $data_aprs = "# Keep alive"; |
| 1609 | 1609 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1610 | - } |
|
| 1610 | + } |
|
| 1611 | 1611 | |
| 1612 | - //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 1613 | - //echo 'APRS data : '.$buffer."\n"; |
|
| 1614 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
| 1615 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
| 1616 | - //echo $buffer."\n"; |
|
| 1617 | - date_default_timezone_set('UTC'); |
|
| 1618 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 1612 | + //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 1613 | + //echo 'APRS data : '.$buffer."\n"; |
|
| 1614 | + $buffer = str_replace('APRS <- ','',$buffer); |
|
| 1615 | + $buffer = str_replace('APRS -> ','',$buffer); |
|
| 1616 | + //echo $buffer."\n"; |
|
| 1617 | + date_default_timezone_set('UTC'); |
|
| 1618 | + if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 1619 | 1619 | $line = $APRS->parse($buffer); |
| 1620 | 1620 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
| 1621 | 1621 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
| 1622 | - $aprs_last_tx = time(); |
|
| 1623 | - $data = array(); |
|
| 1624 | - //print_r($line); |
|
| 1625 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1626 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
| 1627 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
| 1628 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
| 1629 | - if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code']; |
|
| 1630 | - if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
|
| 1631 | - if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
|
| 1632 | - if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
|
| 1633 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1634 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1635 | - //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1636 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
| 1637 | - $data['latitude'] = $line['latitude']; |
|
| 1638 | - $data['longitude'] = $line['longitude']; |
|
| 1639 | - //$data['verticalrate'] = $line[16]; |
|
| 1640 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 1641 | - //else $data['speed'] = 0; |
|
| 1642 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1643 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1644 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 1645 | - //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
|
| 1622 | + $aprs_last_tx = time(); |
|
| 1623 | + $data = array(); |
|
| 1624 | + //print_r($line); |
|
| 1625 | + if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1626 | + if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
| 1627 | + if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
| 1628 | + if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
| 1629 | + if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code']; |
|
| 1630 | + if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
|
| 1631 | + if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
|
| 1632 | + if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
|
| 1633 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1634 | + else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1635 | + //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1636 | + if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
| 1637 | + $data['latitude'] = $line['latitude']; |
|
| 1638 | + $data['longitude'] = $line['longitude']; |
|
| 1639 | + //$data['verticalrate'] = $line[16]; |
|
| 1640 | + if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 1641 | + //else $data['speed'] = 0; |
|
| 1642 | + if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1643 | + if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1644 | + if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 1645 | + //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
|
| 1646 | 1646 | |
| 1647 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
| 1648 | - //else echo 'No heading...'."\n"; |
|
| 1649 | - //else $data['heading'] = 0; |
|
| 1650 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 1651 | - //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
|
| 1652 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
| 1653 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
| 1654 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1655 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
| 1656 | - $data['id_source'] = $id_source; |
|
| 1657 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
| 1658 | - else $data['format_source'] = 'aprs'; |
|
| 1659 | - $data['source_name'] = $line['source']; |
|
| 1660 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
| 1661 | - else $data['source_type'] = 'flarm'; |
|
| 1662 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1663 | - $currentdate = date('Y-m-d H:i:s'); |
|
| 1664 | - $aprsdate = strtotime($data['datetime']); |
|
| 1665 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
| 1666 | - // Accept data if time <= system time + 20s |
|
| 1667 | - //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'])))) { |
|
| 1668 | - if (($data['source_type'] === 'modes') || isset($line['stealth']) && (!isset($data['hex']) || $data['hex'] != 'FFFFFF') && ($line['stealth'] === 0 || $line['stealth'] === '') && (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
| 1647 | + if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
| 1648 | + //else echo 'No heading...'."\n"; |
|
| 1649 | + //else $data['heading'] = 0; |
|
| 1650 | + if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 1651 | + //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
|
| 1652 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
| 1653 | + elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
| 1654 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1655 | + elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
| 1656 | + $data['id_source'] = $id_source; |
|
| 1657 | + if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
| 1658 | + else $data['format_source'] = 'aprs'; |
|
| 1659 | + $data['source_name'] = $line['source']; |
|
| 1660 | + if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
| 1661 | + else $data['source_type'] = 'flarm'; |
|
| 1662 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1663 | + $currentdate = date('Y-m-d H:i:s'); |
|
| 1664 | + $aprsdate = strtotime($data['datetime']); |
|
| 1665 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
| 1666 | + // Accept data if time <= system time + 20s |
|
| 1667 | + //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'])))) { |
|
| 1668 | + if (($data['source_type'] === 'modes') || isset($line['stealth']) && (!isset($data['hex']) || $data['hex'] != 'FFFFFF') && ($line['stealth'] === 0 || $line['stealth'] === '') && (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
| 1669 | 1669 | $send = $SI->add($data); |
| 1670 | - } elseif ($data['source_type'] === 'ais') { |
|
| 1670 | + } elseif ($data['source_type'] === 'ais') { |
|
| 1671 | 1671 | $data['type'] = ''; |
| 1672 | 1672 | if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
| 1673 | - } elseif (isset($line['stealth'])) { |
|
| 1673 | + } elseif (isset($line['stealth'])) { |
|
| 1674 | 1674 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
| 1675 | 1675 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
| 1676 | - } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
| 1677 | - //$line['symbol'] === 'Balloon' || |
|
| 1678 | - $line['symbol'] === 'Glider' || |
|
| 1679 | - $line['symbol'] === 'Aircraft (small)' || $line['symbol'] === 'Helicopter')) { |
|
| 1680 | - if ($line['symbol'] === 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
| 1681 | - if ($line['symbol'] === 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 1682 | - $send = $SI->add($data); |
|
| 1683 | - } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
| 1684 | - $line['symbol'] === 'Yacht (Sail)' || |
|
| 1685 | - $line['symbol'] === 'Ship (Power Boat)')) { |
|
| 1686 | - $send = $MI->add($data); |
|
| 1687 | - } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
| 1688 | - $line['symbol'] === 'Car' || |
|
| 1689 | - $line['symbol'] === 'Ambulance' || |
|
| 1690 | - $line['symbol'] === 'Van' || |
|
| 1691 | - $line['symbol'] === 'Truck' || $line['symbol'] === 'Truck (18 Wheeler)' || |
|
| 1692 | - $line['symbol'] === 'Motorcycle' || |
|
| 1693 | - $line['symbol'] === 'Tractor' || |
|
| 1694 | - $line['symbol'] === 'Police' || |
|
| 1695 | - $line['symbol'] === 'Bike' || |
|
| 1696 | - $line['symbol'] === 'Jogger' || |
|
| 1697 | - $line['symbol'] === 'Horse' || |
|
| 1698 | - $line['symbol'] === 'Bus' || |
|
| 1699 | - $line['symbol'] === 'Jeep' || |
|
| 1700 | - $line['symbol'] === 'Recreational Vehicle' || |
|
| 1701 | - $line['symbol'] === 'Yacht (Sail)' || |
|
| 1702 | - $line['symbol'] === 'Ship (Power Boat)' || |
|
| 1703 | - $line['symbol'] === 'Firetruck' || |
|
| 1704 | - $line['symbol'] === 'Balloon' || $line['symbol'] === 'Glider' || |
|
| 1705 | - $line['symbol'] === 'Aircraft (small)' || $line['symbol'] === 'Helicopter' || |
|
| 1706 | - $line['symbol'] === 'SUV' || |
|
| 1707 | - $line['symbol'] === 'Snowmobile' || |
|
| 1708 | - $line['symbol'] === 'Mobile Satellite Station')) { |
|
| 1709 | - //} 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') { |
|
| 1676 | + } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
| 1677 | + //$line['symbol'] === 'Balloon' || |
|
| 1678 | + $line['symbol'] === 'Glider' || |
|
| 1679 | + $line['symbol'] === 'Aircraft (small)' || $line['symbol'] === 'Helicopter')) { |
|
| 1680 | + if ($line['symbol'] === 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
| 1681 | + if ($line['symbol'] === 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 1682 | + $send = $SI->add($data); |
|
| 1683 | + } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
| 1684 | + $line['symbol'] === 'Yacht (Sail)' || |
|
| 1685 | + $line['symbol'] === 'Ship (Power Boat)')) { |
|
| 1686 | + $send = $MI->add($data); |
|
| 1687 | + } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
|
| 1688 | + $line['symbol'] === 'Car' || |
|
| 1689 | + $line['symbol'] === 'Ambulance' || |
|
| 1690 | + $line['symbol'] === 'Van' || |
|
| 1691 | + $line['symbol'] === 'Truck' || $line['symbol'] === 'Truck (18 Wheeler)' || |
|
| 1692 | + $line['symbol'] === 'Motorcycle' || |
|
| 1693 | + $line['symbol'] === 'Tractor' || |
|
| 1694 | + $line['symbol'] === 'Police' || |
|
| 1695 | + $line['symbol'] === 'Bike' || |
|
| 1696 | + $line['symbol'] === 'Jogger' || |
|
| 1697 | + $line['symbol'] === 'Horse' || |
|
| 1698 | + $line['symbol'] === 'Bus' || |
|
| 1699 | + $line['symbol'] === 'Jeep' || |
|
| 1700 | + $line['symbol'] === 'Recreational Vehicle' || |
|
| 1701 | + $line['symbol'] === 'Yacht (Sail)' || |
|
| 1702 | + $line['symbol'] === 'Ship (Power Boat)' || |
|
| 1703 | + $line['symbol'] === 'Firetruck' || |
|
| 1704 | + $line['symbol'] === 'Balloon' || $line['symbol'] === 'Glider' || |
|
| 1705 | + $line['symbol'] === 'Aircraft (small)' || $line['symbol'] === 'Helicopter' || |
|
| 1706 | + $line['symbol'] === 'SUV' || |
|
| 1707 | + $line['symbol'] === 'Snowmobile' || |
|
| 1708 | + $line['symbol'] === 'Mobile Satellite Station')) { |
|
| 1709 | + //} 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') { |
|
| 1710 | 1710 | // } 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') { |
| 1711 | 1711 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
| 1712 | 1712 | if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
| 1713 | - } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
|
| 1713 | + } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
|
| 1714 | 1714 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
| 1715 | 1715 | $Source->deleteOldLocationByType('gs'); |
| 1716 | 1716 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
@@ -1718,7 +1718,7 @@ discard block |
||
| 1718 | 1718 | } else { |
| 1719 | 1719 | $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
| 1720 | 1720 | } |
| 1721 | - } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
|
| 1721 | + } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
|
| 1722 | 1722 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1723 | 1723 | if ($globalDebug) echo '# Weather Station added'."\n"; |
| 1724 | 1724 | $Source->deleteOldLocationByType('wx'); |
@@ -1728,7 +1728,7 @@ discard block |
||
| 1728 | 1728 | } else { |
| 1729 | 1729 | $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
| 1730 | 1730 | } |
| 1731 | - } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
|
| 1731 | + } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
|
| 1732 | 1732 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1733 | 1733 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
| 1734 | 1734 | $Source->deleteOldLocationByType('lightning'); |
@@ -1737,11 +1737,11 @@ discard block |
||
| 1737 | 1737 | } else { |
| 1738 | 1738 | $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
| 1739 | 1739 | } |
| 1740 | - } elseif ($globalDebug) { |
|
| 1741 | - echo '/!\ Not added: '.$buffer."\n"; |
|
| 1742 | - print_r($line); |
|
| 1743 | - } |
|
| 1744 | - unset($data); |
|
| 1740 | + } elseif ($globalDebug) { |
|
| 1741 | + echo '/!\ Not added: '.$buffer."\n"; |
|
| 1742 | + print_r($line); |
|
| 1743 | + } |
|
| 1744 | + unset($data); |
|
| 1745 | 1745 | } |
| 1746 | 1746 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
| 1747 | 1747 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
@@ -1760,12 +1760,12 @@ discard block |
||
| 1760 | 1760 | } elseif (!isset($globalSources[$nb]['last_weather_clean'])) { |
| 1761 | 1761 | $globalSources[$nb]['last_weather_clean'] = time(); |
| 1762 | 1762 | } |
| 1763 | - } |
|
| 1763 | + } |
|
| 1764 | 1764 | } else { |
| 1765 | - $line = explode(',', $buffer); |
|
| 1766 | - if (count($line) > 20) { |
|
| 1767 | - $data['hex'] = $line[4]; |
|
| 1768 | - /* |
|
| 1765 | + $line = explode(',', $buffer); |
|
| 1766 | + if (count($line) > 20) { |
|
| 1767 | + $data['hex'] = $line[4]; |
|
| 1768 | + /* |
|
| 1769 | 1769 | $data['datetime'] = $line[6].' '.$line[7]; |
| 1770 | 1770 | date_default_timezone_set($globalTimezone); |
| 1771 | 1771 | $datetime = new DateTime($data['datetime']); |
@@ -1773,30 +1773,30 @@ discard block |
||
| 1773 | 1773 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1774 | 1774 | date_default_timezone_set('UTC'); |
| 1775 | 1775 | */ |
| 1776 | - // Force datetime to current UTC datetime |
|
| 1777 | - date_default_timezone_set('UTC'); |
|
| 1778 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1779 | - $data['ident'] = trim($line[10]); |
|
| 1780 | - $data['latitude'] = $line[14]; |
|
| 1781 | - $data['longitude'] = $line[15]; |
|
| 1782 | - $data['verticalrate'] = $line[16]; |
|
| 1783 | - $data['emergency'] = $line[20]; |
|
| 1784 | - $data['speed'] = $line[12]; |
|
| 1785 | - $data['squawk'] = $line[17]; |
|
| 1786 | - $data['altitude'] = $line[11]; |
|
| 1787 | - $data['heading'] = $line[13]; |
|
| 1788 | - $data['ground'] = $line[21]; |
|
| 1789 | - $data['emergency'] = $line[19]; |
|
| 1790 | - $data['format_source'] = 'sbs'; |
|
| 1776 | + // Force datetime to current UTC datetime |
|
| 1777 | + date_default_timezone_set('UTC'); |
|
| 1778 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1779 | + $data['ident'] = trim($line[10]); |
|
| 1780 | + $data['latitude'] = $line[14]; |
|
| 1781 | + $data['longitude'] = $line[15]; |
|
| 1782 | + $data['verticalrate'] = $line[16]; |
|
| 1783 | + $data['emergency'] = $line[20]; |
|
| 1784 | + $data['speed'] = $line[12]; |
|
| 1785 | + $data['squawk'] = $line[17]; |
|
| 1786 | + $data['altitude'] = $line[11]; |
|
| 1787 | + $data['heading'] = $line[13]; |
|
| 1788 | + $data['ground'] = $line[21]; |
|
| 1789 | + $data['emergency'] = $line[19]; |
|
| 1790 | + $data['format_source'] = 'sbs'; |
|
| 1791 | 1791 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 1792 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1792 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1793 | 1793 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1794 | - $data['id_source'] = $id_source; |
|
| 1795 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1796 | - else $error = true; |
|
| 1797 | - unset($data); |
|
| 1798 | - } else $error = true; |
|
| 1799 | - if ($error) { |
|
| 1794 | + $data['id_source'] = $id_source; |
|
| 1795 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1796 | + else $error = true; |
|
| 1797 | + unset($data); |
|
| 1798 | + } else $error = true; |
|
| 1799 | + if ($error) { |
|
| 1800 | 1800 | if (count($line) > 1 && ($line[0] === 'STA' || $line[0] === 'AIR' || $line[0] === 'SEL' || $line[0] === 'ID' || $line[0] === 'CLK')) { |
| 1801 | 1801 | if ($globalDebug) echo "Not a message. Ignoring... \n"; |
| 1802 | 1802 | } else { |
@@ -1812,13 +1812,13 @@ discard block |
||
| 1812 | 1812 | connect_all($sourceer); |
| 1813 | 1813 | $sourceer = array(); |
| 1814 | 1814 | } |
| 1815 | - } |
|
| 1815 | + } |
|
| 1816 | 1816 | } |
| 1817 | 1817 | // Sleep for xxx microseconds |
| 1818 | 1818 | if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
| 1819 | - } else { |
|
| 1819 | + } else { |
|
| 1820 | 1820 | if ($format === 'flightgearmp') { |
| 1821 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1821 | + if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1822 | 1822 | //@socket_close($r); |
| 1823 | 1823 | sleep($globalMinFetch); |
| 1824 | 1824 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1827,9 +1827,9 @@ discard block |
||
| 1827 | 1827 | break; |
| 1828 | 1828 | |
| 1829 | 1829 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1830 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1831 | - else $tt[$format] = 0; |
|
| 1832 | - if ($tt[$format] > 30 || $buffer === FALSE) { |
|
| 1830 | + if (isset($tt[$format])) $tt[$format]++; |
|
| 1831 | + else $tt[$format] = 0; |
|
| 1832 | + if ($tt[$format] > 30 || $buffer === FALSE) { |
|
| 1833 | 1833 | if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
| 1834 | 1834 | //@socket_close($r); |
| 1835 | 1835 | sleep(2); |
@@ -1840,24 +1840,24 @@ discard block |
||
| 1840 | 1840 | //connect_all($globalSources); |
| 1841 | 1841 | $tt[$format]=0; |
| 1842 | 1842 | break; |
| 1843 | - } |
|
| 1844 | - //else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."..."; |
|
| 1843 | + } |
|
| 1844 | + //else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."..."; |
|
| 1845 | + } |
|
| 1845 | 1846 | } |
| 1846 | - } |
|
| 1847 | 1847 | } |
| 1848 | - } else { |
|
| 1848 | + } else { |
|
| 1849 | 1849 | $error = socket_strerror(socket_last_error()); |
| 1850 | 1850 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 1851 | 1851 | if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
| 1852 | 1852 | if (isset($globalDebug)) echo "Restarting...\n"; |
| 1853 | 1853 | // Restart the script if possible |
| 1854 | 1854 | if (is_array($sockets)) { |
| 1855 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1855 | + if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1856 | 1856 | |
| 1857 | - foreach ($sockets as $sock) { |
|
| 1857 | + foreach ($sockets as $sock) { |
|
| 1858 | 1858 | @socket_shutdown($sock,2); |
| 1859 | 1859 | @socket_close($sock); |
| 1860 | - } |
|
| 1860 | + } |
|
| 1861 | 1861 | |
| 1862 | 1862 | } |
| 1863 | 1863 | if ($globalDebug) echo "Waiting..."; |
@@ -1872,15 +1872,15 @@ discard block |
||
| 1872 | 1872 | if ($globalDebug) echo "Restart all connections..."; |
| 1873 | 1873 | connect_all($globalSources); |
| 1874 | 1874 | } |
| 1875 | - } |
|
| 1875 | + } |
|
| 1876 | 1876 | } |
| 1877 | 1877 | if ($globalDaemon === false) { |
| 1878 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1879 | - if (isset($SI)) $SI->checkAll(); |
|
| 1880 | - if (isset($TI)) $TI->checkAll(); |
|
| 1881 | - if (isset($MI)) $MI->checkAll(); |
|
| 1878 | + if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1879 | + if (isset($SI)) $SI->checkAll(); |
|
| 1880 | + if (isset($TI)) $TI->checkAll(); |
|
| 1881 | + if (isset($MI)) $MI->checkAll(); |
|
| 1882 | + } |
|
| 1882 | 1883 | } |
| 1883 | - } |
|
| 1884 | 1884 | } |
| 1885 | 1885 | |
| 1886 | 1886 | ?> |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | die; |
| 51 | 51 | } |
| 52 | 52 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
| 53 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
| 53 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver','enable-aircraft','disable-aircraft','enable-tracker','disable-tracker','enable-marine','disable-marine')); |
|
| 57 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver', 'enable-aircraft', 'disable-aircraft', 'enable-tracker', 'disable-tracker', 'enable-marine', 'disable-marine')); |
|
| 58 | 58 | //if (isset($options['s'])) $hosts = array($options['s']); |
| 59 | 59 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 60 | 60 | if (isset($options['s'])) { |
| 61 | 61 | $globalSources = array(); |
| 62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 62 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); |
|
| 63 | 63 | else $globalSources[] = array('host' => $options['s']); |
| 64 | 64 | } elseif (isset($options['source'])) { |
| 65 | 65 | $globalSources = array(); |
| 66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 66 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); |
|
| 67 | 67 | else $globalSources[] = array('host' => $options['source']); |
| 68 | 68 | } |
| 69 | 69 | if (isset($options['aprsserverhost'])) { |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | else $id_source = 1; |
| 105 | 105 | if (isset($globalServer) && $globalServer) { |
| 106 | 106 | if ($globalDebug) echo "Using Server Mode\n"; |
| 107 | - $SI=new SpotterServer(); |
|
| 107 | + $SI = new SpotterServer(); |
|
| 108 | 108 | /* |
| 109 | 109 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 110 | 110 | $SI = new adsb2aprs(); |
| 111 | 111 | $SI->connect(); |
| 112 | 112 | */ |
| 113 | -} else $SI=new SpotterImport($Connection->db); |
|
| 113 | +} else $SI = new SpotterImport($Connection->db); |
|
| 114 | 114 | |
| 115 | 115 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
| 116 | 116 | if (isset($globalMarine) && $globalMarine) { |
@@ -124,17 +124,17 @@ discard block |
||
| 124 | 124 | $MI = new MarineImport($Connection->db); |
| 125 | 125 | } |
| 126 | 126 | //$APRS=new APRS($Connection->db); |
| 127 | -$SBS=new SBS(); |
|
| 127 | +$SBS = new SBS(); |
|
| 128 | 128 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 129 | - $ACARS=new ACARS($Connection->db,true); |
|
| 130 | - $Source=new Source($Connection->db); |
|
| 129 | + $ACARS = new ACARS($Connection->db, true); |
|
| 130 | + $Source = new Source($Connection->db); |
|
| 131 | 131 | } |
| 132 | -$Common=new Common(); |
|
| 132 | +$Common = new Common(); |
|
| 133 | 133 | date_default_timezone_set('UTC'); |
| 134 | 134 | //$servertz = system('date +%Z'); |
| 135 | 135 | // signal handler - playing nice with sockets and dump1090 |
| 136 | 136 | if (function_exists('pcntl_fork')) { |
| 137 | - pcntl_signal(SIGINT, function() { |
|
| 137 | + pcntl_signal(SIGINT, function() { |
|
| 138 | 138 | global $sockets; |
| 139 | 139 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
| 140 | 140 | die("Bye!\n"); |
@@ -150,35 +150,35 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | function connect_all($hosts) { |
| 152 | 152 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
| 153 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
| 153 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
| 154 | 154 | $reset++; |
| 155 | 155 | if ($globalDebug) echo 'Connect to all...'."\n"; |
| 156 | 156 | foreach ($hosts as $id => $value) { |
| 157 | 157 | $host = $value['host']; |
| 158 | 158 | $globalSources[$id]['last_exec'] = 0; |
| 159 | 159 | // Here we check type of source(s) |
| 160 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
| 161 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 160 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
| 161 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
| 162 | 162 | //$formats[$id] = 'deltadbtxt'; |
| 163 | 163 | $globalSources[$id]['format'] = 'deltadbtxt'; |
| 164 | 164 | //$last_exec['deltadbtxt'] = 0; |
| 165 | 165 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
| 166 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 166 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
| 167 | 167 | //$formats[$id] = 'vatsimtxt'; |
| 168 | 168 | $globalSources[$id]['format'] = 'vatsimtxt'; |
| 169 | 169 | //$last_exec['vatsimtxt'] = 0; |
| 170 | 170 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
| 171 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 171 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
| 172 | 172 | //$formats[$id] = 'aircraftlistjson'; |
| 173 | 173 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
| 174 | 174 | //$last_exec['aircraftlistjson'] = 0; |
| 175 | 175 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
| 176 | - } else if (preg_match('/aircraft.json$/i',$host)) { |
|
| 176 | + } else if (preg_match('/aircraft.json$/i', $host)) { |
|
| 177 | 177 | //$formats[$id] = 'aircraftjson'; |
| 178 | 178 | $globalSources[$id]['format'] = 'aircraftjson'; |
| 179 | 179 | //$last_exec['aircraftlistjson'] = 0; |
| 180 | 180 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
| 181 | - } else if (preg_match('/opensky/i',$host)) { |
|
| 181 | + } else if (preg_match('/opensky/i', $host)) { |
|
| 182 | 182 | //$formats[$id] = 'aircraftlistjson'; |
| 183 | 183 | $globalSources[$id]['format'] = 'opensky'; |
| 184 | 184 | //$last_exec['aircraftlistjson'] = 0; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | exit(0); |
| 196 | 196 | } |
| 197 | 197 | */ |
| 198 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 198 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
| 199 | 199 | //$formats[$id] = 'planeupdatefaa'; |
| 200 | 200 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
| 201 | 201 | //$last_exec['planeupdatefaa'] = 0; |
@@ -204,37 +204,37 @@ discard block |
||
| 204 | 204 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 205 | 205 | exit(0); |
| 206 | 206 | } |
| 207 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 207 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
| 208 | 208 | //$formats[$id] = 'phpvmacars'; |
| 209 | 209 | $globalSources[$id]['format'] = 'phpvmacars'; |
| 210 | 210 | //$last_exec['phpvmacars'] = 0; |
| 211 | 211 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
| 212 | - } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
|
| 212 | + } else if (preg_match('/\/api\/v1\/acars\/data$/i', $host)) { |
|
| 213 | 213 | //$formats[$id] = 'phpvmacars'; |
| 214 | 214 | $globalSources[$id]['format'] = 'vaos'; |
| 215 | 215 | //$last_exec['phpvmacars'] = 0; |
| 216 | 216 | if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
| 217 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 217 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
| 218 | 218 | //$formats[$id] = 'phpvmacars'; |
| 219 | 219 | $globalSources[$id]['format'] = 'vam'; |
| 220 | 220 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
| 221 | - } else if (preg_match('/whazzup/i',$host)) { |
|
| 221 | + } else if (preg_match('/whazzup/i', $host)) { |
|
| 222 | 222 | //$formats[$id] = 'whazzup'; |
| 223 | 223 | $globalSources[$id]['format'] = 'whazzup'; |
| 224 | 224 | //$last_exec['whazzup'] = 0; |
| 225 | 225 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
| 226 | - } else if (preg_match('/blitzortung/i',$host)) { |
|
| 226 | + } else if (preg_match('/blitzortung/i', $host)) { |
|
| 227 | 227 | $globalSources[$id]['format'] = 'blitzortung'; |
| 228 | 228 | if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
| 229 | - } else if (preg_match('/airwhere/i',$host)) { |
|
| 229 | + } else if (preg_match('/airwhere/i', $host)) { |
|
| 230 | 230 | $globalSources[$id]['format'] = 'airwhere'; |
| 231 | 231 | if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
| 232 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
| 232 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
| 233 | 233 | //$formats[$id] = 'pirepsjson'; |
| 234 | 234 | $globalSources[$id]['format'] = 'pirepsjson'; |
| 235 | 235 | //$last_exec['pirepsjson'] = 0; |
| 236 | 236 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
| 237 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 237 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
| 238 | 238 | //$formats[$id] = 'fr24json'; |
| 239 | 239 | $globalSources[$id]['format'] = 'fr24json'; |
| 240 | 240 | //$last_exec['fr24json'] = 0; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 244 | 244 | exit(0); |
| 245 | 245 | } |
| 246 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
| 246 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
| 247 | 247 | //$formats[$id] = 'fr24json'; |
| 248 | 248 | $globalSources[$id]['format'] = 'myshiptracking'; |
| 249 | 249 | //$last_exec['fr24json'] = 0; |
@@ -253,21 +253,21 @@ discard block |
||
| 253 | 253 | exit(0); |
| 254 | 254 | } |
| 255 | 255 | //} else if (preg_match('/10001/',$host)) { |
| 256 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 256 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 257 | 257 | //$formats[$id] = 'tsv'; |
| 258 | 258 | $globalSources[$id]['format'] = 'tsv'; |
| 259 | 259 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
| 260 | 260 | } |
| 261 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 261 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
| 262 | 262 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
| 263 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
| 263 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
| 264 | 264 | if ($idf !== false) { |
| 265 | 265 | $httpfeeds[$id] = $idf; |
| 266 | 266 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
| 267 | 267 | } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
| 268 | 268 | } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
| 269 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 270 | - $hostport = explode(':',$host); |
|
| 269 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
| 270 | + $hostport = explode(':', $host); |
|
| 271 | 271 | if (isset($hostport[1])) { |
| 272 | 272 | $port = $hostport[1]; |
| 273 | 273 | $hostn = $hostport[0]; |
@@ -277,19 +277,19 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | $Common = new Common(); |
| 279 | 279 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
| 280 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
| 280 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
| 281 | 281 | } else { |
| 282 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 282 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
| 283 | 283 | } |
| 284 | 284 | if ($s) { |
| 285 | 285 | $sockets[$id] = $s; |
| 286 | 286 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
| 287 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
| 287 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
| 288 | 288 | //$formats[$id] = 'aprs'; |
| 289 | 289 | $globalSources[$id]['format'] = 'aprs'; |
| 290 | 290 | //$aprs_connect = 0; |
| 291 | 291 | //$use_aprs = true; |
| 292 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
| 292 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
| 293 | 293 | $globalSources[$id]['format'] = 'vrstcp'; |
| 294 | 294 | } elseif ($port == '10001') { |
| 295 | 295 | //$formats[$id] = 'tsv'; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
| 329 | 329 | else $timeout = 20; |
| 330 | 330 | $errno = ''; |
| 331 | -$errstr=''; |
|
| 331 | +$errstr = ''; |
|
| 332 | 332 | |
| 333 | 333 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 334 | 334 | /* Initiate connections to all the hosts simultaneously */ |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | //connect_all($globalSources); |
| 337 | 337 | |
| 338 | 338 | if (isset($globalProxy) && $globalProxy) { |
| 339 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
| 339 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
| 340 | 340 | } else { |
| 341 | 341 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
| 342 | 342 | } |
@@ -366,16 +366,16 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | if ($use_aprs) { |
| 368 | 368 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 369 | - $APRS=new APRS(); |
|
| 369 | + $APRS = new APRS(); |
|
| 370 | 370 | $aprs_connect = 0; |
| 371 | 371 | $aprs_keep = 120; |
| 372 | 372 | $aprs_last_tx = time(); |
| 373 | 373 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
| 374 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 374 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
| 375 | 375 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
| 376 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 376 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
| 377 | 377 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
| 378 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 378 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 379 | 379 | if ($aprs_full) $aprs_filter = ''; |
| 380 | 380 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
| 381 | 381 | else $aprs_pass = '-1'; |
@@ -389,12 +389,12 @@ discard block |
||
| 389 | 389 | sleep(1); |
| 390 | 390 | if ($globalDebug) echo "SCAN MODE \n\n"; |
| 391 | 391 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
| 392 | -$endtime = time()+$globalCronEnd; |
|
| 392 | +$endtime = time() + $globalCronEnd; |
|
| 393 | 393 | $i = 1; |
| 394 | 394 | $tt = array(); |
| 395 | 395 | // Delete all ATC |
| 396 | 396 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
| 397 | - $ATC=new ATC($Connection->db); |
|
| 397 | + $ATC = new ATC($Connection->db); |
|
| 398 | 398 | } |
| 399 | 399 | if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 400 | 400 | $ATC->deleteAll(); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | while ($i > 0) { |
| 405 | 405 | if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
| 406 | 406 | |
| 407 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 407 | + if (!$globalDaemon) $i = $endtime - time(); |
|
| 408 | 408 | // Delete old ATC |
| 409 | 409 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 410 | 410 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | } |
| 419 | 419 | if ($max < $globalMinFetch) { |
| 420 | 420 | if ($globalDebug) echo 'Sleeping...'."\n"; |
| 421 | - sleep($globalMinFetch-$max+2); |
|
| 421 | + sleep($globalMinFetch - $max + 2); |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | //$buffer = $Common->getData($hosts[$id]); |
| 438 | 438 | $buffer = $Common->getData($value['host']); |
| 439 | 439 | if ($buffer != '') $reset = 0; |
| 440 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 441 | - $buffer = explode('\n',$buffer); |
|
| 440 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 441 | + $buffer = explode('\n', $buffer); |
|
| 442 | 442 | foreach ($buffer as $line) { |
| 443 | 443 | if ($line != '' && count($line) > 7) { |
| 444 | 444 | $line = explode(',', $line); |
@@ -471,11 +471,11 @@ discard block |
||
| 471 | 471 | ) |
| 472 | 472 | ) { |
| 473 | 473 | date_default_timezone_set('CET'); |
| 474 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
| 474 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
| 475 | 475 | date_default_timezone_set('UTC'); |
| 476 | 476 | if ($buffer != '') $reset = 0; |
| 477 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 478 | - $buffer = explode('\n',$buffer); |
|
| 477 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 478 | + $buffer = explode('\n', $buffer); |
|
| 479 | 479 | foreach ($buffer as $line) { |
| 480 | 480 | if ($line != '') { |
| 481 | 481 | //echo "'".$line."'\n"; |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | $ais_data = $AIS->parse_line(trim($line)); |
| 484 | 484 | $data = array(); |
| 485 | 485 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
| 486 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 486 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
| 487 | 487 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
| 488 | 488 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
| 489 | 489 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
| 496 | 496 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
| 497 | 497 | if (isset($ais_data['timestamp'])) { |
| 498 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
| 498 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
| 499 | 499 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
| 500 | 500 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
| 501 | 501 | $add = true; |
@@ -518,21 +518,21 @@ discard block |
||
| 518 | 518 | $w = $e = null; |
| 519 | 519 | |
| 520 | 520 | if (isset($arr[$id])) { |
| 521 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
| 521 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
| 522 | 522 | if ($nn > 0) { |
| 523 | 523 | foreach ($httpfeeds as $feed) { |
| 524 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
| 524 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
| 525 | 525 | if ($buffer === FALSE) { |
| 526 | 526 | connect_all($globalSources); |
| 527 | 527 | } |
| 528 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 529 | - $buffer = explode('\n',$buffer); |
|
| 528 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 529 | + $buffer = explode('\n', $buffer); |
|
| 530 | 530 | foreach ($buffer as $line) { |
| 531 | 531 | if ($line != '') { |
| 532 | 532 | $ais_data = $AIS->parse_line(trim($line)); |
| 533 | 533 | $data = array(); |
| 534 | 534 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
| 535 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 535 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
| 536 | 536 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
| 537 | 537 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
| 538 | 538 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -544,9 +544,9 @@ discard block |
||
| 544 | 544 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
| 545 | 545 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
| 546 | 546 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
| 547 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 547 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
| 548 | 548 | if (isset($ais_data['timestamp'])) { |
| 549 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
| 549 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
| 550 | 550 | } else { |
| 551 | 551 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 552 | 552 | } |
@@ -578,10 +578,10 @@ discard block |
||
| 578 | 578 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
| 579 | 579 | ) |
| 580 | 580 | ) { |
| 581 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 581 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
| 582 | 582 | if ($buffer != '') { |
| 583 | 583 | //echo $buffer; |
| 584 | - $all_data = json_decode($buffer,true); |
|
| 584 | + $all_data = json_decode($buffer, true); |
|
| 585 | 585 | //print_r($all_data); |
| 586 | 586 | if (isset($all_data[0]['DATA'])) { |
| 587 | 587 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | $data['ident'] = $line['NAME']; |
| 591 | 591 | $data['mmsi'] = $line['MMSI']; |
| 592 | 592 | if (strlen($data['mmsi']) > 9) { |
| 593 | - $data['mmsi'] = substr($data['mmsi'],-9); |
|
| 593 | + $data['mmsi'] = substr($data['mmsi'], -9); |
|
| 594 | 594 | } |
| 595 | 595 | $data['speed'] = $line['SOG']; |
| 596 | 596 | $data['heading'] = $line['COG']; |
@@ -600,8 +600,8 @@ discard block |
||
| 600 | 600 | //$data['type_id'] = $line['TYPE']; |
| 601 | 601 | $data['imo'] = $line['IMO']; |
| 602 | 602 | if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
| 603 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 604 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
| 603 | + if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s', strtotime($line['ARV'])); |
|
| 604 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
| 605 | 605 | $data['format_source'] = 'myshiptracking'; |
| 606 | 606 | $data['id_source'] = $id_source; |
| 607 | 607 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -618,16 +618,16 @@ discard block |
||
| 618 | 618 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
| 619 | 619 | ) |
| 620 | 620 | ) { |
| 621 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
| 621 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
| 622 | 622 | if ($buffer != '') { |
| 623 | - $all_data = json_decode($buffer,true); |
|
| 623 | + $all_data = json_decode($buffer, true); |
|
| 624 | 624 | if (isset($all_data[0]['mmsi'])) { |
| 625 | 625 | foreach ($all_data as $line) { |
| 626 | 626 | if ($line != '') { |
| 627 | 627 | $data = array(); |
| 628 | 628 | $data['ident'] = $line['shipname']; |
| 629 | 629 | $data['callsign'] = $line['callsign']; |
| 630 | - $data['mmsi'] = substr($line['mmsi'],-9); |
|
| 630 | + $data['mmsi'] = substr($line['mmsi'], -9); |
|
| 631 | 631 | $data['speed'] = $line['sog']; |
| 632 | 632 | if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
| 633 | 633 | $data['latitude'] = $line['latitude']; |
@@ -654,14 +654,14 @@ discard block |
||
| 654 | 654 | ) { |
| 655 | 655 | $buffer = $Common->getData($value['host']); |
| 656 | 656 | if ($buffer != '') { |
| 657 | - $all_data = json_decode($buffer,true); |
|
| 657 | + $all_data = json_decode($buffer, true); |
|
| 658 | 658 | if (isset($all_data['features'][0]['id'])) { |
| 659 | 659 | foreach ($all_data['features'] as $line) { |
| 660 | 660 | print_r($line); |
| 661 | 661 | $data = array(); |
| 662 | 662 | if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
| 663 | 663 | if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
| 664 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
| 664 | + if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'], -9); |
|
| 665 | 665 | if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo']; |
| 666 | 666 | if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
| 667 | 667 | if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading']; |
@@ -688,31 +688,31 @@ discard block |
||
| 688 | 688 | ) |
| 689 | 689 | ) { |
| 690 | 690 | echo 'download...'; |
| 691 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
| 691 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
| 692 | 692 | echo 'done !'."\n"; |
| 693 | 693 | // FIXME: Need more work |
| 694 | 694 | if ($buffer != '') $reset = 0; |
| 695 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 696 | - $buffer = explode('\n',$buffer); |
|
| 695 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 696 | + $buffer = explode('\n', $buffer); |
|
| 697 | 697 | foreach ($buffer as $line) { |
| 698 | 698 | if ($line != '') { |
| 699 | 699 | $data = array(); |
| 700 | 700 | echo $line."\n"; |
| 701 | - $data['mmsi'] = (int)substr($line,0,9); |
|
| 702 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
| 703 | - $data['status_id'] = substr($line,21,2); |
|
| 704 | - $data['type_id'] = substr($line,24,3); |
|
| 705 | - $data['latitude'] = substr($line,29,9); |
|
| 706 | - $data['longitude'] = substr($line,41,9); |
|
| 707 | - $data['speed'] = round(substr($line,51,5)); |
|
| 701 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
| 702 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
| 703 | + $data['status_id'] = substr($line, 21, 2); |
|
| 704 | + $data['type_id'] = substr($line, 24, 3); |
|
| 705 | + $data['latitude'] = substr($line, 29, 9); |
|
| 706 | + $data['longitude'] = substr($line, 41, 9); |
|
| 707 | + $data['speed'] = round(substr($line, 51, 5)); |
|
| 708 | 708 | //$data['course'] = substr($line,57,5); |
| 709 | - $data['heading'] = round(substr($line,63,3)); |
|
| 709 | + $data['heading'] = round(substr($line, 63, 3)); |
|
| 710 | 710 | //$data['draft'] = substr($line,67,4); |
| 711 | 711 | //$data['length'] = substr($line,72,3); |
| 712 | 712 | //$data['beam'] = substr($line,76,2); |
| 713 | - $data['ident'] = trim(utf8_encode(substr($line,78,20))); |
|
| 713 | + $data['ident'] = trim(utf8_encode(substr($line, 78, 20))); |
|
| 714 | 714 | //$data['callsign'] = trim(substr($line,100,7); |
| 715 | - $data['arrival_code'] = substr($line,108,20); |
|
| 715 | + $data['arrival_code'] = substr($line, 108, 20); |
|
| 716 | 716 | //$data['etaDate'] = substr($line,129,5); |
| 717 | 717 | //$data['etaTime'] = substr($line,135,5); |
| 718 | 718 | $data['format_source'] = 'shipplotter'; |
@@ -743,8 +743,8 @@ discard block |
||
| 743 | 743 | ) { |
| 744 | 744 | //$buffer = $Common->getData($hosts[$id]); |
| 745 | 745 | $buffer = $Common->getData($value['host']); |
| 746 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 747 | - $buffer = explode('\n',$buffer); |
|
| 746 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 747 | + $buffer = explode('\n', $buffer); |
|
| 748 | 748 | $reset = 0; |
| 749 | 749 | foreach ($buffer as $line) { |
| 750 | 750 | if ($line != '') { |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
| 756 | 756 | $data['pilot_id'] = $line[1]; |
| 757 | 757 | $data['pilot_name'] = $line[2]; |
| 758 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
| 758 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
| 759 | 759 | $data['ident'] = $line[0]; // ident |
| 760 | 760 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
| 761 | 761 | $data['speed'] = $line[8]; // speed |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
| 772 | 772 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
| 773 | 773 | $data['departure_airport_icao'] = $line[11]; |
| 774 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 774 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
| 775 | 775 | $data['arrival_airport_icao'] = $line[13]; |
| 776 | 776 | $data['frequency'] = $line[4]; |
| 777 | 777 | $data['type'] = $line[18]; |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | $data['id_source'] = $id_source; |
| 781 | 781 | //$data['arrival_airport_time'] = ; |
| 782 | 782 | if ($line[9] != '') { |
| 783 | - $aircraft_data = explode('/',$line[9]); |
|
| 783 | + $aircraft_data = explode('/', $line[9]); |
|
| 784 | 784 | if (isset($aircraft_data[1])) { |
| 785 | 785 | $data['aircraft_icao'] = $aircraft_data[1]; |
| 786 | 786 | } |
@@ -795,9 +795,9 @@ discard block |
||
| 795 | 795 | if ($line[3] === 'PILOT') $SI->add($data); |
| 796 | 796 | elseif ($line[3] === 'ATC') { |
| 797 | 797 | //print_r($data); |
| 798 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
| 799 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
| 800 | - $typec = substr($data['ident'],-3); |
|
| 798 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
| 799 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
| 800 | + $typec = substr($data['ident'], -3); |
|
| 801 | 801 | if ($typec === 'APP') $data['type'] = 'Approach'; |
| 802 | 802 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
| 803 | 803 | elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
@@ -809,8 +809,8 @@ discard block |
||
| 809 | 809 | elseif ($data['type'] === '') $data['type'] = 'Observer'; |
| 810 | 810 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
| 811 | 811 | if (isset($ATC)) { |
| 812 | - 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']); |
|
| 813 | - 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']); |
|
| 812 | + 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']); |
|
| 813 | + 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']); |
|
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | 816 | unset($data); |
@@ -826,24 +826,24 @@ discard block |
||
| 826 | 826 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 827 | 827 | ) |
| 828 | 828 | ) { |
| 829 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
| 829 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); |
|
| 830 | 830 | if ($buffer != '') { |
| 831 | 831 | $all_data = simplexml_load_string($buffer); |
| 832 | - foreach($all_data->children() as $childdata) { |
|
| 832 | + foreach ($all_data->children() as $childdata) { |
|
| 833 | 833 | $data = array(); |
| 834 | 834 | $line = $childdata; |
| 835 | 835 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); |
| 836 | - $data['id'] = date('Ymd').(int)$line['pktPilotID']; |
|
| 837 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
|
| 838 | - $data['latitude'] = (float)$line['pktLatitude']; |
|
| 839 | - $data['longitude'] = (float)$line['pktLongitude']; |
|
| 840 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
| 841 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
| 842 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
|
| 836 | + $data['id'] = date('Ymd').(int) $line['pktPilotID']; |
|
| 837 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); |
|
| 838 | + $data['latitude'] = (float) $line['pktLatitude']; |
|
| 839 | + $data['longitude'] = (float) $line['pktLongitude']; |
|
| 840 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; |
|
| 841 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; |
|
| 842 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); |
|
| 843 | 843 | $data['altitude_relative'] = 'AMSL'; |
| 844 | - $data['pilot_id'] = (int)$line['pktPilotID']; |
|
| 844 | + $data['pilot_id'] = (int) $line['pktPilotID']; |
|
| 845 | 845 | $data['aircraft_icao'] = 'PARAGLIDER'; |
| 846 | - $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
| 846 | + $pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
| 847 | 847 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
| 848 | 848 | $data['format_source'] = $value['format']; |
| 849 | 849 | $SI->add($data); |
@@ -851,22 +851,22 @@ discard block |
||
| 851 | 851 | } |
| 852 | 852 | } |
| 853 | 853 | $Source->deleteOldLocationByType('gs'); |
| 854 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
| 854 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); |
|
| 855 | 855 | if ($buffer != '') { |
| 856 | 856 | $all_data = simplexml_load_string($buffer); |
| 857 | - foreach($all_data->children() as $childdata) { |
|
| 857 | + foreach ($all_data->children() as $childdata) { |
|
| 858 | 858 | $data = array(); |
| 859 | 859 | $line = $childdata; |
| 860 | - $data['id'] = (int)$line['gsID']; |
|
| 861 | - $data['latitude'] = (float)$line['gsLatitude']; |
|
| 862 | - $data['longitude'] = (float)$line['gsLongitude']; |
|
| 863 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); |
|
| 860 | + $data['id'] = (int) $line['gsID']; |
|
| 861 | + $data['latitude'] = (float) $line['gsLatitude']; |
|
| 862 | + $data['longitude'] = (float) $line['gsLongitude']; |
|
| 863 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); |
|
| 864 | 864 | $data['altitude_relative'] = 'AMSL'; |
| 865 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); |
|
| 865 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); |
|
| 866 | 866 | if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { |
| 867 | - $Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
| 867 | + $Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
| 868 | 868 | } else { |
| 869 | - $Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
| 869 | + $Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
| 870 | 870 | } |
| 871 | 871 | unset($data); |
| 872 | 872 | } |
@@ -884,9 +884,9 @@ discard block |
||
| 884 | 884 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
| 885 | 885 | ) |
| 886 | 886 | ) { |
| 887 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 887 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
| 888 | 888 | if ($buffer != '') { |
| 889 | - $all_data = json_decode($buffer,true); |
|
| 889 | + $all_data = json_decode($buffer, true); |
|
| 890 | 890 | if (isset($all_data['acList'])) { |
| 891 | 891 | $reset = 0; |
| 892 | 892 | foreach ($all_data['acList'] as $line) { |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
| 903 | 903 | $data['emergency'] = ''; // emergency |
| 904 | 904 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
| 905 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 905 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
| 906 | 906 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 907 | 907 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 908 | 908 | if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | $data['verticalrate'] = $line['vrt']; // verticale rate |
| 928 | 928 | $data['squawk'] = $line['squawk']; // squawk |
| 929 | 929 | $data['emergency'] = ''; // emergency |
| 930 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 930 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
| 931 | 931 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 932 | 932 | $data['format_source'] = 'aircraftlistjson'; |
| 933 | 933 | $data['id_source'] = $id_source; |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | ) |
| 949 | 949 | ) { |
| 950 | 950 | $buffer = $Common->getData($value['host']); |
| 951 | - $all_data = json_decode($buffer,true); |
|
| 951 | + $all_data = json_decode($buffer, true); |
|
| 952 | 952 | if (isset($all_data['planes'])) { |
| 953 | 953 | $reset = 0; |
| 954 | 954 | foreach ($all_data['planes'] as $key => $line) { |
@@ -965,12 +965,12 @@ discard block |
||
| 965 | 965 | $data['emergency'] = ''; // emergency |
| 966 | 966 | $data['registration'] = $line[2]; |
| 967 | 967 | $data['aircraft_icao'] = $line[0]; |
| 968 | - $deparr = explode('-',$line[1]); |
|
| 968 | + $deparr = explode('-', $line[1]); |
|
| 969 | 969 | if (count($deparr) === 2) { |
| 970 | 970 | $data['departure_airport_icao'] = $deparr[0]; |
| 971 | 971 | $data['arrival_airport_icao'] = $deparr[1]; |
| 972 | 972 | } |
| 973 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 973 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
| 974 | 974 | $data['format_source'] = 'planeupdatefaa'; |
| 975 | 975 | $data['id_source'] = $id_source; |
| 976 | 976 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | ) |
| 989 | 989 | ) { |
| 990 | 990 | $buffer = $Common->getData($value['host']); |
| 991 | - $all_data = json_decode($buffer,true); |
|
| 991 | + $all_data = json_decode($buffer, true); |
|
| 992 | 992 | if (isset($all_data['states'])) { |
| 993 | 993 | $reset = 0; |
| 994 | 994 | foreach ($all_data['states'] as $key => $line) { |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | //$data['emergency'] = ''; // emergency |
| 1006 | 1006 | //$data['registration'] = $line[2]; |
| 1007 | 1007 | //$data['aircraft_icao'] = $line[0]; |
| 1008 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 1008 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
| 1009 | 1009 | $data['format_source'] = 'opensky'; |
| 1010 | 1010 | $data['id_source'] = $id_source; |
| 1011 | 1011 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | ) |
| 1023 | 1023 | ) { |
| 1024 | 1024 | $buffer = $Common->getData($value['host']); |
| 1025 | - $all_data = json_decode($buffer,true); |
|
| 1025 | + $all_data = json_decode($buffer, true); |
|
| 1026 | 1026 | if (isset($all_data['aircraft'])) { |
| 1027 | 1027 | $reset = 0; |
| 1028 | 1028 | foreach ($all_data['aircraft'] as $key => $line) { |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | ) { |
| 1059 | 1059 | //$buffer = $Common->getData($hosts[$id]); |
| 1060 | 1060 | $buffer = $Common->getData($value['host']); |
| 1061 | - $all_data = json_decode($buffer,true); |
|
| 1061 | + $all_data = json_decode($buffer, true); |
|
| 1062 | 1062 | if (!empty($all_data)) $reset = 0; |
| 1063 | 1063 | foreach ($all_data as $key => $line) { |
| 1064 | 1064 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -1096,11 +1096,11 @@ discard block |
||
| 1096 | 1096 | ) |
| 1097 | 1097 | ) { |
| 1098 | 1098 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
| 1099 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 1099 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
| 1100 | 1100 | //echo $buffer; |
| 1101 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 1102 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 1103 | - $all_data = json_decode($buffer,true); |
|
| 1101 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
| 1102 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
| 1103 | + $all_data = json_decode($buffer, true); |
|
| 1104 | 1104 | if (json_last_error() != JSON_ERROR_NONE) { |
| 1105 | 1105 | die(json_last_error_msg()); |
| 1106 | 1106 | } |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | //$data['departure_airport_iata'] = $line[11]; |
| 1124 | 1124 | //$data['arrival_airport_iata'] = $line[12]; |
| 1125 | 1125 | //$data['emergency'] = ''; // emergency |
| 1126 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
| 1126 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
| 1127 | 1127 | $data['format_source'] = 'radarvirtueljson'; |
| 1128 | 1128 | $data['id_source'] = $id_source; |
| 1129 | 1129 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1144,14 +1144,14 @@ discard block |
||
| 1144 | 1144 | ) { |
| 1145 | 1145 | //$buffer = $Common->getData($hosts[$id]); |
| 1146 | 1146 | $buffer = $Common->getData($value['host'].'?'.time()); |
| 1147 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
| 1147 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
| 1148 | 1148 | |
| 1149 | 1149 | if (isset($all_data['pireps'])) { |
| 1150 | 1150 | $reset = 0; |
| 1151 | 1151 | foreach ($all_data['pireps'] as $line) { |
| 1152 | 1152 | $data = array(); |
| 1153 | 1153 | $data['id'] = $line['id']; |
| 1154 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 1154 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
| 1155 | 1155 | $data['ident'] = $line['callsign']; // ident |
| 1156 | 1156 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
| 1157 | 1157 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -1181,9 +1181,9 @@ discard block |
||
| 1181 | 1181 | $SI->add($data); |
| 1182 | 1182 | // print_r($data); |
| 1183 | 1183 | } elseif ($line['icon'] === 'ct') { |
| 1184 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
| 1185 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
| 1186 | - $typec = substr($data['ident'],-3); |
|
| 1184 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
| 1185 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
| 1186 | + $typec = substr($data['ident'], -3); |
|
| 1187 | 1187 | $data['type'] = ''; |
| 1188 | 1188 | if ($typec === 'APP') $data['type'] = 'Approach'; |
| 1189 | 1189 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
| 1195 | 1195 | elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
| 1196 | 1196 | else $data['type'] = 'Observer'; |
| 1197 | - 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']); |
|
| 1197 | + 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']); |
|
| 1198 | 1198 | } |
| 1199 | 1199 | unset($data); |
| 1200 | 1200 | } |
@@ -1211,14 +1211,14 @@ discard block |
||
| 1211 | 1211 | //$buffer = $Common->getData($hosts[$id]); |
| 1212 | 1212 | if ($globalDebug) echo 'Get Data...'."\n"; |
| 1213 | 1213 | $buffer = $Common->getData($value['host']); |
| 1214 | - $all_data = json_decode($buffer,true); |
|
| 1214 | + $all_data = json_decode($buffer, true); |
|
| 1215 | 1215 | if ($buffer != '' && is_array($all_data)) { |
| 1216 | 1216 | $reset = 0; |
| 1217 | 1217 | foreach ($all_data as $line) { |
| 1218 | 1218 | $data = array(); |
| 1219 | 1219 | //$data['id'] = $line['id']; // id not usable |
| 1220 | 1220 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
| 1221 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1221 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
| 1222 | 1222 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
| 1223 | 1223 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
| 1224 | 1224 | $data['ident'] = $line['flightnum']; // ident |
@@ -1233,7 +1233,7 @@ discard block |
||
| 1233 | 1233 | //$data['datetime'] = $line['lastupdate']; |
| 1234 | 1234 | //$data['last_update'] = $line['lastupdate']; |
| 1235 | 1235 | if (isset($value['timezone'])) { |
| 1236 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
| 1236 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); |
|
| 1237 | 1237 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1238 | 1238 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1239 | 1239 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1249,14 +1249,14 @@ discard block |
||
| 1249 | 1249 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
| 1250 | 1250 | if (isset($line['aircraftname'])) { |
| 1251 | 1251 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1252 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
| 1253 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
| 1252 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
| 1253 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
| 1254 | 1254 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
| 1255 | 1255 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
| 1256 | 1256 | else { |
| 1257 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 1258 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1259 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1257 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
| 1258 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
| 1259 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
| 1260 | 1260 | } |
| 1261 | 1261 | } |
| 1262 | 1262 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | //$buffer = $Common->getData($hosts[$id]); |
| 1282 | 1282 | if ($globalDebug) echo 'Get Data...'."\n"; |
| 1283 | 1283 | $buffer = $Common->getData($value['host']); |
| 1284 | - $all_data = json_decode($buffer,true); |
|
| 1284 | + $all_data = json_decode($buffer, true); |
|
| 1285 | 1285 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
| 1286 | 1286 | $reset = 0; |
| 1287 | 1287 | foreach ($all_data['ACARSData'] as $line) { |
@@ -1292,7 +1292,7 @@ discard block |
||
| 1292 | 1292 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1293 | 1293 | if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
| 1294 | 1294 | if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
| 1295 | - $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
|
| 1295 | + $data['ident'] = str_replace(' ', '', $line['bid']['flightnum']); // ident |
|
| 1296 | 1296 | if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
| 1297 | 1297 | $data['altitude'] = $line['altitude']; // altitude |
| 1298 | 1298 | $data['speed'] = $line['groundspeed']; // speed |
@@ -1303,7 +1303,7 @@ discard block |
||
| 1303 | 1303 | //$data['squawk'] = ''; // squawk |
| 1304 | 1304 | //$data['emergency'] = ''; // emergency |
| 1305 | 1305 | if (isset($value['timezone'])) { |
| 1306 | - $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
|
| 1306 | + $datetime = new DateTime($line['updated_at'], new DateTimeZone($value['timezone'])); |
|
| 1307 | 1307 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1308 | 1308 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1309 | 1309 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1339,14 +1339,14 @@ discard block |
||
| 1339 | 1339 | //$buffer = $Common->getData($hosts[$id]); |
| 1340 | 1340 | if ($globalDebug) echo 'Get Data...'."\n"; |
| 1341 | 1341 | $buffer = $Common->getData($value['host']); |
| 1342 | - $all_data = json_decode($buffer,true); |
|
| 1342 | + $all_data = json_decode($buffer, true); |
|
| 1343 | 1343 | if ($buffer != '' && is_array($all_data)) { |
| 1344 | 1344 | $reset = 0; |
| 1345 | 1345 | foreach ($all_data as $line) { |
| 1346 | 1346 | $data = array(); |
| 1347 | 1347 | //$data['id'] = $line['id']; // id not usable |
| 1348 | 1348 | $data['id'] = trim($line['flight_id']); |
| 1349 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1349 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
| 1350 | 1350 | $data['pilot_name'] = $line['pilot_name']; |
| 1351 | 1351 | $data['pilot_id'] = $line['pilot_id']; |
| 1352 | 1352 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1390,24 +1390,24 @@ discard block |
||
| 1390 | 1390 | //$buffer = $Common->getData($hosts[$id]); |
| 1391 | 1391 | if ($globalDebug) echo 'Get Data...'."\n"; |
| 1392 | 1392 | $buffer = $Common->getData($value['host']); |
| 1393 | - $all_data = json_decode($buffer,true); |
|
| 1393 | + $all_data = json_decode($buffer, true); |
|
| 1394 | 1394 | if ($buffer != '') { |
| 1395 | 1395 | $Source->deleteLocationBySource('blitzortung'); |
| 1396 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 1397 | - $buffer = explode('\n',$buffer); |
|
| 1396 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 1397 | + $buffer = explode('\n', $buffer); |
|
| 1398 | 1398 | foreach ($buffer as $buffer_line) { |
| 1399 | - $line = json_decode($buffer_line,true); |
|
| 1399 | + $line = json_decode($buffer_line, true); |
|
| 1400 | 1400 | if (isset($line['time'])) { |
| 1401 | 1401 | $data = array(); |
| 1402 | 1402 | $data['altitude'] = $line['alt']; // altitude |
| 1403 | 1403 | $data['latitude'] = $line['lat']; // lat |
| 1404 | 1404 | $data['longitude'] = $line['lon']; // long |
| 1405 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line['time'],0,10)); |
|
| 1405 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line['time'], 0, 10)); |
|
| 1406 | 1406 | $data['id_source'] = $id_source; |
| 1407 | 1407 | $data['format_source'] = 'blitzortung'; |
| 1408 | 1408 | $SI->add($data); |
| 1409 | 1409 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
| 1410 | - $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
|
| 1410 | + $Source->addLocation('', $data['latitude'], $data['longitude'], 0, '', '', 'blitzortung', 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime']); |
|
| 1411 | 1411 | unset($data); |
| 1412 | 1412 | } |
| 1413 | 1413 | } |
@@ -1430,11 +1430,11 @@ discard block |
||
| 1430 | 1430 | //$value = $formats[$nb]; |
| 1431 | 1431 | $format = $globalSources[$nb]['format']; |
| 1432 | 1432 | if ($format === 'sbs' || $format === 'aprs' || $format === 'famaprs' || $format === 'raw' || $format === 'tsv' || $format === 'acarssbs3') { |
| 1433 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 1433 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
| 1434 | 1434 | } elseif ($format === 'vrstcp') { |
| 1435 | 1435 | $buffer = @socket_read($r, 6000); |
| 1436 | 1436 | } else { |
| 1437 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 1437 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
| 1438 | 1438 | } |
| 1439 | 1439 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
| 1440 | 1440 | //echo $buffer."\n"; |
@@ -1444,8 +1444,8 @@ discard block |
||
| 1444 | 1444 | //$SI::del(); |
| 1445 | 1445 | if ($buffer !== FALSE) { |
| 1446 | 1446 | if ($format === 'vrstcp') { |
| 1447 | - $buffer = explode('},{',$buffer); |
|
| 1448 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1447 | + $buffer = explode('},{', $buffer); |
|
| 1448 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
| 1449 | 1449 | } |
| 1450 | 1450 | // SBS format is CSV format |
| 1451 | 1451 | if ($buffer !== FALSE && $buffer !== '') { |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | $ais_data = $AIS->parse_line(trim($buffer)); |
| 1470 | 1470 | $data = array(); |
| 1471 | 1471 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
| 1472 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 1472 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
| 1473 | 1473 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
| 1474 | 1474 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
| 1475 | 1475 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -1480,13 +1480,13 @@ discard block |
||
| 1480 | 1480 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
| 1481 | 1481 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
| 1482 | 1482 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
| 1483 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1483 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
| 1484 | 1484 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1485 | 1485 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 1486 | 1486 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
| 1487 | 1487 | |
| 1488 | 1488 | if (isset($ais_data['timestamp'])) { |
| 1489 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
| 1489 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
| 1490 | 1490 | } else { |
| 1491 | 1491 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1492 | 1492 | } |
@@ -1497,10 +1497,10 @@ discard block |
||
| 1497 | 1497 | } elseif ($format === 'flightgearsp') { |
| 1498 | 1498 | //echo $buffer."\n"; |
| 1499 | 1499 | if (strlen($buffer) > 5) { |
| 1500 | - $line = explode(',',$buffer); |
|
| 1500 | + $line = explode(',', $buffer); |
|
| 1501 | 1501 | $data = array(); |
| 1502 | 1502 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
| 1503 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
| 1503 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
| 1504 | 1504 | $data['ident'] = $line[6]; |
| 1505 | 1505 | $data['aircraft_name'] = $line[7]; |
| 1506 | 1506 | $data['longitude'] = $line[1]; |
@@ -1517,16 +1517,16 @@ discard block |
||
| 1517 | 1517 | } elseif ($format === 'acars') { |
| 1518 | 1518 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
| 1519 | 1519 | $ACARS->add(trim($buffer)); |
| 1520 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 1520 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
| 1521 | 1521 | $ACARS->deleteLiveAcarsData(); |
| 1522 | 1522 | } elseif ($format === 'flightgearmp') { |
| 1523 | - if (substr($buffer,0,1) != '#') { |
|
| 1523 | + if (substr($buffer, 0, 1) != '#') { |
|
| 1524 | 1524 | $data = array(); |
| 1525 | 1525 | //echo $buffer."\n"; |
| 1526 | - $line = explode(' ',$buffer); |
|
| 1526 | + $line = explode(' ', $buffer); |
|
| 1527 | 1527 | if (count($line) === 11) { |
| 1528 | - $userserver = explode('@',$line[0]); |
|
| 1529 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 1528 | + $userserver = explode('@', $line[0]); |
|
| 1529 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
| 1530 | 1530 | $data['ident'] = $userserver[0]; |
| 1531 | 1531 | $data['registration'] = $userserver[0]; |
| 1532 | 1532 | $data['latitude'] = $line[4]; |
@@ -1534,8 +1534,8 @@ discard block |
||
| 1534 | 1534 | $data['altitude'] = $line[6]; |
| 1535 | 1535 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1536 | 1536 | $aircraft_type = $line[10]; |
| 1537 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 1538 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 1537 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
| 1538 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
| 1539 | 1539 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1540 | 1540 | if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
| 1541 | 1541 | } |
@@ -1544,8 +1544,8 @@ discard block |
||
| 1544 | 1544 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
| 1545 | 1545 | die; |
| 1546 | 1546 | } elseif ($format === 'vrstcp') { |
| 1547 | - foreach($buffer as $all_data) { |
|
| 1548 | - $line = json_decode('{'.$all_data.'}',true); |
|
| 1547 | + foreach ($buffer as $all_data) { |
|
| 1548 | + $line = json_decode('{'.$all_data.'}', true); |
|
| 1549 | 1549 | $data = array(); |
| 1550 | 1550 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
| 1551 | 1551 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1571,16 +1571,16 @@ discard block |
||
| 1571 | 1571 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
| 1572 | 1572 | unset($data); |
| 1573 | 1573 | } |
| 1574 | - } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
|
| 1574 | + } elseif ($format === 'tsv' || substr($buffer, 0, 4) === 'clock') { |
|
| 1575 | 1575 | $line = explode("\t", $buffer); |
| 1576 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
| 1576 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
| 1577 | 1577 | $key = $line[$k]; |
| 1578 | - $lined[$key] = $line[$k+1]; |
|
| 1578 | + $lined[$key] = $line[$k + 1]; |
|
| 1579 | 1579 | } |
| 1580 | 1580 | if (count($lined) > 3) { |
| 1581 | 1581 | $data['hex'] = $lined['hexid']; |
| 1582 | 1582 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
| 1583 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 1583 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
| 1584 | 1584 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
| 1585 | 1585 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
| 1586 | 1586 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1599,23 +1599,23 @@ discard block |
||
| 1599 | 1599 | } else $error = true; |
| 1600 | 1600 | } elseif ($format === 'aprs' && $use_aprs) { |
| 1601 | 1601 | if ($aprs_connect === 0) { |
| 1602 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
| 1602 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
| 1603 | 1603 | $aprs_connect = 1; |
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 1606 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
| 1607 | 1607 | $aprs_last_tx = time(); |
| 1608 | 1608 | $data_aprs = "# Keep alive"; |
| 1609 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
| 1609 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | 1612 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
| 1613 | 1613 | //echo 'APRS data : '.$buffer."\n"; |
| 1614 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
| 1615 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
| 1614 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
| 1615 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
| 1616 | 1616 | //echo $buffer."\n"; |
| 1617 | 1617 | date_default_timezone_set('UTC'); |
| 1618 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 1618 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
| 1619 | 1619 | $line = $APRS->parse($buffer); |
| 1620 | 1620 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
| 1621 | 1621 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
| 1631 | 1631 | if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
| 1632 | 1632 | if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
| 1633 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1633 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
| 1634 | 1634 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 1635 | 1635 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1636 | 1636 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -1713,29 +1713,29 @@ discard block |
||
| 1713 | 1713 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
| 1714 | 1714 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
| 1715 | 1715 | $Source->deleteOldLocationByType('gs'); |
| 1716 | - if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
|
| 1717 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
| 1716 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'gs')) > 0) { |
|
| 1717 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
| 1718 | 1718 | } else { |
| 1719 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
| 1719 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
| 1720 | 1720 | } |
| 1721 | 1721 | } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
| 1722 | 1722 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1723 | 1723 | if ($globalDebug) echo '# Weather Station added'."\n"; |
| 1724 | 1724 | $Source->deleteOldLocationByType('wx'); |
| 1725 | 1725 | $weather_data = json_encode($line); |
| 1726 | - if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
|
| 1727 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
| 1726 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'wx')) > 0) { |
|
| 1727 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
| 1728 | 1728 | } else { |
| 1729 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
| 1729 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
| 1730 | 1730 | } |
| 1731 | 1731 | } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
| 1732 | 1732 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1733 | 1733 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
| 1734 | 1734 | $Source->deleteOldLocationByType('lightning'); |
| 1735 | - if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
|
| 1736 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
| 1735 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'lightning')) > 0) { |
|
| 1736 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
| 1737 | 1737 | } else { |
| 1738 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
| 1738 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
| 1739 | 1739 | } |
| 1740 | 1740 | } elseif ($globalDebug) { |
| 1741 | 1741 | echo '/!\ Not added: '.$buffer."\n"; |
@@ -1744,7 +1744,7 @@ discard block |
||
| 1744 | 1744 | unset($data); |
| 1745 | 1745 | } |
| 1746 | 1746 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
| 1747 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
|
| 1747 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); |
|
| 1748 | 1748 | } |
| 1749 | 1749 | /* |
| 1750 | 1750 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] === 'Car' || $line['symbol'] === 'Ambulance' || $line['symbol'] === 'Van' || $line['symbol'] === 'Truck' || $line['symbol'] === 'Truck (18 Wheeler)' || $line['symbol'] === 'Motorcycle')) { |
@@ -1753,7 +1753,7 @@ discard block |
||
| 1753 | 1753 | */ |
| 1754 | 1754 | //elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 1755 | 1755 | elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
| 1756 | - if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
| 1756 | + if (isset($globalSources[$nb]['last_weather_clean']) && time() - $globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
| 1757 | 1757 | $Source->deleteOldLocationByType('lightning'); |
| 1758 | 1758 | $Source->deleteOldLocationByType('wx'); |
| 1759 | 1759 | $globalSources[$nb]['last_weather_clean'] = time(); |
@@ -1838,7 +1838,7 @@ discard block |
||
| 1838 | 1838 | connect_all($sourceee); |
| 1839 | 1839 | $sourceee = array(); |
| 1840 | 1840 | //connect_all($globalSources); |
| 1841 | - $tt[$format]=0; |
|
| 1841 | + $tt[$format] = 0; |
|
| 1842 | 1842 | break; |
| 1843 | 1843 | } |
| 1844 | 1844 | //else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."..."; |
@@ -1848,14 +1848,14 @@ discard block |
||
| 1848 | 1848 | } else { |
| 1849 | 1849 | $error = socket_strerror(socket_last_error()); |
| 1850 | 1850 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 1851 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 1851 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
| 1852 | 1852 | if (isset($globalDebug)) echo "Restarting...\n"; |
| 1853 | 1853 | // Restart the script if possible |
| 1854 | 1854 | if (is_array($sockets)) { |
| 1855 | 1855 | if ($globalDebug) echo "Shutdown all sockets..."; |
| 1856 | 1856 | |
| 1857 | 1857 | foreach ($sockets as $sock) { |
| 1858 | - @socket_shutdown($sock,2); |
|
| 1858 | + @socket_shutdown($sock, 2); |
|
| 1859 | 1859 | @socket_close($sock); |
| 1860 | 1860 | } |
| 1861 | 1861 | |
@@ -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,27 +211,37 @@ 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('/aircraft.json$/i',$host)) { |
| 177 | 232 | //$formats[$id] = 'aircraftjson'; |
| 178 | 233 | $globalSources[$id]['format'] = 'aircraftjson'; |
| 179 | 234 | //$last_exec['aircraftlistjson'] = 0; |
| 180 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 235 | + if ($globalDebug) { |
|
| 236 | + echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 237 | + } |
|
| 181 | 238 | } else if (preg_match('/opensky/i',$host)) { |
| 182 | 239 | //$formats[$id] = 'aircraftlistjson'; |
| 183 | 240 | $globalSources[$id]['format'] = 'opensky'; |
| 184 | 241 | //$last_exec['aircraftlistjson'] = 0; |
| 185 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 242 | + if ($globalDebug) { |
|
| 243 | + echo "Connect to opensky source (".$host.")...\n"; |
|
| 244 | + } |
|
| 186 | 245 | /* |
| 187 | 246 | // Disabled for now, site change source format |
| 188 | 247 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
@@ -199,7 +258,9 @@ discard block |
||
| 199 | 258 | //$formats[$id] = 'planeupdatefaa'; |
| 200 | 259 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
| 201 | 260 | //$last_exec['planeupdatefaa'] = 0; |
| 202 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 261 | + if ($globalDebug) { |
|
| 262 | + echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 263 | + } |
|
| 203 | 264 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 204 | 265 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 205 | 266 | exit(0); |
@@ -208,37 +269,53 @@ discard block |
||
| 208 | 269 | //$formats[$id] = 'phpvmacars'; |
| 209 | 270 | $globalSources[$id]['format'] = 'phpvmacars'; |
| 210 | 271 | //$last_exec['phpvmacars'] = 0; |
| 211 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 272 | + if ($globalDebug) { |
|
| 273 | + echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 274 | + } |
|
| 212 | 275 | } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
| 213 | 276 | //$formats[$id] = 'phpvmacars'; |
| 214 | 277 | $globalSources[$id]['format'] = 'vaos'; |
| 215 | 278 | //$last_exec['phpvmacars'] = 0; |
| 216 | - if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
|
| 279 | + if ($globalDebug) { |
|
| 280 | + echo "Connect to vaos source (".$host.")...\n"; |
|
| 281 | + } |
|
| 217 | 282 | } else if (preg_match('/VAM-json.php$/i',$host)) { |
| 218 | 283 | //$formats[$id] = 'phpvmacars'; |
| 219 | 284 | $globalSources[$id]['format'] = 'vam'; |
| 220 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 285 | + if ($globalDebug) { |
|
| 286 | + echo "Connect to Vam source (".$host.")...\n"; |
|
| 287 | + } |
|
| 221 | 288 | } else if (preg_match('/whazzup/i',$host)) { |
| 222 | 289 | //$formats[$id] = 'whazzup'; |
| 223 | 290 | $globalSources[$id]['format'] = 'whazzup'; |
| 224 | 291 | //$last_exec['whazzup'] = 0; |
| 225 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 292 | + if ($globalDebug) { |
|
| 293 | + echo "Connect to whazzup source (".$host.")...\n"; |
|
| 294 | + } |
|
| 226 | 295 | } else if (preg_match('/blitzortung/i',$host)) { |
| 227 | 296 | $globalSources[$id]['format'] = 'blitzortung'; |
| 228 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 297 | + if ($globalDebug) { |
|
| 298 | + echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 299 | + } |
|
| 229 | 300 | } else if (preg_match('/airwhere/i',$host)) { |
| 230 | 301 | $globalSources[$id]['format'] = 'airwhere'; |
| 231 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
| 302 | + if ($globalDebug) { |
|
| 303 | + echo "Connect to airwhere source (".$host.")...\n"; |
|
| 304 | + } |
|
| 232 | 305 | } else if (preg_match('/recentpireps/i',$host)) { |
| 233 | 306 | //$formats[$id] = 'pirepsjson'; |
| 234 | 307 | $globalSources[$id]['format'] = 'pirepsjson'; |
| 235 | 308 | //$last_exec['pirepsjson'] = 0; |
| 236 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 309 | + if ($globalDebug) { |
|
| 310 | + echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 311 | + } |
|
| 237 | 312 | } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
| 238 | 313 | //$formats[$id] = 'fr24json'; |
| 239 | 314 | $globalSources[$id]['format'] = 'fr24json'; |
| 240 | 315 | //$last_exec['fr24json'] = 0; |
| 241 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 316 | + if ($globalDebug) { |
|
| 317 | + echo "Connect to fr24 source (".$host.")...\n"; |
|
| 318 | + } |
|
| 242 | 319 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 243 | 320 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 244 | 321 | exit(0); |
@@ -247,7 +324,9 @@ discard block |
||
| 247 | 324 | //$formats[$id] = 'fr24json'; |
| 248 | 325 | $globalSources[$id]['format'] = 'myshiptracking'; |
| 249 | 326 | //$last_exec['fr24json'] = 0; |
| 250 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 327 | + if ($globalDebug) { |
|
| 328 | + echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 329 | + } |
|
| 251 | 330 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 252 | 331 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 253 | 332 | exit(0); |
@@ -256,16 +335,24 @@ discard block |
||
| 256 | 335 | } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
| 257 | 336 | //$formats[$id] = 'tsv'; |
| 258 | 337 | $globalSources[$id]['format'] = 'tsv'; |
| 259 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 338 | + if ($globalDebug) { |
|
| 339 | + echo "Connect to tsv source (".$host.")...\n"; |
|
| 340 | + } |
|
| 260 | 341 | } |
| 261 | 342 | } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
| 262 | 343 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
| 263 | 344 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
| 264 | 345 | if ($idf !== false) { |
| 265 | 346 | $httpfeeds[$id] = $idf; |
| 266 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 267 | - } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 268 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 347 | + if ($globalDebug) { |
|
| 348 | + echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 349 | + } |
|
| 350 | + } elseif ($globalDebug) { |
|
| 351 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 352 | + } |
|
| 353 | + } elseif ($globalDebug) { |
|
| 354 | + echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 355 | + } |
|
| 269 | 356 | } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
| 270 | 357 | $hostport = explode(':',$host); |
| 271 | 358 | if (isset($hostport[1])) { |
@@ -305,17 +392,25 @@ discard block |
||
| 305 | 392 | //$formats[$id] = 'beast'; |
| 306 | 393 | $globalSources[$id]['format'] = 'beast'; |
| 307 | 394 | //} else $formats[$id] = 'sbs'; |
| 308 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 395 | + } else { |
|
| 396 | + $globalSources[$id]['format'] = 'sbs'; |
|
| 397 | + } |
|
| 309 | 398 | //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
| 310 | 399 | } |
| 311 | - if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 400 | + if ($globalDebug) { |
|
| 401 | + echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 402 | + } |
|
| 312 | 403 | } else { |
| 313 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 404 | + if ($globalDebug) { |
|
| 405 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 406 | + } |
|
| 314 | 407 | } |
| 315 | 408 | } |
| 316 | 409 | } |
| 317 | 410 | } |
| 318 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; |
|
| 411 | +if (!isset($globalMinFetch)) { |
|
| 412 | + $globalMinFetch = 15; |
|
| 413 | +} |
|
| 319 | 414 | |
| 320 | 415 | // Initialize all |
| 321 | 416 | $status = array(); |
@@ -324,13 +419,19 @@ discard block |
||
| 324 | 419 | $formats = array(); |
| 325 | 420 | $last_exec = array(); |
| 326 | 421 | $time = time(); |
| 327 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; |
|
| 328 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
|
| 329 | -else $timeout = 20; |
|
| 422 | +if (isset($globalSourcesTimeout)) { |
|
| 423 | + $timeout = $globalSourcesTimeOut; |
|
| 424 | +} else if (isset($globalSBS1TimeOut)) { |
|
| 425 | + $timeout = $globalSBS1TimeOut; |
|
| 426 | +} else { |
|
| 427 | + $timeout = 20; |
|
| 428 | +} |
|
| 330 | 429 | $errno = ''; |
| 331 | 430 | $errstr=''; |
| 332 | 431 | |
| 333 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 432 | +if (!isset($globalDaemon)) { |
|
| 433 | + $globalDaemon = TRUE; |
|
| 434 | +} |
|
| 334 | 435 | /* Initiate connections to all the hosts simultaneously */ |
| 335 | 436 | //connect_all($hosts); |
| 336 | 437 | //connect_all($globalSources); |
@@ -359,7 +460,9 @@ discard block |
||
| 359 | 460 | if (isset($source['format']) && $source['format'] == 'aprs') { |
| 360 | 461 | $aprs_connect = 0; |
| 361 | 462 | $use_aprs = true; |
| 362 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
|
| 463 | + if (isset($source['port']) && $source['port'] == '10152') { |
|
| 464 | + $aprs_full = true; |
|
| 465 | + } |
|
| 363 | 466 | break; |
| 364 | 467 | } |
| 365 | 468 | } |
@@ -370,25 +473,46 @@ discard block |
||
| 370 | 473 | $aprs_connect = 0; |
| 371 | 474 | $aprs_keep = 120; |
| 372 | 475 | $aprs_last_tx = time(); |
| 373 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
| 374 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 375 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
|
| 376 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 377 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
|
| 378 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 379 | - if ($aprs_full) $aprs_filter = ''; |
|
| 380 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
|
| 381 | - else $aprs_pass = '-1'; |
|
| 476 | + if (isset($globalAPRSversion)) { |
|
| 477 | + $aprs_version = $globalAPRSversion; |
|
| 478 | + } else { |
|
| 479 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 480 | + } |
|
| 481 | + if (isset($globalAPRSssid)) { |
|
| 482 | + $aprs_ssid = $globalAPRSssid; |
|
| 483 | + } else { |
|
| 484 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 485 | + } |
|
| 486 | + if (isset($globalAPRSfilter)) { |
|
| 487 | + $aprs_filter = $globalAPRSfilter; |
|
| 488 | + } else { |
|
| 489 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 490 | + } |
|
| 491 | + if ($aprs_full) { |
|
| 492 | + $aprs_filter = ''; |
|
| 493 | + } |
|
| 494 | + if (isset($globalAPRSpass)) { |
|
| 495 | + $aprs_pass = $globalAPRSpass; |
|
| 496 | + } else { |
|
| 497 | + $aprs_pass = '-1'; |
|
| 498 | + } |
|
| 382 | 499 | |
| 383 | - if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 384 | - else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 385 | -} |
|
| 500 | + if ($aprs_filter != '') { |
|
| 501 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 502 | + } else { |
|
| 503 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 504 | + } |
|
| 505 | + } |
|
| 386 | 506 | |
| 387 | 507 | // connected - lets do some work |
| 388 | 508 | //if ($globalDebug) echo "Connected!\n"; |
| 389 | 509 | sleep(1); |
| 390 | -if ($globalDebug) echo "SCAN MODE \n\n"; |
|
| 391 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; |
|
| 510 | +if ($globalDebug) { |
|
| 511 | + echo "SCAN MODE \n\n"; |
|
| 512 | +} |
|
| 513 | +if (!isset($globalCronEnd)) { |
|
| 514 | + $globalCronEnd = 60; |
|
| 515 | +} |
|
| 392 | 516 | $endtime = time()+$globalCronEnd; |
| 393 | 517 | $i = 1; |
| 394 | 518 | $tt = array(); |
@@ -402,22 +526,32 @@ discard block |
||
| 402 | 526 | |
| 403 | 527 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 404 | 528 | while ($i > 0) { |
| 405 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 529 | + if (function_exists('pcntl_fork')) { |
|
| 530 | + pcntl_signal_dispatch(); |
|
| 531 | + } |
|
| 406 | 532 | |
| 407 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 533 | + if (!$globalDaemon) { |
|
| 534 | + $i = $endtime-time(); |
|
| 535 | + } |
|
| 408 | 536 | // Delete old ATC |
| 409 | 537 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 410 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; |
|
| 538 | + if ($globalDebug) { |
|
| 539 | + echo 'Delete old ATC...'."\n"; |
|
| 540 | + } |
|
| 411 | 541 | $ATC->deleteOldATC(); |
| 412 | 542 | } |
| 413 | 543 | |
| 414 | 544 | if (count($last_exec) == count($globalSources)) { |
| 415 | 545 | $max = $globalMinFetch; |
| 416 | 546 | foreach ($last_exec as $last) { |
| 417 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 547 | + if ((time() - $last['last']) < $max) { |
|
| 548 | + $max = time() - $last['last']; |
|
| 549 | + } |
|
| 418 | 550 | } |
| 419 | 551 | if ($max < $globalMinFetch) { |
| 420 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 552 | + if ($globalDebug) { |
|
| 553 | + echo 'Sleeping...'."\n"; |
|
| 554 | + } |
|
| 421 | 555 | sleep($globalMinFetch-$max+2); |
| 422 | 556 | } |
| 423 | 557 | } |
@@ -427,7 +561,9 @@ discard block |
||
| 427 | 561 | foreach ($globalSources as $id => $value) { |
| 428 | 562 | date_default_timezone_set('UTC'); |
| 429 | 563 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
| 430 | - if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
|
| 564 | + if (!isset($last_exec[$id]['last'])) { |
|
| 565 | + $last_exec[$id]['last'] = 0; |
|
| 566 | + } |
|
| 431 | 567 | if ($value['format'] === 'deltadbtxt' && |
| 432 | 568 | ( |
| 433 | 569 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
@@ -436,7 +572,9 @@ discard block |
||
| 436 | 572 | ) { |
| 437 | 573 | //$buffer = $Common->getData($hosts[$id]); |
| 438 | 574 | $buffer = $Common->getData($value['host']); |
| 439 | - if ($buffer != '') $reset = 0; |
|
| 575 | + if ($buffer != '') { |
|
| 576 | + $reset = 0; |
|
| 577 | + } |
|
| 440 | 578 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 441 | 579 | $buffer = explode('\n',$buffer); |
| 442 | 580 | foreach ($buffer as $line) { |
@@ -445,20 +583,41 @@ discard block |
||
| 445 | 583 | $data = array(); |
| 446 | 584 | $data['hex'] = $line[1]; // hex |
| 447 | 585 | $data['ident'] = $line[2]; // ident |
| 448 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 449 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 450 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 451 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 452 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 586 | + if (isset($line[3])) { |
|
| 587 | + $data['altitude'] = $line[3]; |
|
| 588 | + } |
|
| 589 | + // altitude |
|
| 590 | + if (isset($line[4])) { |
|
| 591 | + $data['speed'] = $line[4]; |
|
| 592 | + } |
|
| 593 | + // speed |
|
| 594 | + if (isset($line[5])) { |
|
| 595 | + $data['heading'] = $line[5]; |
|
| 596 | + } |
|
| 597 | + // heading |
|
| 598 | + if (isset($line[6])) { |
|
| 599 | + $data['latitude'] = $line[6]; |
|
| 600 | + } |
|
| 601 | + // lat |
|
| 602 | + if (isset($line[7])) { |
|
| 603 | + $data['longitude'] = $line[7]; |
|
| 604 | + } |
|
| 605 | + // long |
|
| 453 | 606 | $data['verticalrate'] = ''; // vertical rate |
| 454 | 607 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
| 455 | 608 | $data['emergency'] = ''; // emergency |
| 456 | 609 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 457 | 610 | $data['format_source'] = 'deltadbtxt'; |
| 458 | 611 | $data['id_source'] = $id_source; |
| 459 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 460 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 461 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 612 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 613 | + $data['source_name'] = $value['name']; |
|
| 614 | + } |
|
| 615 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 616 | + $data['noarchive'] = true; |
|
| 617 | + } |
|
| 618 | + if (isset($value['sourcestats'])) { |
|
| 619 | + $data['sourcestats'] = $value['sourcestats']; |
|
| 620 | + } |
|
| 462 | 621 | $SI->add($data); |
| 463 | 622 | unset($data); |
| 464 | 623 | } |
@@ -473,7 +632,9 @@ discard block |
||
| 473 | 632 | date_default_timezone_set('CET'); |
| 474 | 633 | $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
| 475 | 634 | date_default_timezone_set('UTC'); |
| 476 | - if ($buffer != '') $reset = 0; |
|
| 635 | + if ($buffer != '') { |
|
| 636 | + $reset = 0; |
|
| 637 | + } |
|
| 477 | 638 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 478 | 639 | $buffer = explode('\n',$buffer); |
| 479 | 640 | foreach ($buffer as $line) { |
@@ -482,18 +643,42 @@ discard block |
||
| 482 | 643 | $add = false; |
| 483 | 644 | $ais_data = $AIS->parse_line(trim($line)); |
| 484 | 645 | $data = array(); |
| 485 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 486 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 487 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 488 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 489 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 490 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 491 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 492 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 493 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 494 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 495 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 496 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 646 | + if (isset($ais_data['ident'])) { |
|
| 647 | + $data['ident'] = $ais_data['ident']; |
|
| 648 | + } |
|
| 649 | + if (isset($ais_data['mmsi'])) { |
|
| 650 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 651 | + } |
|
| 652 | + if (isset($ais_data['speed'])) { |
|
| 653 | + $data['speed'] = $ais_data['speed']; |
|
| 654 | + } |
|
| 655 | + if (isset($ais_data['heading'])) { |
|
| 656 | + $data['heading'] = $ais_data['heading']; |
|
| 657 | + } |
|
| 658 | + if (isset($ais_data['latitude'])) { |
|
| 659 | + $data['latitude'] = $ais_data['latitude']; |
|
| 660 | + } |
|
| 661 | + if (isset($ais_data['longitude'])) { |
|
| 662 | + $data['longitude'] = $ais_data['longitude']; |
|
| 663 | + } |
|
| 664 | + if (isset($ais_data['status'])) { |
|
| 665 | + $data['status'] = $ais_data['status']; |
|
| 666 | + } |
|
| 667 | + if (isset($ais_data['statusid'])) { |
|
| 668 | + $data['status_id'] = $ais_data['statusid']; |
|
| 669 | + } |
|
| 670 | + if (isset($ais_data['type'])) { |
|
| 671 | + $data['type'] = $ais_data['type']; |
|
| 672 | + } |
|
| 673 | + if (isset($ais_data['typeid'])) { |
|
| 674 | + $data['type_id'] = $ais_data['typeid']; |
|
| 675 | + } |
|
| 676 | + if (isset($ais_data['imo'])) { |
|
| 677 | + $data['imo'] = $ais_data['imo']; |
|
| 678 | + } |
|
| 679 | + if (isset($ais_data['callsign'])) { |
|
| 680 | + $data['callsign'] = $ais_data['callsign']; |
|
| 681 | + } |
|
| 497 | 682 | if (isset($ais_data['timestamp'])) { |
| 498 | 683 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 499 | 684 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
@@ -507,8 +692,12 @@ discard block |
||
| 507 | 692 | $data['format_source'] = 'aisnmeatxt'; |
| 508 | 693 | $data['id_source'] = $id_source; |
| 509 | 694 | //print_r($data); |
| 510 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 511 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 695 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 696 | + $data['noarchive'] = true; |
|
| 697 | + } |
|
| 698 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 699 | + $MI->add($data); |
|
| 700 | + } |
|
| 512 | 701 | unset($data); |
| 513 | 702 | } |
| 514 | 703 | } |
@@ -531,20 +720,48 @@ discard block |
||
| 531 | 720 | if ($line != '') { |
| 532 | 721 | $ais_data = $AIS->parse_line(trim($line)); |
| 533 | 722 | $data = array(); |
| 534 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 535 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 536 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 537 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 538 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 539 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 540 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 541 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 542 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 543 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 544 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 545 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 546 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 547 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 723 | + if (isset($ais_data['ident'])) { |
|
| 724 | + $data['ident'] = $ais_data['ident']; |
|
| 725 | + } |
|
| 726 | + if (isset($ais_data['mmsi'])) { |
|
| 727 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 728 | + } |
|
| 729 | + if (isset($ais_data['speed'])) { |
|
| 730 | + $data['speed'] = $ais_data['speed']; |
|
| 731 | + } |
|
| 732 | + if (isset($ais_data['heading'])) { |
|
| 733 | + $data['heading'] = $ais_data['heading']; |
|
| 734 | + } |
|
| 735 | + if (isset($ais_data['latitude'])) { |
|
| 736 | + $data['latitude'] = $ais_data['latitude']; |
|
| 737 | + } |
|
| 738 | + if (isset($ais_data['longitude'])) { |
|
| 739 | + $data['longitude'] = $ais_data['longitude']; |
|
| 740 | + } |
|
| 741 | + if (isset($ais_data['status'])) { |
|
| 742 | + $data['status'] = $ais_data['status']; |
|
| 743 | + } |
|
| 744 | + if (isset($ais_data['statusid'])) { |
|
| 745 | + $data['status_id'] = $ais_data['statusid']; |
|
| 746 | + } |
|
| 747 | + if (isset($ais_data['type'])) { |
|
| 748 | + $data['type'] = $ais_data['type']; |
|
| 749 | + } |
|
| 750 | + if (isset($ais_data['typeid'])) { |
|
| 751 | + $data['type_id'] = $ais_data['typeid']; |
|
| 752 | + } |
|
| 753 | + if (isset($ais_data['imo'])) { |
|
| 754 | + $data['imo'] = $ais_data['imo']; |
|
| 755 | + } |
|
| 756 | + if (isset($ais_data['callsign'])) { |
|
| 757 | + $data['callsign'] = $ais_data['callsign']; |
|
| 758 | + } |
|
| 759 | + if (isset($ais_data['destination'])) { |
|
| 760 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 761 | + } |
|
| 762 | + if (isset($ais_data['eta_ts'])) { |
|
| 763 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 764 | + } |
|
| 548 | 765 | if (isset($ais_data['timestamp'])) { |
| 549 | 766 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 550 | 767 | } else { |
@@ -552,18 +769,27 @@ discard block |
||
| 552 | 769 | } |
| 553 | 770 | $data['format_source'] = 'aisnmeahttp'; |
| 554 | 771 | $data['id_source'] = $id_source; |
| 555 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 556 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 772 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 773 | + $data['noarchive'] = true; |
|
| 774 | + } |
|
| 775 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 776 | + $MI->add($data); |
|
| 777 | + } |
|
| 557 | 778 | unset($data); |
| 558 | 779 | } |
| 559 | 780 | } |
| 560 | 781 | } |
| 561 | 782 | } else { |
| 562 | 783 | $format = $value['format']; |
| 563 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 564 | - else $tt[$format] = 0; |
|
| 784 | + if (isset($tt[$format])) { |
|
| 785 | + $tt[$format]++; |
|
| 786 | + } else { |
|
| 787 | + $tt[$format] = 0; |
|
| 788 | + } |
|
| 565 | 789 | if ($tt[$format] > 30) { |
| 566 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
| 790 | + if ($globalDebug) { |
|
| 791 | + echo 'Reconnect...'."\n"; |
|
| 792 | + } |
|
| 567 | 793 | sleep(2); |
| 568 | 794 | //$sourceeen[] = $value; |
| 569 | 795 | //connect_all($sourceeen); |
@@ -599,12 +825,18 @@ discard block |
||
| 599 | 825 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
| 600 | 826 | //$data['type_id'] = $line['TYPE']; |
| 601 | 827 | $data['imo'] = $line['IMO']; |
| 602 | - if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
|
| 603 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 828 | + if ($line['DEST'] != '') { |
|
| 829 | + $data['arrival_code'] = $line['DEST']; |
|
| 830 | + } |
|
| 831 | + if ($line['ARV'] != '') { |
|
| 832 | + $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 833 | + } |
|
| 604 | 834 | $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
| 605 | 835 | $data['format_source'] = 'myshiptracking'; |
| 606 | 836 | $data['id_source'] = $id_source; |
| 607 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 837 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 838 | + $data['noarchive'] = true; |
|
| 839 | + } |
|
| 608 | 840 | $MI->add($data); |
| 609 | 841 | unset($data); |
| 610 | 842 | } |
@@ -629,7 +861,9 @@ discard block |
||
| 629 | 861 | $data['callsign'] = $line['callsign']; |
| 630 | 862 | $data['mmsi'] = substr($line['mmsi'],-9); |
| 631 | 863 | $data['speed'] = $line['sog']; |
| 632 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
| 864 | + if ($line['heading'] != '511') { |
|
| 865 | + $data['heading'] = $line['heading']; |
|
| 866 | + } |
|
| 633 | 867 | $data['latitude'] = $line['latitude']; |
| 634 | 868 | $data['longitude'] = $line['longitude']; |
| 635 | 869 | $data['type_id'] = $line['shiptype']; |
@@ -637,7 +871,9 @@ discard block |
||
| 637 | 871 | $data['datetime'] = $line['time']; |
| 638 | 872 | $data['format_source'] = 'boatbeaconapp'; |
| 639 | 873 | $data['id_source'] = $id_source; |
| 640 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 874 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 875 | + $data['noarchive'] = true; |
|
| 876 | + } |
|
| 641 | 877 | $MI->add($data); |
| 642 | 878 | unset($data); |
| 643 | 879 | } |
@@ -659,22 +895,44 @@ discard block |
||
| 659 | 895 | foreach ($all_data['features'] as $line) { |
| 660 | 896 | print_r($line); |
| 661 | 897 | $data = array(); |
| 662 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
|
| 663 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
|
| 664 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
| 665 | - if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo']; |
|
| 666 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
|
| 667 | - if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading']; |
|
| 898 | + if (isset($line['properties']['name'])) { |
|
| 899 | + $data['ident'] = $line['properties']['name']; |
|
| 900 | + } |
|
| 901 | + if (isset($line['properties']['callsign'])) { |
|
| 902 | + $data['callsign'] = $line['properties']['callsign']; |
|
| 903 | + } |
|
| 904 | + if (isset($line['properties']['mmsi'])) { |
|
| 905 | + $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
| 906 | + } |
|
| 907 | + if (isset($line['properties']['imo'])) { |
|
| 908 | + $data['imo'] = $line['properties']['imo']; |
|
| 909 | + } |
|
| 910 | + if (isset($line['properties']['speed'])) { |
|
| 911 | + $data['speed'] = $line['properties']['speed']; |
|
| 912 | + } |
|
| 913 | + if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) { |
|
| 914 | + $data['heading'] = $line['properties']['heading']; |
|
| 915 | + } |
|
| 668 | 916 | $data['latitude'] = $line['geometry']['coordinates'][1]; |
| 669 | 917 | $data['longitude'] = $line['geometry']['coordinates'][0]; |
| 670 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; |
|
| 671 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; |
|
| 672 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; |
|
| 918 | + if (isset($line['properties']['vesselType'])) { |
|
| 919 | + $data['type'] = $line['properties']['vesselType']; |
|
| 920 | + } |
|
| 921 | + if (isset($line['properties']['destination'])) { |
|
| 922 | + $data['arrival_code'] = $line['properties']['destination']; |
|
| 923 | + } |
|
| 924 | + if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { |
|
| 925 | + $data['arrival_date'] = $line['properties']['eta']; |
|
| 926 | + } |
|
| 673 | 927 | $data['format_source'] = 'boatnerd'; |
| 674 | 928 | $data['id_source'] = $id_source; |
| 675 | 929 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 676 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 677 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
|
| 930 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 931 | + $data['noarchive'] = true; |
|
| 932 | + } |
|
| 933 | + if ($line['properties']['vesselType'] != 'Navigation Aid') { |
|
| 934 | + $MI->add($data); |
|
| 935 | + } |
|
| 678 | 936 | unset($data); |
| 679 | 937 | } |
| 680 | 938 | } |
@@ -691,7 +949,9 @@ discard block |
||
| 691 | 949 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
| 692 | 950 | echo 'done !'."\n"; |
| 693 | 951 | // FIXME: Need more work |
| 694 | - if ($buffer != '') $reset = 0; |
|
| 952 | + if ($buffer != '') { |
|
| 953 | + $reset = 0; |
|
| 954 | + } |
|
| 695 | 955 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 696 | 956 | $buffer = explode('\n',$buffer); |
| 697 | 957 | foreach ($buffer as $line) { |
@@ -717,7 +977,9 @@ discard block |
||
| 717 | 977 | //$data['etaTime'] = substr($line,135,5); |
| 718 | 978 | $data['format_source'] = 'shipplotter'; |
| 719 | 979 | $data['id_source'] = $id_source; |
| 720 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 980 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 981 | + $data['noarchive'] = true; |
|
| 982 | + } |
|
| 721 | 983 | //print_r($data); |
| 722 | 984 | echo 'Add...'."\n"; |
| 723 | 985 | $MI->add($data); |
@@ -751,16 +1013,28 @@ discard block |
||
| 751 | 1013 | $line = explode(':', $line); |
| 752 | 1014 | if (count($line) > 30 && $line[0] != 'callsign') { |
| 753 | 1015 | $data = array(); |
| 754 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 755 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 1016 | + if (isset($line[37]) && $line[37] != '') { |
|
| 1017 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 1018 | + } else { |
|
| 1019 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 1020 | + } |
|
| 756 | 1021 | $data['pilot_id'] = $line[1]; |
| 757 | 1022 | $data['pilot_name'] = $line[2]; |
| 758 | 1023 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
| 759 | 1024 | $data['ident'] = $line[0]; // ident |
| 760 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
|
| 1025 | + if ($line[7] != '' && $line[7] != 0) { |
|
| 1026 | + $data['altitude'] = $line[7]; |
|
| 1027 | + } |
|
| 1028 | + // altitude |
|
| 761 | 1029 | $data['speed'] = $line[8]; // speed |
| 762 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading |
|
| 763 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
|
| 1030 | + if (isset($line[45])) { |
|
| 1031 | + $data['heading'] = $line[45]; |
|
| 1032 | + } |
|
| 1033 | + // heading |
|
| 1034 | + elseif (isset($line[38])) { |
|
| 1035 | + $data['heading'] = $line[38]; |
|
| 1036 | + } |
|
| 1037 | + // heading |
|
| 764 | 1038 | $data['latitude'] = $line[5]; // lat |
| 765 | 1039 | $data['longitude'] = $line[6]; // long |
| 766 | 1040 | $data['verticalrate'] = ''; // vertical rate |
@@ -776,7 +1050,9 @@ discard block |
||
| 776 | 1050 | $data['frequency'] = $line[4]; |
| 777 | 1051 | $data['type'] = $line[18]; |
| 778 | 1052 | $data['range'] = $line[19]; |
| 779 | - if (isset($line[35])) $data['info'] = $line[35]; |
|
| 1053 | + if (isset($line[35])) { |
|
| 1054 | + $data['info'] = $line[35]; |
|
| 1055 | + } |
|
| 780 | 1056 | $data['id_source'] = $id_source; |
| 781 | 1057 | //$data['arrival_airport_time'] = ; |
| 782 | 1058 | if ($line[9] != '') { |
@@ -790,27 +1066,47 @@ discard block |
||
| 790 | 1066 | elseif ($value === 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 791 | 1067 | */ |
| 792 | 1068 | $data['format_source'] = $value['format']; |
| 793 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 794 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 795 | - if ($line[3] === 'PILOT') $SI->add($data); |
|
| 796 | - elseif ($line[3] === 'ATC') { |
|
| 1069 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1070 | + $data['noarchive'] = true; |
|
| 1071 | + } |
|
| 1072 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1073 | + $data['source_name'] = $value['name']; |
|
| 1074 | + } |
|
| 1075 | + if ($line[3] === 'PILOT') { |
|
| 1076 | + $SI->add($data); |
|
| 1077 | + } elseif ($line[3] === 'ATC') { |
|
| 797 | 1078 | //print_r($data); |
| 798 | 1079 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 799 | 1080 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 800 | 1081 | $typec = substr($data['ident'],-3); |
| 801 | - if ($typec === 'APP') $data['type'] = 'Approach'; |
|
| 802 | - elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
|
| 803 | - elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
|
| 804 | - elseif ($typec === 'GND') $data['type'] = 'Ground'; |
|
| 805 | - elseif ($typec === 'DEL') $data['type'] = 'Delivery'; |
|
| 806 | - elseif ($typec === 'DEP') $data['type'] = 'Departure'; |
|
| 807 | - elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 808 | - elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 809 | - elseif ($data['type'] === '') $data['type'] = 'Observer'; |
|
| 810 | - if (!isset($data['source_name'])) $data['source_name'] = ''; |
|
| 1082 | + if ($typec === 'APP') { |
|
| 1083 | + $data['type'] = 'Approach'; |
|
| 1084 | + } elseif ($typec === 'TWR') { |
|
| 1085 | + $data['type'] = 'Tower'; |
|
| 1086 | + } elseif ($typec === 'OBS') { |
|
| 1087 | + $data['type'] = 'Observer'; |
|
| 1088 | + } elseif ($typec === 'GND') { |
|
| 1089 | + $data['type'] = 'Ground'; |
|
| 1090 | + } elseif ($typec === 'DEL') { |
|
| 1091 | + $data['type'] = 'Delivery'; |
|
| 1092 | + } elseif ($typec === 'DEP') { |
|
| 1093 | + $data['type'] = 'Departure'; |
|
| 1094 | + } elseif ($typec === 'FSS') { |
|
| 1095 | + $data['type'] = 'Flight Service Station'; |
|
| 1096 | + } elseif ($typec === 'CTR') { |
|
| 1097 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1098 | + } elseif ($data['type'] === '') { |
|
| 1099 | + $data['type'] = 'Observer'; |
|
| 1100 | + } |
|
| 1101 | + if (!isset($data['source_name'])) { |
|
| 1102 | + $data['source_name'] = ''; |
|
| 1103 | + } |
|
| 811 | 1104 | if (isset($ATC)) { |
| 812 | - 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']); |
|
| 813 | - 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']); |
|
| 1105 | + if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { |
|
| 1106 | + 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']); |
|
| 1107 | + } else { |
|
| 1108 | + 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']); |
|
| 1109 | + } |
|
| 814 | 1110 | } |
| 815 | 1111 | } |
| 816 | 1112 | unset($data); |
@@ -837,14 +1133,20 @@ discard block |
||
| 837 | 1133 | $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
| 838 | 1134 | $data['latitude'] = (float)$line['pktLatitude']; |
| 839 | 1135 | $data['longitude'] = (float)$line['pktLongitude']; |
| 840 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
| 841 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
| 1136 | + if ((float)$line['pktTrack'] != 0) { |
|
| 1137 | + $data['heading'] = (float)$line['pktTrack']; |
|
| 1138 | + } |
|
| 1139 | + if ((int)$line['pktSpeed'] != 0) { |
|
| 1140 | + $data['speed'] = (int)$line['pktSpeed']; |
|
| 1141 | + } |
|
| 842 | 1142 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
| 843 | 1143 | $data['altitude_relative'] = 'AMSL'; |
| 844 | 1144 | $data['pilot_id'] = (int)$line['pktPilotID']; |
| 845 | 1145 | $data['aircraft_icao'] = 'PARAGLIDER'; |
| 846 | 1146 | $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
| 847 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
|
| 1147 | + if (isset($pilot_data[4])) { |
|
| 1148 | + $data['pilot_name'] = $pilot_data[4]; |
|
| 1149 | + } |
|
| 848 | 1150 | $data['format_source'] = $value['format']; |
| 849 | 1151 | $SI->add($data); |
| 850 | 1152 | unset($data); |
@@ -892,25 +1194,59 @@ discard block |
||
| 892 | 1194 | foreach ($all_data['acList'] as $line) { |
| 893 | 1195 | $data = array(); |
| 894 | 1196 | $data['hex'] = $line['Icao']; // hex |
| 895 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 896 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 897 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 898 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 899 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 900 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 1197 | + if (isset($line['Call'])) { |
|
| 1198 | + $data['ident'] = $line['Call']; |
|
| 1199 | + } |
|
| 1200 | + // ident |
|
| 1201 | + if (isset($line['Alt'])) { |
|
| 1202 | + $data['altitude'] = $line['Alt']; |
|
| 1203 | + } |
|
| 1204 | + // altitude |
|
| 1205 | + if (isset($line['Spd'])) { |
|
| 1206 | + $data['speed'] = $line['Spd']; |
|
| 1207 | + } |
|
| 1208 | + // speed |
|
| 1209 | + if (isset($line['Trak'])) { |
|
| 1210 | + $data['heading'] = $line['Trak']; |
|
| 1211 | + } |
|
| 1212 | + // heading |
|
| 1213 | + if (isset($line['Lat'])) { |
|
| 1214 | + $data['latitude'] = $line['Lat']; |
|
| 1215 | + } |
|
| 1216 | + // lat |
|
| 1217 | + if (isset($line['Long'])) { |
|
| 1218 | + $data['longitude'] = $line['Long']; |
|
| 1219 | + } |
|
| 1220 | + // long |
|
| 901 | 1221 | //$data['verticalrate'] = $line['']; // verticale rate |
| 902 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 1222 | + if (isset($line['Sqk'])) { |
|
| 1223 | + $data['squawk'] = $line['Sqk']; |
|
| 1224 | + } |
|
| 1225 | + // squawk |
|
| 903 | 1226 | $data['emergency'] = ''; // emergency |
| 904 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 905 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 906 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1227 | + if (isset($line['Reg'])) { |
|
| 1228 | + $data['registration'] = $line['Reg']; |
|
| 1229 | + } |
|
| 1230 | + if (isset($line['PosTime'])) { |
|
| 1231 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1232 | + } else { |
|
| 1233 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1234 | + } |
|
| 907 | 1235 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 908 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 1236 | + if (isset($line['Type'])) { |
|
| 1237 | + $data['aircraft_icao'] = $line['Type']; |
|
| 1238 | + } |
|
| 909 | 1239 | $data['format_source'] = 'aircraftlistjson'; |
| 910 | 1240 | $data['id_source'] = $id_source; |
| 911 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 912 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 913 | - if (isset($data['latitude'])) $SI->add($data); |
|
| 1241 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1242 | + $data['source_name'] = $value['name']; |
|
| 1243 | + } |
|
| 1244 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1245 | + $data['noarchive'] = true; |
|
| 1246 | + } |
|
| 1247 | + if (isset($data['latitude'])) { |
|
| 1248 | + $SI->add($data); |
|
| 1249 | + } |
|
| 914 | 1250 | unset($data); |
| 915 | 1251 | } |
| 916 | 1252 | } elseif (is_array($all_data)) { |
@@ -927,17 +1263,26 @@ discard block |
||
| 927 | 1263 | $data['verticalrate'] = $line['vrt']; // verticale rate |
| 928 | 1264 | $data['squawk'] = $line['squawk']; // squawk |
| 929 | 1265 | $data['emergency'] = ''; // emergency |
| 930 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 931 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1266 | + if (isset($line['PosTime'])) { |
|
| 1267 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1268 | + } else { |
|
| 1269 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1270 | + } |
|
| 932 | 1271 | $data['format_source'] = 'aircraftlistjson'; |
| 933 | 1272 | $data['id_source'] = $id_source; |
| 934 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 935 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1273 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1274 | + $data['noarchive'] = true; |
|
| 1275 | + } |
|
| 1276 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1277 | + $data['source_name'] = $value['name']; |
|
| 1278 | + } |
|
| 936 | 1279 | $SI->add($data); |
| 937 | 1280 | unset($data); |
| 938 | 1281 | } |
| 939 | 1282 | } |
| 940 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
| 1283 | + } elseif ($globalDebug) { |
|
| 1284 | + echo 'No data'."\n"; |
|
| 1285 | + } |
|
| 941 | 1286 | //$last_exec['aircraftlistjson'] = time(); |
| 942 | 1287 | $last_exec[$id]['last'] = time(); |
| 943 | 1288 | //} elseif ($value === 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
@@ -973,8 +1318,12 @@ discard block |
||
| 973 | 1318 | $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
| 974 | 1319 | $data['format_source'] = 'planeupdatefaa'; |
| 975 | 1320 | $data['id_source'] = $id_source; |
| 976 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 977 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1321 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1322 | + $data['noarchive'] = true; |
|
| 1323 | + } |
|
| 1324 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1325 | + $data['source_name'] = $value['name']; |
|
| 1326 | + } |
|
| 978 | 1327 | $SI->add($data); |
| 979 | 1328 | unset($data); |
| 980 | 1329 | } |
@@ -1008,7 +1357,9 @@ discard block |
||
| 1008 | 1357 | $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
| 1009 | 1358 | $data['format_source'] = 'opensky'; |
| 1010 | 1359 | $data['id_source'] = $id_source; |
| 1011 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1360 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1361 | + $data['noarchive'] = true; |
|
| 1362 | + } |
|
| 1012 | 1363 | $SI->add($data); |
| 1013 | 1364 | unset($data); |
| 1014 | 1365 | } |
@@ -1027,22 +1378,51 @@ discard block |
||
| 1027 | 1378 | $reset = 0; |
| 1028 | 1379 | foreach ($all_data['aircraft'] as $key => $line) { |
| 1029 | 1380 | $data = array(); |
| 1030 | - if (isset($line['hex'])) $data['hex'] = $line['hex']; // hex |
|
| 1031 | - if (isset($line['ident'])) $data['ident'] = trim($line['ident']); // ident |
|
| 1032 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude |
|
| 1033 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed |
|
| 1034 | - if (isset($line['track'])) $data['heading'] = $line['track']; // heading |
|
| 1035 | - if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat |
|
| 1036 | - if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long |
|
| 1037 | - if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate |
|
| 1038 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk |
|
| 1381 | + if (isset($line['hex'])) { |
|
| 1382 | + $data['hex'] = $line['hex']; |
|
| 1383 | + } |
|
| 1384 | + // hex |
|
| 1385 | + if (isset($line['ident'])) { |
|
| 1386 | + $data['ident'] = trim($line['ident']); |
|
| 1387 | + } |
|
| 1388 | + // ident |
|
| 1389 | + if (isset($line['altitude'])) { |
|
| 1390 | + $data['altitude'] = $line['altitude']; |
|
| 1391 | + } |
|
| 1392 | + // altitude |
|
| 1393 | + if (isset($line['speed'])) { |
|
| 1394 | + $data['speed'] = $line['speed']; |
|
| 1395 | + } |
|
| 1396 | + // speed |
|
| 1397 | + if (isset($line['track'])) { |
|
| 1398 | + $data['heading'] = $line['track']; |
|
| 1399 | + } |
|
| 1400 | + // heading |
|
| 1401 | + if (isset($line['lat'])) { |
|
| 1402 | + $data['latitude'] = $line['lat']; |
|
| 1403 | + } |
|
| 1404 | + // lat |
|
| 1405 | + if (isset($line['lon'])) { |
|
| 1406 | + $data['longitude'] = $line['lon']; |
|
| 1407 | + } |
|
| 1408 | + // long |
|
| 1409 | + if (isset($line['vert_rate'])) { |
|
| 1410 | + $data['verticalrate'] = $line['vert_rate']; |
|
| 1411 | + } |
|
| 1412 | + // verticale rate |
|
| 1413 | + if (isset($line['squawk'])) { |
|
| 1414 | + $data['squawk'] = $line['squawk']; |
|
| 1415 | + } |
|
| 1416 | + // squawk |
|
| 1039 | 1417 | //$data['emergency'] = ''; // emergency |
| 1040 | 1418 | //$data['registration'] = $line[2]; |
| 1041 | 1419 | //$data['aircraft_icao'] = $line[0]; |
| 1042 | 1420 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1043 | 1421 | $data['format_source'] = 'aircraftjson'; |
| 1044 | 1422 | $data['id_source'] = $id_source; |
| 1045 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1423 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1424 | + $data['noarchive'] = true; |
|
| 1425 | + } |
|
| 1046 | 1426 | $SI->add($data); |
| 1047 | 1427 | unset($data); |
| 1048 | 1428 | } |
@@ -1059,7 +1439,9 @@ discard block |
||
| 1059 | 1439 | //$buffer = $Common->getData($hosts[$id]); |
| 1060 | 1440 | $buffer = $Common->getData($value['host']); |
| 1061 | 1441 | $all_data = json_decode($buffer,true); |
| 1062 | - if (!empty($all_data)) $reset = 0; |
|
| 1442 | + if (!empty($all_data)) { |
|
| 1443 | + $reset = 0; |
|
| 1444 | + } |
|
| 1063 | 1445 | foreach ($all_data as $key => $line) { |
| 1064 | 1446 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 1065 | 1447 | $data = array(); |
@@ -1080,8 +1462,12 @@ discard block |
||
| 1080 | 1462 | $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
| 1081 | 1463 | $data['format_source'] = 'fr24json'; |
| 1082 | 1464 | $data['id_source'] = $id_source; |
| 1083 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1084 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1465 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1466 | + $data['noarchive'] = true; |
|
| 1467 | + } |
|
| 1468 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1469 | + $data['source_name'] = $value['name']; |
|
| 1470 | + } |
|
| 1085 | 1471 | $SI->add($data); |
| 1086 | 1472 | unset($data); |
| 1087 | 1473 | } |
@@ -1110,24 +1496,42 @@ discard block |
||
| 1110 | 1496 | if (isset($line['inf'])) { |
| 1111 | 1497 | $data = array(); |
| 1112 | 1498 | $data['hex'] = $line['inf']['ia']; |
| 1113 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
|
| 1499 | + if (isset($line['inf']['cs'])) { |
|
| 1500 | + $data['ident'] = $line['inf']['cs']; |
|
| 1501 | + } |
|
| 1502 | + //$line[13] |
|
| 1114 | 1503 | $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
| 1115 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 1116 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 1504 | + if (isset($line['inf']['gs'])) { |
|
| 1505 | + $data['speed'] = round($line['inf']['gs']*0.539957); |
|
| 1506 | + } |
|
| 1507 | + // speed |
|
| 1508 | + if (isset($line['inf']['tr'])) { |
|
| 1509 | + $data['heading'] = $line['inf']['tr']; |
|
| 1510 | + } |
|
| 1511 | + // heading |
|
| 1117 | 1512 | $data['latitude'] = $line['pt'][0]; // lat |
| 1118 | 1513 | $data['longitude'] = $line['pt'][1]; // long |
| 1119 | 1514 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
| 1120 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 1515 | + if (isset($line['inf']['sq'])) { |
|
| 1516 | + $data['squawk'] = $line['inf']['sq']; |
|
| 1517 | + } |
|
| 1518 | + // squawk |
|
| 1121 | 1519 | //$data['aircraft_icao'] = $line[8]; |
| 1122 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 1520 | + if (isset($line['inf']['rc'])) { |
|
| 1521 | + $data['registration'] = $line['inf']['rc']; |
|
| 1522 | + } |
|
| 1123 | 1523 | //$data['departure_airport_iata'] = $line[11]; |
| 1124 | 1524 | //$data['arrival_airport_iata'] = $line[12]; |
| 1125 | 1525 | //$data['emergency'] = ''; // emergency |
| 1126 | 1526 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 1127 | 1527 | $data['format_source'] = 'radarvirtueljson'; |
| 1128 | 1528 | $data['id_source'] = $id_source; |
| 1129 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1130 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1529 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1530 | + $data['noarchive'] = true; |
|
| 1531 | + } |
|
| 1532 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1533 | + $data['source_name'] = $value['name']; |
|
| 1534 | + } |
|
| 1131 | 1535 | $SI->add($data); |
| 1132 | 1536 | unset($data); |
| 1133 | 1537 | } |
@@ -1153,30 +1557,65 @@ discard block |
||
| 1153 | 1557 | $data['id'] = $line['id']; |
| 1154 | 1558 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
| 1155 | 1559 | $data['ident'] = $line['callsign']; // ident |
| 1156 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 1157 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 1158 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 1159 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 1160 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1161 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1560 | + if (isset($line['pilotid'])) { |
|
| 1561 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1562 | + } |
|
| 1563 | + // pilot id |
|
| 1564 | + if (isset($line['name'])) { |
|
| 1565 | + $data['pilot_name'] = $line['name']; |
|
| 1566 | + } |
|
| 1567 | + // pilot name |
|
| 1568 | + if (isset($line['alt'])) { |
|
| 1569 | + $data['altitude'] = $line['alt']; |
|
| 1570 | + } |
|
| 1571 | + // altitude |
|
| 1572 | + if (isset($line['gs'])) { |
|
| 1573 | + $data['speed'] = $line['gs']; |
|
| 1574 | + } |
|
| 1575 | + // speed |
|
| 1576 | + if (isset($line['heading'])) { |
|
| 1577 | + $data['heading'] = $line['heading']; |
|
| 1578 | + } |
|
| 1579 | + // heading |
|
| 1580 | + if (isset($line['route'])) { |
|
| 1581 | + $data['waypoints'] = $line['route']; |
|
| 1582 | + } |
|
| 1583 | + // route |
|
| 1162 | 1584 | $data['latitude'] = $line['lat']; // lat |
| 1163 | 1585 | $data['longitude'] = $line['lon']; // long |
| 1164 | 1586 | //$data['verticalrate'] = $line['vrt']; // verticale rate |
| 1165 | 1587 | //$data['squawk'] = $line['squawk']; // squawk |
| 1166 | 1588 | //$data['emergency'] = ''; // emergency |
| 1167 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 1168 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 1169 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1589 | + if (isset($line['depicao'])) { |
|
| 1590 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 1591 | + } |
|
| 1592 | + if (isset($line['deptime'])) { |
|
| 1593 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 1594 | + } |
|
| 1595 | + if (isset($line['arricao'])) { |
|
| 1596 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1597 | + } |
|
| 1170 | 1598 | //$data['arrival_airport_time'] = $line['arrtime']; |
| 1171 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 1172 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 1173 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 1174 | - else $data['info'] = ''; |
|
| 1599 | + if (isset($line['aircraft'])) { |
|
| 1600 | + $data['aircraft_icao'] = $line['aircraft']; |
|
| 1601 | + } |
|
| 1602 | + if (isset($line['transponder'])) { |
|
| 1603 | + $data['squawk'] = $line['transponder']; |
|
| 1604 | + } |
|
| 1605 | + if (isset($line['atis'])) { |
|
| 1606 | + $data['info'] = $line['atis']; |
|
| 1607 | + } else { |
|
| 1608 | + $data['info'] = ''; |
|
| 1609 | + } |
|
| 1175 | 1610 | $data['format_source'] = 'pireps'; |
| 1176 | 1611 | $data['id_source'] = $id_source; |
| 1177 | 1612 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1178 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1179 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1613 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1614 | + $data['noarchive'] = true; |
|
| 1615 | + } |
|
| 1616 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1617 | + $data['source_name'] = $value['name']; |
|
| 1618 | + } |
|
| 1180 | 1619 | if ($line['icon'] === 'plane') { |
| 1181 | 1620 | $SI->add($data); |
| 1182 | 1621 | // print_r($data); |
@@ -1185,16 +1624,28 @@ discard block |
||
| 1185 | 1624 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 1186 | 1625 | $typec = substr($data['ident'],-3); |
| 1187 | 1626 | $data['type'] = ''; |
| 1188 | - if ($typec === 'APP') $data['type'] = 'Approach'; |
|
| 1189 | - elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
|
| 1190 | - elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
|
| 1191 | - elseif ($typec === 'GND') $data['type'] = 'Ground'; |
|
| 1192 | - elseif ($typec === 'DEL') $data['type'] = 'Delivery'; |
|
| 1193 | - elseif ($typec === 'DEP') $data['type'] = 'Departure'; |
|
| 1194 | - elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 1195 | - elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 1196 | - else $data['type'] = 'Observer'; |
|
| 1197 | - 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']); |
|
| 1627 | + if ($typec === 'APP') { |
|
| 1628 | + $data['type'] = 'Approach'; |
|
| 1629 | + } elseif ($typec === 'TWR') { |
|
| 1630 | + $data['type'] = 'Tower'; |
|
| 1631 | + } elseif ($typec === 'OBS') { |
|
| 1632 | + $data['type'] = 'Observer'; |
|
| 1633 | + } elseif ($typec === 'GND') { |
|
| 1634 | + $data['type'] = 'Ground'; |
|
| 1635 | + } elseif ($typec === 'DEL') { |
|
| 1636 | + $data['type'] = 'Delivery'; |
|
| 1637 | + } elseif ($typec === 'DEP') { |
|
| 1638 | + $data['type'] = 'Departure'; |
|
| 1639 | + } elseif ($typec === 'FSS') { |
|
| 1640 | + $data['type'] = 'Flight Service Station'; |
|
| 1641 | + } elseif ($typec === 'CTR') { |
|
| 1642 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1643 | + } else { |
|
| 1644 | + $data['type'] = 'Observer'; |
|
| 1645 | + } |
|
| 1646 | + if (isset($ATC)) { |
|
| 1647 | + 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']); |
|
| 1648 | + } |
|
| 1198 | 1649 | } |
| 1199 | 1650 | unset($data); |
| 1200 | 1651 | } |
@@ -1209,7 +1660,9 @@ discard block |
||
| 1209 | 1660 | ) |
| 1210 | 1661 | ) { |
| 1211 | 1662 | //$buffer = $Common->getData($hosts[$id]); |
| 1212 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1663 | + if ($globalDebug) { |
|
| 1664 | + echo 'Get Data...'."\n"; |
|
| 1665 | + } |
|
| 1213 | 1666 | $buffer = $Common->getData($value['host']); |
| 1214 | 1667 | $all_data = json_decode($buffer,true); |
| 1215 | 1668 | if ($buffer != '' && is_array($all_data)) { |
@@ -1217,10 +1670,16 @@ discard block |
||
| 1217 | 1670 | foreach ($all_data as $line) { |
| 1218 | 1671 | $data = array(); |
| 1219 | 1672 | //$data['id'] = $line['id']; // id not usable |
| 1220 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1673 | + if (isset($line['pilotid'])) { |
|
| 1674 | + $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1675 | + } |
|
| 1221 | 1676 | $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1222 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 1223 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 1677 | + if (isset($line['pilotname'])) { |
|
| 1678 | + $data['pilot_name'] = $line['pilotname']; |
|
| 1679 | + } |
|
| 1680 | + if (isset($line['pilotid'])) { |
|
| 1681 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1682 | + } |
|
| 1224 | 1683 | $data['ident'] = $line['flightnum']; // ident |
| 1225 | 1684 | $data['altitude'] = $line['alt']; // altitude |
| 1226 | 1685 | $data['speed'] = $line['gs']; // speed |
@@ -1236,7 +1695,9 @@ discard block |
||
| 1236 | 1695 | $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
| 1237 | 1696 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1238 | 1697 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1239 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1698 | + } else { |
|
| 1699 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1700 | + } |
|
| 1240 | 1701 | $data['departure_airport_icao'] = $line['depicao']; |
| 1241 | 1702 | $data['departure_airport_time'] = $line['deptime']; |
| 1242 | 1703 | $data['arrival_airport_icao'] = $line['arricao']; |
@@ -1244,29 +1705,47 @@ discard block |
||
| 1244 | 1705 | if (isset($line['registration'])) { |
| 1245 | 1706 | $data['registration'] = $line['registration']; |
| 1246 | 1707 | //if (isset($line['aircraft'])) $data['id'] = $line['aircraft']; |
| 1247 | - } else $data['registration'] = $line['aircraft']; |
|
| 1248 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1249 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1708 | + } else { |
|
| 1709 | + $data['registration'] = $line['aircraft']; |
|
| 1710 | + } |
|
| 1711 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1712 | + $data['noarchive'] = true; |
|
| 1713 | + } |
|
| 1714 | + if (isset($line['route'])) { |
|
| 1715 | + $data['waypoints'] = $line['route']; |
|
| 1716 | + } |
|
| 1717 | + // route |
|
| 1250 | 1718 | if (isset($line['aircraftname'])) { |
| 1251 | 1719 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1252 | 1720 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 1253 | 1721 | $aircraft_data = explode('-',$line['aircraftname']); |
| 1254 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1255 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1256 | - else { |
|
| 1722 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { |
|
| 1723 | + $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1724 | + } elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { |
|
| 1725 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1726 | + } else { |
|
| 1257 | 1727 | $aircraft_data = explode(' ',$line['aircraftname']); |
| 1258 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1259 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1728 | + if (isset($aircraft_data[1])) { |
|
| 1729 | + $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1730 | + } else { |
|
| 1731 | + $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1732 | + } |
|
| 1260 | 1733 | } |
| 1261 | 1734 | } |
| 1262 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 1735 | + if (isset($line['route'])) { |
|
| 1736 | + $data['waypoints'] = $line['route']; |
|
| 1737 | + } |
|
| 1263 | 1738 | $data['id_source'] = $id_source; |
| 1264 | 1739 | $data['format_source'] = 'phpvmacars'; |
| 1265 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1740 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1741 | + $data['source_name'] = $value['name']; |
|
| 1742 | + } |
|
| 1266 | 1743 | $SI->add($data); |
| 1267 | 1744 | unset($data); |
| 1268 | 1745 | } |
| 1269 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1746 | + if ($globalDebug) { |
|
| 1747 | + echo 'No more data...'."\n"; |
|
| 1748 | + } |
|
| 1270 | 1749 | unset($buffer); |
| 1271 | 1750 | unset($all_data); |
| 1272 | 1751 | } |
@@ -1279,7 +1758,9 @@ discard block |
||
| 1279 | 1758 | ) |
| 1280 | 1759 | ) { |
| 1281 | 1760 | //$buffer = $Common->getData($hosts[$id]); |
| 1282 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1761 | + if ($globalDebug) { |
|
| 1762 | + echo 'Get Data...'."\n"; |
|
| 1763 | + } |
|
| 1283 | 1764 | $buffer = $Common->getData($value['host']); |
| 1284 | 1765 | $all_data = json_decode($buffer,true); |
| 1285 | 1766 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
@@ -1290,10 +1771,16 @@ discard block |
||
| 1290 | 1771 | //$data['id'] = $line['id']; // id not usable |
| 1291 | 1772 | $data['id'] = $line['id']; |
| 1292 | 1773 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1293 | - if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
|
| 1294 | - if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
|
| 1774 | + if (isset($line['user']['username'])) { |
|
| 1775 | + $data['pilot_name'] = $line['user']['username']; |
|
| 1776 | + } |
|
| 1777 | + if (isset($line['user_id'])) { |
|
| 1778 | + $data['pilot_id'] = $line['user_id']; |
|
| 1779 | + } |
|
| 1295 | 1780 | $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
| 1296 | - if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 1781 | + if (is_numeric($data['ident'])) { |
|
| 1782 | + $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 1783 | + } |
|
| 1297 | 1784 | $data['altitude'] = $line['altitude']; // altitude |
| 1298 | 1785 | $data['speed'] = $line['groundspeed']; // speed |
| 1299 | 1786 | $data['heading'] = $line['heading']; // heading |
@@ -1306,7 +1793,9 @@ discard block |
||
| 1306 | 1793 | $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
| 1307 | 1794 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1308 | 1795 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1309 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1796 | + } else { |
|
| 1797 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1798 | + } |
|
| 1310 | 1799 | |
| 1311 | 1800 | $data['departure_airport_icao'] = $line['bid']['depapt']['icao']; |
| 1312 | 1801 | $data['departure_airport_time'] = $line['bid']['deptime']; |
@@ -1314,17 +1803,26 @@ discard block |
||
| 1314 | 1803 | $data['arrival_airport_time'] = $line['bid']['arrtime']; |
| 1315 | 1804 | $data['registration'] = $line['bid']['aircraft']['registration']; |
| 1316 | 1805 | |
| 1317 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1318 | - if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route |
|
| 1806 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1807 | + $data['noarchive'] = true; |
|
| 1808 | + } |
|
| 1809 | + if (isset($line['bid']['route']) && $line['bid']['route'] != '') { |
|
| 1810 | + $data['waypoints'] = $line['bid']['route']; |
|
| 1811 | + } |
|
| 1812 | + // route |
|
| 1319 | 1813 | $data['aircraft_icao'] = $line['bid']['aircraft']['icao']; |
| 1320 | 1814 | |
| 1321 | 1815 | $data['id_source'] = $id_source; |
| 1322 | 1816 | $data['format_source'] = 'vaos'; |
| 1323 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1817 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1818 | + $data['source_name'] = $value['name']; |
|
| 1819 | + } |
|
| 1324 | 1820 | $SI->add($data); |
| 1325 | 1821 | unset($data); |
| 1326 | 1822 | } |
| 1327 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1823 | + if ($globalDebug) { |
|
| 1824 | + echo 'No more data...'."\n"; |
|
| 1825 | + } |
|
| 1328 | 1826 | unset($buffer); |
| 1329 | 1827 | unset($all_data); |
| 1330 | 1828 | } |
@@ -1337,7 +1835,9 @@ discard block |
||
| 1337 | 1835 | ) |
| 1338 | 1836 | ) { |
| 1339 | 1837 | //$buffer = $Common->getData($hosts[$id]); |
| 1340 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1838 | + if ($globalDebug) { |
|
| 1839 | + echo 'Get Data...'."\n"; |
|
| 1840 | + } |
|
| 1341 | 1841 | $buffer = $Common->getData($value['host']); |
| 1342 | 1842 | $all_data = json_decode($buffer,true); |
| 1343 | 1843 | if ($buffer != '' && is_array($all_data)) { |
@@ -1366,16 +1866,25 @@ discard block |
||
| 1366 | 1866 | $data['arrival_airport_icao'] = $line['arrival']; |
| 1367 | 1867 | //$data['arrival_airport_time'] = $line['arrival_time']; |
| 1368 | 1868 | //$data['registration'] = $line['aircraft']; |
| 1369 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1869 | + if (isset($line['route'])) { |
|
| 1870 | + $data['waypoints'] = $line['route']; |
|
| 1871 | + } |
|
| 1872 | + // route |
|
| 1370 | 1873 | $data['aircraft_icao'] = $line['plane_type']; |
| 1371 | 1874 | $data['id_source'] = $id_source; |
| 1372 | 1875 | $data['format_source'] = 'vam'; |
| 1373 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1374 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1876 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1877 | + $data['noarchive'] = true; |
|
| 1878 | + } |
|
| 1879 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1880 | + $data['source_name'] = $value['name']; |
|
| 1881 | + } |
|
| 1375 | 1882 | $SI->add($data); |
| 1376 | 1883 | unset($data); |
| 1377 | 1884 | } |
| 1378 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1885 | + if ($globalDebug) { |
|
| 1886 | + echo 'No more data...'."\n"; |
|
| 1887 | + } |
|
| 1379 | 1888 | unset($buffer); |
| 1380 | 1889 | unset($all_data); |
| 1381 | 1890 | } |
@@ -1388,7 +1897,9 @@ discard block |
||
| 1388 | 1897 | ) |
| 1389 | 1898 | ) { |
| 1390 | 1899 | //$buffer = $Common->getData($hosts[$id]); |
| 1391 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1900 | + if ($globalDebug) { |
|
| 1901 | + echo 'Get Data...'."\n"; |
|
| 1902 | + } |
|
| 1392 | 1903 | $buffer = $Common->getData($value['host']); |
| 1393 | 1904 | $all_data = json_decode($buffer,true); |
| 1394 | 1905 | if ($buffer != '') { |
@@ -1406,12 +1917,16 @@ discard block |
||
| 1406 | 1917 | $data['id_source'] = $id_source; |
| 1407 | 1918 | $data['format_source'] = 'blitzortung'; |
| 1408 | 1919 | $SI->add($data); |
| 1409 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 1920 | + if ($globalDebug) { |
|
| 1921 | + echo '☈ Lightning added'."\n"; |
|
| 1922 | + } |
|
| 1410 | 1923 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
| 1411 | 1924 | unset($data); |
| 1412 | 1925 | } |
| 1413 | 1926 | } |
| 1414 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1927 | + if ($globalDebug) { |
|
| 1928 | + echo 'No more data...'."\n"; |
|
| 1929 | + } |
|
| 1415 | 1930 | unset($buffer); |
| 1416 | 1931 | } |
| 1417 | 1932 | $last_exec[$id]['last'] = time(); |
@@ -1423,7 +1938,9 @@ discard block |
||
| 1423 | 1938 | $write = NULL; |
| 1424 | 1939 | $e = NULL; |
| 1425 | 1940 | $n = socket_select($read, $write, $e, $timeout); |
| 1426 | - if ($e != NULL) var_dump($e); |
|
| 1941 | + if ($e != NULL) { |
|
| 1942 | + var_dump($e); |
|
| 1943 | + } |
|
| 1427 | 1944 | if ($n > 0) { |
| 1428 | 1945 | $reset = 0; |
| 1429 | 1946 | foreach ($read as $nb => $r) { |
@@ -1445,13 +1962,17 @@ discard block |
||
| 1445 | 1962 | if ($buffer !== FALSE) { |
| 1446 | 1963 | if ($format === 'vrstcp') { |
| 1447 | 1964 | $buffer = explode('},{',$buffer); |
| 1448 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1965 | + } else { |
|
| 1966 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1967 | + } |
|
| 1449 | 1968 | } |
| 1450 | 1969 | // SBS format is CSV format |
| 1451 | 1970 | if ($buffer !== FALSE && $buffer !== '') { |
| 1452 | 1971 | $tt[$format] = 0; |
| 1453 | 1972 | if ($format === 'acarssbs3') { |
| 1454 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1973 | + if ($globalDebug) { |
|
| 1974 | + echo 'ACARS : '.$buffer."\n"; |
|
| 1975 | + } |
|
| 1455 | 1976 | $ACARS->add(trim($buffer)); |
| 1456 | 1977 | $ACARS->deleteLiveAcarsData(); |
| 1457 | 1978 | } elseif ($format === 'raw') { |
@@ -1460,30 +1981,70 @@ discard block |
||
| 1460 | 1981 | if (is_array($data)) { |
| 1461 | 1982 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1462 | 1983 | $data['format_source'] = 'raw'; |
| 1463 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1464 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1465 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1466 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1984 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 1985 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1986 | + } |
|
| 1987 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 1988 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1989 | + } |
|
| 1990 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1991 | + $data['noarchive'] = true; |
|
| 1992 | + } |
|
| 1993 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 1994 | + $SI->add($data); |
|
| 1995 | + } |
|
| 1467 | 1996 | } |
| 1468 | 1997 | } elseif ($format === 'ais') { |
| 1469 | 1998 | $ais_data = $AIS->parse_line(trim($buffer)); |
| 1470 | 1999 | $data = array(); |
| 1471 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 1472 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 1473 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 1474 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 1475 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 1476 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 1477 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 1478 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 1479 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 1480 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 1481 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 1482 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 1483 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1484 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1485 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1486 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2000 | + if (isset($ais_data['ident'])) { |
|
| 2001 | + $data['ident'] = $ais_data['ident']; |
|
| 2002 | + } |
|
| 2003 | + if (isset($ais_data['mmsi'])) { |
|
| 2004 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 2005 | + } |
|
| 2006 | + if (isset($ais_data['speed'])) { |
|
| 2007 | + $data['speed'] = $ais_data['speed']; |
|
| 2008 | + } |
|
| 2009 | + if (isset($ais_data['heading'])) { |
|
| 2010 | + $data['heading'] = $ais_data['heading']; |
|
| 2011 | + } |
|
| 2012 | + if (isset($ais_data['latitude'])) { |
|
| 2013 | + $data['latitude'] = $ais_data['latitude']; |
|
| 2014 | + } |
|
| 2015 | + if (isset($ais_data['longitude'])) { |
|
| 2016 | + $data['longitude'] = $ais_data['longitude']; |
|
| 2017 | + } |
|
| 2018 | + if (isset($ais_data['status'])) { |
|
| 2019 | + $data['status'] = $ais_data['status']; |
|
| 2020 | + } |
|
| 2021 | + if (isset($ais_data['statusid'])) { |
|
| 2022 | + $data['status_id'] = $ais_data['statusid']; |
|
| 2023 | + } |
|
| 2024 | + if (isset($ais_data['type'])) { |
|
| 2025 | + $data['type'] = $ais_data['type']; |
|
| 2026 | + } |
|
| 2027 | + if (isset($ais_data['imo'])) { |
|
| 2028 | + $data['imo'] = $ais_data['imo']; |
|
| 2029 | + } |
|
| 2030 | + if (isset($ais_data['callsign'])) { |
|
| 2031 | + $data['callsign'] = $ais_data['callsign']; |
|
| 2032 | + } |
|
| 2033 | + if (isset($ais_data['destination'])) { |
|
| 2034 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 2035 | + } |
|
| 2036 | + if (isset($ais_data['eta_ts'])) { |
|
| 2037 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 2038 | + } |
|
| 2039 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2040 | + $data['noarchive'] = true; |
|
| 2041 | + } |
|
| 2042 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2043 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2044 | + } |
|
| 2045 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2046 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2047 | + } |
|
| 1487 | 2048 | |
| 1488 | 2049 | if (isset($ais_data['timestamp'])) { |
| 1489 | 2050 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
@@ -1492,7 +2053,9 @@ discard block |
||
| 1492 | 2053 | } |
| 1493 | 2054 | $data['format_source'] = 'aisnmea'; |
| 1494 | 2055 | $data['id_source'] = $id_source; |
| 1495 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 2056 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 2057 | + $MI->add($data); |
|
| 2058 | + } |
|
| 1496 | 2059 | unset($data); |
| 1497 | 2060 | } elseif ($format === 'flightgearsp') { |
| 1498 | 2061 | //echo $buffer."\n"; |
@@ -1510,12 +2073,18 @@ discard block |
||
| 1510 | 2073 | $data['speed'] = round($line[5]*1.94384); |
| 1511 | 2074 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1512 | 2075 | $data['format_source'] = 'flightgearsp'; |
| 1513 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1514 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2076 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2077 | + $data['noarchive'] = true; |
|
| 2078 | + } |
|
| 2079 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2080 | + $SI->add($data); |
|
| 2081 | + } |
|
| 1515 | 2082 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1516 | 2083 | } |
| 1517 | 2084 | } elseif ($format === 'acars') { |
| 1518 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 2085 | + if ($globalDebug) { |
|
| 2086 | + echo 'ACARS : '.$buffer."\n"; |
|
| 2087 | + } |
|
| 1519 | 2088 | $ACARS->add(trim($buffer)); |
| 1520 | 2089 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
| 1521 | 2090 | $ACARS->deleteLiveAcarsData(); |
@@ -1536,8 +2105,12 @@ discard block |
||
| 1536 | 2105 | $aircraft_type = $line[10]; |
| 1537 | 2106 | $aircraft_type = preg_split(':/:',$aircraft_type); |
| 1538 | 2107 | $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
| 1539 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1540 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2108 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2109 | + $data['noarchive'] = true; |
|
| 2110 | + } |
|
| 2111 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2112 | + $SI->add($data); |
|
| 2113 | + } |
|
| 1541 | 2114 | } |
| 1542 | 2115 | } |
| 1543 | 2116 | } elseif ($format === 'beast') { |
@@ -1547,28 +2120,62 @@ discard block |
||
| 1547 | 2120 | foreach($buffer as $all_data) { |
| 1548 | 2121 | $line = json_decode('{'.$all_data.'}',true); |
| 1549 | 2122 | $data = array(); |
| 1550 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
|
| 1551 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 1552 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 1553 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 1554 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 1555 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 1556 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 2123 | + if (isset($line['Icao'])) { |
|
| 2124 | + $data['hex'] = $line['Icao']; |
|
| 2125 | + } |
|
| 2126 | + // hex |
|
| 2127 | + if (isset($line['Call'])) { |
|
| 2128 | + $data['ident'] = $line['Call']; |
|
| 2129 | + } |
|
| 2130 | + // ident |
|
| 2131 | + if (isset($line['Alt'])) { |
|
| 2132 | + $data['altitude'] = $line['Alt']; |
|
| 2133 | + } |
|
| 2134 | + // altitude |
|
| 2135 | + if (isset($line['Spd'])) { |
|
| 2136 | + $data['speed'] = $line['Spd']; |
|
| 2137 | + } |
|
| 2138 | + // speed |
|
| 2139 | + if (isset($line['Trak'])) { |
|
| 2140 | + $data['heading'] = $line['Trak']; |
|
| 2141 | + } |
|
| 2142 | + // heading |
|
| 2143 | + if (isset($line['Lat'])) { |
|
| 2144 | + $data['latitude'] = $line['Lat']; |
|
| 2145 | + } |
|
| 2146 | + // lat |
|
| 2147 | + if (isset($line['Long'])) { |
|
| 2148 | + $data['longitude'] = $line['Long']; |
|
| 2149 | + } |
|
| 2150 | + // long |
|
| 1557 | 2151 | //$data['verticalrate'] = $line['']; // verticale rate |
| 1558 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 2152 | + if (isset($line['Sqk'])) { |
|
| 2153 | + $data['squawk'] = $line['Sqk']; |
|
| 2154 | + } |
|
| 2155 | + // squawk |
|
| 1559 | 2156 | $data['emergency'] = ''; // emergency |
| 1560 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 2157 | + if (isset($line['Reg'])) { |
|
| 2158 | + $data['registration'] = $line['Reg']; |
|
| 2159 | + } |
|
| 1561 | 2160 | /* |
| 1562 | 2161 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 1563 | 2162 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 1564 | 2163 | */ |
| 1565 | 2164 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1566 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 2165 | + if (isset($line['Type'])) { |
|
| 2166 | + $data['aircraft_icao'] = $line['Type']; |
|
| 2167 | + } |
|
| 1567 | 2168 | $data['format_source'] = 'vrstcp'; |
| 1568 | 2169 | $data['id_source'] = $id_source; |
| 1569 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1570 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1571 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
|
| 2170 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2171 | + $data['noarchive'] = true; |
|
| 2172 | + } |
|
| 2173 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2174 | + $data['source_name'] = $value['name']; |
|
| 2175 | + } |
|
| 2176 | + if (isset($data['latitude']) && isset($data['hex'])) { |
|
| 2177 | + $SI->add($data); |
|
| 2178 | + } |
|
| 1572 | 2179 | unset($data); |
| 1573 | 2180 | } |
| 1574 | 2181 | } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
@@ -1581,22 +2188,46 @@ discard block |
||
| 1581 | 2188 | $data['hex'] = $lined['hexid']; |
| 1582 | 2189 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
| 1583 | 2190 | $data['datetime'] = date('Y-m-d H:i:s');; |
| 1584 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1585 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1586 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1587 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1588 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1589 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1590 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 2191 | + if (isset($lined['ident'])) { |
|
| 2192 | + $data['ident'] = $lined['ident']; |
|
| 2193 | + } |
|
| 2194 | + if (isset($lined['lat'])) { |
|
| 2195 | + $data['latitude'] = $lined['lat']; |
|
| 2196 | + } |
|
| 2197 | + if (isset($lined['lon'])) { |
|
| 2198 | + $data['longitude'] = $lined['lon']; |
|
| 2199 | + } |
|
| 2200 | + if (isset($lined['speed'])) { |
|
| 2201 | + $data['speed'] = $lined['speed']; |
|
| 2202 | + } |
|
| 2203 | + if (isset($lined['squawk'])) { |
|
| 2204 | + $data['squawk'] = $lined['squawk']; |
|
| 2205 | + } |
|
| 2206 | + if (isset($lined['alt'])) { |
|
| 2207 | + $data['altitude'] = $lined['alt']; |
|
| 2208 | + } |
|
| 2209 | + if (isset($lined['heading'])) { |
|
| 2210 | + $data['heading'] = $lined['heading']; |
|
| 2211 | + } |
|
| 1591 | 2212 | $data['id_source'] = $id_source; |
| 1592 | 2213 | $data['format_source'] = 'tsv'; |
| 1593 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1594 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1595 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1596 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2214 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2215 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2216 | + } |
|
| 2217 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2218 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2219 | + } |
|
| 2220 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2221 | + $data['noarchive'] = true; |
|
| 2222 | + } |
|
| 2223 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2224 | + $SI->add($data); |
|
| 2225 | + } |
|
| 1597 | 2226 | unset($lined); |
| 1598 | 2227 | unset($data); |
| 1599 | - } else $error = true; |
|
| 2228 | + } else { |
|
| 2229 | + $error = true; |
|
| 2230 | + } |
|
| 1600 | 2231 | } elseif ($format === 'aprs' && $use_aprs) { |
| 1601 | 2232 | if ($aprs_connect === 0) { |
| 1602 | 2233 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
@@ -1622,63 +2253,121 @@ discard block |
||
| 1622 | 2253 | $aprs_last_tx = time(); |
| 1623 | 2254 | $data = array(); |
| 1624 | 2255 | //print_r($line); |
| 1625 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1626 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
| 1627 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
| 1628 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
| 1629 | - if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code']; |
|
| 1630 | - if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
|
| 1631 | - if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
|
| 1632 | - if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
|
| 1633 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1634 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2256 | + if (isset($line['address'])) { |
|
| 2257 | + $data['hex'] = $line['address']; |
|
| 2258 | + } |
|
| 2259 | + if (isset($line['mmsi'])) { |
|
| 2260 | + $data['mmsi'] = $line['mmsi']; |
|
| 2261 | + } |
|
| 2262 | + if (isset($line['imo'])) { |
|
| 2263 | + $data['imo'] = $line['imo']; |
|
| 2264 | + } |
|
| 2265 | + if (isset($line['squawk'])) { |
|
| 2266 | + $data['squawk'] = $line['squawk']; |
|
| 2267 | + } |
|
| 2268 | + if (isset($line['arrival_code'])) { |
|
| 2269 | + $data['arrival_code'] = $line['arrival_code']; |
|
| 2270 | + } |
|
| 2271 | + if (isset($line['arrival_date'])) { |
|
| 2272 | + $data['arrival_date'] = $line['arrival_date']; |
|
| 2273 | + } |
|
| 2274 | + if (isset($line['typeid'])) { |
|
| 2275 | + $data['type_id'] = $line['typeid']; |
|
| 2276 | + } |
|
| 2277 | + if (isset($line['statusid'])) { |
|
| 2278 | + $data['status_id'] = $line['statusid']; |
|
| 2279 | + } |
|
| 2280 | + if (isset($line['timestamp'])) { |
|
| 2281 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 2282 | + } else { |
|
| 2283 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2284 | + } |
|
| 1635 | 2285 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1636 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
| 2286 | + if (isset($line['ident'])) { |
|
| 2287 | + $data['ident'] = $line['ident']; |
|
| 2288 | + } |
|
| 1637 | 2289 | $data['latitude'] = $line['latitude']; |
| 1638 | 2290 | $data['longitude'] = $line['longitude']; |
| 1639 | 2291 | //$data['verticalrate'] = $line[16]; |
| 1640 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 2292 | + if (isset($line['speed'])) { |
|
| 2293 | + $data['speed'] = $line['speed']; |
|
| 2294 | + } |
|
| 1641 | 2295 | //else $data['speed'] = 0; |
| 1642 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1643 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1644 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 2296 | + if (isset($line['altitude'])) { |
|
| 2297 | + $data['altitude'] = $line['altitude']; |
|
| 2298 | + } |
|
| 2299 | + if (isset($line['comment'])) { |
|
| 2300 | + $data['comment'] = $line['comment']; |
|
| 2301 | + } |
|
| 2302 | + if (isset($line['symbol'])) { |
|
| 2303 | + $data['type'] = $line['symbol']; |
|
| 2304 | + } |
|
| 1645 | 2305 | //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
| 1646 | 2306 | |
| 1647 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
| 2307 | + if (isset($line['heading']) && isset($line['format_source'])) { |
|
| 2308 | + $data['heading'] = $line['heading']; |
|
| 2309 | + } |
|
| 1648 | 2310 | //else echo 'No heading...'."\n"; |
| 1649 | 2311 | //else $data['heading'] = 0; |
| 1650 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 2312 | + if (isset($line['stealth'])) { |
|
| 2313 | + $data['aircraft_type'] = $line['stealth']; |
|
| 2314 | + } |
|
| 1651 | 2315 | //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
| 1652 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
| 1653 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
| 1654 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1655 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
| 2316 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { |
|
| 2317 | + $data['noarchive'] = true; |
|
| 2318 | + } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { |
|
| 2319 | + $data['noarchive'] = false; |
|
| 2320 | + } |
|
| 2321 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2322 | + $data['noarchive'] = true; |
|
| 2323 | + } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { |
|
| 2324 | + $data['noarchive'] = false; |
|
| 2325 | + } |
|
| 1656 | 2326 | $data['id_source'] = $id_source; |
| 1657 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
| 1658 | - else $data['format_source'] = 'aprs'; |
|
| 2327 | + if (isset($line['format_source'])) { |
|
| 2328 | + $data['format_source'] = $line['format_source']; |
|
| 2329 | + } else { |
|
| 2330 | + $data['format_source'] = 'aprs'; |
|
| 2331 | + } |
|
| 1659 | 2332 | $data['source_name'] = $line['source']; |
| 1660 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
| 1661 | - else $data['source_type'] = 'flarm'; |
|
| 1662 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2333 | + if (isset($line['source_type'])) { |
|
| 2334 | + $data['source_type'] = $line['source_type']; |
|
| 2335 | + } else { |
|
| 2336 | + $data['source_type'] = 'flarm'; |
|
| 2337 | + } |
|
| 2338 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2339 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2340 | + } |
|
| 1663 | 2341 | $currentdate = date('Y-m-d H:i:s'); |
| 1664 | 2342 | $aprsdate = strtotime($data['datetime']); |
| 1665 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
| 2343 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') { |
|
| 2344 | + $data['altitude_relative'] = 'AMSL'; |
|
| 2345 | + } |
|
| 1666 | 2346 | // Accept data if time <= system time + 20s |
| 1667 | 2347 | //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'])))) { |
| 1668 | 2348 | if (($data['source_type'] === 'modes') || isset($line['stealth']) && (!isset($data['hex']) || $data['hex'] != 'FFFFFF') && ($line['stealth'] === 0 || $line['stealth'] === '') && (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
| 1669 | 2349 | $send = $SI->add($data); |
| 1670 | 2350 | } elseif ($data['source_type'] === 'ais') { |
| 1671 | 2351 | $data['type'] = ''; |
| 1672 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
|
| 2352 | + if (isset($globalMarine) && $globalMarine) { |
|
| 2353 | + $send = $MI->add($data); |
|
| 2354 | + } |
|
| 1673 | 2355 | } elseif (isset($line['stealth'])) { |
| 1674 | - if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
| 1675 | - else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
| 2356 | + if ($line['stealth'] != 0) { |
|
| 2357 | + echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
| 2358 | + } else { |
|
| 2359 | + echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
| 2360 | + } |
|
| 1676 | 2361 | } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1677 | 2362 | //$line['symbol'] === 'Balloon' || |
| 1678 | 2363 | $line['symbol'] === 'Glider' || |
| 1679 | 2364 | $line['symbol'] === 'Aircraft (small)' || $line['symbol'] === 'Helicopter')) { |
| 1680 | - if ($line['symbol'] === 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
| 1681 | - if ($line['symbol'] === 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2365 | + if ($line['symbol'] === 'Ballon') { |
|
| 2366 | + $data['aircraft_icao'] = 'BALL'; |
|
| 2367 | + } |
|
| 2368 | + if ($line['symbol'] === 'Glider') { |
|
| 2369 | + $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2370 | + } |
|
| 1682 | 2371 | $send = $SI->add($data); |
| 1683 | 2372 | } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1684 | 2373 | $line['symbol'] === 'Yacht (Sail)' || |
@@ -1709,9 +2398,13 @@ discard block |
||
| 1709 | 2398 | //} 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') { |
| 1710 | 2399 | // } 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') { |
| 1711 | 2400 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
| 1712 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
|
| 2401 | + if (isset($globalTracker) && $globalTracker) { |
|
| 2402 | + $send = $TI->add($data); |
|
| 2403 | + } |
|
| 1713 | 2404 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
| 1714 | - if (!isset($data['altitude'])) $data['altitude'] = 0; |
|
| 2405 | + if (!isset($data['altitude'])) { |
|
| 2406 | + $data['altitude'] = 0; |
|
| 2407 | + } |
|
| 1715 | 2408 | $Source->deleteOldLocationByType('gs'); |
| 1716 | 2409 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
| 1717 | 2410 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
@@ -1720,7 +2413,9 @@ discard block |
||
| 1720 | 2413 | } |
| 1721 | 2414 | } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
| 1722 | 2415 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1723 | - if ($globalDebug) echo '# Weather Station added'."\n"; |
|
| 2416 | + if ($globalDebug) { |
|
| 2417 | + echo '# Weather Station added'."\n"; |
|
| 2418 | + } |
|
| 1724 | 2419 | $Source->deleteOldLocationByType('wx'); |
| 1725 | 2420 | $weather_data = json_encode($line); |
| 1726 | 2421 | if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
@@ -1730,7 +2425,9 @@ discard block |
||
| 1730 | 2425 | } |
| 1731 | 2426 | } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
| 1732 | 2427 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1733 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2428 | + if ($globalDebug) { |
|
| 2429 | + echo '☈ Lightning added'."\n"; |
|
| 2430 | + } |
|
| 1734 | 2431 | $Source->deleteOldLocationByType('lightning'); |
| 1735 | 2432 | if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
| 1736 | 2433 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
@@ -1742,8 +2439,7 @@ discard block |
||
| 1742 | 2439 | print_r($line); |
| 1743 | 2440 | } |
| 1744 | 2441 | unset($data); |
| 1745 | - } |
|
| 1746 | - elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 2442 | + } elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 1747 | 2443 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
| 1748 | 2444 | } |
| 1749 | 2445 | /* |
@@ -1752,7 +2448,9 @@ discard block |
||
| 1752 | 2448 | } |
| 1753 | 2449 | */ |
| 1754 | 2450 | //elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 1755 | - elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
|
| 2451 | + elseif ($line === true && $globalDebug) { |
|
| 2452 | + echo '!! Failed : '.$buffer."!!\n"; |
|
| 2453 | + } |
|
| 1756 | 2454 | if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
| 1757 | 2455 | $Source->deleteOldLocationByType('lightning'); |
| 1758 | 2456 | $Source->deleteOldLocationByType('wx'); |
@@ -1788,26 +2486,45 @@ discard block |
||
| 1788 | 2486 | $data['ground'] = $line[21]; |
| 1789 | 2487 | $data['emergency'] = $line[19]; |
| 1790 | 2488 | $data['format_source'] = 'sbs'; |
| 1791 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1792 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1793 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 2489 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2490 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2491 | + } |
|
| 2492 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2493 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2494 | + } |
|
| 2495 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2496 | + $data['noarchive'] = true; |
|
| 2497 | + } |
|
| 1794 | 2498 | $data['id_source'] = $id_source; |
| 1795 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1796 | - else $error = true; |
|
| 2499 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2500 | + $send = $SI->add($data); |
|
| 2501 | + } else { |
|
| 2502 | + $error = true; |
|
| 2503 | + } |
|
| 1797 | 2504 | unset($data); |
| 1798 | - } else $error = true; |
|
| 2505 | + } else { |
|
| 2506 | + $error = true; |
|
| 2507 | + } |
|
| 1799 | 2508 | if ($error) { |
| 1800 | 2509 | if (count($line) > 1 && ($line[0] === 'STA' || $line[0] === 'AIR' || $line[0] === 'SEL' || $line[0] === 'ID' || $line[0] === 'CLK')) { |
| 1801 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; |
|
| 2510 | + if ($globalDebug) { |
|
| 2511 | + echo "Not a message. Ignoring... \n"; |
|
| 2512 | + } |
|
| 1802 | 2513 | } else { |
| 1803 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; |
|
| 2514 | + if ($globalDebug) { |
|
| 2515 | + echo "Wrong line format. Ignoring... \n"; |
|
| 2516 | + } |
|
| 1804 | 2517 | if ($globalDebug) { |
| 1805 | 2518 | echo $buffer; |
| 1806 | 2519 | //print_r($line); |
| 1807 | 2520 | } |
| 1808 | 2521 | //socket_close($r); |
| 1809 | - if ($globalDebug) echo "Reconnect after an error...\n"; |
|
| 1810 | - if ($format === 'aprs') $aprs_connect = 0; |
|
| 2522 | + if ($globalDebug) { |
|
| 2523 | + echo "Reconnect after an error...\n"; |
|
| 2524 | + } |
|
| 2525 | + if ($format === 'aprs') { |
|
| 2526 | + $aprs_connect = 0; |
|
| 2527 | + } |
|
| 1811 | 2528 | $sourceer[$nb] = $globalSources[$nb]; |
| 1812 | 2529 | connect_all($sourceer); |
| 1813 | 2530 | $sourceer = array(); |
@@ -1815,10 +2532,14 @@ discard block |
||
| 1815 | 2532 | } |
| 1816 | 2533 | } |
| 1817 | 2534 | // Sleep for xxx microseconds |
| 1818 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
|
| 2535 | + if (isset($globalSBSSleep)) { |
|
| 2536 | + usleep($globalSBSSleep); |
|
| 2537 | + } |
|
| 1819 | 2538 | } else { |
| 1820 | 2539 | if ($format === 'flightgearmp') { |
| 1821 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 2540 | + if ($globalDebug) { |
|
| 2541 | + echo "Reconnect FlightGear MP..."; |
|
| 2542 | + } |
|
| 1822 | 2543 | //@socket_close($r); |
| 1823 | 2544 | sleep($globalMinFetch); |
| 1824 | 2545 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1827,10 +2548,15 @@ discard block |
||
| 1827 | 2548 | break; |
| 1828 | 2549 | |
| 1829 | 2550 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1830 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1831 | - else $tt[$format] = 0; |
|
| 2551 | + if (isset($tt[$format])) { |
|
| 2552 | + $tt[$format]++; |
|
| 2553 | + } else { |
|
| 2554 | + $tt[$format] = 0; |
|
| 2555 | + } |
|
| 1832 | 2556 | if ($tt[$format] > 30 || $buffer === FALSE) { |
| 1833 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
|
| 2557 | + if ($globalDebug) { |
|
| 2558 | + echo "ERROR : Reconnect ".$format."..."; |
|
| 2559 | + } |
|
| 1834 | 2560 | //@socket_close($r); |
| 1835 | 2561 | sleep(2); |
| 1836 | 2562 | $aprs_connect = 0; |
@@ -1848,11 +2574,17 @@ discard block |
||
| 1848 | 2574 | } else { |
| 1849 | 2575 | $error = socket_strerror(socket_last_error()); |
| 1850 | 2576 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 1851 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 1852 | - if (isset($globalDebug)) echo "Restarting...\n"; |
|
| 2577 | + if ($globalDebug) { |
|
| 2578 | + echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 2579 | + } |
|
| 2580 | + if (isset($globalDebug)) { |
|
| 2581 | + echo "Restarting...\n"; |
|
| 2582 | + } |
|
| 1853 | 2583 | // Restart the script if possible |
| 1854 | 2584 | if (is_array($sockets)) { |
| 1855 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 2585 | + if ($globalDebug) { |
|
| 2586 | + echo "Shutdown all sockets..."; |
|
| 2587 | + } |
|
| 1856 | 2588 | |
| 1857 | 2589 | foreach ($sockets as $sock) { |
| 1858 | 2590 | @socket_shutdown($sock,2); |
@@ -1860,25 +2592,45 @@ discard block |
||
| 1860 | 2592 | } |
| 1861 | 2593 | |
| 1862 | 2594 | } |
| 1863 | - if ($globalDebug) echo "Waiting..."; |
|
| 2595 | + if ($globalDebug) { |
|
| 2596 | + echo "Waiting..."; |
|
| 2597 | + } |
|
| 1864 | 2598 | sleep(2); |
| 1865 | 2599 | $time = time(); |
| 1866 | 2600 | //connect_all($hosts); |
| 1867 | 2601 | $aprs_connect = 0; |
| 1868 | - if ($reset%5 === 0) sleep(20); |
|
| 1869 | - if ($reset%10 === 0) sleep(100); |
|
| 1870 | - if ($reset%20 === 0) sleep(200); |
|
| 1871 | - if ($reset > 100) exit('Too many attempts...'); |
|
| 1872 | - if ($globalDebug) echo "Restart all connections..."; |
|
| 2602 | + if ($reset%5 === 0) { |
|
| 2603 | + sleep(20); |
|
| 2604 | + } |
|
| 2605 | + if ($reset%10 === 0) { |
|
| 2606 | + sleep(100); |
|
| 2607 | + } |
|
| 2608 | + if ($reset%20 === 0) { |
|
| 2609 | + sleep(200); |
|
| 2610 | + } |
|
| 2611 | + if ($reset > 100) { |
|
| 2612 | + exit('Too many attempts...'); |
|
| 2613 | + } |
|
| 2614 | + if ($globalDebug) { |
|
| 2615 | + echo "Restart all connections..."; |
|
| 2616 | + } |
|
| 1873 | 2617 | connect_all($globalSources); |
| 1874 | 2618 | } |
| 1875 | 2619 | } |
| 1876 | 2620 | } |
| 1877 | 2621 | if ($globalDaemon === false) { |
| 1878 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1879 | - if (isset($SI)) $SI->checkAll(); |
|
| 1880 | - if (isset($TI)) $TI->checkAll(); |
|
| 1881 | - if (isset($MI)) $MI->checkAll(); |
|
| 2622 | + if ($globalDebug) { |
|
| 2623 | + echo 'Check all...'."\n"; |
|
| 2624 | + } |
|
| 2625 | + if (isset($SI)) { |
|
| 2626 | + $SI->checkAll(); |
|
| 2627 | + } |
|
| 2628 | + if (isset($TI)) { |
|
| 2629 | + $TI->checkAll(); |
|
| 2630 | + } |
|
| 2631 | + if (isset($MI)) { |
|
| 2632 | + $MI->checkAll(); |
|
| 2633 | + } |
|
| 1882 | 2634 | } |
| 1883 | 2635 | } |
| 1884 | 2636 | } |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | $currentdate = date('Y-m-d'); |
| 35 | 35 | $sourcestat = $Stats->getStatsSource($currentdate); |
| 36 | 36 | if (!empty($sourcestat)) { |
| 37 | - foreach($sourcestat as $srcst) { |
|
| 37 | + foreach ($sourcestat as $srcst) { |
|
| 38 | 38 | $type = $srcst['stats_type']; |
| 39 | 39 | if ($type == 'polar' || $type == 'hist') { |
| 40 | 40 | $source = $srcst['source_name']; |
| 41 | 41 | $data = $srcst['source_data']; |
| 42 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 42 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | if (isset($globalGeoid) && $globalGeoid) { |
| 52 | 52 | try { |
| 53 | 53 | $GeoidClass = new GeoidHeight(); |
| 54 | - } catch(Exception $e) { |
|
| 54 | + } catch (Exception $e) { |
|
| 55 | 55 | if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
| 56 | 56 | $GeoidClass = FALSE; |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function get_Schedule($id,$ident) { |
|
| 61 | + public function get_Schedule($id, $ident) { |
|
| 62 | 62 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 63 | 63 | // Get schedule here, so it's done only one time |
| 64 | 64 | |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | $schedule = $Schedule->fetchSchedule($operator); |
| 84 | 84 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 85 | 85 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
| 86 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 87 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 86 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 87 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 88 | 88 | // Should also check if route schedule = route from DB |
| 89 | 89 | if ($schedule['DepartureAirportIATA'] != '') { |
| 90 | 90 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 107 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
| 108 | 108 | } |
| 109 | 109 | } else $scheduleexist = true; |
| 110 | 110 | } else $scheduleexist = true; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if ($scheduleexist) { |
| 113 | 113 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
| 114 | 114 | $sch = $Schedule->getSchedule($operator); |
| 115 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
| 115 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
| 116 | 116 | } |
| 117 | 117 | $Spotter->db = null; |
| 118 | 118 | $Schedule->db = null; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 140 | 140 | $Spotter = new Spotter($this->db); |
| 141 | 141 | $real_arrival = $this->arrival($key); |
| 142 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 142 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $airport_time = ''; |
| 154 | 154 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
| 155 | 155 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 156 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 156 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
| 157 | 157 | if (isset($closestAirports[0])) { |
| 158 | 158 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 159 | 159 | $airport_icao = $closestAirports[0]['icao']; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | break; |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 171 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
| 172 | 172 | $airport_icao = $closestAirports[0]['icao']; |
| 173 | 173 | $airport_time = $this->all_flights[$key]['datetime']; |
| 174 | 174 | } else { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } else { |
| 182 | 182 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
| 183 | 183 | } |
| 184 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 184 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 193 | 193 | foreach ($this->all_flights as $key => $flight) { |
| 194 | 194 | if (isset($flight['lastupdate'])) { |
| 195 | - if ($flight['lastupdate'] < (time()-1800)) { |
|
| 195 | + if ($flight['lastupdate'] < (time() - 1800)) { |
|
| 196 | 196 | $this->delKey($key); |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $real_arrival = $this->arrival($key); |
| 209 | 209 | $Spotter = new Spotter($this->db); |
| 210 | 210 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 211 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 211 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 212 | 212 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $send = false; |
| 242 | 242 | |
| 243 | 243 | // SBS format is CSV format |
| 244 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
| 244 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
| 245 | 245 | //print_r($line); |
| 246 | 246 | if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
| 247 | 247 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
@@ -277,25 +277,25 @@ discard block |
||
| 277 | 277 | if (!isset($this->all_flights[$id])) { |
| 278 | 278 | if ($globalDebug) echo 'New flight...'."\n"; |
| 279 | 279 | $this->all_flights[$id] = array(); |
| 280 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 281 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
| 282 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 280 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 281 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'altitude_previous' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true, 'source_type' => '')); |
|
| 282 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
| 283 | 283 | if (!isset($line['id'])) { |
| 284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 285 | 285 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
| 286 | 286 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 287 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 287 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 288 | 288 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 289 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 289 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 290 | 290 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 291 | 291 | } |
| 292 | 292 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 293 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 293 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type'])); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | //print_r($this->all_flights); |
| 297 | 297 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
| 298 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 298 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
| 299 | 299 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 300 | 300 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 301 | 301 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -304,20 +304,20 @@ discard block |
||
| 304 | 304 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 305 | 305 | $Spotter = new Spotter($this->db); |
| 306 | 306 | if (isset($this->all_flights[$id]['source_type'])) { |
| 307 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
| 307 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
| 308 | 308 | } else { |
| 309 | 309 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 310 | 310 | } |
| 311 | 311 | $Spotter->db = null; |
| 312 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 313 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 312 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 313 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 317 | 317 | if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
| 318 | 318 | } |
| 319 | 319 | if (isset($line['id']) && !isset($line['hex'])) { |
| 320 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
| 320 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => '')); |
|
| 321 | 321 | } |
| 322 | 322 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
| 323 | 323 | $icao = $line['aircraft_icao']; |
@@ -326,14 +326,14 @@ discard block |
||
| 326 | 326 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
| 327 | 327 | $Spotter->db = null; |
| 328 | 328 | } |
| 329 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
| 329 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
| 330 | 330 | } elseif (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
| 331 | 331 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 332 | 332 | // Get aircraft ICAO from aircraft name |
| 333 | 333 | $Spotter = new Spotter($this->db); |
| 334 | 334 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 335 | 335 | $Spotter->db = null; |
| 336 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 336 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -341,15 +341,15 @@ discard block |
||
| 341 | 341 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
| 342 | 342 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
| 343 | 343 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
| 344 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 344 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 345 | 345 | } |
| 346 | 346 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
| 347 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
| 347 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
| 348 | 348 | } |
| 349 | 349 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 350 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
| 350 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
| 351 | 351 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 352 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
| 352 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
| 353 | 353 | } else { |
| 354 | 354 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 355 | 355 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -360,31 +360,31 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | return ''; |
| 362 | 362 | } |
| 363 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
| 363 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
| 364 | 364 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
| 365 | 365 | return ''; |
| 366 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
| 366 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
| 367 | 367 | if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
| 368 | 368 | return ''; |
| 369 | 369 | } elseif (!isset($line['datetime'])) { |
| 370 | 370 | date_default_timezone_set('UTC'); |
| 371 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 371 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 372 | 372 | } else { |
| 373 | 373 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
| 374 | 374 | return ''; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') { |
| 378 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 378 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
| 379 | 379 | } |
| 380 | 380 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 381 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 381 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
| 382 | 382 | } |
| 383 | 383 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 384 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
| 384 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id']))); |
|
| 385 | 385 | } |
| 386 | 386 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 387 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
| 387 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name']))); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
@@ -392,13 +392,13 @@ discard block |
||
| 392 | 392 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
| 393 | 393 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 394 | 394 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
| 395 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 396 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 397 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 398 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 399 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 395 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 396 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 397 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 398 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 399 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 400 | 400 | } else { |
| 401 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 401 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 402 | 402 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 403 | 403 | $timeelapsed = microtime(true); |
| 404 | 404 | $Spotter = new Spotter($this->db); |
@@ -408,13 +408,13 @@ discard block |
||
| 408 | 408 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 409 | 409 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 410 | 410 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 411 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 411 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
| 412 | 412 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 413 | 413 | $Spotter->db = null; |
| 414 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 414 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 417 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 418 | 418 | |
| 419 | 419 | /* |
| 420 | 420 | if (!isset($line['id'])) { |
@@ -424,25 +424,25 @@ discard block |
||
| 424 | 424 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 425 | 425 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 426 | 426 | */ |
| 427 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 427 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 428 | 428 | |
| 429 | 429 | //$putinarchive = true; |
| 430 | 430 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
| 431 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 431 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 432 | 432 | } |
| 433 | 433 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
| 434 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 434 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 435 | 435 | } |
| 436 | 436 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
| 437 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 437 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 438 | 438 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
| 439 | 439 | $timeelapsed = microtime(true); |
| 440 | 440 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 441 | 441 | $Spotter = new Spotter($this->db); |
| 442 | 442 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 443 | 443 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 444 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 445 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 444 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 445 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 446 | 446 | } |
| 447 | 447 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 448 | 448 | $timeelapsed = microtime(true); |
@@ -456,35 +456,35 @@ discard block |
||
| 456 | 456 | $Translation->db = null; |
| 457 | 457 | } |
| 458 | 458 | $Spotter->db = null; |
| 459 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 459 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 460 | 460 | } |
| 461 | 461 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 462 | 462 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
| 463 | 463 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
| 464 | 464 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
| 465 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 465 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | 468 | if (!isset($globalFork)) $globalFork = TRUE; |
| 469 | 469 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 470 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 470 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
| 476 | 476 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 477 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 478 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 477 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
| 478 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
| 479 | 479 | //$dataFound = true; |
| 480 | 480 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 481 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 481 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
| 482 | 482 | if ($distance > 1000 && $distance < 10000) { |
| 483 | 483 | // use datetime |
| 484 | 484 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 485 | 485 | $speed = $speed*3.6; |
| 486 | 486 | if ($speed < 1000) { |
| 487 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 487 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
| 488 | 488 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
| 489 | 489 | } else { |
| 490 | 490 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
@@ -499,9 +499,9 @@ discard block |
||
| 499 | 499 | if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
| 500 | 500 | return false; |
| 501 | 501 | } |
| 502 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 502 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
| 503 | 503 | else unset($timediff); |
| 504 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 504 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time() - $this->all_flights[$id]['time_last_archive_coord']); |
|
| 505 | 505 | else unset($timediff_archive); |
| 506 | 506 | if ($this->tmd > 5 |
| 507 | 507 | || (isset($line['format_source']) |
@@ -526,14 +526,14 @@ discard block |
||
| 526 | 526 | || ($timediff > 30 |
| 527 | 527 | && isset($this->all_flights[$id]['latitude']) |
| 528 | 528 | && isset($this->all_flights[$id]['longitude']) |
| 529 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
| 529 | + && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')) |
|
| 530 | 530 | ) |
| 531 | 531 | ) { |
| 532 | 532 | |
| 533 | 533 | if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) { |
| 534 | 534 | if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
| 535 | 535 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
| 536 | - || !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 536 | + || !$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
| 537 | 537 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 538 | 538 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 539 | 539 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -543,11 +543,11 @@ discard block |
||
| 543 | 543 | $timeelapsed = microtime(true); |
| 544 | 544 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 545 | 545 | $Spotter = new Spotter($this->db); |
| 546 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 546 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 547 | 547 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
| 548 | 548 | else $this->all_flights[$id]['over_country'] = ''; |
| 549 | 549 | $Spotter->db = null; |
| 550 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 550 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 551 | 551 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 552 | 552 | } |
| 553 | 553 | } |
@@ -573,13 +573,13 @@ discard block |
||
| 573 | 573 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 574 | 574 | } |
| 575 | 575 | //if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
| 576 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
|
| 576 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.0001)) { |
|
| 577 | 577 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
| 578 | 578 | $dataFound = true; |
| 579 | 579 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 580 | 580 | } |
| 581 | 581 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 582 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
| 582 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
| 583 | 583 | /* |
| 584 | 584 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
| 585 | 585 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -601,13 +601,13 @@ discard block |
||
| 601 | 601 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 602 | 602 | } |
| 603 | 603 | //if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
| 604 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
|
| 604 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > 0.0001)) { |
|
| 605 | 605 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
| 606 | 606 | $dataFound = true; |
| 607 | 607 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 608 | 608 | } |
| 609 | 609 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 610 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
| 610 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
| 611 | 611 | /* |
| 612 | 612 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
| 613 | 613 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -625,46 +625,46 @@ discard block |
||
| 625 | 625 | } else if ($globalDebug && $timediff > 30) { |
| 626 | 626 | $this->tmd = $this->tmd + 1; |
| 627 | 627 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 628 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
| 629 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 628 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
| 629 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 630 | 630 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 631 | 631 | } |
| 632 | 632 | } |
| 633 | 633 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 634 | 634 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 635 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 635 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
| 636 | 636 | } |
| 637 | 637 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 638 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 638 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
| 639 | 639 | //$dataFound = true; |
| 640 | 640 | } |
| 641 | 641 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 642 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 642 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
| 643 | 643 | } |
| 644 | 644 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 645 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 645 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
| 646 | 646 | } |
| 647 | 647 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 648 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 648 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
| 649 | 649 | //$dataFound = true; |
| 650 | 650 | } |
| 651 | 651 | if (isset($line['ground']) && $line['ground'] != '') { |
| 652 | 652 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
| 653 | 653 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 654 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 655 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 656 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 657 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 658 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 654 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 655 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 656 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 657 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 658 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 659 | 659 | } |
| 660 | 660 | if ($line['ground'] != 1) $line['ground'] = 0; |
| 661 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 661 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
| 662 | 662 | //$dataFound = true; |
| 663 | 663 | } |
| 664 | 664 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 665 | 665 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 666 | 666 | if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
| 667 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 667 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 668 | 668 | $highlight = ''; |
| 669 | 669 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
| 670 | 670 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -673,66 +673,66 @@ discard block |
||
| 673 | 673 | $timeelapsed = microtime(true); |
| 674 | 674 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 675 | 675 | $Spotter = new Spotter($this->db); |
| 676 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 676 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
| 677 | 677 | $Spotter->db = null; |
| 678 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 678 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 679 | 679 | } |
| 680 | 680 | //$putinarchive = true; |
| 681 | 681 | //$highlight = ''; |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 684 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 685 | 685 | //$dataFound = true; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 689 | 689 | if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) { |
| 690 | 690 | if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') { |
| 691 | - $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2); |
|
| 691 | + $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'])*3.28084, 2); |
|
| 692 | 692 | //if ($globalDebug) echo '=> Set altitude to WGS84 Ellipsoid, add '.$geoid.' to '.$line['altitude']."\n"; |
| 693 | 693 | $line['altitude'] = $line['altitude'] - $geoid; |
| 694 | 694 | } |
| 695 | 695 | } |
| 696 | 696 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 697 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 698 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
| 699 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
| 697 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 698 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
| 699 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
| 700 | 700 | //$dataFound = true; |
| 701 | 701 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 702 | 702 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
| 703 | 703 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 704 | 704 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
| 705 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 706 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 707 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 708 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 709 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 705 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 706 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 707 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 708 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 709 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 710 | 710 | } |
| 711 | 711 | } |
| 712 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
| 712 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude'])); |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 716 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 716 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | if (isset($line['heading']) && $line['heading'] != '') { |
| 720 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 721 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 722 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 720 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 721 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
| 722 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
| 723 | 723 | //$dataFound = true; |
| 724 | 724 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 725 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 726 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 727 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 725 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 726 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
| 727 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 728 | 728 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
| 729 | 729 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 730 | 730 | // If not enough messages and ACARS set heading to 0 |
| 731 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 731 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
| 732 | 732 | } |
| 733 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 734 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 735 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
| 733 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 734 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 735 | + elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
| 736 | 736 | |
| 737 | 737 | // print_r($this->all_flights[$id]); |
| 738 | 738 | //gets the callsign from the last hour |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
| 744 | 744 | $this->all_flights[$id]['lastupdate'] = time(); |
| 745 | 745 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
| 746 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 746 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 747 | 747 | //print_r($this->all_flights); |
| 748 | 748 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
| 749 | 749 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -754,61 +754,61 @@ discard block |
||
| 754 | 754 | $SpotterLive = new SpotterLive($this->db); |
| 755 | 755 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
| 756 | 756 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 757 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 757 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 758 | 758 | } elseif (isset($line['id'])) { |
| 759 | 759 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 760 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 760 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 761 | 761 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 762 | 762 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 763 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 763 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 764 | 764 | } else $recent_ident = ''; |
| 765 | - $SpotterLive->db=null; |
|
| 765 | + $SpotterLive->db = null; |
|
| 766 | 766 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 767 | 767 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 768 | 768 | } else $recent_ident = ''; |
| 769 | 769 | } else { |
| 770 | 770 | $recent_ident = ''; |
| 771 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
| 771 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
| 772 | 772 | } |
| 773 | 773 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 774 | - if($recent_ident == "") |
|
| 774 | + if ($recent_ident == "") |
|
| 775 | 775 | { |
| 776 | 776 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 777 | 777 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 778 | 778 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 779 | 779 | //adds the spotter data for the archive |
| 780 | 780 | $ignoreImport = false; |
| 781 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 781 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 782 | 782 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 783 | 783 | $ignoreImport = true; |
| 784 | 784 | } |
| 785 | 785 | } |
| 786 | 786 | if (count($globalAirportAccept) > 0) { |
| 787 | 787 | $ignoreImport = true; |
| 788 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 788 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 789 | 789 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 790 | 790 | $ignoreImport = false; |
| 791 | 791 | } |
| 792 | 792 | } |
| 793 | 793 | } |
| 794 | 794 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 795 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 796 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 795 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 796 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 797 | 797 | $ignoreImport = true; |
| 798 | 798 | } |
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 802 | 802 | $ignoreImport = true; |
| 803 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 804 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 803 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 804 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 805 | 805 | $ignoreImport = false; |
| 806 | 806 | } |
| 807 | 807 | } |
| 808 | 808 | } |
| 809 | 809 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 810 | 810 | $ignoreImport = true; |
| 811 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 811 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 812 | 812 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 813 | 813 | $ignoreImport = false; |
| 814 | 814 | } |
@@ -820,32 +820,32 @@ discard block |
||
| 820 | 820 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
| 821 | 821 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
| 822 | 822 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
| 823 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 823 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 824 | 824 | $timeelapsed = microtime(true); |
| 825 | 825 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 826 | 826 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 827 | 827 | $Spotter = new Spotter($this->db); |
| 828 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
| 828 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['source_type']); |
|
| 829 | 829 | $Spotter->db = null; |
| 830 | 830 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 833 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 834 | 834 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 835 | 835 | |
| 836 | 836 | // Add source stat in DB |
| 837 | 837 | $Stats = new Stats($this->db); |
| 838 | 838 | if (!empty($this->stats)) { |
| 839 | 839 | if ($globalDebug) echo 'Add source stats : '; |
| 840 | - foreach($this->stats as $date => $data) { |
|
| 841 | - foreach($data as $source => $sourced) { |
|
| 840 | + foreach ($this->stats as $date => $data) { |
|
| 841 | + foreach ($data as $source => $sourced) { |
|
| 842 | 842 | //print_r($sourced); |
| 843 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 844 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 843 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
| 844 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
| 845 | 845 | if (isset($sourced['msg'])) { |
| 846 | 846 | if (time() - $sourced['msg']['date'] > 10) { |
| 847 | 847 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
| 848 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 848 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
| 849 | 849 | unset($this->stats[$date][$source]['msg']); |
| 850 | 850 | } |
| 851 | 851 | } |
@@ -883,14 +883,14 @@ discard block |
||
| 883 | 883 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 884 | 884 | $SpotterLive = new SpotterLive($this->db); |
| 885 | 885 | $SpotterLive->deleteLiveSpotterData(); |
| 886 | - $SpotterLive->db=null; |
|
| 886 | + $SpotterLive->db = null; |
|
| 887 | 887 | } |
| 888 | 888 | } |
| 889 | 889 | if ($globalDebug) echo " Done\n"; |
| 890 | 890 | $this->last_delete = time(); |
| 891 | 891 | } |
| 892 | 892 | } else { |
| 893 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
| 893 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
| 894 | 894 | $this->all_flights[$id]['id'] = $recent_ident; |
| 895 | 895 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 896 | 896 | } |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 899 | 899 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 900 | 900 | $Spotter = new Spotter($this->db); |
| 901 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
| 901 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
| 902 | 902 | $Spotter->db = null; |
| 903 | 903 | } |
| 904 | 904 | } |
@@ -924,37 +924,37 @@ discard block |
||
| 924 | 924 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 925 | 925 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 926 | 926 | |
| 927 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 927 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 928 | 928 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 929 | 929 | $ignoreImport = true; |
| 930 | 930 | } |
| 931 | 931 | } |
| 932 | 932 | if (count($globalAirportAccept) > 0) { |
| 933 | 933 | $ignoreImport = true; |
| 934 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 934 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 935 | 935 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 936 | 936 | $ignoreImport = false; |
| 937 | 937 | } |
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 941 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 942 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 941 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 942 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 943 | 943 | $ignoreImport = true; |
| 944 | 944 | } |
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 948 | 948 | $ignoreImport = true; |
| 949 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 950 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 949 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 950 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 951 | 951 | $ignoreImport = false; |
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | } |
| 955 | 955 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 956 | 956 | $ignoreImport = true; |
| 957 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 957 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 958 | 958 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 959 | 959 | $ignoreImport = false; |
| 960 | 960 | } |
@@ -962,23 +962,23 @@ discard block |
||
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | if (!$ignoreImport) { |
| 965 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 966 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 965 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 966 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 967 | 967 | $timeelapsed = microtime(true); |
| 968 | 968 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 969 | 969 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 970 | 970 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 971 | 971 | $SpotterLive = new SpotterLive($this->db); |
| 972 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
| 972 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
| 973 | 973 | $SpotterLive->db = null; |
| 974 | 974 | if ($globalDebug) echo $result."\n"; |
| 975 | 975 | } |
| 976 | 976 | } |
| 977 | 977 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 978 | - $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
| 978 | + $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
| 979 | 979 | } |
| 980 | 980 | $this->all_flights[$id]['putinarchive'] = false; |
| 981 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 981 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 982 | 982 | |
| 983 | 983 | // Put statistics in $this->stats variable |
| 984 | 984 | //if ($line['format_source'] != 'aprs') { |
@@ -997,19 +997,19 @@ discard block |
||
| 997 | 997 | $latitude = $globalCenterLatitude; |
| 998 | 998 | $longitude = $globalCenterLongitude; |
| 999 | 999 | } |
| 1000 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
| 1000 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
| 1001 | 1001 | } else { |
| 1002 | 1002 | $latitude = $this->source_location[$source]['latitude']; |
| 1003 | 1003 | $longitude = $this->source_location[$source]['longitude']; |
| 1004 | 1004 | } |
| 1005 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 1005 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 1006 | 1006 | //$stats_heading = $stats_heading%22.5; |
| 1007 | 1007 | $stats_heading = round($stats_heading/22.5); |
| 1008 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 1008 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 1009 | 1009 | $current_date = date('Y-m-d'); |
| 1010 | 1010 | if ($stats_heading == 16) $stats_heading = 0; |
| 1011 | 1011 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 1012 | - for ($i=0;$i<=15;$i++) { |
|
| 1012 | + for ($i = 0; $i <= 15; $i++) { |
|
| 1013 | 1013 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
| 1014 | 1014 | } |
| 1015 | 1015 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -1024,9 +1024,9 @@ discard block |
||
| 1024 | 1024 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 1025 | 1025 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 1026 | 1026 | end($this->stats[$current_date][$source]['hist']); |
| 1027 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 1027 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
| 1028 | 1028 | } else $mini = 0; |
| 1029 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
| 1029 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
| 1030 | 1030 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 1031 | 1031 | } |
| 1032 | 1032 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | $this->all_flights[$id]['lastupdate'] = time(); |
| 1040 | 1040 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
| 1041 | 1041 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 1042 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1042 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
| 1043 | 1043 | //$this->del(); |
| 1044 | 1044 | |
| 1045 | 1045 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |