Skip to content

Commit

Permalink
Add globalOnlyID for marine, to only add ID in array to DB
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Mar 27, 2018
1 parent 0d661be commit 7456121
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions require/class.MarineImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ public function del() {
}

public function add($line) {
global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM;
global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM, $globalOnlyID;
if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
date_default_timezone_set('UTC');
$dataFound = false;
$send = false;

// SBS format is CSV format
if(is_array($line) && (isset($line['mmsi']) || isset($line['id']))) {
print_r($line);
//print_r($line);
if (isset($line['mmsi']) || isset($line['id'])) {


Expand Down Expand Up @@ -427,7 +427,7 @@ public function add($line) {
if ($dataFound === true && (isset($this->all_tracked[$id]['mmsi']) || isset($this->all_tracked[$id]['id']))) {
$this->all_tracked[$id]['lastupdate'] = time();
if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) {
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'])) {
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'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) {
if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
if ($globalDebug) echo "Check if vessel is already in DB...";
Expand Down Expand Up @@ -556,7 +556,7 @@ public function add($line) {
$ignoreImport = false;
if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true;
if (!$ignoreImport) {
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'])) {
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'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) {
if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/daemon-spotter.php
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ function connect_all($hosts) {
$data['captain_name'] = $sail['usrname'];
$allboats = array('Sailaway Cruiser 38','Mini Transat','Caribbean Rose','52&#39; Cruising Cat','50&#39; Performance Cruiser','Nordic Folkboat');
$boattype = $sail['ubtbtpnr'];
$data['type'] = $allboats[$boattype-1];
if (isset($allboats[$boattype-1])) $data['type'] = $allboats[$boattype-1];
$data['speed'] = round($sail['ubtspeed']*3.6,2);
$data['format_source'] = 'sailaway';
$data['id_source'] = $id_source;
Expand Down

0 comments on commit 7456121

Please sign in to comment.