@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return ($dec); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - /* |
|
| 60 | + /* |
|
| 61 | 61 | $ais_map64 = array( |
| 62 | 62 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', // 48 |
| 63 | 63 | ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | // ' ' --- '?', // 0x20 - 0x3F |
| 98 | 98 | // '@' --- '_', // 0x40 - 0x5F |
| 99 | 99 | $ais_chars = array( |
| 100 | - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', |
|
| 101 | - 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', |
|
| 102 | - 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', |
|
| 103 | - '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'', |
|
| 104 | - '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', |
|
| 105 | - '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', |
|
| 106 | - '<', '=', '>', '?' |
|
| 100 | + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', |
|
| 101 | + 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', |
|
| 102 | + 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', |
|
| 103 | + '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'', |
|
| 104 | + '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', |
|
| 105 | + '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', |
|
| 106 | + '<', '=', '>', '?' |
|
| 107 | 107 | ); |
| 108 | 108 | // " |
| 109 | 109 | $rv = ''; |
@@ -421,8 +421,8 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | if ($num_seq > 1) { // for multipart messages |
| 423 | 423 | if ($cmsg_sid != $msg_sid // different msg_sid |
| 424 | - || $msg_sid == -1 // invalid initial msg_sid |
|
| 425 | - || ($seq - $pseq) != 1 // not insequence |
|
| 424 | + || $msg_sid == -1 // invalid initial msg_sid |
|
| 425 | + || ($seq - $pseq) != 1 // not insequence |
|
| 426 | 426 | ) { // invalid for multipart message |
| 427 | 427 | $msg_sid = -1; |
| 428 | 428 | $cmsg_sid = -1; |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $itu = $itu.$pcs[5]; // get itu message |
| 436 | 436 | $filler += (int)$pcs[6][0]; // get filler |
| 437 | 437 | if ($num_seq == 1 // valid single message |
| 438 | - || $num_seq == $pseq // valid multi-part message |
|
| 438 | + || $num_seq == $pseq // valid multi-part message |
|
| 439 | 439 | ) { |
| 440 | 440 | /* |
| 441 | 441 | if ($num_seq != 1) { // test |
@@ -520,13 +520,13 @@ discard block |
||
| 520 | 520 | else $pad = ''; |
| 521 | 521 | $rv = ''; |
| 522 | 522 | $ais_chars = array( |
| 523 | - '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9, |
|
| 524 | - 'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19, |
|
| 525 | - 'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29, |
|
| 526 | - '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39, |
|
| 527 | - '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49, |
|
| 528 | - '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59, |
|
| 529 | - '<'=>60, '='=>61, '>'=>62, '?'=>63 |
|
| 523 | + '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9, |
|
| 524 | + 'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19, |
|
| 525 | + 'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29, |
|
| 526 | + '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39, |
|
| 527 | + '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49, |
|
| 528 | + '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59, |
|
| 529 | + '<'=>60, '='=>61, '>'=>62, '?'=>63 |
|
| 530 | 530 | ); |
| 531 | 531 | // " |
| 532 | 532 | $_a = str_split($name); |
@@ -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,102 +105,102 @@ 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 | - if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
| 173 | + if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
| 174 | 174 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
| 175 | 175 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
| 176 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 176 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 177 | 177 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 178 | - $Marine = new Marine($this->db); |
|
| 179 | - $fromsource = NULL; |
|
| 180 | - $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
| 181 | - $Marine->db = null; |
|
| 178 | + $Marine = new Marine($this->db); |
|
| 179 | + $fromsource = NULL; |
|
| 180 | + $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
| 181 | + $Marine->db = null; |
|
| 182 | + } |
|
| 182 | 183 | } |
| 183 | - } |
|
| 184 | 184 | } |
| 185 | - } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
| 185 | + } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
| 186 | 186 | $this->all_tracked[$id]['arrival_code'] = $line['arrival_code']; |
| 187 | 187 | if (!isset($line['id'])) { |
| 188 | 188 | $this->all_tracked[$id]['id'] = $id.'-'.date('YmdHi'); |
| 189 | 189 | $this->all_tracked[$id]['forcenew'] = 1; |
| 190 | 190 | $this->all_tracked[$id]['addedMarine'] = 0; |
| 191 | 191 | } |
| 192 | - } |
|
| 192 | + } |
|
| 193 | 193 | } |
| 194 | 194 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 195 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 195 | + if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | //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'])) { |
| 199 | 199 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 200 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 201 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 201 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 202 | 202 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 203 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 203 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 204 | 204 | $timeelapsed = microtime(true); |
| 205 | 205 | $Marine = new Marine($this->db); |
| 206 | 206 | $fromsource = NULL; |
@@ -209,20 +209,20 @@ discard block |
||
| 209 | 209 | $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']); |
| 210 | 210 | $Marine->db = null; |
| 211 | 211 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 212 | - } |
|
| 212 | + } |
|
| 213 | + } |
|
| 213 | 214 | } |
| 214 | - } |
|
| 215 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 215 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
| 219 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 219 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 220 | 220 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 221 | - } else { |
|
| 221 | + } else { |
|
| 222 | 222 | 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"; |
| 223 | 223 | 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"; |
| 224 | 224 | return ''; |
| 225 | - } |
|
| 225 | + } |
|
| 226 | 226 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
| 227 | 227 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
| 228 | 228 | return ''; |
@@ -239,24 +239,24 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | |
| 241 | 241 | if (isset($line['speed'])) { |
| 242 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 243 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 242 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 244 | 244 | } 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'])) { |
| 245 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 246 | - if ($distance > 1000 && $distance < 10000) { |
|
| 245 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 246 | + if ($distance > 1000 && $distance < 10000) { |
|
| 247 | 247 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 248 | 248 | $speed = $speed*3.6; |
| 249 | 249 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
| 250 | 250 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 251 | - } |
|
| 251 | + } |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 255 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 256 | - else unset($timediff); |
|
| 257 | - 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')))) { |
|
| 254 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 255 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 256 | + else unset($timediff); |
|
| 257 | + 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')))) { |
|
| 258 | 258 | 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'])) { |
| 259 | - 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'])) { |
|
| 259 | + 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'])) { |
|
| 260 | 260 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 261 | 261 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 262 | 262 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -264,211 +264,211 @@ discard block |
||
| 264 | 264 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
| 265 | 265 | $timeelapsed = microtime(true); |
| 266 | 266 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 267 | - $Marine = new Marine($this->db); |
|
| 268 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 269 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 270 | - $Marine->db = null; |
|
| 271 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 267 | + $Marine = new Marine($this->db); |
|
| 268 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 269 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 270 | + $Marine->db = null; |
|
| 271 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 272 | 272 | } |
| 273 | 273 | $this->tmd = 0; |
| 274 | 274 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
| 275 | - } |
|
| 275 | + } |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 279 | 279 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 280 | 280 | 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') { |
| 281 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 282 | - $dataFound = true; |
|
| 283 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 281 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 282 | + $dataFound = true; |
|
| 283 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 284 | 284 | } |
| 285 | 285 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 286 | 286 | } |
| 287 | 287 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 288 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 288 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 289 | 289 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 290 | 290 | 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') { |
| 291 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 292 | - $dataFound = true; |
|
| 293 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 291 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 292 | + $dataFound = true; |
|
| 293 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 294 | 294 | } |
| 295 | 295 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - } else if ($globalDebug && $timediff > 20) { |
|
| 298 | + } else if ($globalDebug && $timediff > 20) { |
|
| 299 | 299 | $this->tmd = $this->tmd + 1; |
| 300 | 300 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 301 | 301 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
| 302 | 302 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 303 | 303 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | } |
| 306 | 306 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 307 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 308 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 307 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 308 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 309 | 309 | } |
| 310 | 310 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 311 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 311 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 312 | 312 | } |
| 313 | 313 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 314 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 314 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 315 | 315 | } |
| 316 | 316 | if (isset($line['status']) && $line['status'] != '') { |
| 317 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 317 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 318 | 318 | } |
| 319 | 319 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
| 320 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 321 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 320 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 321 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 322 | 322 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 323 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 323 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 324 | 324 | $Marine = new Marine($this->db); |
| 325 | 325 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
| 326 | 326 | unset($Marine); |
| 327 | - } |
|
| 327 | + } |
|
| 328 | + } |
|
| 328 | 329 | } |
| 329 | - } |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 333 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 333 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | if (isset($line['heading']) && $line['heading'] != '') { |
| 337 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 338 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 339 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 340 | - //$dataFound = true; |
|
| 337 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 338 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 339 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 340 | + //$dataFound = true; |
|
| 341 | 341 | } 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']) { |
| 342 | - $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']); |
|
| 343 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 344 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 345 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 342 | + $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']); |
|
| 343 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 344 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 345 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 346 | 346 | } |
| 347 | 347 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 348 | 348 | |
| 349 | 349 | |
| 350 | 350 | |
| 351 | 351 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
| 352 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 353 | - if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
| 354 | - 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'])) { |
|
| 355 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 352 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 353 | + if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
| 354 | + 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'])) { |
|
| 355 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 356 | 356 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 357 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 358 | - $timeelapsed = microtime(true); |
|
| 359 | - $MarineLive = new MarineLive($this->db); |
|
| 360 | - if (isset($line['id'])) { |
|
| 357 | + if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 358 | + $timeelapsed = microtime(true); |
|
| 359 | + $MarineLive = new MarineLive($this->db); |
|
| 360 | + if (isset($line['id'])) { |
|
| 361 | 361 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 362 | 362 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 363 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 363 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 364 | 364 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 365 | 365 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 366 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 366 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 367 | 367 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 368 | 368 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 369 | - } else $recent_ident = ''; |
|
| 370 | - $MarineLive->db=null; |
|
| 371 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 372 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 369 | + } else $recent_ident = ''; |
|
| 370 | + $MarineLive->db=null; |
|
| 371 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 372 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 373 | 373 | } else $recent_ident = ''; |
| 374 | - } else { |
|
| 374 | + } else { |
|
| 375 | 375 | $recent_ident = ''; |
| 376 | 376 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
| 377 | - } |
|
| 378 | - //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 379 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 380 | - { |
|
| 377 | + } |
|
| 378 | + //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 379 | + if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 380 | + { |
|
| 381 | 381 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
| 382 | 382 | //adds the spotter data for the archive |
| 383 | - $highlight = ''; |
|
| 384 | - 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'))); |
|
| 385 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 383 | + $highlight = ''; |
|
| 384 | + 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'))); |
|
| 385 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 386 | 386 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 387 | - $timeelapsed = microtime(true); |
|
| 388 | - $Marine = new Marine($this->db); |
|
| 389 | - $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']); |
|
| 390 | - $Marine->db = null; |
|
| 391 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 392 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 387 | + $timeelapsed = microtime(true); |
|
| 388 | + $Marine = new Marine($this->db); |
|
| 389 | + $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']); |
|
| 390 | + $Marine->db = null; |
|
| 391 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 392 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 393 | 393 | } |
| 394 | - } |
|
| 395 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 394 | + } |
|
| 395 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 396 | 396 | // Add source stat in DB |
| 397 | 397 | $Stats = new Stats($this->db); |
| 398 | 398 | if (!empty($this->stats)) { |
| 399 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 400 | - foreach($this->stats as $date => $data) { |
|
| 399 | + if ($globalDebug) echo 'Add source stats : '; |
|
| 400 | + foreach($this->stats as $date => $data) { |
|
| 401 | 401 | foreach($data as $source => $sourced) { |
| 402 | - //print_r($sourced); |
|
| 403 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 404 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 405 | - if (isset($sourced['msg'])) { |
|
| 406 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 407 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 408 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 409 | - unset($this->stats[$date][$source]['msg']); |
|
| 410 | - } |
|
| 411 | - } |
|
| 412 | - } |
|
| 413 | - if ($date != date('Y-m-d')) { |
|
| 414 | - unset($this->stats[$date]); |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 402 | + //print_r($sourced); |
|
| 403 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 404 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 405 | + if (isset($sourced['msg'])) { |
|
| 406 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 407 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 408 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 409 | + unset($this->stats[$date][$source]['msg']); |
|
| 410 | + } |
|
| 411 | + } |
|
| 412 | + } |
|
| 413 | + if ($date != date('Y-m-d')) { |
|
| 414 | + unset($this->stats[$date]); |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 418 | 418 | } |
| 419 | 419 | $Stats->db = null; |
| 420 | - } |
|
| 420 | + } |
|
| 421 | 421 | |
| 422 | - $this->del(); |
|
| 422 | + $this->del(); |
|
| 423 | 423 | //$ignoreImport = false; |
| 424 | 424 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 425 | 425 | //print_r($this->all_tracked[$id]); |
| 426 | 426 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 427 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 428 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 429 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 427 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 428 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 429 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 430 | 430 | $MarineLive = new MarineLive($this->db); |
| 431 | 431 | $MarineLive->deleteLiveMarineData(); |
| 432 | 432 | $MarineLive->db=null; |
| 433 | 433 | if ($globalDebug) echo " Done\n"; |
| 434 | - } |
|
| 435 | - $this->last_delete = time(); |
|
| 434 | + } |
|
| 435 | + $this->last_delete = time(); |
|
| 436 | 436 | } |
| 437 | - } elseif ($recent_ident != '') { |
|
| 437 | + } elseif ($recent_ident != '') { |
|
| 438 | 438 | $this->all_tracked[$id]['id'] = $recent_ident; |
| 439 | 439 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 440 | 440 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 441 | - if (isset($globalDaemon) && !$globalDaemon) { |
|
| 441 | + if (isset($globalDaemon) && !$globalDaemon) { |
|
| 442 | 442 | $Marine = new Marine($this->db); |
| 443 | 443 | $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']); |
| 444 | 444 | $Marine->db = null; |
| 445 | - } |
|
| 445 | + } |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - } |
|
| 448 | + } |
|
| 449 | + } |
|
| 449 | 450 | } |
| 450 | - } |
|
| 451 | - //adds the spotter LIVE data |
|
| 452 | - if ($globalDebug) { |
|
| 451 | + //adds the spotter LIVE data |
|
| 452 | + if ($globalDebug) { |
|
| 453 | 453 | 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"; |
| 454 | - } |
|
| 455 | - $ignoreImport = false; |
|
| 454 | + } |
|
| 455 | + $ignoreImport = false; |
|
| 456 | 456 | |
| 457 | - if (!$ignoreImport) { |
|
| 457 | + if (!$ignoreImport) { |
|
| 458 | 458 | 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'])) { |
| 459 | 459 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 460 | 460 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 461 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 461 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 462 | 462 | $timeelapsed = microtime(true); |
| 463 | 463 | $MarineLive = new MarineLive($this->db); |
| 464 | 464 | $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']); |
| 465 | 465 | $MarineLive->db = null; |
| 466 | 466 | if ($globalDebug) echo $result."\n"; |
| 467 | 467 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 468 | - } |
|
| 468 | + } |
|
| 469 | 469 | } |
| 470 | 470 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
| 471 | - $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']); |
|
| 471 | + $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']); |
|
| 472 | 472 | } |
| 473 | 473 | $this->all_tracked[$id]['putinarchive'] = false; |
| 474 | 474 | |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | if ($stats_heading == 16) $stats_heading = 0; |
| 501 | 501 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 502 | 502 | for ($i=0;$i<=15;$i++) { |
| 503 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 503 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 504 | 504 | } |
| 505 | 505 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 506 | 506 | } else { |
@@ -513,11 +513,11 @@ discard block |
||
| 513 | 513 | //var_dump($this->stats); |
| 514 | 514 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 515 | 515 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 516 | - end($this->stats[$current_date][$source]['hist']); |
|
| 517 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 516 | + end($this->stats[$current_date][$source]['hist']); |
|
| 517 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 518 | 518 | } else $mini = 0; |
| 519 | 519 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 520 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 520 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 521 | 521 | } |
| 522 | 522 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 523 | 523 | } else { |
@@ -533,24 +533,24 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | |
| 535 | 535 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 536 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 536 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 537 | 537 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
| 538 | 538 | $MarineLive = new MarineLive($this->db); |
| 539 | 539 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
| 540 | 540 | $MarineLive->db = null; |
| 541 | 541 | //MarineLive->deleteLiveMarineData(); |
| 542 | 542 | if ($globalDebug) echo " Done\n"; |
| 543 | - } |
|
| 544 | - $this->last_delete_hourly = time(); |
|
| 543 | + } |
|
| 544 | + $this->last_delete_hourly = time(); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - } |
|
| 548 | - //$ignoreImport = false; |
|
| 547 | + } |
|
| 548 | + //$ignoreImport = false; |
|
| 549 | 549 | } |
| 550 | 550 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 551 | 551 | if ($send) return $this->all_tracked[$id]; |
| 552 | - } |
|
| 552 | + } |
|
| 553 | + } |
|
| 553 | 554 | } |
| 554 | - } |
|
| 555 | 555 | } |
| 556 | 556 | ?> |
@@ -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,13 +554,13 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | /** |
| 557 | - * Update arrival marine data |
|
| 558 | - * |
|
| 559 | - * @param String $fammarine_id the ID |
|
| 560 | - * @param String $ident the marine ident |
|
| 561 | - * @return String success or false |
|
| 562 | - * |
|
| 563 | - */ |
|
| 557 | + * Update arrival marine data |
|
| 558 | + * |
|
| 559 | + * @param String $fammarine_id the ID |
|
| 560 | + * @param String $ident the marine ident |
|
| 561 | + * @return String success or false |
|
| 562 | + * |
|
| 563 | + */ |
|
| 564 | 564 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
| 565 | 565 | { |
| 566 | 566 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -575,19 +575,19 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | /** |
| 578 | - * Update Status data |
|
| 579 | - * |
|
| 580 | - * @param String $fammarine_id the ID |
|
| 581 | - * @param String $status_id the marine status id |
|
| 582 | - * @param String $status the marine status |
|
| 583 | - * @return String success or false |
|
| 584 | - * |
|
| 585 | - */ |
|
| 578 | + * Update Status data |
|
| 579 | + * |
|
| 580 | + * @param String $fammarine_id the ID |
|
| 581 | + * @param String $status_id the marine status id |
|
| 582 | + * @param String $status the marine status |
|
| 583 | + * @return String success or false |
|
| 584 | + * |
|
| 585 | + */ |
|
| 586 | 586 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
| 587 | 587 | { |
| 588 | 588 | |
| 589 | 589 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
| 590 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 590 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 591 | 591 | |
| 592 | 592 | try { |
| 593 | 593 | $sth = $this->db->prepare($query); |
@@ -600,17 +600,17 @@ discard block |
||
| 600 | 600 | |
| 601 | 601 | } |
| 602 | 602 | /** |
| 603 | - * Update latest marine data |
|
| 604 | - * |
|
| 605 | - * @param String $fammarine_id the ID |
|
| 606 | - * @param String $ident the marine ident |
|
| 607 | - * @return String success or false |
|
| 608 | - * |
|
| 609 | - */ |
|
| 603 | + * Update latest marine data |
|
| 604 | + * |
|
| 605 | + * @param String $fammarine_id the ID |
|
| 606 | + * @param String $ident the marine ident |
|
| 607 | + * @return String success or false |
|
| 608 | + * |
|
| 609 | + */ |
|
| 610 | 610 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
| 611 | 611 | { |
| 612 | 612 | $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'; |
| 613 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 613 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 614 | 614 | |
| 615 | 615 | try { |
| 616 | 616 | $sth = $this->db->prepare($query); |
@@ -624,30 +624,30 @@ discard block |
||
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | /** |
| 627 | - * Adds a new spotter data |
|
| 628 | - * |
|
| 629 | - * @param String $fammarine_id the ID |
|
| 630 | - * @param String $ident the marine ident |
|
| 631 | - * @param String $departure_airport_icao the departure airport |
|
| 632 | - * @param String $arrival_airport_icao the arrival airport |
|
| 633 | - * @param String $latitude latitude of flight |
|
| 634 | - * @param String $longitude latitude of flight |
|
| 635 | - * @param String $waypoints waypoints of flight |
|
| 636 | - * @param String $heading heading of flight |
|
| 637 | - * @param String $groundspeed speed of flight |
|
| 638 | - * @param String $date date of flight |
|
| 639 | - * @param String $departure_airport_time departure time of flight |
|
| 640 | - * @param String $arrival_airport_time arrival time of flight |
|
| 641 | - * @param String $squawk squawk code of flight |
|
| 642 | - * @param String $route_stop route stop of flight |
|
| 643 | - * @param String $highlight highlight or not |
|
| 644 | - * @param String $ModeS ModesS code of flight |
|
| 645 | - * @param String $registration registration code of flight |
|
| 646 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 647 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 648 | - * @param String $verticalrate vertival rate of flight |
|
| 649 | - * @return String success or false |
|
| 650 | - */ |
|
| 627 | + * Adds a new spotter data |
|
| 628 | + * |
|
| 629 | + * @param String $fammarine_id the ID |
|
| 630 | + * @param String $ident the marine ident |
|
| 631 | + * @param String $departure_airport_icao the departure airport |
|
| 632 | + * @param String $arrival_airport_icao the arrival airport |
|
| 633 | + * @param String $latitude latitude of flight |
|
| 634 | + * @param String $longitude latitude of flight |
|
| 635 | + * @param String $waypoints waypoints of flight |
|
| 636 | + * @param String $heading heading of flight |
|
| 637 | + * @param String $groundspeed speed of flight |
|
| 638 | + * @param String $date date of flight |
|
| 639 | + * @param String $departure_airport_time departure time of flight |
|
| 640 | + * @param String $arrival_airport_time arrival time of flight |
|
| 641 | + * @param String $squawk squawk code of flight |
|
| 642 | + * @param String $route_stop route stop of flight |
|
| 643 | + * @param String $highlight highlight or not |
|
| 644 | + * @param String $ModeS ModesS code of flight |
|
| 645 | + * @param String $registration registration code of flight |
|
| 646 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 647 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 648 | + * @param String $verticalrate vertival rate of flight |
|
| 649 | + * @return String success or false |
|
| 650 | + */ |
|
| 651 | 651 | 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 = '') |
| 652 | 652 | { |
| 653 | 653 | global $globalURL, $globalMarineImageFetch; |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | $sth->execute($query_values); |
| 759 | 759 | $this->db = null; |
| 760 | 760 | } catch (PDOException $e) { |
| 761 | - return "error : ".$e->getMessage(); |
|
| 761 | + return "error : ".$e->getMessage(); |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | return "success"; |
@@ -767,11 +767,11 @@ discard block |
||
| 767 | 767 | |
| 768 | 768 | |
| 769 | 769 | /** |
| 770 | - * Gets the aircraft ident within the last hour |
|
| 771 | - * |
|
| 772 | - * @return String the ident |
|
| 773 | - * |
|
| 774 | - */ |
|
| 770 | + * Gets the aircraft ident within the last hour |
|
| 771 | + * |
|
| 772 | + * @return String the ident |
|
| 773 | + * |
|
| 774 | + */ |
|
| 775 | 775 | public function getIdentFromLastHour($ident) |
| 776 | 776 | { |
| 777 | 777 | global $globalDBdriver, $globalTimezone; |
@@ -787,11 +787,11 @@ discard block |
||
| 787 | 787 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 788 | 788 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
| 789 | 789 | $query_data = array(':ident' => $ident); |
| 790 | - } |
|
| 790 | + } |
|
| 791 | 791 | |
| 792 | 792 | $sth = $this->db->prepare($query); |
| 793 | 793 | $sth->execute($query_data); |
| 794 | - $ident_result=''; |
|
| 794 | + $ident_result=''; |
|
| 795 | 795 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 796 | 796 | { |
| 797 | 797 | $ident_result = $row['ident']; |
@@ -802,11 +802,11 @@ discard block |
||
| 802 | 802 | |
| 803 | 803 | |
| 804 | 804 | /** |
| 805 | - * Gets the aircraft data from the last 20 seconds |
|
| 806 | - * |
|
| 807 | - * @return Array the spotter data |
|
| 808 | - * |
|
| 809 | - */ |
|
| 805 | + * Gets the aircraft data from the last 20 seconds |
|
| 806 | + * |
|
| 807 | + * @return Array the spotter data |
|
| 808 | + * |
|
| 809 | + */ |
|
| 810 | 810 | public function getRealTimeData($q = '') |
| 811 | 811 | { |
| 812 | 812 | global $globalDBdriver; |
@@ -844,11 +844,11 @@ discard block |
||
| 844 | 844 | |
| 845 | 845 | |
| 846 | 846 | /** |
| 847 | - * Gets all number of flight over countries |
|
| 848 | - * |
|
| 849 | - * @return Array the airline country list |
|
| 850 | - * |
|
| 851 | - */ |
|
| 847 | + * Gets all number of flight over countries |
|
| 848 | + * |
|
| 849 | + * @return Array the airline country list |
|
| 850 | + * |
|
| 851 | + */ |
|
| 852 | 852 | |
| 853 | 853 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 854 | 854 | { |
@@ -921,11 +921,11 @@ discard block |
||
| 921 | 921 | |
| 922 | 922 | |
| 923 | 923 | /** |
| 924 | - * Gets all callsigns that have flown over |
|
| 925 | - * |
|
| 926 | - * @return Array the callsign list |
|
| 927 | - * |
|
| 928 | - */ |
|
| 924 | + * Gets all callsigns that have flown over |
|
| 925 | + * |
|
| 926 | + * @return Array the callsign list |
|
| 927 | + * |
|
| 928 | + */ |
|
| 929 | 929 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 930 | 930 | { |
| 931 | 931 | global $globalDBdriver; |
@@ -992,11 +992,11 @@ discard block |
||
| 992 | 992 | |
| 993 | 993 | |
| 994 | 994 | /** |
| 995 | - * Counts all dates |
|
| 996 | - * |
|
| 997 | - * @return Array the date list |
|
| 998 | - * |
|
| 999 | - */ |
|
| 995 | + * Counts all dates |
|
| 996 | + * |
|
| 997 | + * @return Array the date list |
|
| 998 | + * |
|
| 999 | + */ |
|
| 1000 | 1000 | public function countAllDates($filters = array()) |
| 1001 | 1001 | { |
| 1002 | 1002 | global $globalTimezone, $globalDBdriver; |
@@ -1042,11 +1042,11 @@ discard block |
||
| 1042 | 1042 | |
| 1043 | 1043 | |
| 1044 | 1044 | /** |
| 1045 | - * Counts all dates during the last 7 days |
|
| 1046 | - * |
|
| 1047 | - * @return Array the date list |
|
| 1048 | - * |
|
| 1049 | - */ |
|
| 1045 | + * Counts all dates during the last 7 days |
|
| 1046 | + * |
|
| 1047 | + * @return Array the date list |
|
| 1048 | + * |
|
| 1049 | + */ |
|
| 1050 | 1050 | public function countAllDatesLast7Days($filters = array()) |
| 1051 | 1051 | { |
| 1052 | 1052 | global $globalTimezone, $globalDBdriver; |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | $query .= " GROUP BY date_name |
| 1069 | 1069 | ORDER BY date_name ASC"; |
| 1070 | 1070 | $query_data = array(':offset' => $offset); |
| 1071 | - } |
|
| 1071 | + } |
|
| 1072 | 1072 | |
| 1073 | 1073 | $sth = $this->db->prepare($query); |
| 1074 | 1074 | $sth->execute($query_data); |
@@ -1088,11 +1088,11 @@ discard block |
||
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | /** |
| 1091 | - * Counts all dates during the last month |
|
| 1092 | - * |
|
| 1093 | - * @return Array the date list |
|
| 1094 | - * |
|
| 1095 | - */ |
|
| 1091 | + * Counts all dates during the last month |
|
| 1092 | + * |
|
| 1093 | + * @return Array the date list |
|
| 1094 | + * |
|
| 1095 | + */ |
|
| 1096 | 1096 | public function countAllDatesLastMonth($filters = array()) |
| 1097 | 1097 | { |
| 1098 | 1098 | global $globalTimezone, $globalDBdriver; |
@@ -1114,7 +1114,7 @@ discard block |
||
| 1114 | 1114 | $query .= " GROUP BY date_name |
| 1115 | 1115 | ORDER BY date_name ASC"; |
| 1116 | 1116 | $query_data = array(':offset' => $offset); |
| 1117 | - } |
|
| 1117 | + } |
|
| 1118 | 1118 | |
| 1119 | 1119 | $sth = $this->db->prepare($query); |
| 1120 | 1120 | $sth->execute($query_data); |
@@ -1136,11 +1136,11 @@ discard block |
||
| 1136 | 1136 | |
| 1137 | 1137 | |
| 1138 | 1138 | /** |
| 1139 | - * Counts all month |
|
| 1140 | - * |
|
| 1141 | - * @return Array the month list |
|
| 1142 | - * |
|
| 1143 | - */ |
|
| 1139 | + * Counts all month |
|
| 1140 | + * |
|
| 1141 | + * @return Array the month list |
|
| 1142 | + * |
|
| 1143 | + */ |
|
| 1144 | 1144 | public function countAllMonths($filters = array()) |
| 1145 | 1145 | { |
| 1146 | 1146 | global $globalTimezone, $globalDBdriver; |
@@ -1185,11 +1185,11 @@ discard block |
||
| 1185 | 1185 | |
| 1186 | 1186 | |
| 1187 | 1187 | /** |
| 1188 | - * Counts all dates during the last year |
|
| 1189 | - * |
|
| 1190 | - * @return Array the date list |
|
| 1191 | - * |
|
| 1192 | - */ |
|
| 1188 | + * Counts all dates during the last year |
|
| 1189 | + * |
|
| 1190 | + * @return Array the date list |
|
| 1191 | + * |
|
| 1192 | + */ |
|
| 1193 | 1193 | public function countAllMonthsLastYear($filters) |
| 1194 | 1194 | { |
| 1195 | 1195 | global $globalTimezone, $globalDBdriver; |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | $query .= " GROUP BY year_name, month_name |
| 1212 | 1212 | ORDER BY year_name, month_name ASC"; |
| 1213 | 1213 | $query_data = array(':offset' => $offset); |
| 1214 | - } |
|
| 1214 | + } |
|
| 1215 | 1215 | |
| 1216 | 1216 | $sth = $this->db->prepare($query); |
| 1217 | 1217 | $sth->execute($query_data); |
@@ -1234,11 +1234,11 @@ discard block |
||
| 1234 | 1234 | |
| 1235 | 1235 | |
| 1236 | 1236 | /** |
| 1237 | - * Counts all hours |
|
| 1238 | - * |
|
| 1239 | - * @return Array the hour list |
|
| 1240 | - * |
|
| 1241 | - */ |
|
| 1237 | + * Counts all hours |
|
| 1238 | + * |
|
| 1239 | + * @return Array the hour list |
|
| 1240 | + * |
|
| 1241 | + */ |
|
| 1242 | 1242 | public function countAllHours($orderby,$filters = array()) |
| 1243 | 1243 | { |
| 1244 | 1244 | global $globalTimezone, $globalDBdriver; |
@@ -1301,11 +1301,11 @@ discard block |
||
| 1301 | 1301 | |
| 1302 | 1302 | |
| 1303 | 1303 | /** |
| 1304 | - * Counts all hours by date |
|
| 1305 | - * |
|
| 1306 | - * @return Array the hour list |
|
| 1307 | - * |
|
| 1308 | - */ |
|
| 1304 | + * Counts all hours by date |
|
| 1305 | + * |
|
| 1306 | + * @return Array the hour list |
|
| 1307 | + * |
|
| 1308 | + */ |
|
| 1309 | 1309 | public function countAllHoursByDate($date, $filters = array()) |
| 1310 | 1310 | { |
| 1311 | 1311 | global $globalTimezone, $globalDBdriver; |
@@ -1349,11 +1349,11 @@ discard block |
||
| 1349 | 1349 | |
| 1350 | 1350 | |
| 1351 | 1351 | /** |
| 1352 | - * Counts all hours by a ident/callsign |
|
| 1353 | - * |
|
| 1354 | - * @return Array the hour list |
|
| 1355 | - * |
|
| 1356 | - */ |
|
| 1352 | + * Counts all hours by a ident/callsign |
|
| 1353 | + * |
|
| 1354 | + * @return Array the hour list |
|
| 1355 | + * |
|
| 1356 | + */ |
|
| 1357 | 1357 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1358 | 1358 | { |
| 1359 | 1359 | global $globalTimezone, $globalDBdriver; |
@@ -1398,11 +1398,11 @@ discard block |
||
| 1398 | 1398 | |
| 1399 | 1399 | |
| 1400 | 1400 | /** |
| 1401 | - * Counts all vessels |
|
| 1402 | - * |
|
| 1403 | - * @return Integer the number of vessels |
|
| 1404 | - * |
|
| 1405 | - */ |
|
| 1401 | + * Counts all vessels |
|
| 1402 | + * |
|
| 1403 | + * @return Integer the number of vessels |
|
| 1404 | + * |
|
| 1405 | + */ |
|
| 1406 | 1406 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
| 1407 | 1407 | { |
| 1408 | 1408 | global $globalDBdriver; |
@@ -1437,11 +1437,11 @@ discard block |
||
| 1437 | 1437 | } |
| 1438 | 1438 | |
| 1439 | 1439 | /** |
| 1440 | - * Counts all vessel type |
|
| 1441 | - * |
|
| 1442 | - * @return Integer the number of vessels |
|
| 1443 | - * |
|
| 1444 | - */ |
|
| 1440 | + * Counts all vessel type |
|
| 1441 | + * |
|
| 1442 | + * @return Integer the number of vessels |
|
| 1443 | + * |
|
| 1444 | + */ |
|
| 1445 | 1445 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
| 1446 | 1446 | { |
| 1447 | 1447 | global $globalDBdriver; |
@@ -1476,11 +1476,11 @@ discard block |
||
| 1476 | 1476 | |
| 1477 | 1477 | |
| 1478 | 1478 | /** |
| 1479 | - * Counts all hours of today |
|
| 1480 | - * |
|
| 1481 | - * @return Array the hour list |
|
| 1482 | - * |
|
| 1483 | - */ |
|
| 1479 | + * Counts all hours of today |
|
| 1480 | + * |
|
| 1481 | + * @return Array the hour list |
|
| 1482 | + * |
|
| 1483 | + */ |
|
| 1484 | 1484 | public function countAllHoursFromToday($filters = array()) |
| 1485 | 1485 | { |
| 1486 | 1486 | global $globalTimezone, $globalDBdriver; |
@@ -1520,12 +1520,12 @@ discard block |
||
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | |
| 1523 | - /** |
|
| 1524 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1525 | - * |
|
| 1526 | - * @return Integer the Barrie Spotter ID |
|
| 1523 | + /** |
|
| 1524 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1525 | + * |
|
| 1526 | + * @return Integer the Barrie Spotter ID |
|
| 1527 | 1527 | q * |
| 1528 | - */ |
|
| 1528 | + */ |
|
| 1529 | 1529 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
| 1530 | 1530 | { |
| 1531 | 1531 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1546,13 +1546,13 @@ discard block |
||
| 1546 | 1546 | |
| 1547 | 1547 | |
| 1548 | 1548 | /** |
| 1549 | - * Parses a date string |
|
| 1550 | - * |
|
| 1551 | - * @param String $dateString the date string |
|
| 1552 | - * @param String $timezone the timezone of a user |
|
| 1553 | - * @return Array the time information |
|
| 1554 | - * |
|
| 1555 | - */ |
|
| 1549 | + * Parses a date string |
|
| 1550 | + * |
|
| 1551 | + * @param String $dateString the date string |
|
| 1552 | + * @param String $timezone the timezone of a user |
|
| 1553 | + * @return Array the time information |
|
| 1554 | + * |
|
| 1555 | + */ |
|
| 1556 | 1556 | public function parseDateString($dateString, $timezone = '') |
| 1557 | 1557 | { |
| 1558 | 1558 | $time_array = array(); |
@@ -1585,12 +1585,12 @@ discard block |
||
| 1585 | 1585 | } |
| 1586 | 1586 | |
| 1587 | 1587 | /** |
| 1588 | - * Parses the direction degrees to working |
|
| 1589 | - * |
|
| 1590 | - * @param Float $direction the direction in degrees |
|
| 1591 | - * @return Array the direction information |
|
| 1592 | - * |
|
| 1593 | - */ |
|
| 1588 | + * Parses the direction degrees to working |
|
| 1589 | + * |
|
| 1590 | + * @param Float $direction the direction in degrees |
|
| 1591 | + * @return Array the direction information |
|
| 1592 | + * |
|
| 1593 | + */ |
|
| 1594 | 1594 | public function parseDirection($direction = 0) |
| 1595 | 1595 | { |
| 1596 | 1596 | if ($direction == '') $direction = 0; |
@@ -1669,12 +1669,12 @@ discard block |
||
| 1669 | 1669 | |
| 1670 | 1670 | |
| 1671 | 1671 | /** |
| 1672 | - * Gets Country from latitude/longitude |
|
| 1673 | - * |
|
| 1674 | - * @param Float $latitude latitute of the flight |
|
| 1675 | - * @param Float $longitude longitute of the flight |
|
| 1676 | - * @return String the countrie |
|
| 1677 | - */ |
|
| 1672 | + * Gets Country from latitude/longitude |
|
| 1673 | + * |
|
| 1674 | + * @param Float $latitude latitute of the flight |
|
| 1675 | + * @param Float $longitude longitute of the flight |
|
| 1676 | + * @return String the countrie |
|
| 1677 | + */ |
|
| 1678 | 1678 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 1679 | 1679 | { |
| 1680 | 1680 | global $globalDBdriver, $globalDebug; |
@@ -1711,11 +1711,11 @@ discard block |
||
| 1711 | 1711 | } |
| 1712 | 1712 | |
| 1713 | 1713 | /** |
| 1714 | - * Gets Country from iso2 |
|
| 1715 | - * |
|
| 1716 | - * @param String $iso2 ISO2 country code |
|
| 1717 | - * @return String the countrie |
|
| 1718 | - */ |
|
| 1714 | + * Gets Country from iso2 |
|
| 1715 | + * |
|
| 1716 | + * @param String $iso2 ISO2 country code |
|
| 1717 | + * @return String the countrie |
|
| 1718 | + */ |
|
| 1719 | 1719 | public function getCountryFromISO2($iso2) |
| 1720 | 1720 | { |
| 1721 | 1721 | global $globalDBdriver, $globalDebug; |
@@ -1744,12 +1744,12 @@ discard block |
||
| 1744 | 1744 | |
| 1745 | 1745 | |
| 1746 | 1746 | /** |
| 1747 | - * Gets the short url from bit.ly |
|
| 1748 | - * |
|
| 1749 | - * @param String $url the full url |
|
| 1750 | - * @return String the bit.ly url |
|
| 1751 | - * |
|
| 1752 | - */ |
|
| 1747 | + * Gets the short url from bit.ly |
|
| 1748 | + * |
|
| 1749 | + * @param String $url the full url |
|
| 1750 | + * @return String the bit.ly url |
|
| 1751 | + * |
|
| 1752 | + */ |
|
| 1753 | 1753 | public function getBitlyURL($url) |
| 1754 | 1754 | { |
| 1755 | 1755 | global $globalBitlyAccessToken; |
@@ -1776,11 +1776,11 @@ discard block |
||
| 1776 | 1776 | |
| 1777 | 1777 | |
| 1778 | 1778 | /** |
| 1779 | - * Gets all vessels types that have flown over |
|
| 1780 | - * |
|
| 1781 | - * @return Array the vessel type list |
|
| 1782 | - * |
|
| 1783 | - */ |
|
| 1779 | + * Gets all vessels types that have flown over |
|
| 1780 | + * |
|
| 1781 | + * @return Array the vessel type list |
|
| 1782 | + * |
|
| 1783 | + */ |
|
| 1784 | 1784 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 1785 | 1785 | { |
| 1786 | 1786 | global $globalDBdriver; |
@@ -1845,11 +1845,11 @@ discard block |
||
| 1845 | 1845 | } |
| 1846 | 1846 | |
| 1847 | 1847 | /** |
| 1848 | - * Gets all the tracker information |
|
| 1849 | - * |
|
| 1850 | - * @return Array the tracker information |
|
| 1851 | - * |
|
| 1852 | - */ |
|
| 1848 | + * Gets all the tracker information |
|
| 1849 | + * |
|
| 1850 | + * @return Array the tracker information |
|
| 1851 | + * |
|
| 1852 | + */ |
|
| 1853 | 1853 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
| 1854 | 1854 | { |
| 1855 | 1855 | global $globalTimezone, $globalDBdriver; |