@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | var entityid = entity.id; |
42 | 42 | var lastupdateentity = entity.properties.lastupdate; |
43 | 43 | <?php |
44 | - if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
44 | + if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
45 | 45 | ?> |
46 | 46 | if (lastupdateentity != lastupdatemarine) { |
47 | 47 | viewer.dataSources.get(dsn).entities.remove(entity); |
48 | 48 | czmldsmarine.entities.removeById(entityid); |
49 | 49 | } |
50 | 50 | <?php |
51 | - } else { |
|
51 | + } else { |
|
52 | 52 | ?> |
53 | 53 | if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
54 | 54 | viewer.dataSources.get(dsn).entities.remove(entity); |
55 | 55 | } |
56 | 56 | <?php |
57 | - } |
|
57 | + } |
|
58 | 58 | ?> |
59 | 59 | } |
60 | 60 | } |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | function updateMarineData() { |
77 | 77 | lastupdatemarine = Date.now(); |
78 | 78 | <?php |
79 | - if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
79 | + if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
80 | 80 | ?> |
81 | 81 | var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&coord='+bbox()+'&update=' + lastupdatemarine); |
82 | 82 | <?php |
83 | - } else { |
|
83 | + } else { |
|
84 | 84 | ?> |
85 | 85 | var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&update=' + lastupdatemarine); |
86 | 86 | <?php |
87 | - } |
|
87 | + } |
|
88 | 88 | ?> |
89 | 89 | livemarinedata.then(function (data) { |
90 | 90 | displayMarineData(data); |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
132 | 132 | camera.moveEnd.addEventListener(function() { |
133 | 133 | <?php |
134 | - if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
134 | + if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
135 | 135 | ?> |
136 | 136 | updateMarineData(); |
137 | 137 | <?php |
138 | - } |
|
138 | + } |
|
139 | 139 | ?> |
140 | 140 | }); |
141 | 141 |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['aircraft_manufacturer'])) { |
7 | - header('Location: '.$globalURL.'/manufacturer'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/manufacturer'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $aircraft_manufacturer = urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)); |
11 | 11 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
@@ -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]); |
@@ -160,17 +160,17 @@ discard block |
||
160 | 160 | } |
161 | 161 | ?> |
162 | 162 | <?php |
163 | - if (isset($_POST['archive'])) { |
|
163 | + if (isset($_POST['archive'])) { |
|
164 | 164 | ?> |
165 | 165 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
166 | 166 | <?php |
167 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
167 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
168 | 168 | ?> |
169 | 169 | |
170 | 170 | <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> |
171 | 171 | <?php |
172 | - } |
|
173 | - } else { |
|
172 | + } |
|
173 | + } else { |
|
174 | 174 | ?> |
175 | 175 | <?php |
176 | 176 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | ?> |
184 | 184 | <?php |
185 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
185 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
186 | 186 | ?> |
187 | 187 | <?php |
188 | 188 | // if (isset($globalBeta) && $globalBeta) { |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | <script src="<?php print $globalURL; ?>/js/map-satellite.2d.js.php?<?php print time(); ?>"></script> |
214 | 214 | <?php |
215 | 215 | } |
216 | - } |
|
216 | + } |
|
217 | 217 | ?> |
218 | 218 | <?php |
219 | 219 | // } |
220 | 220 | ?> |
221 | 221 | <?php |
222 | - } |
|
222 | + } |
|
223 | 223 | } |
224 | 224 | ?> |
225 | 225 | <?php |
@@ -397,61 +397,61 @@ discard block |
||
397 | 397 | <ul class="nav navbar-nav"> |
398 | 398 | |
399 | 399 | <?php |
400 | - $sub = false; |
|
401 | - if ( |
|
400 | + $sub = false; |
|
401 | + if ( |
|
402 | 402 | ( |
403 | - (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
403 | + (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
404 | 404 | ) || |
405 | 405 | ( |
406 | - isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
406 | + isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
407 | 407 | ) || |
408 | 408 | ( |
409 | - isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
409 | + isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
410 | 410 | ) || |
411 | 411 | ( |
412 | - isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
412 | + isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
413 | 413 | ) |
414 | - ) { |
|
414 | + ) { |
|
415 | 415 | $sub = true; |
416 | - } |
|
416 | + } |
|
417 | 417 | ?> |
418 | 418 | <?php |
419 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
419 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
420 | 420 | ?> |
421 | 421 | <li class="dropdown"> |
422 | 422 | <?php |
423 | - if ($sub) { |
|
423 | + if ($sub) { |
|
424 | 424 | ?> |
425 | 425 | <li class="dropdown"> |
426 | 426 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Aircrafts"); ?> <b class="caret"></b></a> |
427 | 427 | <ul class="dropdown-menu multi-level"> |
428 | 428 | <li class="dropdown-submenu"> |
429 | 429 | <?php |
430 | - } |
|
430 | + } |
|
431 | 431 | ?> |
432 | 432 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
433 | 433 | <ul class="dropdown-menu"> |
434 | 434 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li> |
435 | 435 | <?php |
436 | - if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
436 | + if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
437 | 437 | ?> |
438 | 438 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
439 | 439 | <?php |
440 | - } |
|
440 | + } |
|
441 | 441 | ?> |
442 | 442 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
443 | 443 | <?php |
444 | - if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
444 | + if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
445 | 445 | ?> |
446 | 446 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
447 | 447 | <?php |
448 | - } |
|
449 | - if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
448 | + } |
|
449 | + if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
450 | 450 | |
451 | 451 | ?> |
452 | 452 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
453 | 453 | <?php |
454 | - } |
|
454 | + } |
|
455 | 455 | ?> |
456 | 456 | <li><hr /></li> |
457 | 457 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -459,43 +459,43 @@ discard block |
||
459 | 459 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
460 | 460 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
461 | 461 | <?php |
462 | - if ($globalACARS) { |
|
463 | - if (isset($globalDemo) && $globalDemo) { |
|
464 | - ?> |
|
462 | + if ($globalACARS) { |
|
463 | + if (isset($globalDemo) && $globalDemo) { |
|
464 | + ?> |
|
465 | 465 | <li><hr /></li> |
466 | 466 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
467 | 467 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
468 | 468 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
469 | 469 | <?php |
470 | - } else { |
|
471 | - ?> |
|
470 | + } else { |
|
471 | + ?> |
|
472 | 472 | <li><hr /></li> |
473 | 473 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
474 | 474 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
475 | 475 | <?php |
476 | - } |
|
477 | - } |
|
478 | - ?> |
|
476 | + } |
|
477 | + } |
|
478 | + ?> |
|
479 | 479 | <?php |
480 | - if (isset($globalAccidents) && $globalAccidents) { |
|
481 | - ?> |
|
480 | + if (isset($globalAccidents) && $globalAccidents) { |
|
481 | + ?> |
|
482 | 482 | <li><hr /></li> |
483 | 483 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
484 | 484 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
485 | 485 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
486 | 486 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
487 | 487 | <?php |
488 | - } |
|
489 | - ?> |
|
488 | + } |
|
489 | + ?> |
|
490 | 490 | <li><hr /></li> |
491 | 491 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
492 | 492 | <?php |
493 | 493 | if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) { |
494 | - ?> |
|
494 | + ?> |
|
495 | 495 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
496 | 496 | <?php |
497 | 497 | } |
498 | - ?> |
|
498 | + ?> |
|
499 | 499 | </ul> |
500 | 500 | </li> |
501 | 501 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
@@ -522,14 +522,14 @@ discard block |
||
522 | 522 | </ul> |
523 | 523 | <?php |
524 | 524 | } |
525 | - } |
|
525 | + } |
|
526 | 526 | ?> |
527 | 527 | <?php |
528 | - if (isset($globalMarine) && $globalMarine) { |
|
528 | + if (isset($globalMarine) && $globalMarine) { |
|
529 | 529 | ?> |
530 | 530 | <li class="dropdown"> |
531 | 531 | <?php |
532 | - if ($sub) { |
|
532 | + if ($sub) { |
|
533 | 533 | ?> |
534 | 534 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Vessels"); ?> <b class="caret"></b></a> |
535 | 535 | <ul class="dropdown-menu multi-level"> |
@@ -555,14 +555,14 @@ discard block |
||
555 | 555 | } |
556 | 556 | ?> |
557 | 557 | <?php |
558 | - } |
|
558 | + } |
|
559 | 559 | ?> |
560 | 560 | <?php |
561 | - if (isset($globalTracker) && $globalTracker) { |
|
561 | + if (isset($globalTracker) && $globalTracker) { |
|
562 | 562 | ?> |
563 | 563 | <li class="dropdown"> |
564 | 564 | <?php |
565 | - if ($sub) { |
|
565 | + if ($sub) { |
|
566 | 566 | ?> |
567 | 567 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a> |
568 | 568 | <ul class="dropdown-menu multi-level"> |
@@ -588,14 +588,14 @@ discard block |
||
588 | 588 | } |
589 | 589 | ?> |
590 | 590 | <?php |
591 | - } |
|
591 | + } |
|
592 | 592 | ?> |
593 | 593 | <?php |
594 | - if (isset($globalSatellite) && $globalSatellite) { |
|
594 | + if (isset($globalSatellite) && $globalSatellite) { |
|
595 | 595 | ?> |
596 | 596 | <li class="dropdown"> |
597 | 597 | <?php |
598 | - if ($sub) { |
|
598 | + if ($sub) { |
|
599 | 599 | ?> |
600 | 600 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellite"); ?> <b class="caret"></b></a> |
601 | 601 | <ul class="dropdown-menu multi-level"> |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } |
623 | 623 | ?> |
624 | 624 | <?php |
625 | - } |
|
625 | + } |
|
626 | 626 | ?> |
627 | 627 | |
628 | 628 | <li class="dropdown"> |
@@ -631,12 +631,12 @@ discard block |
||
631 | 631 | <li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li> |
632 | 632 | <li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li> |
633 | 633 | <?php |
634 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
634 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
635 | 635 | ?> |
636 | 636 | <li><hr /></li> |
637 | 637 | <li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li> |
638 | 638 | <?php |
639 | - } |
|
639 | + } |
|
640 | 640 | ?> |
641 | 641 | <?php if (isset($globalContribute) && $globalContribute) { ?> |
642 | 642 | <li><hr /></li> |
@@ -657,14 +657,14 @@ discard block |
||
657 | 657 | <form> |
658 | 658 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
659 | 659 | <?php |
660 | - $Language = new Language(); |
|
661 | - $alllang = $Language->getLanguages(); |
|
662 | - foreach ($alllang as $key => $lang) { |
|
663 | - print '<option value="'.$key.'"'; |
|
664 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
665 | - print '>'.$lang[0].'</option>'; |
|
666 | - } |
|
667 | - ?> |
|
660 | + $Language = new Language(); |
|
661 | + $alllang = $Language->getLanguages(); |
|
662 | + foreach ($alllang as $key => $lang) { |
|
663 | + print '<option value="'.$key.'"'; |
|
664 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
665 | + print '>'.$lang[0].'</option>'; |
|
666 | + } |
|
667 | + ?> |
|
668 | 668 | </select> |
669 | 669 | </form> |
670 | 670 | </div> |
@@ -695,18 +695,18 @@ discard block |
||
695 | 695 | ?> |
696 | 696 | <div class="top-header clear" role="main"> |
697 | 697 | <?php |
698 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
698 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
699 | 699 | ?> |
700 | 700 | <div id="archive-map"></div> |
701 | 701 | <?php |
702 | - } |
|
702 | + } |
|
703 | 703 | ?> |
704 | 704 | </div> |
705 | 705 | <?php |
706 | 706 | } |
707 | 707 | 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)) |
708 | 708 | { |
709 | - ?> |
|
709 | + ?> |
|
710 | 710 | <div class="top-header clear" role="main"> |
711 | 711 | <div id="map"></div> |
712 | 712 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -717,15 +717,15 @@ discard block |
||
717 | 717 | var zoom = 13; |
718 | 718 | //create the map |
719 | 719 | <?php |
720 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
720 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
721 | 721 | ?> |
722 | 722 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
723 | 723 | <?php |
724 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
724 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
725 | 725 | ?> |
726 | 726 | map = L.map('map', { zoomControl:true }); |
727 | 727 | <?php |
728 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
728 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
729 | 729 | ?> |
730 | 730 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
731 | 731 | 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); |
@@ -733,22 +733,22 @@ discard block |
||
733 | 733 | 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); |
734 | 734 | 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); |
735 | 735 | <?php |
736 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
736 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
737 | 737 | ?> |
738 | 738 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
739 | 739 | <?php |
740 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
740 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
741 | 741 | ?> |
742 | 742 | map = L.map('map', { zoomControl:true }); |
743 | 743 | <?php |
744 | - } |
|
744 | + } |
|
745 | 745 | ?> |
746 | 746 | //initialize the layer group for the aircrft markers |
747 | 747 | var layer_data = L.layerGroup(); |
748 | 748 | |
749 | 749 | //a few title layers |
750 | 750 | <?php |
751 | - if ($globalMapProvider == 'Mapbox') { |
|
751 | + if ($globalMapProvider == 'Mapbox') { |
|
752 | 752 | ?> |
753 | 753 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
754 | 754 | maxZoom: 18, |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | token : '<?php print $globalMapboxToken; ?>' |
760 | 760 | }).addTo(map); |
761 | 761 | <?php |
762 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
762 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
763 | 763 | ?> |
764 | 764 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
765 | 765 | maxZoom: 18, |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
769 | 769 | }).addTo(map); |
770 | 770 | <?php |
771 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
771 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
772 | 772 | ?> |
773 | 773 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
774 | 774 | maxZoom: 18, |
@@ -777,27 +777,27 @@ discard block |
||
777 | 777 | '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"' |
778 | 778 | }).addTo(map); |
779 | 779 | <?php |
780 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
780 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
781 | 781 | ?> |
782 | 782 | var googleLayer = new L.Google('ROADMAP'); |
783 | 783 | map.addLayer(googleLayer); |
784 | 784 | <?php |
785 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
785 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
786 | 786 | ?> |
787 | 787 | var googleLayer = new L.Google('SATELLITE'); |
788 | 788 | map.addLayer(googleLayer); |
789 | 789 | <?php |
790 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
790 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
791 | 791 | ?> |
792 | 792 | var googleLayer = new L.Google('HYBRID'); |
793 | 793 | map.addLayer(googleLayer); |
794 | 794 | <?php |
795 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
795 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
796 | 796 | ?> |
797 | 797 | var googleLayer = new L.Google('Terrain'); |
798 | 798 | map.addLayer(googleLayer); |
799 | 799 | <?php |
800 | - } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
800 | + } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
801 | 801 | $customid = $globalMapProvider; |
802 | 802 | ?> |
803 | 803 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
@@ -807,8 +807,8 @@ discard block |
||
807 | 807 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
808 | 808 | }).addTo(map); |
809 | 809 | <?php |
810 | - //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
811 | - } else { |
|
810 | + //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
811 | + } else { |
|
812 | 812 | ?> |
813 | 813 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
814 | 814 | maxZoom: 18, |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | }).addTo(map); |
818 | 818 | |
819 | 819 | <?php |
820 | - } |
|
820 | + } |
|
821 | 821 | ?> |
822 | 822 | </script> |
823 | 823 | </div> |
@@ -6,12 +6,12 @@ |
||
6 | 6 | </div> |
7 | 7 | <footer class="container"> |
8 | 8 | <?php |
9 | - if (isset($sql_time)) { |
|
9 | + if (isset($sql_time)) { |
|
10 | 10 | ?> |
11 | 11 | <i><?php echo _("Page generated in").' '.round($sql_time+$page_time,2); ?>s (<?php print round($page_time,2); ?>ms PHP - <?php print round($sql_time,2); ?>ms SQL)</i> |
12 | 12 | <br /> |
13 | 13 | <?php |
14 | - } |
|
14 | + } |
|
15 | 15 | ?> |
16 | 16 | <span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source & Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span> |
17 | 17 | </footer> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?> |
48 | 48 | </tr></table></div> |
49 | 49 | <?php |
50 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
50 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
51 | 51 | ?> |
52 | 52 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script> |
53 | 53 | <?php |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script> |
72 | 72 | <?php |
73 | 73 | } |
74 | - } |
|
74 | + } |
|
75 | 75 | ?> |
76 | 76 | |
77 | 77 | <div id="sidebar" class="sidebar collapsed"> |
@@ -82,34 +82,34 @@ discard block |
||
82 | 82 | <li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
83 | 83 | <li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
84 | 84 | <?php |
85 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
85 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
86 | 86 | if (isset($globalArchive) && $globalArchive == TRUE) { |
87 | 87 | ?> |
88 | 88 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
89 | 89 | <?php |
90 | 90 | } |
91 | - } |
|
91 | + } |
|
92 | 92 | ?> |
93 | 93 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
94 | 94 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
95 | 95 | <li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li> |
96 | 96 | <?php |
97 | - if (isset($globalMap3D) && $globalMap3D) { |
|
97 | + if (isset($globalMap3D) && $globalMap3D) { |
|
98 | 98 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
99 | 99 | ?> |
100 | 100 | <li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
101 | 101 | <?php |
102 | - if (isset($globalSatellite) && $globalSatellite) { |
|
102 | + if (isset($globalSatellite) && $globalSatellite) { |
|
103 | 103 | ?> |
104 | 104 | <li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li> |
105 | 105 | <?php |
106 | - } |
|
106 | + } |
|
107 | 107 | } else { |
108 | 108 | ?> |
109 | 109 | <li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
110 | 110 | <?php |
111 | 111 | } |
112 | - } |
|
112 | + } |
|
113 | 113 | ?> |
114 | 114 | </ul> |
115 | 115 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | ?> |
185 | 185 | </div> |
186 | 186 | <?php |
187 | - if (isset($globalArchive) && $globalArchive == TRUE) { |
|
187 | + if (isset($globalArchive) && $globalArchive == TRUE) { |
|
188 | 188 | ?> |
189 | 189 | <div class="sidebar-pane" id="archive"> |
190 | 190 | <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | </form> |
244 | 244 | </div> |
245 | 245 | <?php |
246 | - } |
|
246 | + } |
|
247 | 247 | ?> |
248 | 248 | <div class="sidebar-pane" id="settings"> |
249 | 249 | <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -254,56 +254,56 @@ discard block |
||
254 | 254 | <?php |
255 | 255 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
256 | 256 | else $MapType = $_COOKIE['MapType']; |
257 | - ?> |
|
257 | + ?> |
|
258 | 258 | <?php |
259 | 259 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
260 | - ?> |
|
260 | + ?> |
|
261 | 261 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
262 | 262 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
263 | 263 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
264 | 264 | <?php |
265 | 265 | } |
266 | - ?> |
|
266 | + ?> |
|
267 | 267 | <?php |
268 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
269 | - ?> |
|
268 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
269 | + ?> |
|
270 | 270 | <?php |
271 | - if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
272 | - ?> |
|
271 | + if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
272 | + ?> |
|
273 | 273 | <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
274 | 274 | <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
275 | 275 | <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
276 | 276 | <?php |
277 | - } |
|
278 | - ?> |
|
277 | + } |
|
278 | + ?> |
|
279 | 279 | <?php |
280 | - if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
281 | - ?> |
|
280 | + if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
281 | + ?> |
|
282 | 282 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
283 | 283 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
284 | 284 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
285 | 285 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
286 | 286 | <?php |
287 | - } |
|
288 | - ?> |
|
287 | + } |
|
288 | + ?> |
|
289 | 289 | <?php |
290 | - if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
291 | - ?> |
|
290 | + if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
291 | + ?> |
|
292 | 292 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
293 | 293 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
294 | 294 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
295 | 295 | <?php |
296 | - } |
|
297 | - ?> |
|
296 | + } |
|
297 | + ?> |
|
298 | 298 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
299 | 299 | <?php |
300 | 300 | } |
301 | - ?> |
|
301 | + ?> |
|
302 | 302 | <?php |
303 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
303 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
304 | 304 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
305 | 305 | else $MapBoxId = $_COOKIE['MapTypeId']; |
306 | - ?> |
|
306 | + ?> |
|
307 | 307 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
308 | 308 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
309 | 309 | <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
@@ -317,13 +317,13 @@ discard block |
||
317 | 317 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
318 | 318 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
319 | 319 | <?php |
320 | - } |
|
321 | - ?> |
|
320 | + } |
|
321 | + ?> |
|
322 | 322 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
323 | 323 | </select> |
324 | 324 | </li> |
325 | 325 | <?php |
326 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
326 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
327 | 327 | ?> |
328 | 328 | <li><?php echo _("Type of Terrain:"); ?> |
329 | 329 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | </select> |
335 | 335 | </li> |
336 | 336 | <?php |
337 | - } |
|
337 | + } |
|
338 | 338 | ?> |
339 | 339 | <?php |
340 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
340 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
341 | 341 | ?> |
342 | 342 | <?php |
343 | 343 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
355 | 355 | <?php |
356 | 356 | } |
357 | - } |
|
357 | + } |
|
358 | 358 | ?> |
359 | 359 | <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
360 | 360 | <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
@@ -366,81 +366,81 @@ discard block |
||
366 | 366 | <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li> |
367 | 367 | <?php |
368 | 368 | } |
369 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
369 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
370 | 370 | ?> |
371 | 371 | <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> |
372 | 372 | <?php |
373 | - } |
|
374 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
373 | + } |
|
374 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
375 | 375 | ?> |
376 | 376 | <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> |
377 | 377 | <?php |
378 | - } |
|
378 | + } |
|
379 | 379 | ?> |
380 | 380 | <?php |
381 | 381 | if (function_exists('array_column')) { |
382 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
383 | - ?> |
|
382 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
383 | + ?> |
|
384 | 384 | <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> |
385 | 385 | <?php |
386 | - } |
|
386 | + } |
|
387 | 387 | } elseif (isset($globalSources)) { |
388 | - $dispolar = false; |
|
389 | - foreach ($globalSources as $testsource) { |
|
390 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
391 | - } |
|
392 | - if ($dispolar) { |
|
393 | - ?> |
|
388 | + $dispolar = false; |
|
389 | + foreach ($globalSources as $testsource) { |
|
390 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
391 | + } |
|
392 | + if ($dispolar) { |
|
393 | + ?> |
|
394 | 394 | <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> |
395 | 395 | <?php |
396 | - } |
|
397 | - } |
|
398 | - ?> |
|
396 | + } |
|
397 | + } |
|
398 | + ?> |
|
399 | 399 | <?php |
400 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
400 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
401 | 401 | ?> |
402 | 402 | |
403 | 403 | <?php |
404 | 404 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
405 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
406 | - ?> |
|
405 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
406 | + ?> |
|
407 | 407 | <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> |
408 | 408 | <?php |
409 | 409 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
410 | - ?> |
|
410 | + ?> |
|
411 | 411 | <li><?php echo _("Aircraft icon color:"); ?> |
412 | 412 | <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'; ?>"> |
413 | 413 | </li> |
414 | 414 | <?php |
415 | 415 | } |
416 | - } |
|
417 | - } |
|
418 | - ?> |
|
416 | + } |
|
417 | + } |
|
418 | + ?> |
|
419 | 419 | <?php |
420 | 420 | if (isset($globalMarine) && $globalMarine === TRUE) { |
421 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
422 | - ?> |
|
421 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
422 | + ?> |
|
423 | 423 | <li><?php echo _("Marine icon color:"); ?> |
424 | 424 | <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
425 | 425 | </li> |
426 | 426 | <?php |
427 | - } |
|
428 | - } |
|
429 | - ?> |
|
427 | + } |
|
428 | + } |
|
429 | + ?> |
|
430 | 430 | <?php |
431 | 431 | if (isset($globalTracker) && $globalTracker === TRUE) { |
432 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
433 | - ?> |
|
432 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
433 | + ?> |
|
434 | 434 | <li><?php echo _("Tracker icon color:"); ?> |
435 | 435 | <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
436 | 436 | </li> |
437 | 437 | <?php |
438 | - } |
|
439 | - } |
|
440 | - ?> |
|
438 | + } |
|
439 | + } |
|
440 | + ?> |
|
441 | 441 | <?php |
442 | 442 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
443 | - ?> |
|
443 | + ?> |
|
444 | 444 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
445 | 445 | <div class="range"> |
446 | 446 | <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'; ?>"> |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | </li> |
450 | 450 | <?php |
451 | 451 | } |
452 | - ?> |
|
452 | + ?> |
|
453 | 453 | <?php |
454 | - } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
454 | + } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
455 | 455 | ?> |
456 | 456 | <?php |
457 | 457 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | </li> |
484 | 484 | <?php |
485 | 485 | } |
486 | - } |
|
486 | + } |
|
487 | 487 | ?> |
488 | 488 | <li><?php echo _("Distance unit:"); ?> |
489 | 489 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -516,19 +516,19 @@ discard block |
||
516 | 516 | <ul> |
517 | 517 | <?php |
518 | 518 | if (!isset($globalAircraft) || $globalAircraft) { |
519 | - ?> |
|
519 | + ?> |
|
520 | 520 | <?php |
521 | 521 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
522 | - ?> |
|
522 | + ?> |
|
523 | 523 | <?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 } ?> |
524 | 524 | <?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 } ?> |
525 | 525 | <?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 } ?> |
526 | 526 | <?php |
527 | 527 | } |
528 | - ?> |
|
528 | + ?> |
|
529 | 529 | <?php |
530 | 530 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
531 | - ?> |
|
531 | + ?> |
|
532 | 532 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
533 | 533 | <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> |
534 | 534 | <?php } ?> |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | <?php } ?> |
538 | 538 | <?php |
539 | 539 | } |
540 | - ?> |
|
540 | + ?> |
|
541 | 541 | <li><?php echo _("Display airlines:"); ?> |
542 | 542 | <br/> |
543 | 543 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -557,14 +557,14 @@ discard block |
||
557 | 557 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
558 | 558 | } |
559 | 559 | } |
560 | - ?> |
|
560 | + ?> |
|
561 | 561 | </select> |
562 | 562 | </li> |
563 | 563 | <?php |
564 | 564 | $Spotter = new Spotter(); |
565 | 565 | $allalliancenames = $Spotter->getAllAllianceNames(); |
566 | 566 | if (!empty($allalliancenames)) { |
567 | - ?> |
|
567 | + ?> |
|
568 | 568 | <li><?php echo _("Display alliance:"); ?> |
569 | 569 | <br/> |
570 | 570 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
@@ -578,18 +578,18 @@ discard block |
||
578 | 578 | echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>'; |
579 | 579 | } |
580 | 580 | } |
581 | - ?> |
|
581 | + ?> |
|
582 | 582 | </select> |
583 | 583 | </li> |
584 | 584 | <?php |
585 | 585 | } |
586 | - ?> |
|
586 | + ?> |
|
587 | 587 | <?php |
588 | 588 | } |
589 | - ?> |
|
589 | + ?> |
|
590 | 590 | <?php |
591 | 591 | if (isset($globalAPRS) && $globalAPRS) { |
592 | - ?> |
|
592 | + ?> |
|
593 | 593 | <li><?php echo _("Display APRS sources name:"); ?> |
594 | 594 | <select class="selectpicker" multiple onchange="sources(this);"> |
595 | 595 | <?php |
@@ -613,18 +613,18 @@ discard block |
||
613 | 613 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
614 | 614 | } |
615 | 615 | } |
616 | - ?> |
|
616 | + ?> |
|
617 | 617 | </select> |
618 | 618 | </li> |
619 | 619 | <?php |
620 | 620 | } |
621 | - ?> |
|
621 | + ?> |
|
622 | 622 | <?php |
623 | 623 | if (!isset($globalAircraft) || $globalAircraft) { |
624 | - ?> |
|
624 | + ?> |
|
625 | 625 | <?php |
626 | - if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
627 | - ?> |
|
626 | + if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
627 | + ?> |
|
628 | 628 | <li><?php echo _("Display airlines of type:"); ?><br/> |
629 | 629 | <select class="selectpicker" onchange="airlinestype(this);"> |
630 | 630 | <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -634,21 +634,21 @@ discard block |
||
634 | 634 | </select> |
635 | 635 | </li> |
636 | 636 | <?php |
637 | - } |
|
638 | - ?> |
|
637 | + } |
|
638 | + ?> |
|
639 | 639 | <?php |
640 | 640 | } |
641 | - ?> |
|
641 | + ?> |
|
642 | 642 | <?php |
643 | 643 | if (isset($globalMarine) && $globalMarine) { |
644 | - ?> |
|
644 | + ?> |
|
645 | 645 | <li> |
646 | 646 | <?php echo _("Display vessels with MMSI:"); ?> |
647 | 647 | <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
648 | 648 | </li> |
649 | 649 | <?php |
650 | 650 | } |
651 | - ?> |
|
651 | + ?> |
|
652 | 652 | <li> |
653 | 653 | <?php echo _("Display with ident:"); ?> |
654 | 654 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | </form> |
662 | 662 | </div> |
663 | 663 | <?php |
664 | - if (isset($globalSatellite) && $globalSatellite) { |
|
664 | + if (isset($globalSatellite) && $globalSatellite) { |
|
665 | 665 | ?> |
666 | 666 | <div class="sidebar-pane" id="satellites"> |
667 | 667 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
702 | 702 | } |
703 | 703 | } |
704 | - ?> |
|
704 | + ?> |
|
705 | 705 | </select> |
706 | 706 | </li> |
707 | 707 | </ul> |
708 | 708 | </form> |
709 | 709 | </div> |
710 | 710 | <?php |
711 | - } |
|
711 | + } |
|
712 | 712 | ?> |
713 | 713 | </div> |
714 | 714 | </div> |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | |
14 | 14 | |
15 | 15 | /** |
16 | - * Get SQL query part for filter used |
|
17 | - * @param Array $filter the filter |
|
18 | - * @return Array the SQL part |
|
19 | - */ |
|
16 | + * Get SQL query part for filter used |
|
17 | + * @param Array $filter the filter |
|
18 | + * @return Array the SQL part |
|
19 | + */ |
|
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * Gets all the spotter information based on the latest data entry |
|
94 | - * |
|
95 | - * @return Array the spotter information |
|
96 | - * |
|
97 | - */ |
|
93 | + * Gets all the spotter information based on the latest data entry |
|
94 | + * |
|
95 | + * @return Array the spotter information |
|
96 | + * |
|
97 | + */ |
|
98 | 98 | public function getLiveMarineData($limit = '', $sort = '', $filter = array()) |
99 | 99 | { |
100 | 100 | global $globalDBdriver, $globalLiveInterval; |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
140 | - * Gets Minimal Live Spotter data |
|
141 | - * |
|
142 | - * @return Array the spotter information |
|
143 | - * |
|
144 | - */ |
|
140 | + * Gets Minimal Live Spotter data |
|
141 | + * |
|
142 | + * @return Array the spotter information |
|
143 | + * |
|
144 | + */ |
|
145 | 145 | public function getMinLiveMarineData($filter = array()) |
146 | 146 | { |
147 | 147 | global $globalDBdriver, $globalLiveInterval; |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
174 | - * Gets Minimal Live Spotter data since xx seconds |
|
175 | - * |
|
176 | - * @return Array the spotter information |
|
177 | - * |
|
178 | - */ |
|
174 | + * Gets Minimal Live Spotter data since xx seconds |
|
175 | + * |
|
176 | + * @return Array the spotter information |
|
177 | + * |
|
178 | + */ |
|
179 | 179 | public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false) |
180 | 180 | { |
181 | 181 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
249 | - * Gets number of latest data entry |
|
250 | - * |
|
251 | - * @return String number of entry |
|
252 | - * |
|
253 | - */ |
|
249 | + * Gets number of latest data entry |
|
250 | + * |
|
251 | + * @return String number of entry |
|
252 | + * |
|
253 | + */ |
|
254 | 254 | public function getLiveMarineCount($filter = array()) |
255 | 255 | { |
256 | 256 | global $globalDBdriver, $globalLiveInterval; |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
278 | - * Gets all the spotter information based on the latest data entry and coord |
|
279 | - * |
|
280 | - * @return Array the spotter information |
|
281 | - * |
|
282 | - */ |
|
278 | + * Gets all the spotter information based on the latest data entry and coord |
|
279 | + * |
|
280 | + * @return Array the spotter information |
|
281 | + * |
|
282 | + */ |
|
283 | 283 | public function getLiveMarineDatabyCoord($coord, $filter = array()) |
284 | 284 | { |
285 | 285 | global $globalDBdriver, $globalLiveInterval; |
@@ -303,11 +303,11 @@ discard block |
||
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
306 | - * Gets all the spotter information based on the latest data entry and coord |
|
307 | - * |
|
308 | - * @return Array the spotter information |
|
309 | - * |
|
310 | - */ |
|
306 | + * Gets all the spotter information based on the latest data entry and coord |
|
307 | + * |
|
308 | + * @return Array the spotter information |
|
309 | + * |
|
310 | + */ |
|
311 | 311 | public function getMinLiveMarineDatabyCoord($coord, $filter = array()) |
312 | 312 | { |
313 | 313 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
379 | - * Gets all the spotter information based on a user's latitude and longitude |
|
380 | - * |
|
381 | - * @return Array the spotter information |
|
382 | - * |
|
383 | - */ |
|
379 | + * Gets all the spotter information based on a user's latitude and longitude |
|
380 | + * |
|
381 | + * @return Array the spotter information |
|
382 | + * |
|
383 | + */ |
|
384 | 384 | public function getLatestMarineForLayar($lat, $lng, $radius, $interval) |
385 | 385 | { |
386 | 386 | $Marine = new Marine($this->db); |
@@ -393,75 +393,75 @@ discard block |
||
393 | 393 | if ($lng != '') |
394 | 394 | { |
395 | 395 | if (!is_numeric($lng)) |
396 | - { |
|
397 | - return false; |
|
398 | - } |
|
399 | - } |
|
400 | - |
|
401 | - if ($radius != '') |
|
402 | - { |
|
403 | - if (!is_numeric($radius)) |
|
404 | - { |
|
405 | - return false; |
|
406 | - } |
|
407 | - } |
|
396 | + { |
|
397 | + return false; |
|
398 | + } |
|
399 | + } |
|
400 | + |
|
401 | + if ($radius != '') |
|
402 | + { |
|
403 | + if (!is_numeric($radius)) |
|
404 | + { |
|
405 | + return false; |
|
406 | + } |
|
407 | + } |
|
408 | 408 | $additional_query = ''; |
409 | 409 | if ($interval != '') |
410 | - { |
|
411 | - if (!is_string($interval)) |
|
412 | - { |
|
413 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
414 | - return false; |
|
415 | - } else { |
|
416 | - if ($interval == '1m') |
|
417 | - { |
|
418 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
419 | - } else if ($interval == '15m'){ |
|
420 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
421 | - } |
|
422 | - } |
|
423 | - } else { |
|
424 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
425 | - } |
|
426 | - |
|
427 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
410 | + { |
|
411 | + if (!is_string($interval)) |
|
412 | + { |
|
413 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
414 | + return false; |
|
415 | + } else { |
|
416 | + if ($interval == '1m') |
|
417 | + { |
|
418 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
419 | + } else if ($interval == '15m'){ |
|
420 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
421 | + } |
|
422 | + } |
|
423 | + } else { |
|
424 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
425 | + } |
|
426 | + |
|
427 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
428 | 428 | WHERE marine_live.latitude <> '' |
429 | 429 | AND marine_live.longitude <> '' |
430 | 430 | ".$additional_query." |
431 | 431 | HAVING distance < :radius |
432 | 432 | ORDER BY distance"; |
433 | 433 | |
434 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
434 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
435 | 435 | |
436 | - return $spotter_array; |
|
437 | - } |
|
436 | + return $spotter_array; |
|
437 | + } |
|
438 | 438 | |
439 | 439 | |
440 | - /** |
|
441 | - * Gets all the spotter information based on a particular callsign |
|
442 | - * |
|
443 | - * @return Array the spotter information |
|
444 | - * |
|
445 | - */ |
|
440 | + /** |
|
441 | + * Gets all the spotter information based on a particular callsign |
|
442 | + * |
|
443 | + * @return Array the spotter information |
|
444 | + * |
|
445 | + */ |
|
446 | 446 | public function getLastLiveMarineDataByIdent($ident) |
447 | 447 | { |
448 | 448 | $Marine = new Marine($this->db); |
449 | 449 | date_default_timezone_set('UTC'); |
450 | 450 | |
451 | 451 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
452 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
452 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
453 | 453 | |
454 | 454 | $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
455 | 455 | |
456 | 456 | return $spotter_array; |
457 | 457 | } |
458 | 458 | |
459 | - /** |
|
460 | - * Gets all the spotter information based on a particular callsign |
|
461 | - * |
|
462 | - * @return Array the spotter information |
|
463 | - * |
|
464 | - */ |
|
459 | + /** |
|
460 | + * Gets all the spotter information based on a particular callsign |
|
461 | + * |
|
462 | + * @return Array the spotter information |
|
463 | + * |
|
464 | + */ |
|
465 | 465 | public function getDateLiveMarineDataByIdent($ident,$date) |
466 | 466 | { |
467 | 467 | $Marine = new Marine($this->db); |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
477 | - * Gets all the spotter information based on a particular MMSI |
|
478 | - * |
|
479 | - * @return Array the spotter information |
|
480 | - * |
|
481 | - */ |
|
477 | + * Gets all the spotter information based on a particular MMSI |
|
478 | + * |
|
479 | + * @return Array the spotter information |
|
480 | + * |
|
481 | + */ |
|
482 | 482 | public function getDateLiveMarineDataByMMSI($mmsi,$date) |
483 | 483 | { |
484 | 484 | $Marine = new Marine($this->db); |
@@ -490,51 +490,51 @@ discard block |
||
490 | 490 | return $spotter_array; |
491 | 491 | } |
492 | 492 | |
493 | - /** |
|
494 | - * Gets last spotter information based on a particular callsign |
|
495 | - * |
|
496 | - * @return Array the spotter information |
|
497 | - * |
|
498 | - */ |
|
493 | + /** |
|
494 | + * Gets last spotter information based on a particular callsign |
|
495 | + * |
|
496 | + * @return Array the spotter information |
|
497 | + * |
|
498 | + */ |
|
499 | 499 | public function getLastLiveMarineDataById($id) |
500 | 500 | { |
501 | 501 | $Marine = new Marine($this->db); |
502 | 502 | date_default_timezone_set('UTC'); |
503 | 503 | |
504 | 504 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
505 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
505 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
506 | 506 | |
507 | 507 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
508 | 508 | |
509 | 509 | return $spotter_array; |
510 | 510 | } |
511 | 511 | |
512 | - /** |
|
513 | - * Gets last spotter information based on a particular callsign |
|
514 | - * |
|
515 | - * @return Array the spotter information |
|
516 | - * |
|
517 | - */ |
|
512 | + /** |
|
513 | + * Gets last spotter information based on a particular callsign |
|
514 | + * |
|
515 | + * @return Array the spotter information |
|
516 | + * |
|
517 | + */ |
|
518 | 518 | public function getDateLiveMarineDataById($id,$date) |
519 | 519 | { |
520 | 520 | $Marine = new Marine($this->db); |
521 | 521 | date_default_timezone_set('UTC'); |
522 | 522 | |
523 | 523 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
524 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
525 | - $date = date('c',$date); |
|
524 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
525 | + $date = date('c',$date); |
|
526 | 526 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
527 | 527 | |
528 | 528 | return $spotter_array; |
529 | 529 | } |
530 | 530 | |
531 | 531 | |
532 | - /** |
|
533 | - * Gets all the spotter information based on a particular id |
|
534 | - * |
|
535 | - * @return Array the spotter information |
|
536 | - * |
|
537 | - */ |
|
532 | + /** |
|
533 | + * Gets all the spotter information based on a particular id |
|
534 | + * |
|
535 | + * @return Array the spotter information |
|
536 | + * |
|
537 | + */ |
|
538 | 538 | public function getAllLiveMarineDataById($id,$liveinterval = false) |
539 | 539 | { |
540 | 540 | global $globalDBdriver, $globalLiveInterval; |
@@ -562,18 +562,18 @@ discard block |
||
562 | 562 | return $spotter_array; |
563 | 563 | } |
564 | 564 | |
565 | - /** |
|
566 | - * Gets all the spotter information based on a particular ident |
|
567 | - * |
|
568 | - * @return Array the spotter information |
|
569 | - * |
|
570 | - */ |
|
565 | + /** |
|
566 | + * Gets all the spotter information based on a particular ident |
|
567 | + * |
|
568 | + * @return Array the spotter information |
|
569 | + * |
|
570 | + */ |
|
571 | 571 | public function getAllLiveMarineDataByIdent($ident) |
572 | 572 | { |
573 | 573 | date_default_timezone_set('UTC'); |
574 | 574 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
575 | 575 | $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
576 | - try { |
|
576 | + try { |
|
577 | 577 | |
578 | 578 | $sth = $this->db->prepare($query); |
579 | 579 | $sth->execute(array(':ident' => $ident)); |
@@ -587,23 +587,23 @@ discard block |
||
587 | 587 | |
588 | 588 | |
589 | 589 | /** |
590 | - * Deletes all info in the table |
|
591 | - * |
|
592 | - * @return String success or false |
|
593 | - * |
|
594 | - */ |
|
590 | + * Deletes all info in the table |
|
591 | + * |
|
592 | + * @return String success or false |
|
593 | + * |
|
594 | + */ |
|
595 | 595 | public function deleteLiveMarineData() |
596 | 596 | { |
597 | 597 | global $globalDBdriver; |
598 | 598 | if ($globalDBdriver == 'mysql') { |
599 | 599 | //$query = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date"; |
600 | 600 | $query = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date'; |
601 | - //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
601 | + //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
602 | 602 | } else { |
603 | 603 | $query = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date"; |
604 | 604 | } |
605 | 605 | |
606 | - try { |
|
606 | + try { |
|
607 | 607 | |
608 | 608 | $sth = $this->db->prepare($query); |
609 | 609 | $sth->execute(); |
@@ -615,18 +615,18 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | /** |
618 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
619 | - * |
|
620 | - * @return String success or false |
|
621 | - * |
|
622 | - */ |
|
618 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
619 | + * |
|
620 | + * @return String success or false |
|
621 | + * |
|
622 | + */ |
|
623 | 623 | public function deleteLiveMarineDataNotUpdated() |
624 | 624 | { |
625 | 625 | global $globalDBdriver, $globalDebug; |
626 | 626 | if ($globalDBdriver == 'mysql') { |
627 | 627 | //$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0'; |
628 | - $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
629 | - try { |
|
628 | + $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
629 | + try { |
|
630 | 630 | |
631 | 631 | $sth = $this->db->prepare($query); |
632 | 632 | $sth->execute(); |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | return "error"; |
635 | 635 | } |
636 | 636 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
637 | - $i = 0; |
|
638 | - $j =0; |
|
637 | + $i = 0; |
|
638 | + $j =0; |
|
639 | 639 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
640 | 640 | foreach($all as $row) |
641 | 641 | { |
@@ -643,20 +643,20 @@ discard block |
||
643 | 643 | $j++; |
644 | 644 | if ($j == 30) { |
645 | 645 | if ($globalDebug) echo "."; |
646 | - try { |
|
646 | + try { |
|
647 | 647 | |
648 | 648 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
649 | 649 | $sth->execute(); |
650 | 650 | } catch(PDOException $e) { |
651 | 651 | return "error"; |
652 | 652 | } |
653 | - $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
654 | - $j = 0; |
|
653 | + $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
654 | + $j = 0; |
|
655 | 655 | } |
656 | 656 | $query_delete .= "'".$row['fammarine_id']."',"; |
657 | 657 | } |
658 | 658 | if ($i > 0) { |
659 | - try { |
|
659 | + try { |
|
660 | 660 | |
661 | 661 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
662 | 662 | $sth->execute(); |
@@ -667,9 +667,9 @@ discard block |
||
667 | 667 | return "success"; |
668 | 668 | } elseif ($globalDBdriver == 'pgsql') { |
669 | 669 | //$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0"; |
670 | - //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
671 | - $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
672 | - try { |
|
670 | + //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
671 | + $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
672 | + try { |
|
673 | 673 | |
674 | 674 | $sth = $this->db->prepare($query); |
675 | 675 | $sth->execute(); |
@@ -713,17 +713,17 @@ discard block |
||
713 | 713 | } |
714 | 714 | |
715 | 715 | /** |
716 | - * Deletes all info in the table for an ident |
|
717 | - * |
|
718 | - * @return String success or false |
|
719 | - * |
|
720 | - */ |
|
716 | + * Deletes all info in the table for an ident |
|
717 | + * |
|
718 | + * @return String success or false |
|
719 | + * |
|
720 | + */ |
|
721 | 721 | public function deleteLiveMarineDataByIdent($ident) |
722 | 722 | { |
723 | 723 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
724 | 724 | $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
725 | 725 | |
726 | - try { |
|
726 | + try { |
|
727 | 727 | |
728 | 728 | $sth = $this->db->prepare($query); |
729 | 729 | $sth->execute(array(':ident' => $ident)); |
@@ -735,17 +735,17 @@ discard block |
||
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
738 | - * Deletes all info in the table for an id |
|
739 | - * |
|
740 | - * @return String success or false |
|
741 | - * |
|
742 | - */ |
|
738 | + * Deletes all info in the table for an id |
|
739 | + * |
|
740 | + * @return String success or false |
|
741 | + * |
|
742 | + */ |
|
743 | 743 | public function deleteLiveMarineDataById($id) |
744 | 744 | { |
745 | 745 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
746 | 746 | $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
747 | 747 | |
748 | - try { |
|
748 | + try { |
|
749 | 749 | |
750 | 750 | $sth = $this->db->prepare($query); |
751 | 751 | $sth->execute(array(':id' => $id)); |
@@ -758,11 +758,11 @@ discard block |
||
758 | 758 | |
759 | 759 | |
760 | 760 | /** |
761 | - * Gets the aircraft ident within the last hour |
|
762 | - * |
|
763 | - * @return String the ident |
|
764 | - * |
|
765 | - */ |
|
761 | + * Gets the aircraft ident within the last hour |
|
762 | + * |
|
763 | + * @return String the ident |
|
764 | + * |
|
765 | + */ |
|
766 | 766 | public function getIdentFromLastHour($ident) |
767 | 767 | { |
768 | 768 | global $globalDBdriver, $globalTimezone; |
@@ -788,14 +788,14 @@ discard block |
||
788 | 788 | $ident_result = $row['ident']; |
789 | 789 | } |
790 | 790 | return $ident_result; |
791 | - } |
|
791 | + } |
|
792 | 792 | |
793 | 793 | /** |
794 | - * Check recent aircraft |
|
795 | - * |
|
796 | - * @return String the ident |
|
797 | - * |
|
798 | - */ |
|
794 | + * Check recent aircraft |
|
795 | + * |
|
796 | + * @return String the ident |
|
797 | + * |
|
798 | + */ |
|
799 | 799 | public function checkIdentRecent($ident) |
800 | 800 | { |
801 | 801 | global $globalDBdriver, $globalTimezone; |
@@ -821,14 +821,14 @@ discard block |
||
821 | 821 | $ident_result = $row['fammarine_id']; |
822 | 822 | } |
823 | 823 | return $ident_result; |
824 | - } |
|
824 | + } |
|
825 | 825 | |
826 | 826 | /** |
827 | - * Check recent aircraft by id |
|
828 | - * |
|
829 | - * @return String the ident |
|
830 | - * |
|
831 | - */ |
|
827 | + * Check recent aircraft by id |
|
828 | + * |
|
829 | + * @return String the ident |
|
830 | + * |
|
831 | + */ |
|
832 | 832 | public function checkIdRecent($id) |
833 | 833 | { |
834 | 834 | global $globalDBdriver, $globalTimezone; |
@@ -854,14 +854,14 @@ discard block |
||
854 | 854 | $ident_result = $row['fammarine_id']; |
855 | 855 | } |
856 | 856 | return $ident_result; |
857 | - } |
|
857 | + } |
|
858 | 858 | |
859 | 859 | /** |
860 | - * Check recent aircraft by mmsi |
|
861 | - * |
|
862 | - * @return String the ident |
|
863 | - * |
|
864 | - */ |
|
860 | + * Check recent aircraft by mmsi |
|
861 | + * |
|
862 | + * @return String the ident |
|
863 | + * |
|
864 | + */ |
|
865 | 865 | public function checkMMSIRecent($mmsi) |
866 | 866 | { |
867 | 867 | global $globalDBdriver, $globalTimezone; |
@@ -887,19 +887,19 @@ discard block |
||
887 | 887 | $ident_result = $row['fammarine_id']; |
888 | 888 | } |
889 | 889 | return $ident_result; |
890 | - } |
|
890 | + } |
|
891 | 891 | |
892 | 892 | /** |
893 | - * Adds a new spotter data |
|
894 | - * |
|
895 | - * @param String $fammarine_id the ID from flightaware |
|
896 | - * @param String $ident the flight ident |
|
897 | - * @param String $aircraft_icao the aircraft type |
|
898 | - * @param String $departure_airport_icao the departure airport |
|
899 | - * @param String $arrival_airport_icao the arrival airport |
|
900 | - * @return String success or false |
|
901 | - * |
|
902 | - */ |
|
893 | + * Adds a new spotter data |
|
894 | + * |
|
895 | + * @param String $fammarine_id the ID from flightaware |
|
896 | + * @param String $ident the flight ident |
|
897 | + * @param String $aircraft_icao the aircraft type |
|
898 | + * @param String $departure_airport_icao the departure airport |
|
899 | + * @param String $arrival_airport_icao the arrival airport |
|
900 | + * @return String success or false |
|
901 | + * |
|
902 | + */ |
|
903 | 903 | public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
904 | 904 | { |
905 | 905 | global $globalURL, $globalArchive, $globalDebug; |
@@ -970,10 +970,10 @@ discard block |
||
970 | 970 | $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
971 | 971 | |
972 | 972 | |
973 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
974 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
975 | - if ($arrival_date == '') $arrival_date = NULL; |
|
976 | - $query = ''; |
|
973 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
974 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
975 | + if ($arrival_date == '') $arrival_date = NULL; |
|
976 | + $query = ''; |
|
977 | 977 | if ($globalArchive) { |
978 | 978 | if ($globalDebug) echo '-- Delete previous data -- '; |
979 | 979 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | require_once(dirname(__FILE__).'/class.Common.php'); |
4 | 4 | require_once(dirname(__FILE__).'/class.GeoidHeight.php'); |
5 | 5 | class aprs { |
6 | - private $socket; |
|
7 | - private $connected = false; |
|
6 | + private $socket; |
|
7 | + private $connected = false; |
|
8 | 8 | |
9 | - protected $symbols = array('/!' => 'Police', |
|
9 | + protected $symbols = array('/!' => 'Police', |
|
10 | 10 | '/#' => 'DIGI', |
11 | 11 | '/$' => 'Phone', |
12 | 12 | '/%' => 'DX Cluster', |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | '\~' => 'TNC Stream SW'); |
167 | 167 | |
168 | 168 | |
169 | - private function urshift($n, $s) { |
|
169 | + private function urshift($n, $s) { |
|
170 | 170 | return ($n >= 0) ? ($n >> $s) : |
171 | - (($n & 0x7fffffff) >> $s) | |
|
171 | + (($n & 0x7fffffff) >> $s) | |
|
172 | 172 | (0x40000000 >> ($s - 1)); |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | - public function parse($input) { |
|
175 | + public function parse($input) { |
|
176 | 176 | global $globalDebug; |
177 | 177 | $debug = false; |
178 | 178 | $result = array(); |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | |
185 | 185 | /* Check that end was found and body has at least one byte. */ |
186 | 186 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
187 | - if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
188 | - return false; |
|
187 | + if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
188 | + return false; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | if ($debug) echo 'input : '.$input."\n"; |
@@ -199,34 +199,34 @@ discard block |
||
199 | 199 | /* Parse source, target and path. */ |
200 | 200 | //FLRDF0A52>APRS,qAS,LSTB |
201 | 201 | if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) { |
202 | - $ident = $matches[1]; |
|
203 | - $all_elements = $matches[2]; |
|
204 | - if ($ident == 'AIRCRAFT') { |
|
202 | + $ident = $matches[1]; |
|
203 | + $all_elements = $matches[2]; |
|
204 | + if ($ident == 'AIRCRAFT') { |
|
205 | 205 | $result['format_source'] = 'famaprs'; |
206 | 206 | $result['source_type'] = 'modes'; |
207 | - } elseif ($ident == 'MARINE') { |
|
207 | + } elseif ($ident == 'MARINE') { |
|
208 | 208 | $result['format_source'] = 'famaprs'; |
209 | 209 | $result['source_type'] = 'ais'; |
210 | - } else { |
|
210 | + } else { |
|
211 | 211 | if ($debug) echo 'ident : '.$ident."\n"; |
212 | 212 | $result['ident'] = $ident; |
213 | - } |
|
213 | + } |
|
214 | 214 | } else { |
215 | - if ($debug) 'No ident'."\n"; |
|
216 | - return false; |
|
215 | + if ($debug) 'No ident'."\n"; |
|
216 | + return false; |
|
217 | 217 | } |
218 | 218 | $elements = explode(',',$all_elements); |
219 | 219 | $source = end($elements); |
220 | 220 | $result['source'] = $source; |
221 | 221 | foreach ($elements as $element) { |
222 | - if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
223 | - //echo "ok"; |
|
224 | - //if ($element == 'TCPIP*') return false; |
|
225 | - } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
222 | + if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
223 | + //echo "ok"; |
|
224 | + //if ($element == 'TCPIP*') return false; |
|
225 | + } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
226 | 226 | if ($debug) echo 'element : '.$element."\n"; |
227 | 227 | return false; |
228 | - } |
|
229 | - /* |
|
228 | + } |
|
229 | + /* |
|
230 | 230 | } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) { |
231 | 231 | //echo "ok"; |
232 | 232 | } else { |
@@ -253,48 +253,48 @@ discard block |
||
253 | 253 | $body_parse = substr($body,1); |
254 | 254 | //echo 'Body : '.$body."\n"; |
255 | 255 | if (preg_match('/^;(.){9}\*/',$body,$matches)) { |
256 | - $body_parse = substr($body_parse,10); |
|
257 | - $find = true; |
|
258 | - //echo $body_parse."\n"; |
|
256 | + $body_parse = substr($body_parse,10); |
|
257 | + $find = true; |
|
258 | + //echo $body_parse."\n"; |
|
259 | 259 | } |
260 | 260 | if (preg_match('/^`(.*)\//',$body,$matches)) { |
261 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
262 | - $find = true; |
|
263 | - //echo $body_parse."\n"; |
|
261 | + $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
262 | + $find = true; |
|
263 | + //echo $body_parse."\n"; |
|
264 | 264 | } |
265 | 265 | if (preg_match("/^'(.*)\//",$body,$matches)) { |
266 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
267 | - $find = true; |
|
268 | - //echo $body_parse."\n"; |
|
266 | + $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
267 | + $find = true; |
|
268 | + //echo $body_parse."\n"; |
|
269 | 269 | } |
270 | 270 | if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) { |
271 | - $find = true; |
|
272 | - //print_r($matches); |
|
273 | - $timestamp = $matches[0]; |
|
274 | - if ($matches[4] == 'h') { |
|
271 | + $find = true; |
|
272 | + //print_r($matches); |
|
273 | + $timestamp = $matches[0]; |
|
274 | + if ($matches[4] == 'h') { |
|
275 | 275 | $timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]); |
276 | 276 | //echo 'timestamp : '.$timestamp.' - now : '.time()."\n"; |
277 | 277 | /* |
278 | 278 | if (time() + 3900 < $timestamp) $timestamp -= 86400; |
279 | 279 | elseif (time() - 82500 > $timestamp) $timestamp += 86400; |
280 | 280 | */ |
281 | - } elseif ($matches[4] == 'z' || $matches[4] == '/') { |
|
281 | + } elseif ($matches[4] == 'z' || $matches[4] == '/') { |
|
282 | 282 | // This work or not ? |
283 | 283 | $timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]); |
284 | - } |
|
285 | - $body_parse = substr($body_parse,7); |
|
286 | - $result['timestamp'] = $timestamp; |
|
287 | - //echo date('Ymd H:i:s',$timestamp); |
|
284 | + } |
|
285 | + $body_parse = substr($body_parse,7); |
|
286 | + $result['timestamp'] = $timestamp; |
|
287 | + //echo date('Ymd H:i:s',$timestamp); |
|
288 | 288 | } |
289 | 289 | if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) { |
290 | - $find = true; |
|
291 | - $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
|
292 | - $body_parse = substr($body_parse,8); |
|
293 | - $result['timestamp'] = $timestamp; |
|
294 | - //echo date('Ymd H:i:s',$timestamp); |
|
290 | + $find = true; |
|
291 | + $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
|
292 | + $body_parse = substr($body_parse,8); |
|
293 | + $result['timestamp'] = $timestamp; |
|
294 | + //echo date('Ymd H:i:s',$timestamp); |
|
295 | 295 | } |
296 | 296 | //if (strlen($body_parse) > 19) { |
297 | - if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
297 | + if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
298 | 298 | $find = true; |
299 | 299 | // 4658.70N/00707.78Ez |
300 | 300 | //print_r(str_split($body_parse)); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $lon = intval($lon_deg); |
314 | 314 | if ($lat > 89 || $lon > 179) return false; |
315 | 315 | |
316 | - /* |
|
316 | + /* |
|
317 | 317 | $tmp_5b = str_replace('.','',$lat_min); |
318 | 318 | if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) { |
319 | 319 | print_r($matches); |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | $result['longitude'] = $longitude; |
328 | 328 | $body_parse = substr($body_parse,18); |
329 | 329 | $body_parse_len = strlen($body_parse); |
330 | - } |
|
331 | - $body_parse_len = strlen($body_parse); |
|
332 | - if ($body_parse_len > 0) { |
|
330 | + } |
|
331 | + $body_parse_len = strlen($body_parse); |
|
332 | + if ($body_parse_len > 0) { |
|
333 | 333 | /* |
334 | 334 | if (!isset($result['timestamp']) && !isset($result['latitude'])) { |
335 | 335 | $body_split = str_split($body); |
@@ -363,95 +363,95 @@ discard block |
||
363 | 363 | if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
364 | 364 | if ($symbol_code != '_') { |
365 | 365 | } |
366 | - //$body_parse = substr($body_parse,1); |
|
367 | - //$body_parse = trim($body_parse); |
|
368 | - //$body_parse_len = strlen($body_parse); |
|
369 | - if ($body_parse_len >= 7) { |
|
366 | + //$body_parse = substr($body_parse,1); |
|
367 | + //$body_parse = trim($body_parse); |
|
368 | + //$body_parse_len = strlen($body_parse); |
|
369 | + if ($body_parse_len >= 7) { |
|
370 | 370 | |
371 | - if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
372 | - $course = substr($body_parse,0,3); |
|
373 | - $tmp_s = intval($course); |
|
374 | - if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
375 | - $speed = substr($body_parse,4,3); |
|
376 | - if ($speed != '...') { |
|
377 | - //$result['speed'] = round($speed*1.852); |
|
378 | - $result['speed'] = intval($speed); |
|
379 | - } |
|
380 | - $body_parse = substr($body_parse,7); |
|
381 | - } |
|
382 | - // Check PHGR, PHG, RNG |
|
383 | - } |
|
384 | - /* |
|
371 | + if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
372 | + $course = substr($body_parse,0,3); |
|
373 | + $tmp_s = intval($course); |
|
374 | + if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
375 | + $speed = substr($body_parse,4,3); |
|
376 | + if ($speed != '...') { |
|
377 | + //$result['speed'] = round($speed*1.852); |
|
378 | + $result['speed'] = intval($speed); |
|
379 | + } |
|
380 | + $body_parse = substr($body_parse,7); |
|
381 | + } |
|
382 | + // Check PHGR, PHG, RNG |
|
383 | + } |
|
384 | + /* |
|
385 | 385 | else if ($body_parse_len > 0) { |
386 | 386 | $rest = $body_parse; |
387 | 387 | } |
388 | 388 | */ |
389 | - if (strlen($body_parse) > 0) { |
|
390 | - if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
391 | - $altitude = intval($matches[1]); |
|
392 | - //$result['altitude'] = round($altitude*0.3048); |
|
393 | - $result['altitude'] = $altitude; |
|
394 | - //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
|
395 | - $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
396 | - } |
|
397 | - } |
|
389 | + if (strlen($body_parse) > 0) { |
|
390 | + if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
391 | + $altitude = intval($matches[1]); |
|
392 | + //$result['altitude'] = round($altitude*0.3048); |
|
393 | + $result['altitude'] = $altitude; |
|
394 | + //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
|
395 | + $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
396 | + } |
|
397 | + } |
|
398 | 398 | |
399 | - // Telemetry |
|
400 | - /* |
|
399 | + // Telemetry |
|
400 | + /* |
|
401 | 401 | if (preg_match('/^([0-9]+),(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,([01]{0,8})/',$body_parse,$matches)) { |
402 | 402 | // Nothing yet... |
403 | 403 | } |
404 | 404 | */ |
405 | - // DAO |
|
405 | + // DAO |
|
406 | 406 | |
407 | - if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
407 | + if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
408 | 408 | |
409 | - $dao = $matches[1]; |
|
410 | - if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
409 | + $dao = $matches[1]; |
|
410 | + if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
411 | 411 | $dao_split = str_split($dao); |
412 | - $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
413 | - $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
412 | + $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
413 | + $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
414 | 414 | |
415 | 415 | if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
416 | 416 | else $result['latitude'] += $lat_off; |
417 | 417 | if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
418 | 418 | else $result['longitude'] += $lon_off; |
419 | - } |
|
419 | + } |
|
420 | 420 | |
421 | - $body_parse = substr($body_parse,6); |
|
422 | - } |
|
423 | - //echo 'bodyparse : '.$body_parse."\n"; |
|
424 | - if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
421 | + $body_parse = substr($body_parse,6); |
|
422 | + } |
|
423 | + //echo 'bodyparse : '.$body_parse."\n"; |
|
424 | + if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
425 | 425 | $result['ident'] = str_replace('_',' ',$matches[1]); |
426 | - } |
|
427 | - if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
426 | + } |
|
427 | + if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
428 | 428 | $result['squawk'] = $matches[1]; |
429 | - } |
|
430 | - if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
429 | + } |
|
430 | + if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
431 | 431 | $result['aircraft_icao'] = $matches[1]; |
432 | - } |
|
433 | - if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) { |
|
432 | + } |
|
433 | + if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) { |
|
434 | 434 | $result['verticalrate'] = $matches[1]; |
435 | - } |
|
436 | - if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
435 | + } |
|
436 | + if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
437 | 437 | $result['typeid'] = $matches[1]; |
438 | - } |
|
439 | - if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
438 | + } |
|
439 | + if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
440 | 440 | $result['statusid'] = $matches[1]; |
441 | - } |
|
442 | - if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
441 | + } |
|
442 | + if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
443 | 443 | $result['imo'] = $matches[1]; |
444 | - } |
|
445 | - if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
444 | + } |
|
445 | + if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
446 | 446 | $result['arrival_date'] = $matches[1]; |
447 | - } |
|
448 | - if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
447 | + } |
|
448 | + if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
449 | 449 | $result['arrival_code'] = str_replace('_',' ',$matches[1]); |
450 | - } |
|
451 | - // OGN comment |
|
450 | + } |
|
451 | + // OGN comment |
|
452 | 452 | // echo "Before OGN : ".$body_parse."\n"; |
453 | - //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
|
454 | - if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
453 | + //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
|
454 | + if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
455 | 455 | $id = $matches[1]; |
456 | 456 | //$mode = substr($id,0,2); |
457 | 457 | $address = substr($id,2); |
@@ -481,42 +481,42 @@ discard block |
||
481 | 481 | $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
482 | 482 | $result['stealth'] = $stealth; |
483 | 483 | $result['address'] = $address; |
484 | - } |
|
484 | + } |
|
485 | 485 | |
486 | - //Comment |
|
487 | - $result['comment'] = trim($body_parse); |
|
486 | + //Comment |
|
487 | + $result['comment'] = trim($body_parse); |
|
488 | 488 | //} else { |
489 | - // parse weather |
|
490 | - //$body_parse = substr($body_parse,1); |
|
491 | - //$body_parse_len = strlen($body_parse); |
|
492 | - //echo 'weather'."\n"; |
|
493 | - if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
494 | - $result['wind_dir'] = intval($matches[1]); |
|
495 | - $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
496 | - $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
497 | - $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
498 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
499 | - } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
489 | + // parse weather |
|
490 | + //$body_parse = substr($body_parse,1); |
|
491 | + //$body_parse_len = strlen($body_parse); |
|
492 | + //echo 'weather'."\n"; |
|
493 | + if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
494 | + $result['wind_dir'] = intval($matches[1]); |
|
495 | + $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
496 | + $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
497 | + $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
498 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
499 | + } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
500 | 500 | $result['wind_dir'] = intval($matches[1]); |
501 | 501 | $result['wind_speed'] = round($matches[2]*1.60934,1); |
502 | 502 | $result['wind_gust'] = round($matches[3]*1.60934,1); |
503 | 503 | $result['temp'] = round(5/9*(($matches[4])-32),1); |
504 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
505 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
504 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
505 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
506 | 506 | $result['wind_dir'] = intval($matches[1]); |
507 | 507 | $result['wind_speed'] = round($matches[2]*1.60934,1); |
508 | 508 | $result['wind_gust'] = round($matches[3]*1.60934,1); |
509 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
510 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
509 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
510 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
511 | 511 | $result['wind_dir'] = intval($matches[1]); |
512 | 512 | $result['wind_speed'] = round($matches[2]*1.60934,1); |
513 | 513 | $result['wind_gust'] = round($matches[3]*1.60934,1); |
514 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
515 | - } |
|
516 | - //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) { |
|
517 | - //g012t088r000p000P000h38b10110 |
|
518 | - //g011t086r000p000P000h29b10198 |
|
519 | - if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
514 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
515 | + } |
|
516 | + //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) { |
|
517 | + //g012t088r000p000P000h38b10110 |
|
518 | + //g011t086r000p000P000h29b10198 |
|
519 | + if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
520 | 520 | if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
521 | 521 | if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
522 | 522 | if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
525 | 525 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
526 | 526 | if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
527 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
528 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
527 | + $body_parse = substr($body_parse,strlen($matches[0])); |
|
528 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
529 | 529 | if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
530 | 530 | if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
531 | 531 | if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
@@ -533,8 +533,8 @@ discard block |
||
533 | 533 | if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
534 | 534 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
535 | 535 | if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
536 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
537 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
536 | + $body_parse = substr($body_parse,strlen($matches[0])); |
|
537 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
538 | 538 | if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
539 | 539 | if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
540 | 540 | if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
@@ -542,58 +542,58 @@ discard block |
||
542 | 542 | if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
543 | 543 | if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
544 | 544 | if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
545 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
546 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
545 | + $body_parse = substr($body_parse,strlen($matches[0])); |
|
546 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
547 | 547 | if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
548 | 548 | if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
549 | 549 | if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
550 | 550 | if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
551 | 551 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
552 | 552 | if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
553 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
554 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
553 | + $body_parse = substr($body_parse,strlen($matches[0])); |
|
554 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
555 | 555 | if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
556 | 556 | if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
557 | 557 | if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
558 | 558 | if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
559 | 559 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
560 | 560 | if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
561 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
562 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
561 | + $body_parse = substr($body_parse,strlen($matches[0])); |
|
562 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
563 | 563 | if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
564 | 564 | if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
565 | 565 | if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
566 | 566 | if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
567 | 567 | if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
568 | 568 | if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
569 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
570 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
569 | + $body_parse = substr($body_parse,strlen($matches[0])); |
|
570 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
571 | 571 | if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
572 | 572 | if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
573 | 573 | if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
574 | 574 | if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
575 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
576 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
575 | + $body_parse = substr($body_parse,strlen($matches[0])); |
|
576 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
577 | 577 | if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
578 | 578 | if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
579 | 579 | if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
580 | 580 | if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
581 | 581 | if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
582 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
583 | - } |
|
584 | - $result['comment'] = trim($body_parse); |
|
582 | + $body_parse = substr($body_parse,strlen($matches[0])); |
|
583 | + } |
|
584 | + $result['comment'] = trim($body_parse); |
|
585 | 585 | } |
586 | 586 | } else $result['comment'] = trim($body_parse); |
587 | 587 | |
588 | - } |
|
588 | + } |
|
589 | 589 | //} |
590 | 590 | if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
591 | 591 | if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
592 | 592 | if ($debug) print_r($result); |
593 | 593 | return $result; |
594 | - } |
|
594 | + } |
|
595 | 595 | |
596 | - public function connect() { |
|
596 | + public function connect() { |
|
597 | 597 | global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport; |
598 | 598 | $aprs_connect = 0; |
599 | 599 | $aprs_keep = 120; |
@@ -617,24 +617,24 @@ discard block |
||
617 | 617 | socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1); |
618 | 618 | while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) { |
619 | 619 | if (strpos($msgin, "$aprs_ssid verified") !== FALSE) { |
620 | - echo 'APRS user verified !'."\n"; |
|
621 | - $this->connected = true; |
|
622 | - return true; |
|
623 | - break; |
|
620 | + echo 'APRS user verified !'."\n"; |
|
621 | + $this->connected = true; |
|
622 | + return true; |
|
623 | + break; |
|
624 | 624 | } |
625 | 625 | if (time()-$authstart > 5) { |
626 | - echo 'APRS timeout'."\n"; |
|
627 | - break; |
|
626 | + echo 'APRS timeout'."\n"; |
|
627 | + break; |
|
628 | 628 | } |
629 | 629 | } |
630 | 630 | } |
631 | - } |
|
631 | + } |
|
632 | 632 | |
633 | - public function disconnect() { |
|
633 | + public function disconnect() { |
|
634 | 634 | socket_close($this->socket); |
635 | - } |
|
635 | + } |
|
636 | 636 | |
637 | - public function send($data) { |
|
637 | + public function send($data) { |
|
638 | 638 | global $globalDebug; |
639 | 639 | if ($this->connected === false) $this->connect(); |
640 | 640 | $send = socket_send( $this->socket , $data , strlen($data),0); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | socket_close($this->socket); |
644 | 644 | $this->connect(); |
645 | 645 | } |
646 | - } |
|
646 | + } |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | class APRSSpotter extends APRS { |
@@ -9,25 +9,25 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.Stats.php'); |
10 | 10 | require_once(dirname(__FILE__).'/class.Source.php'); |
11 | 11 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
12 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
12 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | class MarineImport { |
16 | - private $all_tracked = array(); |
|
17 | - private $last_delete_hourly = 0; |
|
18 | - private $last_delete = 0; |
|
19 | - private $stats = array(); |
|
20 | - private $tmd = 0; |
|
21 | - private $source_location = array(); |
|
22 | - public $db = null; |
|
23 | - public $nb = 0; |
|
16 | + private $all_tracked = array(); |
|
17 | + private $last_delete_hourly = 0; |
|
18 | + private $last_delete = 0; |
|
19 | + private $stats = array(); |
|
20 | + private $tmd = 0; |
|
21 | + private $source_location = array(); |
|
22 | + public $db = null; |
|
23 | + public $nb = 0; |
|
24 | 24 | |
25 | - public function __construct($dbc = null) { |
|
25 | + public function __construct($dbc = null) { |
|
26 | 26 | global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB; |
27 | 27 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
28 | - $Connection = new Connection($dbc); |
|
29 | - $this->db = $Connection->db(); |
|
30 | - date_default_timezone_set('UTC'); |
|
28 | + $Connection = new Connection($dbc); |
|
29 | + $this->db = $Connection->db(); |
|
30 | + date_default_timezone_set('UTC'); |
|
31 | 31 | } |
32 | 32 | // Get previous source stats |
33 | 33 | /* |
@@ -46,57 +46,57 @@ discard block |
||
46 | 46 | } |
47 | 47 | */ |
48 | 48 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
49 | - $APRSMarine = new APRSMarine(); |
|
50 | - //$APRSSpotter->connect(); |
|
49 | + $APRSMarine = new APRSMarine(); |
|
50 | + //$APRSSpotter->connect(); |
|
51 | + } |
|
51 | 52 | } |
52 | - } |
|
53 | 53 | |
54 | - public function checkAll() { |
|
54 | + public function checkAll() { |
|
55 | 55 | global $globalDebug, $globalNoDB; |
56 | 56 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
57 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
58 | - foreach ($this->all_tracked as $key => $flight) { |
|
57 | + if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
58 | + foreach ($this->all_tracked as $key => $flight) { |
|
59 | 59 | if (isset($this->all_tracked[$key]['id'])) { |
60 | - //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
61 | - $Marine = new Marine($this->db); |
|
62 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
60 | + //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
61 | + $Marine = new Marine($this->db); |
|
62 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
63 | 63 | } |
64 | - } |
|
64 | + } |
|
65 | + } |
|
65 | 66 | } |
66 | - } |
|
67 | 67 | |
68 | - public function del() { |
|
68 | + public function del() { |
|
69 | 69 | global $globalDebug, $globalNoDB, $globalNoImport; |
70 | 70 | // Delete old infos |
71 | 71 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
72 | 72 | foreach ($this->all_tracked as $key => $flight) { |
73 | - if (isset($flight['lastupdate'])) { |
|
74 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
75 | - if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
76 | - if (isset($this->all_tracked[$key]['id'])) { |
|
77 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
78 | - /* |
|
73 | + if (isset($flight['lastupdate'])) { |
|
74 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
75 | + if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
76 | + if (isset($this->all_tracked[$key]['id'])) { |
|
77 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
78 | + /* |
|
79 | 79 | $MarineLive = new MarineLive(); |
80 | 80 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
81 | 81 | $MarineLive->db = null; |
82 | 82 | */ |
83 | - //$real_arrival = $this->arrival($key); |
|
84 | - $Marine = new Marine($this->db); |
|
85 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
83 | + //$real_arrival = $this->arrival($key); |
|
84 | + $Marine = new Marine($this->db); |
|
85 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
86 | 86 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
87 | 87 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
88 | - } |
|
89 | - // Put in archive |
|
88 | + } |
|
89 | + // Put in archive |
|
90 | 90 | // $Marine->db = null; |
91 | 91 | } |
92 | - } |
|
93 | - unset($this->all_tracked[$key]); |
|
94 | - } |
|
95 | - } |
|
96 | - } |
|
97 | - } |
|
92 | + } |
|
93 | + unset($this->all_tracked[$key]); |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | + } |
|
98 | 98 | |
99 | - public function add($line) { |
|
99 | + public function add($line) { |
|
100 | 100 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine; |
101 | 101 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
102 | 102 | date_default_timezone_set('UTC'); |
@@ -105,83 +105,83 @@ discard block |
||
105 | 105 | |
106 | 106 | // SBS format is CSV format |
107 | 107 | if(is_array($line) && isset($line['mmsi'])) { |
108 | - //print_r($line); |
|
109 | - if (isset($line['mmsi'])) { |
|
108 | + //print_r($line); |
|
109 | + if (isset($line['mmsi'])) { |
|
110 | 110 | |
111 | 111 | |
112 | 112 | // Increment message number |
113 | 113 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
114 | - $current_date = date('Y-m-d'); |
|
115 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
116 | - else $source = ''; |
|
117 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
118 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
119 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
120 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
121 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
114 | + $current_date = date('Y-m-d'); |
|
115 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
116 | + else $source = ''; |
|
117 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
118 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
119 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
120 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
121 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
125 | 125 | $Common = new Common(); |
126 | 126 | $AIS = new AIS(); |
127 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
128 | - else $id = trim($line['id']); |
|
127 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
128 | + else $id = trim($line['id']); |
|
129 | 129 | |
130 | 130 | if (!isset($this->all_tracked[$id])) { |
131 | - $this->all_tracked[$id] = array(); |
|
132 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
133 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
134 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
135 | - if (!isset($line['id'])) { |
|
131 | + $this->all_tracked[$id] = array(); |
|
132 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
133 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
134 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
135 | + if (!isset($line['id'])) { |
|
136 | 136 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
137 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
138 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
139 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
138 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
139 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
143 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
144 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
143 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
144 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
145 | 145 | $Marine = new Marine($this->db); |
146 | 146 | $identity = $Marine->getIdentity($line['mmsi']); |
147 | 147 | if (!empty($identity)) { |
148 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
149 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
148 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
149 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
150 | 150 | } |
151 | 151 | //print_r($identity); |
152 | 152 | unset($Marine); |
153 | 153 | //$dataFound = true; |
154 | - } |
|
154 | + } |
|
155 | 155 | } |
156 | 156 | if (isset($line['type_id'])) { |
157 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
158 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
157 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
158 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
159 | 159 | } |
160 | 160 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
162 | 162 | } |
163 | 163 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
165 | 165 | } |
166 | 166 | if (isset($line['imo']) && $line['imo'] != '') { |
167 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
167 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
168 | 168 | } |
169 | 169 | if (isset($line['callsign']) && $line['callsign'] != '') { |
170 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
170 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
171 | 171 | } |
172 | 172 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
173 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
173 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
174 | 174 | } |
175 | 175 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
176 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
176 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
180 | 180 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
181 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
182 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
181 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
182 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
183 | 183 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
184 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
184 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
185 | 185 | $timeelapsed = microtime(true); |
186 | 186 | $Marine = new Marine($this->db); |
187 | 187 | $fromsource = NULL; |
@@ -190,20 +190,20 @@ discard block |
||
190 | 190 | $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
191 | 191 | $Marine->db = null; |
192 | 192 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
193 | - } |
|
193 | + } |
|
194 | 194 | } |
195 | - } |
|
196 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
195 | + } |
|
196 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
200 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
200 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
201 | 201 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
202 | - } else { |
|
202 | + } else { |
|
203 | 203 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
204 | 204 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
205 | 205 | return ''; |
206 | - } |
|
206 | + } |
|
207 | 207 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
208 | 208 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
209 | 209 | return ''; |
@@ -220,24 +220,24 @@ discard block |
||
220 | 220 | |
221 | 221 | |
222 | 222 | if (isset($line['speed'])) { |
223 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
224 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
223 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
224 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
225 | 225 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
226 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
227 | - if ($distance > 1000 && $distance < 10000) { |
|
226 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
227 | + if ($distance > 1000 && $distance < 10000) { |
|
228 | 228 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
229 | 229 | $speed = $speed*3.6; |
230 | 230 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
231 | 231 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
232 | - } |
|
232 | + } |
|
233 | 233 | } |
234 | 234 | |
235 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
236 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
237 | - else unset($timediff); |
|
238 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
235 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
236 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
237 | + else unset($timediff); |
|
238 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
239 | 239 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
240 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
240 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
241 | 241 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
242 | 242 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
243 | 243 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -245,211 +245,211 @@ discard block |
||
245 | 245 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
246 | 246 | $timeelapsed = microtime(true); |
247 | 247 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
248 | - $Marine = new Marine($this->db); |
|
249 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
250 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
251 | - $Marine->db = null; |
|
252 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
248 | + $Marine = new Marine($this->db); |
|
249 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
250 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
251 | + $Marine->db = null; |
|
252 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
253 | 253 | } |
254 | 254 | $this->tmd = 0; |
255 | 255 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
256 | - } |
|
256 | + } |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
260 | 260 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
261 | 261 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
262 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
263 | - $dataFound = true; |
|
264 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
262 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
263 | + $dataFound = true; |
|
264 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
265 | 265 | } |
266 | 266 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
267 | 267 | } |
268 | 268 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
269 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
269 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
270 | 270 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
271 | 271 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
272 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
273 | - $dataFound = true; |
|
274 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
272 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
273 | + $dataFound = true; |
|
274 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
275 | 275 | } |
276 | 276 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
277 | 277 | } |
278 | 278 | |
279 | - } else if ($globalDebug && $timediff > 20) { |
|
279 | + } else if ($globalDebug && $timediff > 20) { |
|
280 | 280 | $this->tmd = $this->tmd + 1; |
281 | 281 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
282 | 282 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
283 | 283 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
284 | 284 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
285 | - } |
|
285 | + } |
|
286 | 286 | } |
287 | 287 | if (isset($line['last_update']) && $line['last_update'] != '') { |
288 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
289 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
288 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
289 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
290 | 290 | } |
291 | 291 | if (isset($line['format_source']) && $line['format_source'] != '') { |
292 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
292 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
293 | 293 | } |
294 | 294 | if (isset($line['source_name']) && $line['source_name'] != '') { |
295 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
295 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
296 | 296 | } |
297 | 297 | if (isset($line['status']) && $line['status'] != '') { |
298 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
298 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
299 | 299 | } |
300 | 300 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
301 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
302 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
301 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
302 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
303 | 303 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
304 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
304 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
305 | 305 | $Marine = new Marine($this->db); |
306 | 306 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
307 | 307 | unset($Marine); |
308 | - } |
|
308 | + } |
|
309 | + } |
|
309 | 310 | } |
310 | - } |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
314 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
314 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | if (isset($line['heading']) && $line['heading'] != '') { |
318 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
319 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
320 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
321 | - //$dataFound = true; |
|
318 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
319 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
320 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
321 | + //$dataFound = true; |
|
322 | 322 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
323 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
324 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
325 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
326 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
323 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
324 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
325 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
326 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
327 | 327 | } |
328 | 328 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
329 | 329 | |
330 | 330 | |
331 | 331 | |
332 | 332 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
333 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
334 | - if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
335 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
336 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
333 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
334 | + if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
335 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
336 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
337 | 337 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
338 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
339 | - $timeelapsed = microtime(true); |
|
340 | - $MarineLive = new MarineLive($this->db); |
|
341 | - if (isset($line['id'])) { |
|
338 | + if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
339 | + $timeelapsed = microtime(true); |
|
340 | + $MarineLive = new MarineLive($this->db); |
|
341 | + if (isset($line['id'])) { |
|
342 | 342 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
343 | 343 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
344 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
344 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
345 | 345 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
346 | 346 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
347 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
347 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
348 | 348 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
349 | 349 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
350 | - } else $recent_ident = ''; |
|
351 | - $MarineLive->db=null; |
|
352 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
353 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
350 | + } else $recent_ident = ''; |
|
351 | + $MarineLive->db=null; |
|
352 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
353 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
354 | 354 | } else $recent_ident = ''; |
355 | - } else { |
|
355 | + } else { |
|
356 | 356 | $recent_ident = ''; |
357 | 357 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
358 | - } |
|
359 | - //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
360 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
361 | - { |
|
358 | + } |
|
359 | + //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
360 | + if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
361 | + { |
|
362 | 362 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
363 | 363 | //adds the spotter data for the archive |
364 | - $highlight = ''; |
|
365 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
366 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
364 | + $highlight = ''; |
|
365 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
366 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
367 | 367 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
368 | - $timeelapsed = microtime(true); |
|
369 | - $Marine = new Marine($this->db); |
|
370 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
371 | - $Marine->db = null; |
|
372 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
373 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
368 | + $timeelapsed = microtime(true); |
|
369 | + $Marine = new Marine($this->db); |
|
370 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
371 | + $Marine->db = null; |
|
372 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
373 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
374 | + } |
|
374 | 375 | } |
375 | - } |
|
376 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
376 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
377 | 377 | // Add source stat in DB |
378 | 378 | $Stats = new Stats($this->db); |
379 | 379 | if (!empty($this->stats)) { |
380 | - if ($globalDebug) echo 'Add source stats : '; |
|
381 | - foreach($this->stats as $date => $data) { |
|
380 | + if ($globalDebug) echo 'Add source stats : '; |
|
381 | + foreach($this->stats as $date => $data) { |
|
382 | 382 | foreach($data as $source => $sourced) { |
383 | - //print_r($sourced); |
|
384 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
385 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
386 | - if (isset($sourced['msg'])) { |
|
387 | - if (time() - $sourced['msg']['date'] > 10) { |
|
388 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
389 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
390 | - unset($this->stats[$date][$source]['msg']); |
|
391 | - } |
|
392 | - } |
|
393 | - } |
|
394 | - if ($date != date('Y-m-d')) { |
|
395 | - unset($this->stats[$date]); |
|
396 | - } |
|
397 | - } |
|
398 | - if ($globalDebug) echo 'Done'."\n"; |
|
383 | + //print_r($sourced); |
|
384 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
385 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
386 | + if (isset($sourced['msg'])) { |
|
387 | + if (time() - $sourced['msg']['date'] > 10) { |
|
388 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
389 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
390 | + unset($this->stats[$date][$source]['msg']); |
|
391 | + } |
|
392 | + } |
|
393 | + } |
|
394 | + if ($date != date('Y-m-d')) { |
|
395 | + unset($this->stats[$date]); |
|
396 | + } |
|
397 | + } |
|
398 | + if ($globalDebug) echo 'Done'."\n"; |
|
399 | 399 | } |
400 | 400 | $Stats->db = null; |
401 | - } |
|
401 | + } |
|
402 | 402 | |
403 | - $this->del(); |
|
403 | + $this->del(); |
|
404 | 404 | //$ignoreImport = false; |
405 | 405 | $this->all_tracked[$id]['addedMarine'] = 1; |
406 | 406 | //print_r($this->all_tracked[$id]); |
407 | 407 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
408 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
409 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
410 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
408 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
409 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
410 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
411 | 411 | $MarineLive = new MarineLive($this->db); |
412 | 412 | $MarineLive->deleteLiveMarineData(); |
413 | 413 | $MarineLive->db=null; |
414 | 414 | if ($globalDebug) echo " Done\n"; |
415 | - } |
|
416 | - $this->last_delete = time(); |
|
415 | + } |
|
416 | + $this->last_delete = time(); |
|
417 | 417 | } |
418 | - } elseif ($recent_ident != '') { |
|
418 | + } elseif ($recent_ident != '') { |
|
419 | 419 | $this->all_tracked[$id]['id'] = $recent_ident; |
420 | 420 | $this->all_tracked[$id]['addedMarine'] = 1; |
421 | 421 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
422 | - if (isset($globalDaemon) && !$globalDaemon) { |
|
422 | + if (isset($globalDaemon) && !$globalDaemon) { |
|
423 | 423 | $Marine = new Marine($this->db); |
424 | 424 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
425 | 425 | $Marine->db = null; |
426 | - } |
|
426 | + } |
|
427 | 427 | } |
428 | 428 | |
429 | - } |
|
429 | + } |
|
430 | + } |
|
430 | 431 | } |
431 | - } |
|
432 | - //adds the spotter LIVE data |
|
433 | - if ($globalDebug) { |
|
432 | + //adds the spotter LIVE data |
|
433 | + if ($globalDebug) { |
|
434 | 434 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
435 | - } |
|
436 | - $ignoreImport = false; |
|
435 | + } |
|
436 | + $ignoreImport = false; |
|
437 | 437 | |
438 | - if (!$ignoreImport) { |
|
438 | + if (!$ignoreImport) { |
|
439 | 439 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
440 | 440 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
441 | 441 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
442 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
442 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
443 | 443 | $timeelapsed = microtime(true); |
444 | 444 | $MarineLive = new MarineLive($this->db); |
445 | 445 | $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
446 | 446 | $MarineLive->db = null; |
447 | 447 | if ($globalDebug) echo $result."\n"; |
448 | 448 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
449 | - } |
|
449 | + } |
|
450 | 450 | } |
451 | 451 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
452 | - $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
452 | + $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
453 | 453 | } |
454 | 454 | $this->all_tracked[$id]['putinarchive'] = false; |
455 | 455 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | if ($stats_heading == 16) $stats_heading = 0; |
482 | 482 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
483 | 483 | for ($i=0;$i<=15;$i++) { |
484 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
484 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
485 | 485 | } |
486 | 486 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
487 | 487 | } else { |
@@ -494,11 +494,11 @@ discard block |
||
494 | 494 | //var_dump($this->stats); |
495 | 495 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
496 | 496 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
497 | - end($this->stats[$current_date][$source]['hist']); |
|
498 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
497 | + end($this->stats[$current_date][$source]['hist']); |
|
498 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
499 | 499 | } else $mini = 0; |
500 | 500 | for ($i=$mini;$i<=$distance;$i+=10) { |
501 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
501 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
502 | 502 | } |
503 | 503 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
504 | 504 | } else { |
@@ -514,24 +514,24 @@ discard block |
||
514 | 514 | |
515 | 515 | |
516 | 516 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
517 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
517 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
518 | 518 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
519 | 519 | $MarineLive = new MarineLive($this->db); |
520 | 520 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
521 | 521 | $MarineLive->db = null; |
522 | 522 | //MarineLive->deleteLiveMarineData(); |
523 | 523 | if ($globalDebug) echo " Done\n"; |
524 | - } |
|
525 | - $this->last_delete_hourly = time(); |
|
524 | + } |
|
525 | + $this->last_delete_hourly = time(); |
|
526 | 526 | } |
527 | 527 | |
528 | - } |
|
529 | - //$ignoreImport = false; |
|
528 | + } |
|
529 | + //$ignoreImport = false; |
|
530 | 530 | } |
531 | 531 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
532 | 532 | if ($send) return $this->all_tracked[$id]; |
533 | - } |
|
533 | + } |
|
534 | + } |
|
534 | 535 | } |
535 | - } |
|
536 | 536 | } |
537 | 537 | ?> |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | - * Executes the SQL statements to get the spotter information |
|
86 | - * |
|
87 | - * @param String $query the SQL query |
|
88 | - * @param Array $params parameter of the query |
|
89 | - * @param String $limitQuery the limit query |
|
90 | - * @return Array the spotter information |
|
91 | - * |
|
92 | - */ |
|
85 | + * Executes the SQL statements to get the spotter information |
|
86 | + * |
|
87 | + * @param String $query the SQL query |
|
88 | + * @param Array $params parameter of the query |
|
89 | + * @param String $limitQuery the limit query |
|
90 | + * @return Array the spotter information |
|
91 | + * |
|
92 | + */ |
|
93 | 93 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
94 | 94 | { |
95 | 95 | date_default_timezone_set('UTC'); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | |
218 | 218 | |
219 | 219 | /** |
220 | - * Gets all the spotter information based on the latest data entry |
|
221 | - * |
|
222 | - * @return Array the spotter information |
|
223 | - * |
|
224 | - */ |
|
220 | + * Gets all the spotter information based on the latest data entry |
|
221 | + * |
|
222 | + * @return Array the spotter information |
|
223 | + * |
|
224 | + */ |
|
225 | 225 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
226 | 226 | { |
227 | 227 | global $global_query; |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
273 | - * Gets all the spotter information based on the callsign |
|
274 | - * |
|
275 | - * @return Array the spotter information |
|
276 | - * |
|
277 | - */ |
|
273 | + * Gets all the spotter information based on the callsign |
|
274 | + * |
|
275 | + * @return Array the spotter information |
|
276 | + * |
|
277 | + */ |
|
278 | 278 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
279 | 279 | { |
280 | 280 | global $global_query; |
@@ -385,12 +385,12 @@ discard block |
||
385 | 385 | |
386 | 386 | |
387 | 387 | /** |
388 | - * Gets all source name |
|
389 | - * |
|
390 | - * @param String type format of source |
|
391 | - * @return Array list of source name |
|
392 | - * |
|
393 | - */ |
|
388 | + * Gets all source name |
|
389 | + * |
|
390 | + * @param String type format of source |
|
391 | + * @return Array list of source name |
|
392 | + * |
|
393 | + */ |
|
394 | 394 | public function getAllSourceName($type = '',$filters = array()) |
395 | 395 | { |
396 | 396 | $filter_query = $this->getFilter($filters,true,true); |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | |
421 | 421 | |
422 | 422 | /** |
423 | - * Gets a list of all idents/callsigns |
|
424 | - * |
|
425 | - * @return Array list of ident/callsign names |
|
426 | - * |
|
427 | - */ |
|
423 | + * Gets a list of all idents/callsigns |
|
424 | + * |
|
425 | + * @return Array list of ident/callsign names |
|
426 | + * |
|
427 | + */ |
|
428 | 428 | public function getAllIdents($filters = array()) |
429 | 429 | { |
430 | 430 | $filter_query = $this->getFilter($filters,true,true); |
@@ -448,11 +448,11 @@ discard block |
||
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
451 | - * Gets all info from a mmsi |
|
452 | - * |
|
453 | - * @return Array ident |
|
454 | - * |
|
455 | - */ |
|
451 | + * Gets all info from a mmsi |
|
452 | + * |
|
453 | + * @return Array ident |
|
454 | + * |
|
455 | + */ |
|
456 | 456 | public function getIdentity($mmsi) |
457 | 457 | { |
458 | 458 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -465,9 +465,9 @@ discard block |
||
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
468 | - * Add identity |
|
469 | - * |
|
470 | - */ |
|
468 | + * Add identity |
|
469 | + * |
|
470 | + */ |
|
471 | 471 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
472 | 472 | { |
473 | 473 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | } |
534 | 534 | |
535 | 535 | /** |
536 | - * Update ident tracker data |
|
537 | - * |
|
538 | - * @param String $fammarine_id the ID |
|
539 | - * @param String $ident the marine ident |
|
540 | - * @return String success or false |
|
541 | - * |
|
542 | - */ |
|
536 | + * Update ident tracker data |
|
537 | + * |
|
538 | + * @param String $fammarine_id the ID |
|
539 | + * @param String $ident the marine ident |
|
540 | + * @return String success or false |
|
541 | + * |
|
542 | + */ |
|
543 | 543 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
544 | 544 | { |
545 | 545 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -554,19 +554,19 @@ discard block |
||
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
557 | - * Update Status data |
|
558 | - * |
|
559 | - * @param String $fammarine_id the ID |
|
560 | - * @param String $status_id the marine status id |
|
561 | - * @param String $status the marine status |
|
562 | - * @return String success or false |
|
563 | - * |
|
564 | - */ |
|
557 | + * Update Status data |
|
558 | + * |
|
559 | + * @param String $fammarine_id the ID |
|
560 | + * @param String $status_id the marine status id |
|
561 | + * @param String $status the marine status |
|
562 | + * @return String success or false |
|
563 | + * |
|
564 | + */ |
|
565 | 565 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
566 | 566 | { |
567 | 567 | |
568 | 568 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
569 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
569 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
570 | 570 | |
571 | 571 | try { |
572 | 572 | $sth = $this->db->prepare($query); |
@@ -579,17 +579,17 @@ discard block |
||
579 | 579 | |
580 | 580 | } |
581 | 581 | /** |
582 | - * Update latest marine data |
|
583 | - * |
|
584 | - * @param String $fammarine_id the ID |
|
585 | - * @param String $ident the marine ident |
|
586 | - * @return String success or false |
|
587 | - * |
|
588 | - */ |
|
582 | + * Update latest marine data |
|
583 | + * |
|
584 | + * @param String $fammarine_id the ID |
|
585 | + * @param String $ident the marine ident |
|
586 | + * @return String success or false |
|
587 | + * |
|
588 | + */ |
|
589 | 589 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
590 | 590 | { |
591 | 591 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
592 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
592 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
593 | 593 | |
594 | 594 | try { |
595 | 595 | $sth = $this->db->prepare($query); |
@@ -603,30 +603,30 @@ discard block |
||
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
606 | - * Adds a new spotter data |
|
607 | - * |
|
608 | - * @param String $fammarine_id the ID |
|
609 | - * @param String $ident the marine ident |
|
610 | - * @param String $departure_airport_icao the departure airport |
|
611 | - * @param String $arrival_airport_icao the arrival airport |
|
612 | - * @param String $latitude latitude of flight |
|
613 | - * @param String $longitude latitude of flight |
|
614 | - * @param String $waypoints waypoints of flight |
|
615 | - * @param String $heading heading of flight |
|
616 | - * @param String $groundspeed speed of flight |
|
617 | - * @param String $date date of flight |
|
618 | - * @param String $departure_airport_time departure time of flight |
|
619 | - * @param String $arrival_airport_time arrival time of flight |
|
620 | - * @param String $squawk squawk code of flight |
|
621 | - * @param String $route_stop route stop of flight |
|
622 | - * @param String $highlight highlight or not |
|
623 | - * @param String $ModeS ModesS code of flight |
|
624 | - * @param String $registration registration code of flight |
|
625 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
626 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
627 | - * @param String $verticalrate vertival rate of flight |
|
628 | - * @return String success or false |
|
629 | - */ |
|
606 | + * Adds a new spotter data |
|
607 | + * |
|
608 | + * @param String $fammarine_id the ID |
|
609 | + * @param String $ident the marine ident |
|
610 | + * @param String $departure_airport_icao the departure airport |
|
611 | + * @param String $arrival_airport_icao the arrival airport |
|
612 | + * @param String $latitude latitude of flight |
|
613 | + * @param String $longitude latitude of flight |
|
614 | + * @param String $waypoints waypoints of flight |
|
615 | + * @param String $heading heading of flight |
|
616 | + * @param String $groundspeed speed of flight |
|
617 | + * @param String $date date of flight |
|
618 | + * @param String $departure_airport_time departure time of flight |
|
619 | + * @param String $arrival_airport_time arrival time of flight |
|
620 | + * @param String $squawk squawk code of flight |
|
621 | + * @param String $route_stop route stop of flight |
|
622 | + * @param String $highlight highlight or not |
|
623 | + * @param String $ModeS ModesS code of flight |
|
624 | + * @param String $registration registration code of flight |
|
625 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
626 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
627 | + * @param String $verticalrate vertival rate of flight |
|
628 | + * @return String success or false |
|
629 | + */ |
|
630 | 630 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '') |
631 | 631 | { |
632 | 632 | global $globalURL, $globalMarineImageFetch; |
@@ -723,13 +723,13 @@ discard block |
||
723 | 723 | unset($Image); |
724 | 724 | } |
725 | 725 | |
726 | - if ($latitude == '' && $longitude == '') { |
|
727 | - $latitude = 0; |
|
728 | - $longitude = 0; |
|
729 | - } |
|
730 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
731 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
732 | - if ($arrival_date == '') $arrival_date = NULL; |
|
726 | + if ($latitude == '' && $longitude == '') { |
|
727 | + $latitude = 0; |
|
728 | + $longitude = 0; |
|
729 | + } |
|
730 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
731 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
732 | + if ($arrival_date == '') $arrival_date = NULL; |
|
733 | 733 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
734 | 734 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
735 | 735 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | $sth->execute($query_values); |
741 | 741 | $this->db = null; |
742 | 742 | } catch (PDOException $e) { |
743 | - return "error : ".$e->getMessage(); |
|
743 | + return "error : ".$e->getMessage(); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | return "success"; |
@@ -749,11 +749,11 @@ discard block |
||
749 | 749 | |
750 | 750 | |
751 | 751 | /** |
752 | - * Gets the aircraft ident within the last hour |
|
753 | - * |
|
754 | - * @return String the ident |
|
755 | - * |
|
756 | - */ |
|
752 | + * Gets the aircraft ident within the last hour |
|
753 | + * |
|
754 | + * @return String the ident |
|
755 | + * |
|
756 | + */ |
|
757 | 757 | public function getIdentFromLastHour($ident) |
758 | 758 | { |
759 | 759 | global $globalDBdriver, $globalTimezone; |
@@ -769,11 +769,11 @@ discard block |
||
769 | 769 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
770 | 770 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
771 | 771 | $query_data = array(':ident' => $ident); |
772 | - } |
|
772 | + } |
|
773 | 773 | |
774 | 774 | $sth = $this->db->prepare($query); |
775 | 775 | $sth->execute($query_data); |
776 | - $ident_result=''; |
|
776 | + $ident_result=''; |
|
777 | 777 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
778 | 778 | { |
779 | 779 | $ident_result = $row['ident']; |
@@ -784,11 +784,11 @@ discard block |
||
784 | 784 | |
785 | 785 | |
786 | 786 | /** |
787 | - * Gets the aircraft data from the last 20 seconds |
|
788 | - * |
|
789 | - * @return Array the spotter data |
|
790 | - * |
|
791 | - */ |
|
787 | + * Gets the aircraft data from the last 20 seconds |
|
788 | + * |
|
789 | + * @return Array the spotter data |
|
790 | + * |
|
791 | + */ |
|
792 | 792 | public function getRealTimeData($q = '') |
793 | 793 | { |
794 | 794 | global $globalDBdriver; |
@@ -826,11 +826,11 @@ discard block |
||
826 | 826 | |
827 | 827 | |
828 | 828 | /** |
829 | - * Gets all number of flight over countries |
|
830 | - * |
|
831 | - * @return Array the airline country list |
|
832 | - * |
|
833 | - */ |
|
829 | + * Gets all number of flight over countries |
|
830 | + * |
|
831 | + * @return Array the airline country list |
|
832 | + * |
|
833 | + */ |
|
834 | 834 | |
835 | 835 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
836 | 836 | { |
@@ -903,11 +903,11 @@ discard block |
||
903 | 903 | |
904 | 904 | |
905 | 905 | /** |
906 | - * Gets all callsigns that have flown over |
|
907 | - * |
|
908 | - * @return Array the callsign list |
|
909 | - * |
|
910 | - */ |
|
906 | + * Gets all callsigns that have flown over |
|
907 | + * |
|
908 | + * @return Array the callsign list |
|
909 | + * |
|
910 | + */ |
|
911 | 911 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
912 | 912 | { |
913 | 913 | global $globalDBdriver; |
@@ -974,11 +974,11 @@ discard block |
||
974 | 974 | |
975 | 975 | |
976 | 976 | /** |
977 | - * Counts all dates |
|
978 | - * |
|
979 | - * @return Array the date list |
|
980 | - * |
|
981 | - */ |
|
977 | + * Counts all dates |
|
978 | + * |
|
979 | + * @return Array the date list |
|
980 | + * |
|
981 | + */ |
|
982 | 982 | public function countAllDates($filters = array()) |
983 | 983 | { |
984 | 984 | global $globalTimezone, $globalDBdriver; |
@@ -1024,11 +1024,11 @@ discard block |
||
1024 | 1024 | |
1025 | 1025 | |
1026 | 1026 | /** |
1027 | - * Counts all dates during the last 7 days |
|
1028 | - * |
|
1029 | - * @return Array the date list |
|
1030 | - * |
|
1031 | - */ |
|
1027 | + * Counts all dates during the last 7 days |
|
1028 | + * |
|
1029 | + * @return Array the date list |
|
1030 | + * |
|
1031 | + */ |
|
1032 | 1032 | public function countAllDatesLast7Days($filters = array()) |
1033 | 1033 | { |
1034 | 1034 | global $globalTimezone, $globalDBdriver; |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $query .= " GROUP BY date_name |
1051 | 1051 | ORDER BY date_name ASC"; |
1052 | 1052 | $query_data = array(':offset' => $offset); |
1053 | - } |
|
1053 | + } |
|
1054 | 1054 | |
1055 | 1055 | $sth = $this->db->prepare($query); |
1056 | 1056 | $sth->execute($query_data); |
@@ -1070,11 +1070,11 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | /** |
1073 | - * Counts all dates during the last month |
|
1074 | - * |
|
1075 | - * @return Array the date list |
|
1076 | - * |
|
1077 | - */ |
|
1073 | + * Counts all dates during the last month |
|
1074 | + * |
|
1075 | + * @return Array the date list |
|
1076 | + * |
|
1077 | + */ |
|
1078 | 1078 | public function countAllDatesLastMonth($filters = array()) |
1079 | 1079 | { |
1080 | 1080 | global $globalTimezone, $globalDBdriver; |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | $query .= " GROUP BY date_name |
1097 | 1097 | ORDER BY date_name ASC"; |
1098 | 1098 | $query_data = array(':offset' => $offset); |
1099 | - } |
|
1099 | + } |
|
1100 | 1100 | |
1101 | 1101 | $sth = $this->db->prepare($query); |
1102 | 1102 | $sth->execute($query_data); |
@@ -1118,11 +1118,11 @@ discard block |
||
1118 | 1118 | |
1119 | 1119 | |
1120 | 1120 | /** |
1121 | - * Counts all month |
|
1122 | - * |
|
1123 | - * @return Array the month list |
|
1124 | - * |
|
1125 | - */ |
|
1121 | + * Counts all month |
|
1122 | + * |
|
1123 | + * @return Array the month list |
|
1124 | + * |
|
1125 | + */ |
|
1126 | 1126 | public function countAllMonths($filters = array()) |
1127 | 1127 | { |
1128 | 1128 | global $globalTimezone, $globalDBdriver; |
@@ -1167,11 +1167,11 @@ discard block |
||
1167 | 1167 | |
1168 | 1168 | |
1169 | 1169 | /** |
1170 | - * Counts all dates during the last year |
|
1171 | - * |
|
1172 | - * @return Array the date list |
|
1173 | - * |
|
1174 | - */ |
|
1170 | + * Counts all dates during the last year |
|
1171 | + * |
|
1172 | + * @return Array the date list |
|
1173 | + * |
|
1174 | + */ |
|
1175 | 1175 | public function countAllMonthsLastYear($filters) |
1176 | 1176 | { |
1177 | 1177 | global $globalTimezone, $globalDBdriver; |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | $query .= " GROUP BY year_name, month_name |
1194 | 1194 | ORDER BY year_name, month_name ASC"; |
1195 | 1195 | $query_data = array(':offset' => $offset); |
1196 | - } |
|
1196 | + } |
|
1197 | 1197 | |
1198 | 1198 | $sth = $this->db->prepare($query); |
1199 | 1199 | $sth->execute($query_data); |
@@ -1216,11 +1216,11 @@ discard block |
||
1216 | 1216 | |
1217 | 1217 | |
1218 | 1218 | /** |
1219 | - * Counts all hours |
|
1220 | - * |
|
1221 | - * @return Array the hour list |
|
1222 | - * |
|
1223 | - */ |
|
1219 | + * Counts all hours |
|
1220 | + * |
|
1221 | + * @return Array the hour list |
|
1222 | + * |
|
1223 | + */ |
|
1224 | 1224 | public function countAllHours($orderby,$filters = array()) |
1225 | 1225 | { |
1226 | 1226 | global $globalTimezone, $globalDBdriver; |
@@ -1283,11 +1283,11 @@ discard block |
||
1283 | 1283 | |
1284 | 1284 | |
1285 | 1285 | /** |
1286 | - * Counts all hours by date |
|
1287 | - * |
|
1288 | - * @return Array the hour list |
|
1289 | - * |
|
1290 | - */ |
|
1286 | + * Counts all hours by date |
|
1287 | + * |
|
1288 | + * @return Array the hour list |
|
1289 | + * |
|
1290 | + */ |
|
1291 | 1291 | public function countAllHoursByDate($date, $filters = array()) |
1292 | 1292 | { |
1293 | 1293 | global $globalTimezone, $globalDBdriver; |
@@ -1331,11 +1331,11 @@ discard block |
||
1331 | 1331 | |
1332 | 1332 | |
1333 | 1333 | /** |
1334 | - * Counts all hours by a ident/callsign |
|
1335 | - * |
|
1336 | - * @return Array the hour list |
|
1337 | - * |
|
1338 | - */ |
|
1334 | + * Counts all hours by a ident/callsign |
|
1335 | + * |
|
1336 | + * @return Array the hour list |
|
1337 | + * |
|
1338 | + */ |
|
1339 | 1339 | public function countAllHoursByIdent($ident, $filters = array()) |
1340 | 1340 | { |
1341 | 1341 | global $globalTimezone, $globalDBdriver; |
@@ -1380,11 +1380,11 @@ discard block |
||
1380 | 1380 | |
1381 | 1381 | |
1382 | 1382 | /** |
1383 | - * Counts all vessels |
|
1384 | - * |
|
1385 | - * @return Integer the number of vessels |
|
1386 | - * |
|
1387 | - */ |
|
1383 | + * Counts all vessels |
|
1384 | + * |
|
1385 | + * @return Integer the number of vessels |
|
1386 | + * |
|
1387 | + */ |
|
1388 | 1388 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
1389 | 1389 | { |
1390 | 1390 | global $globalDBdriver; |
@@ -1419,11 +1419,11 @@ discard block |
||
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | /** |
1422 | - * Counts all vessel type |
|
1423 | - * |
|
1424 | - * @return Integer the number of vessels |
|
1425 | - * |
|
1426 | - */ |
|
1422 | + * Counts all vessel type |
|
1423 | + * |
|
1424 | + * @return Integer the number of vessels |
|
1425 | + * |
|
1426 | + */ |
|
1427 | 1427 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
1428 | 1428 | { |
1429 | 1429 | global $globalDBdriver; |
@@ -1458,11 +1458,11 @@ discard block |
||
1458 | 1458 | |
1459 | 1459 | |
1460 | 1460 | /** |
1461 | - * Counts all hours of today |
|
1462 | - * |
|
1463 | - * @return Array the hour list |
|
1464 | - * |
|
1465 | - */ |
|
1461 | + * Counts all hours of today |
|
1462 | + * |
|
1463 | + * @return Array the hour list |
|
1464 | + * |
|
1465 | + */ |
|
1466 | 1466 | public function countAllHoursFromToday($filters = array()) |
1467 | 1467 | { |
1468 | 1468 | global $globalTimezone, $globalDBdriver; |
@@ -1502,12 +1502,12 @@ discard block |
||
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | |
1505 | - /** |
|
1506 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1507 | - * |
|
1508 | - * @return Integer the Barrie Spotter ID |
|
1505 | + /** |
|
1506 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1507 | + * |
|
1508 | + * @return Integer the Barrie Spotter ID |
|
1509 | 1509 | q * |
1510 | - */ |
|
1510 | + */ |
|
1511 | 1511 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1512 | 1512 | { |
1513 | 1513 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1528,13 +1528,13 @@ discard block |
||
1528 | 1528 | |
1529 | 1529 | |
1530 | 1530 | /** |
1531 | - * Parses a date string |
|
1532 | - * |
|
1533 | - * @param String $dateString the date string |
|
1534 | - * @param String $timezone the timezone of a user |
|
1535 | - * @return Array the time information |
|
1536 | - * |
|
1537 | - */ |
|
1531 | + * Parses a date string |
|
1532 | + * |
|
1533 | + * @param String $dateString the date string |
|
1534 | + * @param String $timezone the timezone of a user |
|
1535 | + * @return Array the time information |
|
1536 | + * |
|
1537 | + */ |
|
1538 | 1538 | public function parseDateString($dateString, $timezone = '') |
1539 | 1539 | { |
1540 | 1540 | $time_array = array(); |
@@ -1567,12 +1567,12 @@ discard block |
||
1567 | 1567 | } |
1568 | 1568 | |
1569 | 1569 | /** |
1570 | - * Parses the direction degrees to working |
|
1571 | - * |
|
1572 | - * @param Float $direction the direction in degrees |
|
1573 | - * @return Array the direction information |
|
1574 | - * |
|
1575 | - */ |
|
1570 | + * Parses the direction degrees to working |
|
1571 | + * |
|
1572 | + * @param Float $direction the direction in degrees |
|
1573 | + * @return Array the direction information |
|
1574 | + * |
|
1575 | + */ |
|
1576 | 1576 | public function parseDirection($direction = 0) |
1577 | 1577 | { |
1578 | 1578 | if ($direction == '') $direction = 0; |
@@ -1651,12 +1651,12 @@ discard block |
||
1651 | 1651 | |
1652 | 1652 | |
1653 | 1653 | /** |
1654 | - * Gets Country from latitude/longitude |
|
1655 | - * |
|
1656 | - * @param Float $latitude latitute of the flight |
|
1657 | - * @param Float $longitude longitute of the flight |
|
1658 | - * @return String the countrie |
|
1659 | - */ |
|
1654 | + * Gets Country from latitude/longitude |
|
1655 | + * |
|
1656 | + * @param Float $latitude latitute of the flight |
|
1657 | + * @param Float $longitude longitute of the flight |
|
1658 | + * @return String the countrie |
|
1659 | + */ |
|
1660 | 1660 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
1661 | 1661 | { |
1662 | 1662 | global $globalDBdriver, $globalDebug; |
@@ -1693,11 +1693,11 @@ discard block |
||
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | /** |
1696 | - * Gets Country from iso2 |
|
1697 | - * |
|
1698 | - * @param String $iso2 ISO2 country code |
|
1699 | - * @return String the countrie |
|
1700 | - */ |
|
1696 | + * Gets Country from iso2 |
|
1697 | + * |
|
1698 | + * @param String $iso2 ISO2 country code |
|
1699 | + * @return String the countrie |
|
1700 | + */ |
|
1701 | 1701 | public function getCountryFromISO2($iso2) |
1702 | 1702 | { |
1703 | 1703 | global $globalDBdriver, $globalDebug; |
@@ -1726,12 +1726,12 @@ discard block |
||
1726 | 1726 | |
1727 | 1727 | |
1728 | 1728 | /** |
1729 | - * Gets the short url from bit.ly |
|
1730 | - * |
|
1731 | - * @param String $url the full url |
|
1732 | - * @return String the bit.ly url |
|
1733 | - * |
|
1734 | - */ |
|
1729 | + * Gets the short url from bit.ly |
|
1730 | + * |
|
1731 | + * @param String $url the full url |
|
1732 | + * @return String the bit.ly url |
|
1733 | + * |
|
1734 | + */ |
|
1735 | 1735 | public function getBitlyURL($url) |
1736 | 1736 | { |
1737 | 1737 | global $globalBitlyAccessToken; |
@@ -1758,11 +1758,11 @@ discard block |
||
1758 | 1758 | |
1759 | 1759 | |
1760 | 1760 | /** |
1761 | - * Gets all vessels types that have flown over |
|
1762 | - * |
|
1763 | - * @return Array the vessel type list |
|
1764 | - * |
|
1765 | - */ |
|
1761 | + * Gets all vessels types that have flown over |
|
1762 | + * |
|
1763 | + * @return Array the vessel type list |
|
1764 | + * |
|
1765 | + */ |
|
1766 | 1766 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
1767 | 1767 | { |
1768 | 1768 | global $globalDBdriver; |
@@ -1827,11 +1827,11 @@ discard block |
||
1827 | 1827 | } |
1828 | 1828 | |
1829 | 1829 | /** |
1830 | - * Gets all the tracker information |
|
1831 | - * |
|
1832 | - * @return Array the tracker information |
|
1833 | - * |
|
1834 | - */ |
|
1830 | + * Gets all the tracker information |
|
1831 | + * |
|
1832 | + * @return Array the tracker information |
|
1833 | + * |
|
1834 | + */ |
|
1835 | 1835 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
1836 | 1836 | { |
1837 | 1837 | global $globalTimezone, $globalDBdriver; |