@@ -516,8 +516,8 @@ discard block |
||
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | <?php |
| 519 | - } else { |
|
| 520 | - ?> |
|
| 519 | + } else { |
|
| 520 | + ?> |
|
| 521 | 521 | if (map.getZoom() > 7) { |
| 522 | 522 | var style = { |
| 523 | 523 | "color": "#1a3151", |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | layer_marine_data.addLayer(layer); |
| 537 | 537 | } |
| 538 | 538 | <?php |
| 539 | - } |
|
| 539 | + } |
|
| 540 | 540 | ?> |
| 541 | 541 | } |
| 542 | 542 | } |
@@ -517,8 +517,8 @@ discard block |
||
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | 519 | <?php |
| 520 | - } else { |
|
| 521 | - ?> |
|
| 520 | + } else { |
|
| 521 | + ?> |
|
| 522 | 522 | if (map.getZoom() > 7) { |
| 523 | 523 | var style = { |
| 524 | 524 | "color": "#1a3151", |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | layer_tracker_data.addLayer(layer); |
| 538 | 538 | } |
| 539 | 539 | <?php |
| 540 | - } |
|
| 540 | + } |
|
| 541 | 541 | ?> |
| 542 | 542 | } |
| 543 | 543 | } |
@@ -352,10 +352,10 @@ discard block |
||
| 352 | 352 | }); |
| 353 | 353 | update_locationsLayer(); |
| 354 | 354 | <?php |
| 355 | - // Add support for custom json via $globalMapJson |
|
| 356 | - if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
| 355 | + // Add support for custom json via $globalMapJson |
|
| 356 | + if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
| 357 | 357 | foreach ($globalMapJson as $json) { |
| 358 | - if (isset($json['url'])) { |
|
| 358 | + if (isset($json['url'])) { |
|
| 359 | 359 | ?> |
| 360 | 360 | update_genLayer('<?php print $json['url']; ?>'); |
| 361 | 361 | <?php |
@@ -364,9 +364,9 @@ discard block |
||
| 364 | 364 | setInterval(function(){update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>); |
| 365 | 365 | <?php |
| 366 | 366 | } |
| 367 | - } |
|
| 367 | + } |
|
| 368 | + } |
|
| 368 | 369 | } |
| 369 | - } |
|
| 370 | 370 | |
| 371 | 371 | ?> |
| 372 | 372 | //adds the bootstrap tooltip to the map icons |
@@ -34,30 +34,30 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
| 37 | - // Assuming the angles are in radians. |
|
| 38 | - $c1 = cos($heading/2); |
|
| 39 | - $s1 = sin($heading/2); |
|
| 40 | - $c2 = cos($attitude/2); |
|
| 41 | - $s2 = sin($attitude/2); |
|
| 42 | - $c3 = cos($bank/2); |
|
| 43 | - $s3 = sin($bank/2); |
|
| 44 | - $c1c2 = $c1*$c2; |
|
| 45 | - $s1s2 = $s1*$s2; |
|
| 46 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 47 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 48 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 49 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 50 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 37 | + // Assuming the angles are in radians. |
|
| 38 | + $c1 = cos($heading/2); |
|
| 39 | + $s1 = sin($heading/2); |
|
| 40 | + $c2 = cos($attitude/2); |
|
| 41 | + $s2 = sin($attitude/2); |
|
| 42 | + $c3 = cos($bank/2); |
|
| 43 | + $s3 = sin($bank/2); |
|
| 44 | + $c1c2 = $c1*$c2; |
|
| 45 | + $s1s2 = $s1*$s2; |
|
| 46 | + $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 47 | + $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 48 | + $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 49 | + $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 50 | + return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 51 | 51 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
| 52 | 52 | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | if (isset($_GET['download'])) { |
| 57 | - if ($_GET['download'] == "true") |
|
| 58 | - { |
|
| 57 | + if ($_GET['download'] == "true") |
|
| 58 | + { |
|
| 59 | 59 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
| 60 | - } |
|
| 60 | + } |
|
| 61 | 61 | } |
| 62 | 62 | header('Content-Type: text/javascript'); |
| 63 | 63 | |
@@ -220,10 +220,10 @@ discard block |
||
| 220 | 220 | $image = "images/placeholder_thumb.png"; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
| 224 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
| 225 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
| 226 | - if ($prev_flightaware_id != $id) { |
|
| 223 | + if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
| 224 | + elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
| 225 | + elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
| 226 | + if ($prev_flightaware_id != $id) { |
|
| 227 | 227 | if ($prev_flightaware_id != '') { |
| 228 | 228 | $output .= ']'; |
| 229 | 229 | $output .= '}'; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // When button "Remove all filters" is clicked |
| 29 | 29 | if (isset($_POST['removefilters'])) { |
| 30 | 30 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
| 31 | - return strpos($key,'filter_') === 0; |
|
| 31 | + return strpos($key,'filter_') === 0; |
|
| 32 | 32 | }); |
| 33 | 33 | foreach ($allfilters as $filt) { |
| 34 | 34 | unset($_COOKIE[$filt]); |
@@ -168,17 +168,17 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | ?> |
| 170 | 170 | <?php |
| 171 | - if (isset($_POST['archive'])) { |
|
| 171 | + if (isset($_POST['archive'])) { |
|
| 172 | 172 | ?> |
| 173 | 173 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 174 | 174 | <?php |
| 175 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 175 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 176 | 176 | ?> |
| 177 | 177 | |
| 178 | 178 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script> |
| 179 | 179 | <?php |
| 180 | - } |
|
| 181 | - } else { |
|
| 180 | + } |
|
| 181 | + } else { |
|
| 182 | 182 | ?> |
| 183 | 183 | <?php |
| 184 | 184 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | ?> |
| 192 | 192 | <?php |
| 193 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 193 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 194 | 194 | ?> |
| 195 | 195 | <?php |
| 196 | 196 | // if (isset($globalBeta) && $globalBeta) { |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | <script src="<?php print $globalURL; ?>/js/map-marine.2d.js.php?<?php print time(); ?>"></script> |
| 218 | 218 | <?php |
| 219 | 219 | } |
| 220 | - } |
|
| 220 | + } |
|
| 221 | 221 | ?> |
| 222 | 222 | <?php |
| 223 | 223 | // } |
| 224 | 224 | ?> |
| 225 | 225 | <?php |
| 226 | - } |
|
| 226 | + } |
|
| 227 | 227 | } |
| 228 | 228 | ?> |
| 229 | 229 | <?php |
@@ -380,15 +380,15 @@ discard block |
||
| 380 | 380 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
| 381 | 381 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
| 382 | 382 | <?php |
| 383 | - if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 383 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 384 | 384 | ?> |
| 385 | 385 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
| 386 | 386 | <?php |
| 387 | - } else { |
|
| 387 | + } else { |
|
| 388 | 388 | ?> |
| 389 | 389 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
| 390 | 390 | <?php |
| 391 | - } |
|
| 391 | + } |
|
| 392 | 392 | ?> |
| 393 | 393 | <li><hr /></li> |
| 394 | 394 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -396,34 +396,34 @@ discard block |
||
| 396 | 396 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
| 397 | 397 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
| 398 | 398 | <?php |
| 399 | - if ($globalACARS) { |
|
| 400 | - if (isset($globalDemo) && $globalDemo) { |
|
| 401 | - ?> |
|
| 399 | + if ($globalACARS) { |
|
| 400 | + if (isset($globalDemo) && $globalDemo) { |
|
| 401 | + ?> |
|
| 402 | 402 | <li><hr /></li> |
| 403 | 403 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
| 404 | 404 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
| 405 | 405 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
| 406 | 406 | <?php |
| 407 | - } else { |
|
| 408 | - ?> |
|
| 407 | + } else { |
|
| 408 | + ?> |
|
| 409 | 409 | <li><hr /></li> |
| 410 | 410 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
| 411 | 411 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
| 412 | 412 | <?php |
| 413 | - } |
|
| 414 | - } |
|
| 415 | - ?> |
|
| 413 | + } |
|
| 414 | + } |
|
| 415 | + ?> |
|
| 416 | 416 | <?php |
| 417 | - if (isset($globalAccidents) && $globalAccidents) { |
|
| 418 | - ?> |
|
| 417 | + if (isset($globalAccidents) && $globalAccidents) { |
|
| 418 | + ?> |
|
| 419 | 419 | <li><hr /></li> |
| 420 | 420 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
| 421 | 421 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
| 422 | 422 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
| 423 | 423 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
| 424 | 424 | <?php |
| 425 | - } |
|
| 426 | - ?> |
|
| 425 | + } |
|
| 426 | + ?> |
|
| 427 | 427 | <li><hr /></li> |
| 428 | 428 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
| 429 | 429 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
@@ -465,14 +465,14 @@ discard block |
||
| 465 | 465 | <form> |
| 466 | 466 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
| 467 | 467 | <?php |
| 468 | - $Language = new Language(); |
|
| 469 | - $alllang = $Language->getLanguages(); |
|
| 470 | - foreach ($alllang as $key => $lang) { |
|
| 471 | - print '<option value="'.$key.'"'; |
|
| 472 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 473 | - print '>'.$lang[0].'</option>'; |
|
| 474 | - } |
|
| 475 | - ?> |
|
| 468 | + $Language = new Language(); |
|
| 469 | + $alllang = $Language->getLanguages(); |
|
| 470 | + foreach ($alllang as $key => $lang) { |
|
| 471 | + print '<option value="'.$key.'"'; |
|
| 472 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 473 | + print '>'.$lang[0].'</option>'; |
|
| 474 | + } |
|
| 475 | + ?> |
|
| 476 | 476 | </select> |
| 477 | 477 | </form> |
| 478 | 478 | </div> |
@@ -503,18 +503,18 @@ discard block |
||
| 503 | 503 | ?> |
| 504 | 504 | <div class="top-header clear" role="main"> |
| 505 | 505 | <?php |
| 506 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 506 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 507 | 507 | ?> |
| 508 | 508 | <div id="archive-map"></div> |
| 509 | 509 | <?php |
| 510 | - } |
|
| 510 | + } |
|
| 511 | 511 | ?> |
| 512 | 512 | </div> |
| 513 | 513 | <?php |
| 514 | 514 | } |
| 515 | 515 | if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
| 516 | 516 | { |
| 517 | - ?> |
|
| 517 | + ?> |
|
| 518 | 518 | <div class="top-header clear" role="main"> |
| 519 | 519 | <div id="map"></div> |
| 520 | 520 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -525,15 +525,15 @@ discard block |
||
| 525 | 525 | var zoom = 13; |
| 526 | 526 | //create the map |
| 527 | 527 | <?php |
| 528 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 528 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 529 | 529 | ?> |
| 530 | 530 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
| 531 | 531 | <?php |
| 532 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 532 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 533 | 533 | ?> |
| 534 | 534 | map = L.map('map', { zoomControl:true }); |
| 535 | 535 | <?php |
| 536 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 536 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 537 | 537 | ?> |
| 538 | 538 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
| 539 | 539 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -541,22 +541,22 @@ discard block |
||
| 541 | 541 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 542 | 542 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 543 | 543 | <?php |
| 544 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 544 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 545 | 545 | ?> |
| 546 | 546 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
| 547 | 547 | <?php |
| 548 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 548 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 549 | 549 | ?> |
| 550 | 550 | map = L.map('map', { zoomControl:true }); |
| 551 | 551 | <?php |
| 552 | - } |
|
| 552 | + } |
|
| 553 | 553 | ?> |
| 554 | 554 | //initialize the layer group for the aircrft markers |
| 555 | 555 | var layer_data = L.layerGroup(); |
| 556 | 556 | |
| 557 | 557 | //a few title layers |
| 558 | 558 | <?php |
| 559 | - if ($globalMapProvider == 'Mapbox') { |
|
| 559 | + if ($globalMapProvider == 'Mapbox') { |
|
| 560 | 560 | ?> |
| 561 | 561 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
| 562 | 562 | maxZoom: 18, |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | token : '<?php print $globalMapboxToken; ?>' |
| 568 | 568 | }).addTo(map); |
| 569 | 569 | <?php |
| 570 | - } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 570 | + } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 571 | 571 | ?> |
| 572 | 572 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| 573 | 573 | maxZoom: 18, |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>' |
| 576 | 576 | }).addTo(map); |
| 577 | 577 | <?php |
| 578 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 578 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 579 | 579 | ?> |
| 580 | 580 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
| 581 | 581 | maxZoom: 18, |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
| 585 | 585 | }).addTo(map); |
| 586 | 586 | <?php |
| 587 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 587 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 588 | 588 | ?> |
| 589 | 589 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
| 590 | 590 | maxZoom: 18, |
@@ -593,27 +593,27 @@ discard block |
||
| 593 | 593 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"' |
| 594 | 594 | }).addTo(map); |
| 595 | 595 | <?php |
| 596 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 596 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 597 | 597 | ?> |
| 598 | 598 | var googleLayer = new L.Google('ROADMAP'); |
| 599 | 599 | map.addLayer(googleLayer); |
| 600 | 600 | <?php |
| 601 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 601 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 602 | 602 | ?> |
| 603 | 603 | var googleLayer = new L.Google('SATELLITE'); |
| 604 | 604 | map.addLayer(googleLayer); |
| 605 | 605 | <?php |
| 606 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 606 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 607 | 607 | ?> |
| 608 | 608 | var googleLayer = new L.Google('HYBRID'); |
| 609 | 609 | map.addLayer(googleLayer); |
| 610 | 610 | <?php |
| 611 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 611 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 612 | 612 | ?> |
| 613 | 613 | var googleLayer = new L.Google('Terrain'); |
| 614 | 614 | map.addLayer(googleLayer); |
| 615 | 615 | <?php |
| 616 | - } |
|
| 616 | + } |
|
| 617 | 617 | ?> |
| 618 | 618 | </script> |
| 619 | 619 | </div> |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | <div id="showdetails" class="showdetails"></div> |
| 37 | 37 | <div id="infobox" class="infobox"><h4><?php echo _("Aircrafts detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div> |
| 38 | 38 | <?php |
| 39 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
| 39 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
| 40 | 40 | |
| 41 | 41 | ?> |
| 42 | 42 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script> |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script> |
| 57 | 57 | <?php |
| 58 | 58 | } |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | ?> |
| 61 | 61 | <div id="dialog" title="<?php echo _("Session has timed-out"); ?>"> |
| 62 | 62 | <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p> |
@@ -70,34 +70,34 @@ discard block |
||
| 70 | 70 | <li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
| 71 | 71 | <li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
| 72 | 72 | <?php |
| 73 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 73 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 74 | 74 | if (isset($globalArchive) && $globalArchive == TRUE) { |
| 75 | 75 | ?> |
| 76 | 76 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
| 77 | 77 | <?php |
| 78 | 78 | } |
| 79 | - } |
|
| 79 | + } |
|
| 80 | 80 | ?> |
| 81 | 81 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
| 82 | 82 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
| 83 | 83 | <li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li> |
| 84 | 84 | <?php |
| 85 | - if (isset($globalMap3D) && $globalMap3D) { |
|
| 85 | + if (isset($globalMap3D) && $globalMap3D) { |
|
| 86 | 86 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
| 87 | 87 | ?> |
| 88 | 88 | <li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
| 89 | 89 | <?php |
| 90 | - } else { |
|
| 91 | - if (isset($globalMapSatellites) && $globalMapSatellites) { |
|
| 90 | + } else { |
|
| 91 | + if (isset($globalMapSatellites) && $globalMapSatellites) { |
|
| 92 | 92 | ?> |
| 93 | 93 | <li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li> |
| 94 | 94 | <?php |
| 95 | - } |
|
| 95 | + } |
|
| 96 | 96 | ?> |
| 97 | 97 | <li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
| 98 | 98 | <?php |
| 99 | 99 | } |
| 100 | - } |
|
| 100 | + } |
|
| 101 | 101 | ?> |
| 102 | 102 | </ul> |
| 103 | 103 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | ?> |
| 172 | 172 | </div> |
| 173 | 173 | <?php |
| 174 | - if (isset($globalArchive) && $globalArchive == TRUE) { |
|
| 174 | + if (isset($globalArchive) && $globalArchive == TRUE) { |
|
| 175 | 175 | ?> |
| 176 | 176 | <div class="sidebar-pane" id="archive"> |
| 177 | 177 | <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | </form> |
| 232 | 232 | </div> |
| 233 | 233 | <?php |
| 234 | - } |
|
| 234 | + } |
|
| 235 | 235 | ?> |
| 236 | 236 | <div class="sidebar-pane" id="settings"> |
| 237 | 237 | <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -242,56 +242,56 @@ discard block |
||
| 242 | 242 | <?php |
| 243 | 243 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
| 244 | 244 | else $MapType = $_COOKIE['MapType']; |
| 245 | - ?> |
|
| 245 | + ?> |
|
| 246 | 246 | <?php |
| 247 | 247 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
| 248 | - ?> |
|
| 248 | + ?> |
|
| 249 | 249 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
| 250 | 250 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
| 251 | 251 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
| 252 | 252 | <?php |
| 253 | 253 | } |
| 254 | - ?> |
|
| 254 | + ?> |
|
| 255 | 255 | <?php |
| 256 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 257 | - ?> |
|
| 256 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 257 | + ?> |
|
| 258 | 258 | <?php |
| 259 | - if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
| 260 | - ?> |
|
| 259 | + if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
| 260 | + ?> |
|
| 261 | 261 | <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
| 262 | 262 | <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
| 263 | 263 | <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
| 264 | 264 | <?php |
| 265 | - } |
|
| 266 | - ?> |
|
| 265 | + } |
|
| 266 | + ?> |
|
| 267 | 267 | <?php |
| 268 | - if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
| 269 | - ?> |
|
| 268 | + if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
| 269 | + ?> |
|
| 270 | 270 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
| 271 | 271 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
| 272 | 272 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
| 273 | 273 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
| 274 | 274 | <?php |
| 275 | - } |
|
| 276 | - ?> |
|
| 275 | + } |
|
| 276 | + ?> |
|
| 277 | 277 | <?php |
| 278 | - if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
| 279 | - ?> |
|
| 278 | + if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
| 279 | + ?> |
|
| 280 | 280 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
| 281 | 281 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
| 282 | 282 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
| 283 | 283 | <?php |
| 284 | - } |
|
| 285 | - ?> |
|
| 284 | + } |
|
| 285 | + ?> |
|
| 286 | 286 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
| 287 | 287 | <?php |
| 288 | 288 | } |
| 289 | - ?> |
|
| 289 | + ?> |
|
| 290 | 290 | <?php |
| 291 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
| 291 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
| 292 | 292 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
| 293 | 293 | else $MapBoxId = $_COOKIE['MapTypeId']; |
| 294 | - ?> |
|
| 294 | + ?> |
|
| 295 | 295 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
| 296 | 296 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
| 297 | 297 | <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
@@ -305,13 +305,13 @@ discard block |
||
| 305 | 305 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
| 306 | 306 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
| 307 | 307 | <?php |
| 308 | - } |
|
| 309 | - ?> |
|
| 308 | + } |
|
| 309 | + ?> |
|
| 310 | 310 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
| 311 | 311 | </select> |
| 312 | 312 | </li> |
| 313 | 313 | <?php |
| 314 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 314 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 315 | 315 | ?> |
| 316 | 316 | <li><?php echo _("Type of Terrain:"); ?> |
| 317 | 317 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | </select> |
| 322 | 322 | </li> |
| 323 | 323 | <?php |
| 324 | - } |
|
| 324 | + } |
|
| 325 | 325 | ?> |
| 326 | 326 | <?php |
| 327 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 327 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 328 | 328 | ?> |
| 329 | 329 | |
| 330 | 330 | <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> |
@@ -332,59 +332,59 @@ discard block |
||
| 332 | 332 | <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'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
| 333 | 333 | <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> |
| 334 | 334 | <?php |
| 335 | - } |
|
| 335 | + } |
|
| 336 | 336 | ?> |
| 337 | 337 | <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
| 338 | 338 | <?php |
| 339 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 339 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 340 | 340 | ?> |
| 341 | 341 | <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> |
| 342 | 342 | <?php |
| 343 | - } |
|
| 344 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
| 343 | + } |
|
| 344 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
| 345 | 345 | ?> |
| 346 | 346 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
| 347 | 347 | <?php |
| 348 | - } |
|
| 348 | + } |
|
| 349 | 349 | ?> |
| 350 | 350 | |
| 351 | 351 | <?php |
| 352 | 352 | if (function_exists('array_column')) { |
| 353 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
| 354 | - ?> |
|
| 353 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
| 354 | + ?> |
|
| 355 | 355 | <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> |
| 356 | 356 | <?php |
| 357 | - } |
|
| 357 | + } |
|
| 358 | 358 | } elseif (isset($globalSources)) { |
| 359 | - $dispolar = false; |
|
| 360 | - foreach ($globalSources as $testsource) { |
|
| 361 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 362 | - } |
|
| 363 | - if ($dispolar) { |
|
| 364 | - ?> |
|
| 359 | + $dispolar = false; |
|
| 360 | + foreach ($globalSources as $testsource) { |
|
| 361 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 362 | + } |
|
| 363 | + if ($dispolar) { |
|
| 364 | + ?> |
|
| 365 | 365 | <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> |
| 366 | 366 | <?php |
| 367 | - } |
|
| 368 | - } |
|
| 369 | - ?> |
|
| 367 | + } |
|
| 368 | + } |
|
| 369 | + ?> |
|
| 370 | 370 | <?php |
| 371 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 371 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 372 | 372 | ?> |
| 373 | 373 | |
| 374 | 374 | <?php |
| 375 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 376 | - ?> |
|
| 375 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 376 | + ?> |
|
| 377 | 377 | <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> |
| 378 | 378 | <?php |
| 379 | 379 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
| 380 | - ?> |
|
| 380 | + ?> |
|
| 381 | 381 | <li><?php echo _("Aircraft icon color:"); ?> |
| 382 | 382 | <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'; ?>"> |
| 383 | 383 | </li> |
| 384 | 384 | <?php |
| 385 | - } |
|
| 386 | - } |
|
| 387 | - ?> |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | + ?> |
|
| 388 | 388 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
| 389 | 389 | <div class="range"> |
| 390 | 390 | <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'; ?>"> |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | </div> |
| 393 | 393 | </li> |
| 394 | 394 | <?php |
| 395 | - } |
|
| 395 | + } |
|
| 396 | 396 | ?> |
| 397 | 397 | <li><?php echo _("Distance unit:"); ?> |
| 398 | 398 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -425,16 +425,16 @@ discard block |
||
| 425 | 425 | <ul> |
| 426 | 426 | <?php |
| 427 | 427 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
| 428 | - ?> |
|
| 428 | + ?> |
|
| 429 | 429 | <?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 } ?> |
| 430 | 430 | <?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 } ?> |
| 431 | 431 | <?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 } ?> |
| 432 | 432 | <?php |
| 433 | 433 | } |
| 434 | - ?> |
|
| 434 | + ?> |
|
| 435 | 435 | <?php |
| 436 | 436 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
| 437 | - ?> |
|
| 437 | + ?> |
|
| 438 | 438 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
| 439 | 439 | <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> |
| 440 | 440 | <?php } ?> |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | <?php } ?> |
| 444 | 444 | <?php |
| 445 | 445 | } |
| 446 | - ?> |
|
| 446 | + ?> |
|
| 447 | 447 | <li><?php echo _("Display airlines:"); ?> |
| 448 | 448 | <br/> |
| 449 | 449 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -463,14 +463,14 @@ discard block |
||
| 463 | 463 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | - ?> |
|
| 466 | + ?> |
|
| 467 | 467 | </select> |
| 468 | 468 | </li> |
| 469 | 469 | <?php |
| 470 | 470 | $Spotter = new Spotter(); |
| 471 | 471 | $allalliancenames = $Spotter->getAllAllianceNames(); |
| 472 | 472 | if (!empty($allalliancenames)) { |
| 473 | - ?> |
|
| 473 | + ?> |
|
| 474 | 474 | <li><?php echo _("Display alliance:"); ?> |
| 475 | 475 | <br/> |
| 476 | 476 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
@@ -484,15 +484,15 @@ discard block |
||
| 484 | 484 | echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>'; |
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | - ?> |
|
| 487 | + ?> |
|
| 488 | 488 | </select> |
| 489 | 489 | </li> |
| 490 | 490 | <?php |
| 491 | 491 | } |
| 492 | - ?> |
|
| 492 | + ?> |
|
| 493 | 493 | <?php |
| 494 | 494 | if (isset($globalAPRS) && $globalAPRS) { |
| 495 | - ?> |
|
| 495 | + ?> |
|
| 496 | 496 | <li><?php echo _("Display APRS sources name:"); ?> |
| 497 | 497 | <select class="selectpicker" multiple onchange="sources(this);"> |
| 498 | 498 | <?php |
@@ -504,15 +504,15 @@ discard block |
||
| 504 | 504 | echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>'; |
| 505 | 505 | } |
| 506 | 506 | } |
| 507 | - ?> |
|
| 507 | + ?> |
|
| 508 | 508 | </select> |
| 509 | 509 | </li> |
| 510 | 510 | <?php |
| 511 | 511 | } |
| 512 | - ?> |
|
| 512 | + ?> |
|
| 513 | 513 | <?php |
| 514 | 514 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
| 515 | - ?> |
|
| 515 | + ?> |
|
| 516 | 516 | <li><?php echo _("Display airlines of type:"); ?><br/> |
| 517 | 517 | <select class="selectpicker" onchange="airlinestype(this);"> |
| 518 | 518 | <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | </li> |
| 524 | 524 | <?php |
| 525 | 525 | } |
| 526 | - ?> |
|
| 526 | + ?> |
|
| 527 | 527 | <li> |
| 528 | 528 | <?php echo _("Display flight with ident:"); ?> |
| 529 | 529 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | </form> |
| 537 | 537 | </div> |
| 538 | 538 | <?php |
| 539 | - if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 539 | + if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 540 | 540 | ?> |
| 541 | 541 | <div class="sidebar-pane" id="satellites"> |
| 542 | 542 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -576,14 +576,14 @@ discard block |
||
| 576 | 576 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | - ?> |
|
| 579 | + ?> |
|
| 580 | 580 | </select> |
| 581 | 581 | </li> |
| 582 | 582 | </ul> |
| 583 | 583 | </form> |
| 584 | 584 | </div> |
| 585 | 585 | <?php |
| 586 | - } |
|
| 586 | + } |
|
| 587 | 587 | ?> |
| 588 | 588 | </div> |
| 589 | 589 | </div> |
@@ -4,31 +4,31 @@ discard block |
||
| 4 | 4 | $hex = str_replace("#", "", $hex); |
| 5 | 5 | $color = array(); |
| 6 | 6 | if (strlen($hex) == 3) { |
| 7 | - $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1)); |
|
| 8 | - $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1)); |
|
| 9 | - $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1)); |
|
| 7 | + $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1)); |
|
| 8 | + $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1)); |
|
| 9 | + $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1)); |
|
| 10 | 10 | } else if (strlen($hex) == 6) { |
| 11 | - $color['r'] = hexdec(substr($hex, 0, 2)); |
|
| 12 | - $color['g'] = hexdec(substr($hex, 2, 2)); |
|
| 13 | - $color['b'] = hexdec(substr($hex, 4, 2)); |
|
| 11 | + $color['r'] = hexdec(substr($hex, 0, 2)); |
|
| 12 | + $color['g'] = hexdec(substr($hex, 2, 2)); |
|
| 13 | + $color['b'] = hexdec(substr($hex, 4, 2)); |
|
| 14 | 14 | } |
| 15 | 15 | return $color; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { |
| 20 | - exit(0); |
|
| 20 | + exit(0); |
|
| 21 | 21 | } |
| 22 | 22 | $color = $_GET['color']; |
| 23 | 23 | if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) { |
| 24 | - echo "Incorrect filename"; |
|
| 25 | - exit(0); |
|
| 24 | + echo "Incorrect filename"; |
|
| 25 | + exit(0); |
|
| 26 | 26 | } |
| 27 | 27 | $filename = $_GET['filename']; |
| 28 | 28 | if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename)) { |
| 29 | - header('Content-type: image/png'); |
|
| 30 | - readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename); |
|
| 31 | - exit(0); |
|
| 29 | + header('Content-type: image/png'); |
|
| 30 | + readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename); |
|
| 31 | + exit(0); |
|
| 32 | 32 | } |
| 33 | 33 | if (isset($_GET['tracker'])) { |
| 34 | 34 | $original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'vehicules'.DIRECTORY_SEPARATOR.$filename; |
@@ -38,66 +38,66 @@ discard block |
||
| 38 | 38 | $original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'aircrafts'.DIRECTORY_SEPARATOR.'new'.DIRECTORY_SEPARATOR.$filename; |
| 39 | 39 | } |
| 40 | 40 | if (!file_exists($original)) { |
| 41 | - echo "File not found"; |
|
| 41 | + echo "File not found"; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 45 | - $image = imagecreatefrompng($original); |
|
| 46 | - $index = imagecolorexact($image,26,49,81); |
|
| 47 | - if ($index < 0) { |
|
| 45 | + $image = imagecreatefrompng($original); |
|
| 46 | + $index = imagecolorexact($image,26,49,81); |
|
| 47 | + if ($index < 0) { |
|
| 48 | 48 | $index = imagecolorexact($image,25,49,79); |
| 49 | - } |
|
| 50 | - if ($index < 0) { |
|
| 49 | + } |
|
| 50 | + if ($index < 0) { |
|
| 51 | 51 | $index = imagecolorexact($image,0,0,0); |
| 52 | - } |
|
| 53 | - $c = hexToRGB($color); |
|
| 54 | - imagecolorset($image,$index,$c['r'],$c['g'],$c['b']); |
|
| 52 | + } |
|
| 53 | + $c = hexToRGB($color); |
|
| 54 | + imagecolorset($image,$index,$c['r'],$c['g'],$c['b']); |
|
| 55 | 55 | /* |
| 56 | 56 | $ig = imagecolorat($image, 0, 0); |
| 57 | 57 | imagecolortransparent($image, $ig); |
| 58 | 58 | */ |
| 59 | 59 | |
| 60 | - header('Content-type: image/png'); |
|
| 61 | - if (isset($_GET['resize']) && function_exists('imagecopyresampled')) { |
|
| 60 | + header('Content-type: image/png'); |
|
| 61 | + if (isset($_GET['resize']) && function_exists('imagecopyresampled')) { |
|
| 62 | 62 | $resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT); |
| 63 | 63 | $newimg = imagecreatetruecolor($resize,$resize); |
| 64 | - imagealphablending($newimg, false); |
|
| 64 | + imagealphablending($newimg, false); |
|
| 65 | 65 | imagesavealpha($newimg, true); |
| 66 | 66 | imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image)); |
| 67 | 67 | if (isset($_GET['heading'])) { |
| 68 | - $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT); |
|
| 69 | - $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127)); |
|
| 70 | - imagealphablending($rotation, false); |
|
| 71 | - imagesavealpha($rotation, true); |
|
| 72 | - imagepng($rotation); |
|
| 73 | - imagedestroy($newimg); |
|
| 74 | - imagedestroy($image); |
|
| 75 | - imagedestroy($rotation); |
|
| 68 | + $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT); |
|
| 69 | + $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127)); |
|
| 70 | + imagealphablending($rotation, false); |
|
| 71 | + imagesavealpha($rotation, true); |
|
| 72 | + imagepng($rotation); |
|
| 73 | + imagedestroy($newimg); |
|
| 74 | + imagedestroy($image); |
|
| 75 | + imagedestroy($rotation); |
|
| 76 | 76 | |
| 77 | 77 | } else { |
| 78 | - imagepng($newimg); |
|
| 79 | - imagedestroy($newimg); |
|
| 80 | - imagedestroy($image); |
|
| 81 | - } |
|
| 82 | - } else { |
|
| 78 | + imagepng($newimg); |
|
| 79 | + imagedestroy($newimg); |
|
| 80 | + imagedestroy($image); |
|
| 81 | + } |
|
| 82 | + } else { |
|
| 83 | 83 | imagealphablending($image, false); |
| 84 | - imagesavealpha($image, true); |
|
| 84 | + imagesavealpha($image, true); |
|
| 85 | 85 | imagepng($image); |
| 86 | 86 | imagepng($image); |
| 87 | 87 | if (is_writable('cache')) { |
| 88 | - imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename); |
|
| 88 | + imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename); |
|
| 89 | + } |
|
| 90 | + imagedestroy($image); |
|
| 89 | 91 | } |
| 90 | - imagedestroy($image); |
|
| 91 | - } |
|
| 92 | 92 | } else { |
| 93 | - header('Content-type: image/png'); |
|
| 94 | - if (isset($_GET['tracker'])) { |
|
| 95 | - readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename); |
|
| 96 | - } elseif (isset($_GET['marine'])) { |
|
| 97 | - readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename); |
|
| 98 | - } else { |
|
| 99 | - if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
| 93 | + header('Content-type: image/png'); |
|
| 94 | + if (isset($_GET['tracker'])) { |
|
| 95 | + readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename); |
|
| 96 | + } elseif (isset($_GET['marine'])) { |
|
| 97 | + readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename); |
|
| 98 | + } else { |
|
| 99 | + if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
| 100 | 100 | else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename); |
| 101 | - } |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | ?> |
| 104 | 104 | \ No newline at end of file |
@@ -4,23 +4,23 @@ discard block |
||
| 4 | 4 | $tracker = false; |
| 5 | 5 | $marine = false; |
| 6 | 6 | if (isset($_GET['tracker'])) { |
| 7 | - $tracker = true; |
|
| 7 | + $tracker = true; |
|
| 8 | 8 | } |
| 9 | 9 | if (isset($_GET['marine'])) { |
| 10 | - $marine = true; |
|
| 10 | + $marine = true; |
|
| 11 | 11 | } |
| 12 | 12 | if ($tracker) { |
| 13 | - require_once('require/class.Tracker.php'); |
|
| 14 | - require_once('require/class.TrackerLive.php'); |
|
| 15 | - //require_once('require/class.TrackerArchive.php'); |
|
| 13 | + require_once('require/class.Tracker.php'); |
|
| 14 | + require_once('require/class.TrackerLive.php'); |
|
| 15 | + //require_once('require/class.TrackerArchive.php'); |
|
| 16 | 16 | } elseif ($marine) { |
| 17 | - require_once('require/class.Marine.php'); |
|
| 18 | - require_once('require/class.MarineLive.php'); |
|
| 19 | - //require_once('require/class.MarineArchive.php'); |
|
| 17 | + require_once('require/class.Marine.php'); |
|
| 18 | + require_once('require/class.MarineLive.php'); |
|
| 19 | + //require_once('require/class.MarineArchive.php'); |
|
| 20 | 20 | } else { |
| 21 | - require_once('require/class.Spotter.php'); |
|
| 22 | - require_once('require/class.SpotterLive.php'); |
|
| 23 | - require_once('require/class.SpotterArchive.php'); |
|
| 21 | + require_once('require/class.Spotter.php'); |
|
| 22 | + require_once('require/class.SpotterLive.php'); |
|
| 23 | + require_once('require/class.SpotterArchive.php'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $begintime = microtime(true); |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | $Common = new Common(); |
| 41 | 41 | |
| 42 | 42 | if (isset($_GET['download'])) { |
| 43 | - if ($_GET['download'] == "true") |
|
| 44 | - { |
|
| 43 | + if ($_GET['download'] == "true") |
|
| 44 | + { |
|
| 45 | 45 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
| 46 | - } |
|
| 46 | + } |
|
| 47 | 47 | } |
| 48 | 48 | header('Content-Type: text/javascript'); |
| 49 | 49 | |
@@ -488,8 +488,8 @@ discard block |
||
| 488 | 488 | |
| 489 | 489 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
| 490 | 490 | || (!isset($_COOKIE['flightpath']) |
| 491 | - && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
|
| 492 | - || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
|
| 491 | + && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
|
| 492 | + || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
|
| 493 | 493 | || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
| 494 | 494 | if ($tracker) { |
| 495 | 495 | $spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']); |
@@ -502,19 +502,19 @@ discard block |
||
| 502 | 502 | $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
| 503 | 503 | } |
| 504 | 504 | } |
| 505 | - $d = false; |
|
| 505 | + $d = false; |
|
| 506 | 506 | foreach ($spotter_history_array as $key => $spotter_history) |
| 507 | 507 | { |
| 508 | 508 | if (isset($spotter_history['altitude'])) { |
| 509 | 509 | $alt = round($spotter_history['altitude']/10)*10; |
| 510 | 510 | if (!isset($prev_alt) || $prev_alt != $alt) { |
| 511 | - if (isset($prev_alt)) { |
|
| 511 | + if (isset($prev_alt)) { |
|
| 512 | 512 | $output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].', '.$spotter_history['altitude'].']'; |
| 513 | 513 | $output_history .= ']}},'; |
| 514 | 514 | $output .= $output_history; |
| 515 | - } |
|
| 516 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 517 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 515 | + } |
|
| 516 | + if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 517 | + else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 518 | 518 | } |
| 519 | 519 | $output_history .= '['; |
| 520 | 520 | $output_history .= $spotter_history['longitude'].', '; |
@@ -532,38 +532,38 @@ discard block |
||
| 532 | 532 | $output_history .= $spotter_history['latitude']; |
| 533 | 533 | $output_history .= '],'; |
| 534 | 534 | } |
| 535 | - //} |
|
| 535 | + //} |
|
| 536 | 536 | } |
| 537 | 537 | if (isset($output_history)) { |
| 538 | - $output_history = substr($output_history, 0, -1); |
|
| 539 | - $output_history .= ']}},'; |
|
| 540 | - $output .= $output_history; |
|
| 541 | - unset($prev_alt); |
|
| 542 | - unset($output_history); |
|
| 538 | + $output_history = substr($output_history, 0, -1); |
|
| 539 | + $output_history .= ']}},'; |
|
| 540 | + $output .= $output_history; |
|
| 541 | + unset($prev_alt); |
|
| 542 | + unset($output_history); |
|
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | if (isset($history) && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 547 | - $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 548 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
| 547 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 548 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
| 549 | 549 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
| 550 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
| 550 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
| 551 | 551 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
| 552 | 552 | if (isset($dairport[0]['latitude'])) { |
| 553 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
| 553 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
| 554 | 554 | } |
| 555 | - } |
|
| 556 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
| 555 | + } |
|
| 556 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
| 557 | 557 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
| 558 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
| 558 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
| 559 | 559 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
| 560 | 560 | if (isset($aairport[0]['latitude'])) { |
| 561 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
| 561 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
| 562 | 562 | } |
| 563 | - } |
|
| 564 | - $output_air .= ']}},'; |
|
| 565 | - $output .= $output_air; |
|
| 566 | - unset($output_air); |
|
| 563 | + } |
|
| 564 | + $output_air .= ']}},'; |
|
| 565 | + $output .= $output_air; |
|
| 566 | + unset($output_air); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | $output = substr($output, 0, -1); |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
| 16 | 16 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
| 17 | 17 | if (isset($globalMarine) && $globalMarine) { |
| 18 | - require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
| 19 | - require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
| 18 | + require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
|
| 19 | + require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | if (!isset($globalDebug)) $globalDebug = FALSE; |
@@ -24,52 +24,52 @@ discard block |
||
| 24 | 24 | // Check if schema is at latest version |
| 25 | 25 | $Connection = new Connection(); |
| 26 | 26 | if ($Connection->latest() === false) { |
| 27 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
| 28 | - exit(); |
|
| 27 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
| 28 | + exit(); |
|
| 29 | 29 | } |
| 30 | 30 | if (PHP_SAPI != 'cli') { |
| 31 | - echo "This script MUST be called from console, not a web browser."; |
|
| 31 | + echo "This script MUST be called from console, not a web browser."; |
|
| 32 | 32 | // exit(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // This is to be compatible with old version of settings.php |
| 36 | 36 | if (!isset($globalSources)) { |
| 37 | - if (isset($globalSBS1Hosts)) { |
|
| 38 | - //$hosts = $globalSBS1Hosts; |
|
| 39 | - foreach ($globalSBS1Hosts as $host) { |
|
| 40 | - $globalSources[] = array('host' => $host); |
|
| 41 | - } |
|
| 42 | - } else { |
|
| 43 | - if (!isset($globalSBS1Host)) { |
|
| 44 | - echo '$globalSources MUST be defined !'; |
|
| 45 | - die; |
|
| 37 | + if (isset($globalSBS1Hosts)) { |
|
| 38 | + //$hosts = $globalSBS1Hosts; |
|
| 39 | + foreach ($globalSBS1Hosts as $host) { |
|
| 40 | + $globalSources[] = array('host' => $host); |
|
| 41 | + } |
|
| 42 | + } else { |
|
| 43 | + if (!isset($globalSBS1Host)) { |
|
| 44 | + echo '$globalSources MUST be defined !'; |
|
| 45 | + die; |
|
| 46 | 46 | } |
| 47 | 47 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
| 48 | 48 | $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $options = getopt('s::',array('source::','server','idsource::')); |
| 53 | 53 | //if (isset($options['s'])) $hosts = array($options['s']); |
| 54 | 54 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 55 | 55 | if (isset($options['s'])) { |
| 56 | - $globalSources = array(); |
|
| 57 | - $globalSources[] = array('host' => $options['s']); |
|
| 56 | + $globalSources = array(); |
|
| 57 | + $globalSources[] = array('host' => $options['s']); |
|
| 58 | 58 | } elseif (isset($options['source'])) { |
| 59 | - $globalSources = array(); |
|
| 60 | - $globalSources[] = array('host' => $options['source']); |
|
| 59 | + $globalSources = array(); |
|
| 60 | + $globalSources[] = array('host' => $options['source']); |
|
| 61 | 61 | } |
| 62 | 62 | if (isset($options['server'])) $globalServer = TRUE; |
| 63 | 63 | if (isset($options['idsource'])) $id_source = $options['idsource']; |
| 64 | 64 | else $id_source = 1; |
| 65 | 65 | if (isset($globalServer) && $globalServer) { |
| 66 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 67 | - $SI=new SpotterServer(); |
|
| 66 | + if ($globalDebug) echo "Using Server Mode\n"; |
|
| 67 | + $SI=new SpotterServer(); |
|
| 68 | 68 | } else $SI=new SpotterImport($Connection->db); |
| 69 | 69 | if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
| 70 | 70 | if (isset($globalMarine) && $globalMarine) { |
| 71 | - $AIS = new AIS(); |
|
| 72 | - $MI = new MarineImport($Connection->db); |
|
| 71 | + $AIS = new AIS(); |
|
| 72 | + $MI = new MarineImport($Connection->db); |
|
| 73 | 73 | } |
| 74 | 74 | //$APRS=new APRS($Connection->db); |
| 75 | 75 | $SBS=new SBS(); |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | //$servertz = system('date +%Z'); |
| 80 | 80 | // signal handler - playing nice with sockets and dump1090 |
| 81 | 81 | if (function_exists('pcntl_fork')) { |
| 82 | - pcntl_signal(SIGINT, function() { |
|
| 83 | - global $sockets; |
|
| 84 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 85 | - die("Bye!\n"); |
|
| 86 | - }); |
|
| 87 | - pcntl_signal_dispatch(); |
|
| 82 | + pcntl_signal(SIGINT, function() { |
|
| 83 | + global $sockets; |
|
| 84 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 85 | + die("Bye!\n"); |
|
| 86 | + }); |
|
| 87 | + pcntl_signal_dispatch(); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | // let's try and connect |
@@ -94,169 +94,169 @@ discard block |
||
| 94 | 94 | $reset = 0; |
| 95 | 95 | |
| 96 | 96 | function create_socket($host, $port, &$errno, &$errstr) { |
| 97 | - $ip = gethostbyname($host); |
|
| 98 | - $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
| 99 | - $r = @socket_connect($s, $ip, $port); |
|
| 100 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 101 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 102 | - return $s; |
|
| 103 | - } |
|
| 104 | - $errno = socket_last_error($s); |
|
| 105 | - $errstr = socket_strerror($errno); |
|
| 106 | - socket_close($s); |
|
| 107 | - return false; |
|
| 97 | + $ip = gethostbyname($host); |
|
| 98 | + $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
| 99 | + $r = @socket_connect($s, $ip, $port); |
|
| 100 | + if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 101 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 102 | + return $s; |
|
| 103 | + } |
|
| 104 | + $errno = socket_last_error($s); |
|
| 105 | + $errstr = socket_strerror($errno); |
|
| 106 | + socket_close($s); |
|
| 107 | + return false; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | function create_socket_udp($host, $port, &$errno, &$errstr) { |
| 111 | - echo "Create an UDP socket...\n"; |
|
| 112 | - $ip = gethostbyname($host); |
|
| 113 | - $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
| 114 | - $r = @socket_bind($s, $ip, $port); |
|
| 115 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 116 | - return $s; |
|
| 117 | - } |
|
| 118 | - $errno = socket_last_error($s); |
|
| 119 | - $errstr = socket_strerror($errno); |
|
| 120 | - socket_close($s); |
|
| 121 | - return false; |
|
| 111 | + echo "Create an UDP socket...\n"; |
|
| 112 | + $ip = gethostbyname($host); |
|
| 113 | + $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
| 114 | + $r = @socket_bind($s, $ip, $port); |
|
| 115 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 116 | + return $s; |
|
| 117 | + } |
|
| 118 | + $errno = socket_last_error($s); |
|
| 119 | + $errstr = socket_strerror($errno); |
|
| 120 | + socket_close($s); |
|
| 121 | + return false; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | function connect_all($hosts) { |
| 125 | - //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 126 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
| 127 | - $reset++; |
|
| 128 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 129 | - foreach ($hosts as $id => $value) { |
|
| 125 | + //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 126 | + global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
| 127 | + $reset++; |
|
| 128 | + if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 129 | + foreach ($hosts as $id => $value) { |
|
| 130 | 130 | $host = $value['host']; |
| 131 | 131 | $globalSources[$id]['last_exec'] = 0; |
| 132 | 132 | // Here we check type of source(s) |
| 133 | 133 | if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
| 134 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 135 | - //$formats[$id] = 'deltadbtxt'; |
|
| 136 | - $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 137 | - //$last_exec['deltadbtxt'] = 0; |
|
| 138 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 139 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 140 | - //$formats[$id] = 'vatsimtxt'; |
|
| 141 | - $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 142 | - //$last_exec['vatsimtxt'] = 0; |
|
| 143 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 144 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 145 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 146 | - $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 147 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 148 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 149 | - } else if (preg_match('/opensky/i',$host)) { |
|
| 150 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 151 | - $globalSources[$id]['format'] = 'opensky'; |
|
| 152 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 153 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 154 | - } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
| 155 | - //$formats[$id] = 'radarvirtueljson'; |
|
| 156 | - $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
| 157 | - //$last_exec['radarvirtueljson'] = 0; |
|
| 158 | - if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
| 159 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 160 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 161 | - exit(0); |
|
| 162 | - } |
|
| 163 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 164 | - //$formats[$id] = 'planeupdatefaa'; |
|
| 165 | - $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 166 | - //$last_exec['planeupdatefaa'] = 0; |
|
| 167 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 168 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 169 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 170 | - exit(0); |
|
| 171 | - } |
|
| 172 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 173 | - //$formats[$id] = 'phpvmacars'; |
|
| 174 | - $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 175 | - //$last_exec['phpvmacars'] = 0; |
|
| 176 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 177 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 178 | - //$formats[$id] = 'phpvmacars'; |
|
| 179 | - $globalSources[$id]['format'] = 'vam'; |
|
| 180 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 181 | - } else if (preg_match('/whazzup/i',$host)) { |
|
| 182 | - //$formats[$id] = 'whazzup'; |
|
| 183 | - $globalSources[$id]['format'] = 'whazzup'; |
|
| 184 | - //$last_exec['whazzup'] = 0; |
|
| 185 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 186 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
| 187 | - //$formats[$id] = 'pirepsjson'; |
|
| 188 | - $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 189 | - //$last_exec['pirepsjson'] = 0; |
|
| 190 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 191 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 192 | - //$formats[$id] = 'fr24json'; |
|
| 193 | - $globalSources[$id]['format'] = 'fr24json'; |
|
| 194 | - //$last_exec['fr24json'] = 0; |
|
| 195 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 196 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 197 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 198 | - exit(0); |
|
| 199 | - } |
|
| 200 | - //} else if (preg_match('/10001/',$host)) { |
|
| 201 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 202 | - //$formats[$id] = 'tsv'; |
|
| 203 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 204 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 205 | - } |
|
| 206 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 207 | - if ($globalSources[$id]['format'] == 'nmeahttp') { |
|
| 208 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
| 209 | - if ($idf !== false) { |
|
| 210 | - $httpfeeds[$id] = $idf; |
|
| 211 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 212 | - } |
|
| 213 | - elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 214 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 215 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 216 | - $hostport = explode(':',$host); |
|
| 217 | - if (isset($hostport[1])) { |
|
| 134 | + if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 135 | + //$formats[$id] = 'deltadbtxt'; |
|
| 136 | + $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 137 | + //$last_exec['deltadbtxt'] = 0; |
|
| 138 | + if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 139 | + } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 140 | + //$formats[$id] = 'vatsimtxt'; |
|
| 141 | + $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 142 | + //$last_exec['vatsimtxt'] = 0; |
|
| 143 | + if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 144 | + } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 145 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 146 | + $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 147 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 148 | + if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 149 | + } else if (preg_match('/opensky/i',$host)) { |
|
| 150 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 151 | + $globalSources[$id]['format'] = 'opensky'; |
|
| 152 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 153 | + if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 154 | + } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
| 155 | + //$formats[$id] = 'radarvirtueljson'; |
|
| 156 | + $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
| 157 | + //$last_exec['radarvirtueljson'] = 0; |
|
| 158 | + if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
| 159 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 160 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 161 | + exit(0); |
|
| 162 | + } |
|
| 163 | + } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 164 | + //$formats[$id] = 'planeupdatefaa'; |
|
| 165 | + $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 166 | + //$last_exec['planeupdatefaa'] = 0; |
|
| 167 | + if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 168 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 169 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 170 | + exit(0); |
|
| 171 | + } |
|
| 172 | + } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 173 | + //$formats[$id] = 'phpvmacars'; |
|
| 174 | + $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 175 | + //$last_exec['phpvmacars'] = 0; |
|
| 176 | + if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 177 | + } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 178 | + //$formats[$id] = 'phpvmacars'; |
|
| 179 | + $globalSources[$id]['format'] = 'vam'; |
|
| 180 | + if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 181 | + } else if (preg_match('/whazzup/i',$host)) { |
|
| 182 | + //$formats[$id] = 'whazzup'; |
|
| 183 | + $globalSources[$id]['format'] = 'whazzup'; |
|
| 184 | + //$last_exec['whazzup'] = 0; |
|
| 185 | + if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 186 | + } else if (preg_match('/recentpireps/i',$host)) { |
|
| 187 | + //$formats[$id] = 'pirepsjson'; |
|
| 188 | + $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 189 | + //$last_exec['pirepsjson'] = 0; |
|
| 190 | + if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 191 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 192 | + //$formats[$id] = 'fr24json'; |
|
| 193 | + $globalSources[$id]['format'] = 'fr24json'; |
|
| 194 | + //$last_exec['fr24json'] = 0; |
|
| 195 | + if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 196 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 197 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 198 | + exit(0); |
|
| 199 | + } |
|
| 200 | + //} else if (preg_match('/10001/',$host)) { |
|
| 201 | + } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 202 | + //$formats[$id] = 'tsv'; |
|
| 203 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 204 | + if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 205 | + } |
|
| 206 | + } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 207 | + if ($globalSources[$id]['format'] == 'nmeahttp') { |
|
| 208 | + $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
| 209 | + if ($idf !== false) { |
|
| 210 | + $httpfeeds[$id] = $idf; |
|
| 211 | + if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 212 | + } |
|
| 213 | + elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 214 | + } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 215 | + } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 216 | + $hostport = explode(':',$host); |
|
| 217 | + if (isset($hostport[1])) { |
|
| 218 | 218 | $port = $hostport[1]; |
| 219 | 219 | $hostn = $hostport[0]; |
| 220 | - } else { |
|
| 220 | + } else { |
|
| 221 | 221 | $port = $globalSources[$id]['port']; |
| 222 | 222 | $hostn = $globalSources[$id]['host']; |
| 223 | - } |
|
| 224 | - if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 225 | - $s = create_socket($hostn,$port, $errno, $errstr); |
|
| 226 | - } else { |
|
| 227 | - $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 228 | - } |
|
| 229 | - if ($s) { |
|
| 230 | - $sockets[$id] = $s; |
|
| 231 | - if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 232 | - if (preg_match('/aprs/',$hostn)) { |
|
| 223 | + } |
|
| 224 | + if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 225 | + $s = create_socket($hostn,$port, $errno, $errstr); |
|
| 226 | + } else { |
|
| 227 | + $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 228 | + } |
|
| 229 | + if ($s) { |
|
| 230 | + $sockets[$id] = $s; |
|
| 231 | + if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 232 | + if (preg_match('/aprs/',$hostn)) { |
|
| 233 | 233 | //$formats[$id] = 'aprs'; |
| 234 | 234 | $globalSources[$id]['format'] = 'aprs'; |
| 235 | 235 | //$aprs_connect = 0; |
| 236 | 236 | //$use_aprs = true; |
| 237 | - } elseif ($port == '10001') { |
|
| 238 | - //$formats[$id] = 'tsv'; |
|
| 239 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 240 | - } elseif ($port == '30002') { |
|
| 241 | - //$formats[$id] = 'raw'; |
|
| 242 | - $globalSources[$id]['format'] = 'raw'; |
|
| 243 | - } elseif ($port == '5001') { |
|
| 244 | - //$formats[$id] = 'raw'; |
|
| 245 | - $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 246 | - } elseif ($port == '30005') { |
|
| 237 | + } elseif ($port == '10001') { |
|
| 238 | + //$formats[$id] = 'tsv'; |
|
| 239 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 240 | + } elseif ($port == '30002') { |
|
| 241 | + //$formats[$id] = 'raw'; |
|
| 242 | + $globalSources[$id]['format'] = 'raw'; |
|
| 243 | + } elseif ($port == '5001') { |
|
| 244 | + //$formats[$id] = 'raw'; |
|
| 245 | + $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 246 | + } elseif ($port == '30005') { |
|
| 247 | 247 | // Not yet supported |
| 248 | - //$formats[$id] = 'beast'; |
|
| 249 | - $globalSources[$id]['format'] = 'beast'; |
|
| 250 | - //} else $formats[$id] = 'sbs'; |
|
| 251 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 252 | - //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 248 | + //$formats[$id] = 'beast'; |
|
| 249 | + $globalSources[$id]['format'] = 'beast'; |
|
| 250 | + //} else $formats[$id] = 'sbs'; |
|
| 251 | + } else $globalSources[$id]['format'] = 'sbs'; |
|
| 252 | + //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 253 | 253 | } |
| 254 | 254 | if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
| 255 | - } else { |
|
| 255 | + } else { |
|
| 256 | 256 | if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
| 257 | - } |
|
| 258 | - } |
|
| 259 | - } |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + } |
|
| 260 | 260 | } |
| 261 | 261 | if (!isset($globalMinFetch)) $globalMinFetch = 15; |
| 262 | 262 | |
@@ -279,9 +279,9 @@ discard block |
||
| 279 | 279 | //connect_all($globalSources); |
| 280 | 280 | |
| 281 | 281 | if (isset($globalProxy) && $globalProxy) { |
| 282 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
| 282 | + $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
| 283 | 283 | } else { |
| 284 | - $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
|
| 284 | + $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // APRS Configuration |
@@ -290,18 +290,18 @@ discard block |
||
| 290 | 290 | die; |
| 291 | 291 | } |
| 292 | 292 | foreach ($globalSources as $key => $source) { |
| 293 | - if (!isset($source['format'])) { |
|
| 294 | - $globalSources[$key]['format'] = 'auto'; |
|
| 295 | - } |
|
| 293 | + if (!isset($source['format'])) { |
|
| 294 | + $globalSources[$key]['format'] = 'auto'; |
|
| 295 | + } |
|
| 296 | 296 | } |
| 297 | 297 | connect_all($globalSources); |
| 298 | 298 | foreach ($globalSources as $key => $source) { |
| 299 | - if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 299 | + if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 300 | 300 | $aprs_connect = 0; |
| 301 | 301 | $use_aprs = true; |
| 302 | 302 | if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
| 303 | 303 | break; |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | if ($use_aprs) { |
@@ -340,179 +340,179 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 342 | 342 | while ($i > 0) { |
| 343 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 344 | - // Delete old ATC |
|
| 345 | - if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 343 | + if (!$globalDaemon) $i = $endtime-time(); |
|
| 344 | + // Delete old ATC |
|
| 345 | + if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 346 | 346 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
| 347 | - $ATC->deleteOldATC(); |
|
| 348 | - } |
|
| 347 | + $ATC->deleteOldATC(); |
|
| 348 | + } |
|
| 349 | 349 | |
| 350 | - //if (count($last_exec) > 0) { |
|
| 351 | - if (count($last_exec) == count($globalSources)) { |
|
| 350 | + //if (count($last_exec) > 0) { |
|
| 351 | + if (count($last_exec) == count($globalSources)) { |
|
| 352 | 352 | $max = $globalMinFetch; |
| 353 | 353 | foreach ($last_exec as $last) { |
| 354 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 354 | + if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 355 | 355 | } |
| 356 | 356 | if ($max != $globalMinFetch) { |
| 357 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 358 | - sleep($globalMinFetch-$max+2); |
|
| 357 | + if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 358 | + sleep($globalMinFetch-$max+2); |
|
| 359 | + } |
|
| 359 | 360 | } |
| 360 | - } |
|
| 361 | 361 | |
| 362 | 362 | |
| 363 | - //foreach ($formats as $id => $value) { |
|
| 364 | - foreach ($globalSources as $id => $value) { |
|
| 363 | + //foreach ($formats as $id => $value) { |
|
| 364 | + foreach ($globalSources as $id => $value) { |
|
| 365 | 365 | date_default_timezone_set('UTC'); |
| 366 | 366 | if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
| 367 | 367 | if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 368 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 369 | - $buffer = $Common->getData($value['host']); |
|
| 370 | - if ($buffer != '') $reset = 0; |
|
| 371 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 372 | - $buffer = explode('\n',$buffer); |
|
| 373 | - foreach ($buffer as $line) { |
|
| 374 | - if ($line != '' && count($line) > 7) { |
|
| 375 | - $line = explode(',', $line); |
|
| 376 | - $data = array(); |
|
| 377 | - $data['hex'] = $line[1]; // hex |
|
| 378 | - $data['ident'] = $line[2]; // ident |
|
| 379 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 380 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 381 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 382 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 383 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 384 | - $data['verticalrate'] = ''; // vertical rate |
|
| 385 | - //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 386 | - $data['emergency'] = ''; // emergency |
|
| 387 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 388 | - $data['format_source'] = 'deltadbtxt'; |
|
| 389 | - $data['id_source'] = $id_source; |
|
| 390 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 391 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 392 | - $SI->add($data); |
|
| 393 | - unset($data); |
|
| 394 | - } |
|
| 395 | - } |
|
| 396 | - $last_exec[$id]['last'] = time(); |
|
| 368 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 369 | + $buffer = $Common->getData($value['host']); |
|
| 370 | + if ($buffer != '') $reset = 0; |
|
| 371 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 372 | + $buffer = explode('\n',$buffer); |
|
| 373 | + foreach ($buffer as $line) { |
|
| 374 | + if ($line != '' && count($line) > 7) { |
|
| 375 | + $line = explode(',', $line); |
|
| 376 | + $data = array(); |
|
| 377 | + $data['hex'] = $line[1]; // hex |
|
| 378 | + $data['ident'] = $line[2]; // ident |
|
| 379 | + if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 380 | + if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 381 | + if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 382 | + if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 383 | + if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 384 | + $data['verticalrate'] = ''; // vertical rate |
|
| 385 | + //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 386 | + $data['emergency'] = ''; // emergency |
|
| 387 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 388 | + $data['format_source'] = 'deltadbtxt'; |
|
| 389 | + $data['id_source'] = $id_source; |
|
| 390 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 391 | + if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 392 | + $SI->add($data); |
|
| 393 | + unset($data); |
|
| 394 | + } |
|
| 395 | + } |
|
| 396 | + $last_exec[$id]['last'] = time(); |
|
| 397 | 397 | } elseif ($value['format'] == 'aisnmeatxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
| 398 | - date_default_timezone_set('CET'); |
|
| 399 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
| 400 | - date_default_timezone_set('UTC'); |
|
| 401 | - if ($buffer != '') $reset = 0; |
|
| 402 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 403 | - $buffer = explode('\n',$buffer); |
|
| 404 | - foreach ($buffer as $line) { |
|
| 398 | + date_default_timezone_set('CET'); |
|
| 399 | + $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
| 400 | + date_default_timezone_set('UTC'); |
|
| 401 | + if ($buffer != '') $reset = 0; |
|
| 402 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 403 | + $buffer = explode('\n',$buffer); |
|
| 404 | + foreach ($buffer as $line) { |
|
| 405 | 405 | if ($line != '') { |
| 406 | - echo "'".$line."'\n"; |
|
| 407 | - $add = false; |
|
| 408 | - $ais_data = $AIS->parse_line(trim($line)); |
|
| 409 | - $data = array(); |
|
| 410 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 411 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 412 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 413 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 414 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 415 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 416 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 417 | - if (isset($ais_data['timestamp'])) { |
|
| 406 | + echo "'".$line."'\n"; |
|
| 407 | + $add = false; |
|
| 408 | + $ais_data = $AIS->parse_line(trim($line)); |
|
| 409 | + $data = array(); |
|
| 410 | + if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 411 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 412 | + if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 413 | + if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 414 | + if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 415 | + if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 416 | + if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 417 | + if (isset($ais_data['timestamp'])) { |
|
| 418 | 418 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 419 | 419 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
| 420 | - $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
|
| 421 | - $add = true; |
|
| 420 | + $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
|
| 421 | + $add = true; |
|
| 422 | 422 | } |
| 423 | - } else { |
|
| 423 | + } else { |
|
| 424 | 424 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 425 | 425 | $add = true; |
| 426 | - } |
|
| 427 | - $data['format_source'] = 'nmeatxt'; |
|
| 428 | - $data['id_source'] = $id_source; |
|
| 429 | - print_r($data); |
|
| 430 | - echo 'Add...'."\n"; |
|
| 431 | - if ($add) $MI->add($data); |
|
| 432 | - unset($data); |
|
| 426 | + } |
|
| 427 | + $data['format_source'] = 'nmeatxt'; |
|
| 428 | + $data['id_source'] = $id_source; |
|
| 429 | + print_r($data); |
|
| 430 | + echo 'Add...'."\n"; |
|
| 431 | + if ($add) $MI->add($data); |
|
| 432 | + unset($data); |
|
| 433 | 433 | } |
| 434 | - } |
|
| 435 | - $last_exec[$id]['last'] = time(); |
|
| 434 | + } |
|
| 435 | + $last_exec[$id]['last'] = time(); |
|
| 436 | 436 | } elseif ($value['format'] == 'aisnmeahttp') { |
| 437 | - $arr = $httpfeeds; |
|
| 438 | - $w = $e = null; |
|
| 439 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
| 440 | - if ($nn > 0) { |
|
| 437 | + $arr = $httpfeeds; |
|
| 438 | + $w = $e = null; |
|
| 439 | + $nn = stream_select($arr,$w,$e,$timeout); |
|
| 440 | + if ($nn > 0) { |
|
| 441 | 441 | foreach ($httpfeeds as $feed) { |
| 442 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
| 443 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 444 | - $buffer = explode('\n',$buffer); |
|
| 445 | - foreach ($buffer as $line) { |
|
| 442 | + $buffer = stream_get_line($feed,2000,"\n"); |
|
| 443 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 444 | + $buffer = explode('\n',$buffer); |
|
| 445 | + foreach ($buffer as $line) { |
|
| 446 | 446 | if ($line != '') { |
| 447 | - $ais_data = $AIS->parse_line(trim($line)); |
|
| 448 | - $data = array(); |
|
| 449 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 450 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 451 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 452 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 453 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 454 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 455 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 456 | - if (isset($ais_data['timestamp'])) { |
|
| 447 | + $ais_data = $AIS->parse_line(trim($line)); |
|
| 448 | + $data = array(); |
|
| 449 | + if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 450 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 451 | + if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 452 | + if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 453 | + if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 454 | + if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 455 | + if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 456 | + if (isset($ais_data['timestamp'])) { |
|
| 457 | 457 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 458 | - } else { |
|
| 458 | + } else { |
|
| 459 | 459 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 460 | - } |
|
| 461 | - $data['format_source'] = 'nmeatxt'; |
|
| 462 | - $data['id_source'] = $id_source; |
|
| 463 | - $MI->add($data); |
|
| 464 | - unset($data); |
|
| 460 | + } |
|
| 461 | + $data['format_source'] = 'nmeatxt'; |
|
| 462 | + $data['id_source'] = $id_source; |
|
| 463 | + $MI->add($data); |
|
| 464 | + unset($data); |
|
| 465 | 465 | } |
| 466 | - } |
|
| 466 | + } |
|
| 467 | + } |
|
| 467 | 468 | } |
| 468 | - } |
|
| 469 | 469 | } elseif ($value['format'] == 'shipplotter' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
| 470 | - echo 'download...'; |
|
| 471 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
| 472 | - echo 'done !'."\n"; |
|
| 473 | - if ($buffer != '') $reset = 0; |
|
| 474 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 475 | - $buffer = explode('\n',$buffer); |
|
| 476 | - foreach ($buffer as $line) { |
|
| 470 | + echo 'download...'; |
|
| 471 | + $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
| 472 | + echo 'done !'."\n"; |
|
| 473 | + if ($buffer != '') $reset = 0; |
|
| 474 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 475 | + $buffer = explode('\n',$buffer); |
|
| 476 | + foreach ($buffer as $line) { |
|
| 477 | 477 | if ($line != '') { |
| 478 | - $data = array(); |
|
| 479 | - $data['mmsi'] = (int)substr($line,0,9); |
|
| 480 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
| 481 | - //$data['status'] = substr($line,21,2); |
|
| 482 | - //$data['type'] = substr($line,24,3); |
|
| 483 | - $data['latitude'] = substr($line,29,9); |
|
| 484 | - $data['longitude'] = substr($line,41,9); |
|
| 485 | - $data['speed'] = round(substr($line,51,5)); |
|
| 486 | - //$data['course'] = substr($line,57,5); |
|
| 487 | - $data['heading'] = round(substr($line,63,3)); |
|
| 488 | - //$data['draft'] = substr($line,67,4); |
|
| 489 | - //$data['length'] = substr($line,72,3); |
|
| 490 | - //$data['beam'] = substr($line,76,2); |
|
| 491 | - $data['ident'] = trim(utf8_encode(substr($line,79,20))); |
|
| 492 | - //$data['callsign'] = trim(substr($line,100,7); |
|
| 493 | - //$data['dest'] = substr($line,108,20); |
|
| 494 | - //$data['etaDate'] = substr($line,129,5); |
|
| 495 | - //$data['etaTime'] = substr($line,135,5); |
|
| 496 | - $data['format_source'] = 'shipplotter'; |
|
| 497 | - $data['id_source'] = $id_source; |
|
| 498 | - print_r($data); |
|
| 499 | - echo 'Add...'."\n"; |
|
| 500 | - $MI->add($data); |
|
| 501 | - unset($data); |
|
| 478 | + $data = array(); |
|
| 479 | + $data['mmsi'] = (int)substr($line,0,9); |
|
| 480 | + $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
| 481 | + //$data['status'] = substr($line,21,2); |
|
| 482 | + //$data['type'] = substr($line,24,3); |
|
| 483 | + $data['latitude'] = substr($line,29,9); |
|
| 484 | + $data['longitude'] = substr($line,41,9); |
|
| 485 | + $data['speed'] = round(substr($line,51,5)); |
|
| 486 | + //$data['course'] = substr($line,57,5); |
|
| 487 | + $data['heading'] = round(substr($line,63,3)); |
|
| 488 | + //$data['draft'] = substr($line,67,4); |
|
| 489 | + //$data['length'] = substr($line,72,3); |
|
| 490 | + //$data['beam'] = substr($line,76,2); |
|
| 491 | + $data['ident'] = trim(utf8_encode(substr($line,79,20))); |
|
| 492 | + //$data['callsign'] = trim(substr($line,100,7); |
|
| 493 | + //$data['dest'] = substr($line,108,20); |
|
| 494 | + //$data['etaDate'] = substr($line,129,5); |
|
| 495 | + //$data['etaTime'] = substr($line,135,5); |
|
| 496 | + $data['format_source'] = 'shipplotter'; |
|
| 497 | + $data['id_source'] = $id_source; |
|
| 498 | + print_r($data); |
|
| 499 | + echo 'Add...'."\n"; |
|
| 500 | + $MI->add($data); |
|
| 501 | + unset($data); |
|
| 502 | 502 | } |
| 503 | - } |
|
| 504 | - $last_exec[$id]['last'] = time(); |
|
| 503 | + } |
|
| 504 | + $last_exec[$id]['last'] = time(); |
|
| 505 | 505 | //} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) { |
| 506 | 506 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { |
| 507 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 508 | - $buffer = $Common->getData($value['host']); |
|
| 509 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 510 | - $buffer = explode('\n',$buffer); |
|
| 511 | - $reset = 0; |
|
| 512 | - foreach ($buffer as $line) { |
|
| 513 | - if ($line != '') { |
|
| 514 | - $line = explode(':', $line); |
|
| 515 | - if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 507 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 508 | + $buffer = $Common->getData($value['host']); |
|
| 509 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 510 | + $buffer = explode('\n',$buffer); |
|
| 511 | + $reset = 0; |
|
| 512 | + foreach ($buffer as $line) { |
|
| 513 | + if ($line != '') { |
|
| 514 | + $line = explode(':', $line); |
|
| 515 | + if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 516 | 516 | $data = array(); |
| 517 | 517 | if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
| 518 | 518 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
@@ -525,36 +525,36 @@ discard block |
||
| 525 | 525 | if (isset($line[45])) $data['heading'] = $line[45]; // heading |
| 526 | 526 | elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
| 527 | 527 | $data['latitude'] = $line[5]; // lat |
| 528 | - $data['longitude'] = $line[6]; // long |
|
| 529 | - $data['verticalrate'] = ''; // vertical rate |
|
| 530 | - $data['squawk'] = ''; // squawk |
|
| 531 | - $data['emergency'] = ''; // emergency |
|
| 532 | - $data['waypoints'] = $line[30]; |
|
| 528 | + $data['longitude'] = $line[6]; // long |
|
| 529 | + $data['verticalrate'] = ''; // vertical rate |
|
| 530 | + $data['squawk'] = ''; // squawk |
|
| 531 | + $data['emergency'] = ''; // emergency |
|
| 532 | + $data['waypoints'] = $line[30]; |
|
| 533 | 533 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 534 | 534 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
| 535 | 535 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
| 536 | - $data['departure_airport_icao'] = $line[11]; |
|
| 537 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 538 | - $data['arrival_airport_icao'] = $line[13]; |
|
| 536 | + $data['departure_airport_icao'] = $line[11]; |
|
| 537 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 538 | + $data['arrival_airport_icao'] = $line[13]; |
|
| 539 | 539 | $data['frequency'] = $line[4]; |
| 540 | 540 | $data['type'] = $line[18]; |
| 541 | 541 | $data['range'] = $line[19]; |
| 542 | 542 | if (isset($line[35])) $data['info'] = $line[35]; |
| 543 | - $data['id_source'] = $id_source; |
|
| 544 | - //$data['arrival_airport_time'] = ; |
|
| 545 | - if ($line[9] != '') { |
|
| 546 | - $aircraft_data = explode('/',$line[9]); |
|
| 547 | - if (isset($aircraft_data[1])) { |
|
| 548 | - $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 549 | - } |
|
| 550 | - } |
|
| 551 | - /* |
|
| 543 | + $data['id_source'] = $id_source; |
|
| 544 | + //$data['arrival_airport_time'] = ; |
|
| 545 | + if ($line[9] != '') { |
|
| 546 | + $aircraft_data = explode('/',$line[9]); |
|
| 547 | + if (isset($aircraft_data[1])) { |
|
| 548 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 549 | + } |
|
| 550 | + } |
|
| 551 | + /* |
|
| 552 | 552 | if ($value == 'whazzup') $data['format_source'] = 'whazzup'; |
| 553 | 553 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 554 | 554 | */ |
| 555 | - $data['format_source'] = $value['format']; |
|
| 555 | + $data['format_source'] = $value['format']; |
|
| 556 | 556 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 557 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
| 557 | + if ($line[3] == 'PILOT') $SI->add($data); |
|
| 558 | 558 | elseif ($line[3] == 'ATC') { |
| 559 | 559 | //print_r($data); |
| 560 | 560 | $data['info'] = str_replace('^§','<br />',$data['info']); |
@@ -572,247 +572,247 @@ discard block |
||
| 572 | 572 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
| 573 | 573 | if (isset($ATC)) 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']); |
| 574 | 574 | } |
| 575 | - unset($data); |
|
| 576 | - } |
|
| 577 | - } |
|
| 578 | - } |
|
| 579 | - //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
| 580 | - //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 581 | - $last_exec[$id]['last'] = time(); |
|
| 582 | - //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
| 583 | - } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 584 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 585 | - if ($buffer != '') { |
|
| 586 | - $all_data = json_decode($buffer,true); |
|
| 587 | - if (isset($all_data['acList'])) { |
|
| 575 | + unset($data); |
|
| 576 | + } |
|
| 577 | + } |
|
| 578 | + } |
|
| 579 | + //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
| 580 | + //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 581 | + $last_exec[$id]['last'] = time(); |
|
| 582 | + //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
| 583 | + } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 584 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 585 | + if ($buffer != '') { |
|
| 586 | + $all_data = json_decode($buffer,true); |
|
| 587 | + if (isset($all_data['acList'])) { |
|
| 588 | 588 | $reset = 0; |
| 589 | 589 | foreach ($all_data['acList'] as $line) { |
| 590 | - $data = array(); |
|
| 591 | - $data['hex'] = $line['Icao']; // hex |
|
| 592 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 593 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 594 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 595 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 596 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 597 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 598 | - //$data['verticalrate'] = $line['']; // verticale rate |
|
| 599 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 600 | - $data['emergency'] = ''; // emergency |
|
| 601 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 602 | - /* |
|
| 590 | + $data = array(); |
|
| 591 | + $data['hex'] = $line['Icao']; // hex |
|
| 592 | + if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 593 | + if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 594 | + if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 595 | + if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 596 | + if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 597 | + if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 598 | + //$data['verticalrate'] = $line['']; // verticale rate |
|
| 599 | + if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 600 | + $data['emergency'] = ''; // emergency |
|
| 601 | + if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 602 | + /* |
|
| 603 | 603 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 604 | 604 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 605 | 605 | */ |
| 606 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 607 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 608 | - $data['format_source'] = 'aircraftlistjson'; |
|
| 609 | - $data['id_source'] = $id_source; |
|
| 610 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 611 | - if (isset($data['datetime'])) $SI->add($data); |
|
| 612 | - unset($data); |
|
| 606 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 607 | + if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 608 | + $data['format_source'] = 'aircraftlistjson'; |
|
| 609 | + $data['id_source'] = $id_source; |
|
| 610 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 611 | + if (isset($data['datetime'])) $SI->add($data); |
|
| 612 | + unset($data); |
|
| 613 | 613 | } |
| 614 | - } else { |
|
| 614 | + } else { |
|
| 615 | 615 | $reset = 0; |
| 616 | 616 | foreach ($all_data as $line) { |
| 617 | - $data = array(); |
|
| 618 | - $data['hex'] = $line['hex']; // hex |
|
| 619 | - $data['ident'] = $line['flight']; // ident |
|
| 620 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 621 | - $data['speed'] = $line['speed']; // speed |
|
| 622 | - $data['heading'] = $line['track']; // heading |
|
| 623 | - $data['latitude'] = $line['lat']; // lat |
|
| 624 | - $data['longitude'] = $line['lon']; // long |
|
| 625 | - $data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 626 | - $data['squawk'] = $line['squawk']; // squawk |
|
| 627 | - $data['emergency'] = ''; // emergency |
|
| 628 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 629 | - $data['format_source'] = 'aircraftlistjson'; |
|
| 630 | - $data['id_source'] = $id_source; |
|
| 631 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 632 | - $SI->add($data); |
|
| 633 | - unset($data); |
|
| 617 | + $data = array(); |
|
| 618 | + $data['hex'] = $line['hex']; // hex |
|
| 619 | + $data['ident'] = $line['flight']; // ident |
|
| 620 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 621 | + $data['speed'] = $line['speed']; // speed |
|
| 622 | + $data['heading'] = $line['track']; // heading |
|
| 623 | + $data['latitude'] = $line['lat']; // lat |
|
| 624 | + $data['longitude'] = $line['lon']; // long |
|
| 625 | + $data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 626 | + $data['squawk'] = $line['squawk']; // squawk |
|
| 627 | + $data['emergency'] = ''; // emergency |
|
| 628 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 629 | + $data['format_source'] = 'aircraftlistjson'; |
|
| 630 | + $data['id_source'] = $id_source; |
|
| 631 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 632 | + $SI->add($data); |
|
| 633 | + unset($data); |
|
| 634 | + } |
|
| 634 | 635 | } |
| 635 | - } |
|
| 636 | - } |
|
| 637 | - //$last_exec['aircraftlistjson'] = time(); |
|
| 638 | - $last_exec[$id]['last'] = time(); |
|
| 639 | - //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 640 | - } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 641 | - $buffer = $Common->getData($value['host']); |
|
| 642 | - $all_data = json_decode($buffer,true); |
|
| 643 | - if (isset($all_data['planes'])) { |
|
| 636 | + } |
|
| 637 | + //$last_exec['aircraftlistjson'] = time(); |
|
| 638 | + $last_exec[$id]['last'] = time(); |
|
| 639 | + //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 640 | + } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 641 | + $buffer = $Common->getData($value['host']); |
|
| 642 | + $all_data = json_decode($buffer,true); |
|
| 643 | + if (isset($all_data['planes'])) { |
|
| 644 | 644 | $reset = 0; |
| 645 | 645 | foreach ($all_data['planes'] as $key => $line) { |
| 646 | - $data = array(); |
|
| 647 | - $data['hex'] = $key; // hex |
|
| 648 | - $data['ident'] = $line[3]; // ident |
|
| 649 | - $data['altitude'] = $line[6]; // altitude |
|
| 650 | - $data['speed'] = $line[8]; // speed |
|
| 651 | - $data['heading'] = $line[7]; // heading |
|
| 652 | - $data['latitude'] = $line[4]; // lat |
|
| 653 | - $data['longitude'] = $line[5]; // long |
|
| 654 | - //$data['verticalrate'] = $line[]; // verticale rate |
|
| 655 | - $data['squawk'] = $line[10]; // squawk |
|
| 656 | - $data['emergency'] = ''; // emergency |
|
| 657 | - $data['registration'] = $line[2]; |
|
| 658 | - $data['aircraft_icao'] = $line[0]; |
|
| 659 | - $deparr = explode('-',$line[1]); |
|
| 660 | - if (count($deparr) == 2) { |
|
| 646 | + $data = array(); |
|
| 647 | + $data['hex'] = $key; // hex |
|
| 648 | + $data['ident'] = $line[3]; // ident |
|
| 649 | + $data['altitude'] = $line[6]; // altitude |
|
| 650 | + $data['speed'] = $line[8]; // speed |
|
| 651 | + $data['heading'] = $line[7]; // heading |
|
| 652 | + $data['latitude'] = $line[4]; // lat |
|
| 653 | + $data['longitude'] = $line[5]; // long |
|
| 654 | + //$data['verticalrate'] = $line[]; // verticale rate |
|
| 655 | + $data['squawk'] = $line[10]; // squawk |
|
| 656 | + $data['emergency'] = ''; // emergency |
|
| 657 | + $data['registration'] = $line[2]; |
|
| 658 | + $data['aircraft_icao'] = $line[0]; |
|
| 659 | + $deparr = explode('-',$line[1]); |
|
| 660 | + if (count($deparr) == 2) { |
|
| 661 | 661 | $data['departure_airport_icao'] = $deparr[0]; |
| 662 | 662 | $data['arrival_airport_icao'] = $deparr[1]; |
| 663 | - } |
|
| 664 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 665 | - $data['format_source'] = 'planeupdatefaa'; |
|
| 666 | - $data['id_source'] = $id_source; |
|
| 667 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 668 | - $SI->add($data); |
|
| 669 | - unset($data); |
|
| 663 | + } |
|
| 664 | + $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 665 | + $data['format_source'] = 'planeupdatefaa'; |
|
| 666 | + $data['id_source'] = $id_source; |
|
| 667 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 668 | + $SI->add($data); |
|
| 669 | + unset($data); |
|
| 670 | 670 | } |
| 671 | - } |
|
| 672 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 673 | - $last_exec[$id]['last'] = time(); |
|
| 674 | - } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 675 | - $buffer = $Common->getData($value['host']); |
|
| 676 | - $all_data = json_decode($buffer,true); |
|
| 677 | - if (isset($all_data['states'])) { |
|
| 671 | + } |
|
| 672 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 673 | + $last_exec[$id]['last'] = time(); |
|
| 674 | + } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 675 | + $buffer = $Common->getData($value['host']); |
|
| 676 | + $all_data = json_decode($buffer,true); |
|
| 677 | + if (isset($all_data['states'])) { |
|
| 678 | 678 | $reset = 0; |
| 679 | 679 | foreach ($all_data['states'] as $key => $line) { |
| 680 | - $data = array(); |
|
| 681 | - $data['hex'] = $line[0]; // hex |
|
| 682 | - $data['ident'] = trim($line[1]); // ident |
|
| 683 | - $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 684 | - $data['speed'] = round($line[9]*1.94384); // speed |
|
| 685 | - $data['heading'] = round($line[10]); // heading |
|
| 686 | - $data['latitude'] = $line[5]; // lat |
|
| 687 | - $data['longitude'] = $line[6]; // long |
|
| 688 | - $data['verticalrate'] = $line[11]; // verticale rate |
|
| 689 | - //$data['squawk'] = $line[10]; // squawk |
|
| 690 | - //$data['emergency'] = ''; // emergency |
|
| 691 | - //$data['registration'] = $line[2]; |
|
| 692 | - //$data['aircraft_icao'] = $line[0]; |
|
| 693 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 694 | - $data['format_source'] = 'opensky'; |
|
| 695 | - $data['id_source'] = $id_source; |
|
| 696 | - $SI->add($data); |
|
| 697 | - unset($data); |
|
| 680 | + $data = array(); |
|
| 681 | + $data['hex'] = $line[0]; // hex |
|
| 682 | + $data['ident'] = trim($line[1]); // ident |
|
| 683 | + $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 684 | + $data['speed'] = round($line[9]*1.94384); // speed |
|
| 685 | + $data['heading'] = round($line[10]); // heading |
|
| 686 | + $data['latitude'] = $line[5]; // lat |
|
| 687 | + $data['longitude'] = $line[6]; // long |
|
| 688 | + $data['verticalrate'] = $line[11]; // verticale rate |
|
| 689 | + //$data['squawk'] = $line[10]; // squawk |
|
| 690 | + //$data['emergency'] = ''; // emergency |
|
| 691 | + //$data['registration'] = $line[2]; |
|
| 692 | + //$data['aircraft_icao'] = $line[0]; |
|
| 693 | + $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 694 | + $data['format_source'] = 'opensky'; |
|
| 695 | + $data['id_source'] = $id_source; |
|
| 696 | + $SI->add($data); |
|
| 697 | + unset($data); |
|
| 698 | + } |
|
| 698 | 699 | } |
| 699 | - } |
|
| 700 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 701 | - $last_exec[$id]['last'] = time(); |
|
| 702 | - //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
| 703 | - } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 704 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 705 | - $buffer = $Common->getData($value['host']); |
|
| 706 | - $all_data = json_decode($buffer,true); |
|
| 707 | - if (!empty($all_data)) $reset = 0; |
|
| 708 | - foreach ($all_data as $key => $line) { |
|
| 700 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 701 | + $last_exec[$id]['last'] = time(); |
|
| 702 | + //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
| 703 | + } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 704 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 705 | + $buffer = $Common->getData($value['host']); |
|
| 706 | + $all_data = json_decode($buffer,true); |
|
| 707 | + if (!empty($all_data)) $reset = 0; |
|
| 708 | + foreach ($all_data as $key => $line) { |
|
| 709 | 709 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 710 | - $data = array(); |
|
| 711 | - $data['hex'] = $line[0]; |
|
| 712 | - $data['ident'] = $line[16]; //$line[13] |
|
| 713 | - $data['altitude'] = $line[4]; // altitude |
|
| 714 | - $data['speed'] = $line[5]; // speed |
|
| 715 | - $data['heading'] = $line[3]; // heading |
|
| 716 | - $data['latitude'] = $line[1]; // lat |
|
| 717 | - $data['longitude'] = $line[2]; // long |
|
| 718 | - $data['verticalrate'] = $line[15]; // verticale rate |
|
| 719 | - $data['squawk'] = $line[6]; // squawk |
|
| 720 | - $data['aircraft_icao'] = $line[8]; |
|
| 721 | - $data['registration'] = $line[9]; |
|
| 722 | - $data['departure_airport_iata'] = $line[11]; |
|
| 723 | - $data['arrival_airport_iata'] = $line[12]; |
|
| 724 | - $data['emergency'] = ''; // emergency |
|
| 725 | - $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 726 | - $data['format_source'] = 'fr24json'; |
|
| 727 | - $data['id_source'] = $id_source; |
|
| 728 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 729 | - $SI->add($data); |
|
| 730 | - unset($data); |
|
| 710 | + $data = array(); |
|
| 711 | + $data['hex'] = $line[0]; |
|
| 712 | + $data['ident'] = $line[16]; //$line[13] |
|
| 713 | + $data['altitude'] = $line[4]; // altitude |
|
| 714 | + $data['speed'] = $line[5]; // speed |
|
| 715 | + $data['heading'] = $line[3]; // heading |
|
| 716 | + $data['latitude'] = $line[1]; // lat |
|
| 717 | + $data['longitude'] = $line[2]; // long |
|
| 718 | + $data['verticalrate'] = $line[15]; // verticale rate |
|
| 719 | + $data['squawk'] = $line[6]; // squawk |
|
| 720 | + $data['aircraft_icao'] = $line[8]; |
|
| 721 | + $data['registration'] = $line[9]; |
|
| 722 | + $data['departure_airport_iata'] = $line[11]; |
|
| 723 | + $data['arrival_airport_iata'] = $line[12]; |
|
| 724 | + $data['emergency'] = ''; // emergency |
|
| 725 | + $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 726 | + $data['format_source'] = 'fr24json'; |
|
| 727 | + $data['id_source'] = $id_source; |
|
| 728 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 729 | + $SI->add($data); |
|
| 730 | + unset($data); |
|
| 731 | + } |
|
| 731 | 732 | } |
| 732 | - } |
|
| 733 | - //$last_exec['fr24json'] = time(); |
|
| 734 | - $last_exec[$id]['last'] = time(); |
|
| 735 | - //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
| 736 | - } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 737 | - //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 738 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 739 | - //echo $buffer; |
|
| 740 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 741 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 742 | - $all_data = json_decode($buffer,true); |
|
| 743 | - if (json_last_error() != JSON_ERROR_NONE) { |
|
| 733 | + //$last_exec['fr24json'] = time(); |
|
| 734 | + $last_exec[$id]['last'] = time(); |
|
| 735 | + //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
| 736 | + } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 737 | + //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 738 | + $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 739 | + //echo $buffer; |
|
| 740 | + $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 741 | + $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 742 | + $all_data = json_decode($buffer,true); |
|
| 743 | + if (json_last_error() != JSON_ERROR_NONE) { |
|
| 744 | 744 | die(json_last_error_msg()); |
| 745 | - } |
|
| 746 | - if (isset($all_data['mrkrs'])) { |
|
| 745 | + } |
|
| 746 | + if (isset($all_data['mrkrs'])) { |
|
| 747 | 747 | $reset = 0; |
| 748 | 748 | foreach ($all_data['mrkrs'] as $key => $line) { |
| 749 | - if (isset($line['inf'])) { |
|
| 749 | + if (isset($line['inf'])) { |
|
| 750 | 750 | $data = array(); |
| 751 | 751 | $data['hex'] = $line['inf']['ia']; |
| 752 | 752 | if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
| 753 | - $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 754 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 755 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 756 | - $data['latitude'] = $line['pt'][0]; // lat |
|
| 757 | - $data['longitude'] = $line['pt'][1]; // long |
|
| 758 | - //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 759 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 760 | - //$data['aircraft_icao'] = $line[8]; |
|
| 761 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 753 | + $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 754 | + if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 755 | + if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 756 | + $data['latitude'] = $line['pt'][0]; // lat |
|
| 757 | + $data['longitude'] = $line['pt'][1]; // long |
|
| 758 | + //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 759 | + if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 760 | + //$data['aircraft_icao'] = $line[8]; |
|
| 761 | + if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 762 | 762 | //$data['departure_airport_iata'] = $line[11]; |
| 763 | 763 | //$data['arrival_airport_iata'] = $line[12]; |
| 764 | - //$data['emergency'] = ''; // emergency |
|
| 764 | + //$data['emergency'] = ''; // emergency |
|
| 765 | 765 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 766 | - $data['format_source'] = 'radarvirtueljson'; |
|
| 767 | - $data['id_source'] = $id_source; |
|
| 766 | + $data['format_source'] = 'radarvirtueljson'; |
|
| 767 | + $data['id_source'] = $id_source; |
|
| 768 | 768 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 769 | 769 | $SI->add($data); |
| 770 | 770 | unset($data); |
| 771 | - } |
|
| 771 | + } |
|
| 772 | 772 | } |
| 773 | - } |
|
| 774 | - //$last_exec['radarvirtueljson'] = time(); |
|
| 775 | - $last_exec[$id]['last'] = time(); |
|
| 776 | - //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
| 777 | - } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 778 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 779 | - $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 780 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
| 773 | + } |
|
| 774 | + //$last_exec['radarvirtueljson'] = time(); |
|
| 775 | + $last_exec[$id]['last'] = time(); |
|
| 776 | + //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
| 777 | + } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 778 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 779 | + $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 780 | + $all_data = json_decode(utf8_encode($buffer),true); |
|
| 781 | 781 | |
| 782 | - if (isset($all_data['pireps'])) { |
|
| 782 | + if (isset($all_data['pireps'])) { |
|
| 783 | 783 | $reset = 0; |
| 784 | - foreach ($all_data['pireps'] as $line) { |
|
| 785 | - $data = array(); |
|
| 786 | - $data['id'] = $line['id']; |
|
| 787 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 788 | - $data['ident'] = $line['callsign']; // ident |
|
| 789 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 790 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 791 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 792 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 793 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 794 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 795 | - $data['latitude'] = $line['lat']; // lat |
|
| 796 | - $data['longitude'] = $line['lon']; // long |
|
| 797 | - //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 798 | - //$data['squawk'] = $line['squawk']; // squawk |
|
| 799 | - //$data['emergency'] = ''; // emergency |
|
| 800 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 801 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 802 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 803 | - //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 804 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 805 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 806 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 807 | - else $data['info'] = ''; |
|
| 808 | - $data['format_source'] = 'pireps'; |
|
| 809 | - $data['id_source'] = $id_source; |
|
| 810 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 811 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 812 | - if ($line['icon'] == 'plane') { |
|
| 784 | + foreach ($all_data['pireps'] as $line) { |
|
| 785 | + $data = array(); |
|
| 786 | + $data['id'] = $line['id']; |
|
| 787 | + $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 788 | + $data['ident'] = $line['callsign']; // ident |
|
| 789 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 790 | + if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 791 | + if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 792 | + if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 793 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 794 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 795 | + $data['latitude'] = $line['lat']; // lat |
|
| 796 | + $data['longitude'] = $line['lon']; // long |
|
| 797 | + //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 798 | + //$data['squawk'] = $line['squawk']; // squawk |
|
| 799 | + //$data['emergency'] = ''; // emergency |
|
| 800 | + if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 801 | + if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 802 | + if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 803 | + //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 804 | + if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 805 | + if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 806 | + if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 807 | + else $data['info'] = ''; |
|
| 808 | + $data['format_source'] = 'pireps'; |
|
| 809 | + $data['id_source'] = $id_source; |
|
| 810 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 811 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 812 | + if ($line['icon'] == 'plane') { |
|
| 813 | 813 | $SI->add($data); |
| 814 | - // print_r($data); |
|
| 815 | - } elseif ($line['icon'] == 'ct') { |
|
| 814 | + // print_r($data); |
|
| 815 | + } elseif ($line['icon'] == 'ct') { |
|
| 816 | 816 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 817 | 817 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 818 | 818 | $typec = substr($data['ident'],-3); |
@@ -827,181 +827,181 @@ discard block |
||
| 827 | 827 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
| 828 | 828 | else $data['type'] = 'Observer'; |
| 829 | 829 | 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']); |
| 830 | - } |
|
| 831 | - unset($data); |
|
| 830 | + } |
|
| 831 | + unset($data); |
|
| 832 | 832 | } |
| 833 | - } |
|
| 834 | - //$last_exec['pirepsjson'] = time(); |
|
| 835 | - $last_exec[$id]['last'] = time(); |
|
| 836 | - //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
| 837 | - } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 838 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 839 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 840 | - $buffer = $Common->getData($value['host']); |
|
| 841 | - $all_data = json_decode($buffer,true); |
|
| 842 | - if ($buffer != '' && is_array($all_data)) { |
|
| 833 | + } |
|
| 834 | + //$last_exec['pirepsjson'] = time(); |
|
| 835 | + $last_exec[$id]['last'] = time(); |
|
| 836 | + //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
| 837 | + } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 838 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 839 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 840 | + $buffer = $Common->getData($value['host']); |
|
| 841 | + $all_data = json_decode($buffer,true); |
|
| 842 | + if ($buffer != '' && is_array($all_data)) { |
|
| 843 | 843 | $reset = 0; |
| 844 | 844 | foreach ($all_data as $line) { |
| 845 | - $data = array(); |
|
| 846 | - //$data['id'] = $line['id']; // id not usable |
|
| 847 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 848 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 849 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 850 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 851 | - $data['ident'] = $line['flightnum']; // ident |
|
| 852 | - $data['altitude'] = $line['alt']; // altitude |
|
| 853 | - $data['speed'] = $line['gs']; // speed |
|
| 854 | - $data['heading'] = $line['heading']; // heading |
|
| 855 | - $data['latitude'] = $line['lat']; // lat |
|
| 856 | - $data['longitude'] = $line['lng']; // long |
|
| 857 | - $data['verticalrate'] = ''; // verticale rate |
|
| 858 | - $data['squawk'] = ''; // squawk |
|
| 859 | - $data['emergency'] = ''; // emergency |
|
| 860 | - //$data['datetime'] = $line['lastupdate']; |
|
| 861 | - $data['last_update'] = $line['lastupdate']; |
|
| 862 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 863 | - $data['departure_airport_icao'] = $line['depicao']; |
|
| 864 | - $data['departure_airport_time'] = $line['deptime']; |
|
| 865 | - $data['arrival_airport_icao'] = $line['arricao']; |
|
| 866 | - $data['arrival_airport_time'] = $line['arrtime']; |
|
| 867 | - $data['registration'] = $line['aircraft']; |
|
| 868 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 869 | - if (isset($line['aircraftname'])) { |
|
| 845 | + $data = array(); |
|
| 846 | + //$data['id'] = $line['id']; // id not usable |
|
| 847 | + if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 848 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 849 | + if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 850 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 851 | + $data['ident'] = $line['flightnum']; // ident |
|
| 852 | + $data['altitude'] = $line['alt']; // altitude |
|
| 853 | + $data['speed'] = $line['gs']; // speed |
|
| 854 | + $data['heading'] = $line['heading']; // heading |
|
| 855 | + $data['latitude'] = $line['lat']; // lat |
|
| 856 | + $data['longitude'] = $line['lng']; // long |
|
| 857 | + $data['verticalrate'] = ''; // verticale rate |
|
| 858 | + $data['squawk'] = ''; // squawk |
|
| 859 | + $data['emergency'] = ''; // emergency |
|
| 860 | + //$data['datetime'] = $line['lastupdate']; |
|
| 861 | + $data['last_update'] = $line['lastupdate']; |
|
| 862 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 863 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 864 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 865 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 866 | + $data['arrival_airport_time'] = $line['arrtime']; |
|
| 867 | + $data['registration'] = $line['aircraft']; |
|
| 868 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 869 | + if (isset($line['aircraftname'])) { |
|
| 870 | 870 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 871 | 871 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 872 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
| 873 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 874 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 875 | - else { |
|
| 876 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 877 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 878 | - else $data['aircraft_icao'] = $line['aircraftname']; |
|
| 879 | - } |
|
| 880 | - } |
|
| 881 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 882 | - $data['id_source'] = $id_source; |
|
| 883 | - $data['format_source'] = 'phpvmacars'; |
|
| 884 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 885 | - $SI->add($data); |
|
| 886 | - unset($data); |
|
| 872 | + $aircraft_data = explode('-',$line['aircraftname']); |
|
| 873 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 874 | + elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 875 | + else { |
|
| 876 | + $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 877 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 878 | + else $data['aircraft_icao'] = $line['aircraftname']; |
|
| 879 | + } |
|
| 880 | + } |
|
| 881 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 882 | + $data['id_source'] = $id_source; |
|
| 883 | + $data['format_source'] = 'phpvmacars'; |
|
| 884 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 885 | + $SI->add($data); |
|
| 886 | + unset($data); |
|
| 887 | 887 | } |
| 888 | 888 | if ($globalDebug) echo 'No more data...'."\n"; |
| 889 | 889 | unset($buffer); |
| 890 | 890 | unset($all_data); |
| 891 | - } |
|
| 892 | - //$last_exec['phpvmacars'] = time(); |
|
| 893 | - $last_exec[$id]['last'] = time(); |
|
| 894 | - } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 895 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 896 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 897 | - $buffer = $Common->getData($value['host']); |
|
| 898 | - $all_data = json_decode($buffer,true); |
|
| 899 | - if ($buffer != '' && is_array($all_data)) { |
|
| 891 | + } |
|
| 892 | + //$last_exec['phpvmacars'] = time(); |
|
| 893 | + $last_exec[$id]['last'] = time(); |
|
| 894 | + } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 895 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 896 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 897 | + $buffer = $Common->getData($value['host']); |
|
| 898 | + $all_data = json_decode($buffer,true); |
|
| 899 | + if ($buffer != '' && is_array($all_data)) { |
|
| 900 | 900 | $reset = 0; |
| 901 | 901 | foreach ($all_data as $line) { |
| 902 | - $data = array(); |
|
| 903 | - //$data['id'] = $line['id']; // id not usable |
|
| 904 | - $data['id'] = trim($line['flight_id']); |
|
| 905 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 906 | - $data['pilot_name'] = $line['pilot_name']; |
|
| 907 | - $data['pilot_id'] = $line['pilot_id']; |
|
| 908 | - $data['ident'] = trim($line['callsign']); // ident |
|
| 909 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 910 | - $data['speed'] = $line['gs']; // speed |
|
| 911 | - $data['heading'] = $line['heading']; // heading |
|
| 912 | - $data['latitude'] = $line['latitude']; // lat |
|
| 913 | - $data['longitude'] = $line['longitude']; // long |
|
| 914 | - $data['verticalrate'] = ''; // verticale rate |
|
| 915 | - $data['squawk'] = ''; // squawk |
|
| 916 | - $data['emergency'] = ''; // emergency |
|
| 917 | - //$data['datetime'] = $line['lastupdate']; |
|
| 918 | - $data['last_update'] = $line['last_update']; |
|
| 919 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 920 | - $data['departure_airport_icao'] = $line['departure']; |
|
| 921 | - //$data['departure_airport_time'] = $line['departure_time']; |
|
| 922 | - $data['arrival_airport_icao'] = $line['arrival']; |
|
| 923 | - //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 924 | - //$data['registration'] = $line['aircraft']; |
|
| 925 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 926 | - $data['aircraft_icao'] = $line['plane_type']; |
|
| 927 | - $data['id_source'] = $id_source; |
|
| 928 | - $data['format_source'] = 'vam'; |
|
| 929 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 930 | - $SI->add($data); |
|
| 931 | - unset($data); |
|
| 902 | + $data = array(); |
|
| 903 | + //$data['id'] = $line['id']; // id not usable |
|
| 904 | + $data['id'] = trim($line['flight_id']); |
|
| 905 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 906 | + $data['pilot_name'] = $line['pilot_name']; |
|
| 907 | + $data['pilot_id'] = $line['pilot_id']; |
|
| 908 | + $data['ident'] = trim($line['callsign']); // ident |
|
| 909 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 910 | + $data['speed'] = $line['gs']; // speed |
|
| 911 | + $data['heading'] = $line['heading']; // heading |
|
| 912 | + $data['latitude'] = $line['latitude']; // lat |
|
| 913 | + $data['longitude'] = $line['longitude']; // long |
|
| 914 | + $data['verticalrate'] = ''; // verticale rate |
|
| 915 | + $data['squawk'] = ''; // squawk |
|
| 916 | + $data['emergency'] = ''; // emergency |
|
| 917 | + //$data['datetime'] = $line['lastupdate']; |
|
| 918 | + $data['last_update'] = $line['last_update']; |
|
| 919 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 920 | + $data['departure_airport_icao'] = $line['departure']; |
|
| 921 | + //$data['departure_airport_time'] = $line['departure_time']; |
|
| 922 | + $data['arrival_airport_icao'] = $line['arrival']; |
|
| 923 | + //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 924 | + //$data['registration'] = $line['aircraft']; |
|
| 925 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 926 | + $data['aircraft_icao'] = $line['plane_type']; |
|
| 927 | + $data['id_source'] = $id_source; |
|
| 928 | + $data['format_source'] = 'vam'; |
|
| 929 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 930 | + $SI->add($data); |
|
| 931 | + unset($data); |
|
| 932 | 932 | } |
| 933 | 933 | if ($globalDebug) echo 'No more data...'."\n"; |
| 934 | 934 | unset($buffer); |
| 935 | 935 | unset($all_data); |
| 936 | - } |
|
| 937 | - //$last_exec['phpvmacars'] = time(); |
|
| 938 | - $last_exec[$id]['last'] = time(); |
|
| 936 | + } |
|
| 937 | + //$last_exec['phpvmacars'] = time(); |
|
| 938 | + $last_exec[$id]['last'] = time(); |
|
| 939 | 939 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
| 940 | 940 | } elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais') { |
| 941 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 942 | - //$last_exec[$id]['last'] = time(); |
|
| 941 | + if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 942 | + //$last_exec[$id]['last'] = time(); |
|
| 943 | 943 | |
| 944 | - //$read = array( $sockets[$id] ); |
|
| 945 | - $read = $sockets; |
|
| 946 | - $write = NULL; |
|
| 947 | - $e = NULL; |
|
| 948 | - $n = socket_select($read, $write, $e, $timeout); |
|
| 949 | - if ($e != NULL) var_dump($e); |
|
| 950 | - if ($n > 0) { |
|
| 944 | + //$read = array( $sockets[$id] ); |
|
| 945 | + $read = $sockets; |
|
| 946 | + $write = NULL; |
|
| 947 | + $e = NULL; |
|
| 948 | + $n = socket_select($read, $write, $e, $timeout); |
|
| 949 | + if ($e != NULL) var_dump($e); |
|
| 950 | + if ($n > 0) { |
|
| 951 | 951 | $reset = 0; |
| 952 | 952 | foreach ($read as $nb => $r) { |
| 953 | - //$value = $formats[$nb]; |
|
| 954 | - $format = $globalSources[$nb]['format']; |
|
| 955 | - if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
| 956 | - $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 957 | - } else { |
|
| 958 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 959 | - } |
|
| 960 | - //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 961 | - //echo $buffer."\n"; |
|
| 962 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 963 | - //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 964 | - $error = false; |
|
| 965 | - //$SI::del(); |
|
| 966 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 967 | - // SBS format is CSV format |
|
| 968 | - if ($buffer != '') { |
|
| 953 | + //$value = $formats[$nb]; |
|
| 954 | + $format = $globalSources[$nb]['format']; |
|
| 955 | + if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
| 956 | + $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 957 | + } else { |
|
| 958 | + $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 959 | + } |
|
| 960 | + //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 961 | + //echo $buffer."\n"; |
|
| 962 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 963 | + //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 964 | + $error = false; |
|
| 965 | + //$SI::del(); |
|
| 966 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 967 | + // SBS format is CSV format |
|
| 968 | + if ($buffer != '') { |
|
| 969 | 969 | $tt[$format] = 0; |
| 970 | 970 | if ($format == 'acarssbs3') { |
| 971 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 972 | - $ACARS->add(trim($buffer)); |
|
| 973 | - $ACARS->deleteLiveAcarsData(); |
|
| 971 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 972 | + $ACARS->add(trim($buffer)); |
|
| 973 | + $ACARS->deleteLiveAcarsData(); |
|
| 974 | 974 | } elseif ($format == 'raw') { |
| 975 | - // AVR format |
|
| 976 | - $data = $SBS->parse($buffer); |
|
| 977 | - if (is_array($data)) { |
|
| 975 | + // AVR format |
|
| 976 | + $data = $SBS->parse($buffer); |
|
| 977 | + if (is_array($data)) { |
|
| 978 | 978 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 979 | 979 | $data['format_source'] = 'raw'; |
| 980 | 980 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 981 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 982 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 983 | - } |
|
| 984 | - } elseif ($format == 'ais') { |
|
| 985 | - $ais_data = $AIS->parse_line(trim($buffer)); |
|
| 986 | - $data = array(); |
|
| 987 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 988 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 989 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 990 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 991 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 992 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 993 | - if (isset($ais_data['timestamp'])) { |
|
| 981 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 982 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 983 | + } |
|
| 984 | + } elseif ($format == 'ais') { |
|
| 985 | + $ais_data = $AIS->parse_line(trim($buffer)); |
|
| 986 | + $data = array(); |
|
| 987 | + if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 988 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 989 | + if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 990 | + if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 991 | + if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 992 | + if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 993 | + if (isset($ais_data['timestamp'])) { |
|
| 994 | 994 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 995 | - } else { |
|
| 995 | + } else { |
|
| 996 | 996 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 997 | - } |
|
| 998 | - $data['format_source'] = 'nmeatxt'; |
|
| 999 | - $data['id_source'] = $id_source; |
|
| 1000 | - $MI->add($data); |
|
| 1001 | - unset($data); |
|
| 1002 | - } elseif ($format == 'flightgearsp') { |
|
| 1003 | - //echo $buffer."\n"; |
|
| 1004 | - if (strlen($buffer) > 5) { |
|
| 997 | + } |
|
| 998 | + $data['format_source'] = 'nmeatxt'; |
|
| 999 | + $data['id_source'] = $id_source; |
|
| 1000 | + $MI->add($data); |
|
| 1001 | + unset($data); |
|
| 1002 | + } elseif ($format == 'flightgearsp') { |
|
| 1003 | + //echo $buffer."\n"; |
|
| 1004 | + if (strlen($buffer) > 5) { |
|
| 1005 | 1005 | $line = explode(',',$buffer); |
| 1006 | 1006 | $data = array(); |
| 1007 | 1007 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
@@ -1017,120 +1017,120 @@ discard block |
||
| 1017 | 1017 | $data['format_source'] = 'flightgearsp'; |
| 1018 | 1018 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
| 1019 | 1019 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1020 | - } |
|
| 1021 | - } elseif ($format == 'acars') { |
|
| 1022 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1023 | - $ACARS->add(trim($buffer)); |
|
| 1024 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 1025 | - $ACARS->deleteLiveAcarsData(); |
|
| 1020 | + } |
|
| 1021 | + } elseif ($format == 'acars') { |
|
| 1022 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1023 | + $ACARS->add(trim($buffer)); |
|
| 1024 | + socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 1025 | + $ACARS->deleteLiveAcarsData(); |
|
| 1026 | 1026 | } elseif ($format == 'flightgearmp') { |
| 1027 | - if (substr($buffer,0,1) != '#') { |
|
| 1027 | + if (substr($buffer,0,1) != '#') { |
|
| 1028 | 1028 | $data = array(); |
| 1029 | 1029 | //echo $buffer."\n"; |
| 1030 | 1030 | $line = explode(' ',$buffer); |
| 1031 | 1031 | if (count($line) == 11) { |
| 1032 | - $userserver = explode('@',$line[0]); |
|
| 1033 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 1034 | - $data['ident'] = $userserver[0]; |
|
| 1035 | - $data['registration'] = $userserver[0]; |
|
| 1036 | - $data['latitude'] = $line[4]; |
|
| 1037 | - $data['longitude'] = $line[5]; |
|
| 1038 | - $data['altitude'] = $line[6]; |
|
| 1039 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1040 | - $aircraft_type = $line[10]; |
|
| 1041 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 1042 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 1043 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1032 | + $userserver = explode('@',$line[0]); |
|
| 1033 | + $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 1034 | + $data['ident'] = $userserver[0]; |
|
| 1035 | + $data['registration'] = $userserver[0]; |
|
| 1036 | + $data['latitude'] = $line[4]; |
|
| 1037 | + $data['longitude'] = $line[5]; |
|
| 1038 | + $data['altitude'] = $line[6]; |
|
| 1039 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1040 | + $aircraft_type = $line[10]; |
|
| 1041 | + $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 1042 | + $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 1043 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1044 | + } |
|
| 1044 | 1045 | } |
| 1045 | - } |
|
| 1046 | 1046 | } elseif ($format == 'beast') { |
| 1047 | - echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 1048 | - die; |
|
| 1047 | + echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 1048 | + die; |
|
| 1049 | 1049 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
| 1050 | - $line = explode("\t", $buffer); |
|
| 1051 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
| 1050 | + $line = explode("\t", $buffer); |
|
| 1051 | + for($k = 0; $k < count($line); $k=$k+2) { |
|
| 1052 | 1052 | $key = $line[$k]; |
| 1053 | - $lined[$key] = $line[$k+1]; |
|
| 1054 | - } |
|
| 1055 | - if (count($lined) > 3) { |
|
| 1056 | - $data['hex'] = $lined['hexid']; |
|
| 1057 | - //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 1058 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 1059 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1060 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1061 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1062 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1063 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1064 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1065 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 1066 | - $data['id_source'] = $id_source; |
|
| 1067 | - $data['format_source'] = 'tsv'; |
|
| 1068 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1069 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1070 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1071 | - unset($lined); |
|
| 1072 | - unset($data); |
|
| 1073 | - } else $error = true; |
|
| 1053 | + $lined[$key] = $line[$k+1]; |
|
| 1054 | + } |
|
| 1055 | + if (count($lined) > 3) { |
|
| 1056 | + $data['hex'] = $lined['hexid']; |
|
| 1057 | + //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 1058 | + $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 1059 | + if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1060 | + if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1061 | + if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1062 | + if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1063 | + if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1064 | + if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1065 | + if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 1066 | + $data['id_source'] = $id_source; |
|
| 1067 | + $data['format_source'] = 'tsv'; |
|
| 1068 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1069 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1070 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1071 | + unset($lined); |
|
| 1072 | + unset($data); |
|
| 1073 | + } else $error = true; |
|
| 1074 | 1074 | } elseif ($format == 'aprs' && $use_aprs) { |
| 1075 | - if ($aprs_connect == 0) { |
|
| 1075 | + if ($aprs_connect == 0) { |
|
| 1076 | 1076 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
| 1077 | 1077 | $aprs_connect = 1; |
| 1078 | - } |
|
| 1078 | + } |
|
| 1079 | 1079 | |
| 1080 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 1080 | + if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 1081 | 1081 | $aprs_last_tx = time(); |
| 1082 | 1082 | $data_aprs = "# Keep alive"; |
| 1083 | 1083 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1084 | - } |
|
| 1084 | + } |
|
| 1085 | 1085 | |
| 1086 | - //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 1087 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
| 1088 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
| 1089 | - //echo $buffer."\n"; |
|
| 1090 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 1086 | + //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 1087 | + $buffer = str_replace('APRS <- ','',$buffer); |
|
| 1088 | + $buffer = str_replace('APRS -> ','',$buffer); |
|
| 1089 | + //echo $buffer."\n"; |
|
| 1090 | + if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 1091 | 1091 | $line = $APRS->parse($buffer); |
| 1092 | 1092 | //print_r($line); |
| 1093 | 1093 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
| 1094 | 1094 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && isset($line['ident'])) { |
| 1095 | - $aprs_last_tx = time(); |
|
| 1096 | - $data = array(); |
|
| 1097 | - //print_r($line); |
|
| 1098 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1099 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1100 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1101 | - //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1102 | - $data['ident'] = $line['ident']; |
|
| 1103 | - $data['latitude'] = $line['latitude']; |
|
| 1104 | - $data['longitude'] = $line['longitude']; |
|
| 1105 | - //$data['verticalrate'] = $line[16]; |
|
| 1106 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 1107 | - else $data['speed'] = 0; |
|
| 1108 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1109 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1110 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 1111 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; |
|
| 1112 | - //else $data['heading'] = 0; |
|
| 1113 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 1114 | - if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
| 1115 | - $data['id_source'] = $id_source; |
|
| 1116 | - $data['format_source'] = 'aprs'; |
|
| 1117 | - $data['source_name'] = $line['source']; |
|
| 1118 | - $data['source_type'] = 'flarm'; |
|
| 1119 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1120 | - $currentdate = date('Y-m-d H:i:s'); |
|
| 1121 | - $aprsdate = strtotime($data['datetime']); |
|
| 1122 | - // Accept data if time <= system time + 20s |
|
| 1123 | - if (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'])))) { |
|
| 1095 | + $aprs_last_tx = time(); |
|
| 1096 | + $data = array(); |
|
| 1097 | + //print_r($line); |
|
| 1098 | + if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1099 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1100 | + else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1101 | + //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1102 | + $data['ident'] = $line['ident']; |
|
| 1103 | + $data['latitude'] = $line['latitude']; |
|
| 1104 | + $data['longitude'] = $line['longitude']; |
|
| 1105 | + //$data['verticalrate'] = $line[16]; |
|
| 1106 | + if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 1107 | + else $data['speed'] = 0; |
|
| 1108 | + if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1109 | + if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1110 | + if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 1111 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; |
|
| 1112 | + //else $data['heading'] = 0; |
|
| 1113 | + if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 1114 | + if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
| 1115 | + $data['id_source'] = $id_source; |
|
| 1116 | + $data['format_source'] = 'aprs'; |
|
| 1117 | + $data['source_name'] = $line['source']; |
|
| 1118 | + $data['source_type'] = 'flarm'; |
|
| 1119 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1120 | + $currentdate = date('Y-m-d H:i:s'); |
|
| 1121 | + $aprsdate = strtotime($data['datetime']); |
|
| 1122 | + // Accept data if time <= system time + 20s |
|
| 1123 | + if (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'])))) { |
|
| 1124 | 1124 | $send = $SI->add($data); |
| 1125 | - } elseif (isset($line['stealth'])) { |
|
| 1125 | + } elseif (isset($line['stealth'])) { |
|
| 1126 | 1126 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
| 1127 | 1127 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
| 1128 | - //} elseif (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' || $line['symbol'] == 'Police' || $line['symbol'] == 'Bike' || $line['symbol'] == 'Jogger' || $line['symbol'] == 'Bus' || $line['symbol'] == 'Jeep' || $line['symbol'] == 'Recreational Vehicle' || $line['symbol'] == 'Yacht (Sail)' || $line['symbol'] == 'Ship (Power Boat)' || $line['symbol'] == 'Firetruck' || $line['symbol'] == 'Balloon' || $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) { |
|
| 1129 | - } 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') { |
|
| 1128 | + //} elseif (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' || $line['symbol'] == 'Police' || $line['symbol'] == 'Bike' || $line['symbol'] == 'Jogger' || $line['symbol'] == 'Bus' || $line['symbol'] == 'Jeep' || $line['symbol'] == 'Recreational Vehicle' || $line['symbol'] == 'Yacht (Sail)' || $line['symbol'] == 'Ship (Power Boat)' || $line['symbol'] == 'Firetruck' || $line['symbol'] == 'Balloon' || $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) { |
|
| 1129 | + } 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') { |
|
| 1130 | 1130 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
| 1131 | 1131 | if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
| 1132 | - } |
|
| 1133 | - unset($data); |
|
| 1132 | + } |
|
| 1133 | + unset($data); |
|
| 1134 | 1134 | } |
| 1135 | 1135 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
| 1136 | 1136 | echo '!! Weather Station not yet supported'."\n"; |
@@ -1140,12 +1140,12 @@ discard block |
||
| 1140 | 1140 | } |
| 1141 | 1141 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 1142 | 1142 | //elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
| 1143 | - } |
|
| 1143 | + } |
|
| 1144 | 1144 | } else { |
| 1145 | - $line = explode(',', $buffer); |
|
| 1146 | - if (count($line) > 20) { |
|
| 1147 | - $data['hex'] = $line[4]; |
|
| 1148 | - /* |
|
| 1145 | + $line = explode(',', $buffer); |
|
| 1146 | + if (count($line) > 20) { |
|
| 1147 | + $data['hex'] = $line[4]; |
|
| 1148 | + /* |
|
| 1149 | 1149 | $data['datetime'] = $line[6].' '.$line[7]; |
| 1150 | 1150 | date_default_timezone_set($globalTimezone); |
| 1151 | 1151 | $datetime = new DateTime($data['datetime']); |
@@ -1153,29 +1153,29 @@ discard block |
||
| 1153 | 1153 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1154 | 1154 | date_default_timezone_set('UTC'); |
| 1155 | 1155 | */ |
| 1156 | - // Force datetime to current UTC datetime |
|
| 1157 | - date_default_timezone_set('UTC'); |
|
| 1158 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1159 | - $data['ident'] = trim($line[10]); |
|
| 1160 | - $data['latitude'] = $line[14]; |
|
| 1161 | - $data['longitude'] = $line[15]; |
|
| 1162 | - $data['verticalrate'] = $line[16]; |
|
| 1163 | - $data['emergency'] = $line[20]; |
|
| 1164 | - $data['speed'] = $line[12]; |
|
| 1165 | - $data['squawk'] = $line[17]; |
|
| 1166 | - $data['altitude'] = $line[11]; |
|
| 1167 | - $data['heading'] = $line[13]; |
|
| 1168 | - $data['ground'] = $line[21]; |
|
| 1169 | - $data['emergency'] = $line[19]; |
|
| 1170 | - $data['format_source'] = 'sbs'; |
|
| 1156 | + // Force datetime to current UTC datetime |
|
| 1157 | + date_default_timezone_set('UTC'); |
|
| 1158 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1159 | + $data['ident'] = trim($line[10]); |
|
| 1160 | + $data['latitude'] = $line[14]; |
|
| 1161 | + $data['longitude'] = $line[15]; |
|
| 1162 | + $data['verticalrate'] = $line[16]; |
|
| 1163 | + $data['emergency'] = $line[20]; |
|
| 1164 | + $data['speed'] = $line[12]; |
|
| 1165 | + $data['squawk'] = $line[17]; |
|
| 1166 | + $data['altitude'] = $line[11]; |
|
| 1167 | + $data['heading'] = $line[13]; |
|
| 1168 | + $data['ground'] = $line[21]; |
|
| 1169 | + $data['emergency'] = $line[19]; |
|
| 1170 | + $data['format_source'] = 'sbs'; |
|
| 1171 | 1171 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 1172 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1173 | - $data['id_source'] = $id_source; |
|
| 1174 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1175 | - else $error = true; |
|
| 1176 | - unset($data); |
|
| 1177 | - } else $error = true; |
|
| 1178 | - if ($error) { |
|
| 1172 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1173 | + $data['id_source'] = $id_source; |
|
| 1174 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1175 | + else $error = true; |
|
| 1176 | + unset($data); |
|
| 1177 | + } else $error = true; |
|
| 1178 | + if ($error) { |
|
| 1179 | 1179 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
| 1180 | 1180 | if ($globalDebug) echo "Not a message. Ignoring... \n"; |
| 1181 | 1181 | } else { |
@@ -1191,13 +1191,13 @@ discard block |
||
| 1191 | 1191 | connect_all($sourceer); |
| 1192 | 1192 | $sourceer = array(); |
| 1193 | 1193 | } |
| 1194 | - } |
|
| 1194 | + } |
|
| 1195 | 1195 | } |
| 1196 | 1196 | // Sleep for xxx microseconds |
| 1197 | 1197 | if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
| 1198 | - } else { |
|
| 1198 | + } else { |
|
| 1199 | 1199 | if ($format == 'flightgearmp') { |
| 1200 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1200 | + if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1201 | 1201 | //@socket_close($r); |
| 1202 | 1202 | sleep($globalMinFetch); |
| 1203 | 1203 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1206,9 +1206,9 @@ discard block |
||
| 1206 | 1206 | break; |
| 1207 | 1207 | |
| 1208 | 1208 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1209 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1210 | - else $tt[$format] = 0; |
|
| 1211 | - if ($tt[$format] > 30) { |
|
| 1209 | + if (isset($tt[$format])) $tt[$format]++; |
|
| 1210 | + else $tt[$format] = 0; |
|
| 1211 | + if ($tt[$format] > 30) { |
|
| 1212 | 1212 | if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
| 1213 | 1213 | //@socket_close($r); |
| 1214 | 1214 | sleep(2); |
@@ -1219,23 +1219,23 @@ discard block |
||
| 1219 | 1219 | //connect_all($globalSources); |
| 1220 | 1220 | $tt[$format]=0; |
| 1221 | 1221 | break; |
| 1222 | - } |
|
| 1222 | + } |
|
| 1223 | + } |
|
| 1223 | 1224 | } |
| 1224 | - } |
|
| 1225 | 1225 | } |
| 1226 | - } else { |
|
| 1226 | + } else { |
|
| 1227 | 1227 | $error = socket_strerror(socket_last_error()); |
| 1228 | 1228 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 1229 | 1229 | if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
| 1230 | 1230 | if (isset($globalDebug)) echo "Restarting...\n"; |
| 1231 | 1231 | // Restart the script if possible |
| 1232 | 1232 | if (is_array($sockets)) { |
| 1233 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1233 | + if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1234 | 1234 | |
| 1235 | - foreach ($sockets as $sock) { |
|
| 1235 | + foreach ($sockets as $sock) { |
|
| 1236 | 1236 | @socket_shutdown($sock,2); |
| 1237 | 1237 | @socket_close($sock); |
| 1238 | - } |
|
| 1238 | + } |
|
| 1239 | 1239 | |
| 1240 | 1240 | } |
| 1241 | 1241 | if ($globalDebug) echo "Restart all connections..."; |
@@ -1246,13 +1246,13 @@ discard block |
||
| 1246 | 1246 | if ($reset > 40) exit('Too many attempts...'); |
| 1247 | 1247 | connect_all($globalSources); |
| 1248 | 1248 | } |
| 1249 | - } |
|
| 1249 | + } |
|
| 1250 | 1250 | } |
| 1251 | 1251 | if ($globalDaemon === false) { |
| 1252 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1253 | - $SI->checkAll(); |
|
| 1252 | + if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1253 | + $SI->checkAll(); |
|
| 1254 | + } |
|
| 1254 | 1255 | } |
| 1255 | - } |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | ?> |