@@ -16,25 +16,25 @@ discard block |
||
| 16 | 16 | require_once(dirname(__FILE__).'/class.Stats.php'); |
| 17 | 17 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 18 | 18 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 19 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 19 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | class MarineImport { |
| 23 | - private $all_tracked = array(); |
|
| 24 | - private $last_delete_hourly = 0; |
|
| 25 | - private $last_delete = 0; |
|
| 26 | - private $stats = array(); |
|
| 27 | - private $tmd = 0; |
|
| 28 | - private $source_location = array(); |
|
| 29 | - public $db = null; |
|
| 30 | - public $nb = 0; |
|
| 23 | + private $all_tracked = array(); |
|
| 24 | + private $last_delete_hourly = 0; |
|
| 25 | + private $last_delete = 0; |
|
| 26 | + private $stats = array(); |
|
| 27 | + private $tmd = 0; |
|
| 28 | + private $source_location = array(); |
|
| 29 | + public $db = null; |
|
| 30 | + public $nb = 0; |
|
| 31 | 31 | |
| 32 | - public function __construct($dbc = null) { |
|
| 32 | + public function __construct($dbc = null) { |
|
| 33 | 33 | global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB; |
| 34 | 34 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 35 | - $Connection = new Connection($dbc); |
|
| 36 | - $this->db = $Connection->db(); |
|
| 37 | - date_default_timezone_set('UTC'); |
|
| 35 | + $Connection = new Connection($dbc); |
|
| 36 | + $this->db = $Connection->db(); |
|
| 37 | + date_default_timezone_set('UTC'); |
|
| 38 | 38 | } |
| 39 | 39 | // Get previous source stats |
| 40 | 40 | /* |
@@ -53,79 +53,79 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | */ |
| 55 | 55 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 56 | - $APRSMarine = new APRSMarine(); |
|
| 57 | - //$APRSSpotter->connect(); |
|
| 56 | + $APRSMarine = new APRSMarine(); |
|
| 57 | + //$APRSSpotter->connect(); |
|
| 58 | + } |
|
| 58 | 59 | } |
| 59 | - } |
|
| 60 | 60 | |
| 61 | - public function checkAll() { |
|
| 61 | + public function checkAll() { |
|
| 62 | 62 | global $globalDebug, $globalNoDB, $globalVM; |
| 63 | 63 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 64 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 65 | - foreach ($this->all_tracked as $key => $flight) { |
|
| 64 | + if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 65 | + foreach ($this->all_tracked as $key => $flight) { |
|
| 66 | 66 | if (isset($this->all_tracked[$key]['id'])) { |
| 67 | - //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
| 68 | - $Marine = new Marine($this->db); |
|
| 69 | - if (isset($globalVM) && $globalVM) { |
|
| 67 | + //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
| 68 | + $Marine = new Marine($this->db); |
|
| 69 | + if (isset($globalVM) && $globalVM) { |
|
| 70 | 70 | if ($this->all_tracked[$key]['status'] == 'Racing') { |
| 71 | - $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'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 72 | - } else { |
|
| 73 | - $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
|
| 74 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 75 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 76 | - $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'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 77 | - } |
|
| 78 | - } else { |
|
| 71 | + $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'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 72 | + } else { |
|
| 73 | + $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
|
| 74 | + if ($timerace > time()) $finaldatetime = NULL; |
|
| 75 | + else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 76 | + $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'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 77 | + } |
|
| 78 | + } else { |
|
| 79 | 79 | $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'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 80 | - } |
|
| 80 | + } |
|
| 81 | + } |
|
| 81 | 82 | } |
| 82 | - } |
|
| 83 | 83 | } |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - public function del() { |
|
| 86 | + public function del() { |
|
| 87 | 87 | global $globalDebug, $globalNoDB, $globalNoImport; |
| 88 | 88 | // Delete old infos |
| 89 | 89 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 90 | 90 | foreach ($this->all_tracked as $key => $flight) { |
| 91 | - if (isset($flight['lastupdate'])) { |
|
| 92 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 93 | - if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 94 | - if (isset($this->all_tracked[$key]['id'])) { |
|
| 95 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 96 | - /* |
|
| 91 | + if (isset($flight['lastupdate'])) { |
|
| 92 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 93 | + if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 94 | + if (isset($this->all_tracked[$key]['id'])) { |
|
| 95 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 96 | + /* |
|
| 97 | 97 | $MarineLive = new MarineLive(); |
| 98 | 98 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
| 99 | 99 | $MarineLive->db = null; |
| 100 | 100 | */ |
| 101 | - //$real_arrival = $this->arrival($key); |
|
| 102 | - $Marine = new Marine($this->db); |
|
| 103 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 101 | + //$real_arrival = $this->arrival($key); |
|
| 102 | + $Marine = new Marine($this->db); |
|
| 103 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 104 | 104 | if (isset($globalVM) && $globalVM) { |
| 105 | - if ($this->all_tracked[$key]['status'] == 'Racing') { |
|
| 105 | + if ($this->all_tracked[$key]['status'] == 'Racing') { |
|
| 106 | 106 | $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'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 107 | - } else { |
|
| 107 | + } else { |
|
| 108 | 108 | $timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']; |
| 109 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 109 | + if ($timerace > time()) $finaldatetime = NULL; |
|
| 110 | 110 | else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
| 111 | 111 | $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'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 112 | - } |
|
| 112 | + } |
|
| 113 | 113 | } else { |
| 114 | 114 | $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'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 115 | 115 | } |
| 116 | 116 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 117 | - } |
|
| 118 | - // Put in archive |
|
| 117 | + } |
|
| 118 | + // Put in archive |
|
| 119 | 119 | // $Marine->db = null; |
| 120 | 120 | } |
| 121 | - } |
|
| 122 | - unset($this->all_tracked[$key]); |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - } |
|
| 121 | + } |
|
| 122 | + unset($this->all_tracked[$key]); |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - public function add($line) { |
|
| 128 | + public function add($line) { |
|
| 129 | 129 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM; |
| 130 | 130 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
| 131 | 131 | date_default_timezone_set('UTC'); |
@@ -134,106 +134,106 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | // SBS format is CSV format |
| 136 | 136 | if(is_array($line) && (isset($line['mmsi']) || isset($line['id']))) { |
| 137 | - //print_r($line); |
|
| 138 | - if (isset($line['mmsi']) || isset($line['id'])) { |
|
| 137 | + //print_r($line); |
|
| 138 | + if (isset($line['mmsi']) || isset($line['id'])) { |
|
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | // Increment message number |
| 142 | 142 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 143 | - $current_date = date('Y-m-d'); |
|
| 144 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 145 | - else $source = ''; |
|
| 146 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 147 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 148 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 149 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 150 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 143 | + $current_date = date('Y-m-d'); |
|
| 144 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 145 | + else $source = ''; |
|
| 146 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 147 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 148 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 149 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 150 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | $Common = new Common(); |
| 155 | 155 | $AIS = new AIS(); |
| 156 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 157 | - else $id = trim($line['id']); |
|
| 156 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 157 | + else $id = trim($line['id']); |
|
| 158 | 158 | |
| 159 | 159 | if (!isset($this->all_tracked[$id])) { |
| 160 | - $this->all_tracked[$id] = array(); |
|
| 161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 162 | - $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' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
|
| 163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 164 | - if (!isset($line['id'])) { |
|
| 160 | + $this->all_tracked[$id] = array(); |
|
| 161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 162 | + $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' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
|
| 163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 164 | + if (!isset($line['id'])) { |
|
| 165 | 165 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 166 | 166 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 167 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 168 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 167 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 168 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
| 172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 173 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 173 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 174 | 174 | $Marine = new Marine($this->db); |
| 175 | 175 | $identity = $Marine->getIdentity($line['mmsi']); |
| 176 | 176 | if (!empty($identity)) { |
| 177 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 178 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 179 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
| 177 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 178 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 179 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
| 180 | 180 | } |
| 181 | 181 | //print_r($identity); |
| 182 | 182 | unset($Marine); |
| 183 | 183 | //$dataFound = true; |
| 184 | - } |
|
| 184 | + } |
|
| 185 | 185 | } |
| 186 | 186 | if (isset($line['type_id'])) { |
| 187 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 188 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
| 187 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 188 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
| 189 | 189 | } |
| 190 | 190 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
| 191 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 192 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
| 191 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 192 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
| 193 | 193 | } elseif (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] != '') { |
| 194 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 194 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 195 | 195 | } |
| 196 | 196 | if (isset($line['status']) && $line['status'] != '') { |
| 197 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 197 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 198 | 198 | } |
| 199 | 199 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
| 200 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 201 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 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 | $Marine = new Marine($this->db); |
| 205 | 205 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
| 206 | 206 | unset($Marine); |
| 207 | - } |
|
| 207 | + } |
|
| 208 | + } |
|
| 208 | 209 | } |
| 209 | - } |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
| 214 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 214 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 215 | 215 | } |
| 216 | 216 | if (isset($line['imo']) && $line['imo'] != '') { |
| 217 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 217 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 218 | 218 | } |
| 219 | 219 | if (isset($line['callsign']) && $line['callsign'] != '') { |
| 220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 221 | 221 | } |
| 222 | 222 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
| 223 | - if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
| 223 | + if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
| 224 | 224 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
| 225 | 225 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
| 226 | 226 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
| 227 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 227 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 228 | 228 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 229 | - $Marine = new Marine($this->db); |
|
| 230 | - $fromsource = NULL; |
|
| 231 | - $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
| 232 | - $Marine->db = null; |
|
| 229 | + $Marine = new Marine($this->db); |
|
| 230 | + $fromsource = NULL; |
|
| 231 | + $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
| 232 | + $Marine->db = null; |
|
| 233 | + } |
|
| 233 | 234 | } |
| 234 | - } |
|
| 235 | 235 | } |
| 236 | - } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
| 236 | + } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
| 237 | 237 | $this->all_tracked[$id]['arrival_code'] = $line['arrival_code']; |
| 238 | 238 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
| 239 | 239 | if (!isset($line['id'])) { |
@@ -241,50 +241,50 @@ discard block |
||
| 241 | 241 | $this->all_tracked[$id]['forcenew'] = 1; |
| 242 | 242 | $this->all_tracked[$id]['addedMarine'] = 0; |
| 243 | 243 | } |
| 244 | - } |
|
| 244 | + } |
|
| 245 | 245 | } |
| 246 | 246 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 247 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 247 | + if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 248 | 248 | } |
| 249 | 249 | if (isset($line['captain_id']) && $line['captain_id'] != '') { |
| 250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
|
| 250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
|
| 251 | 251 | } |
| 252 | 252 | if (isset($line['captain_name']) && $line['captain_name'] != '') { |
| 253 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name'])); |
|
| 253 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name'])); |
|
| 254 | 254 | } |
| 255 | 255 | if (isset($line['race_id']) && $line['race_id'] != '') { |
| 256 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id'])); |
|
| 256 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id'])); |
|
| 257 | 257 | } |
| 258 | 258 | if (isset($line['race_name']) && $line['race_name'] != '') { |
| 259 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name'])); |
|
| 259 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name'])); |
|
| 260 | 260 | } |
| 261 | 261 | if (isset($line['race_rank']) && $line['race_rank'] != '') { |
| 262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank'])); |
|
| 262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank'])); |
|
| 263 | 263 | } |
| 264 | 264 | if (isset($line['race_time']) && $line['race_time'] != '') { |
| 265 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time'])); |
|
| 265 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time'])); |
|
| 266 | 266 | } |
| 267 | 267 | if (isset($line['race_begin']) && $line['race_begin'] != '') { |
| 268 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin'])); |
|
| 268 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin'])); |
|
| 269 | 269 | } |
| 270 | 270 | if (isset($line['distance']) && $line['distance'] != '') { |
| 271 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance'])); |
|
| 271 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance'])); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | //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'])) { |
| 275 | 275 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 276 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 276 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 277 | 277 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 278 | - $timeelapsed = microtime(true); |
|
| 279 | - $Marine = new Marine($this->db); |
|
| 280 | - $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']); |
|
| 281 | - $Marine->db = null; |
|
| 278 | + $timeelapsed = microtime(true); |
|
| 279 | + $Marine = new Marine($this->db); |
|
| 280 | + $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']); |
|
| 281 | + $Marine->db = null; |
|
| 282 | + } |
|
| 282 | 283 | } |
| 283 | - } |
|
| 284 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 285 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 284 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 285 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 286 | 286 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 287 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 287 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 288 | 288 | $timeelapsed = microtime(true); |
| 289 | 289 | $Marine = new Marine($this->db); |
| 290 | 290 | $fromsource = NULL; |
@@ -292,20 +292,20 @@ discard block |
||
| 292 | 292 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 293 | 293 | $Marine->db = null; |
| 294 | 294 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 295 | - } |
|
| 295 | + } |
|
| 296 | + } |
|
| 296 | 297 | } |
| 297 | - } |
|
| 298 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 298 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
| 302 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 302 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 303 | 303 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 304 | - } else { |
|
| 304 | + } else { |
|
| 305 | 305 | 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"; |
| 306 | 306 | 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"; |
| 307 | 307 | return ''; |
| 308 | - } |
|
| 308 | + } |
|
| 309 | 309 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
| 310 | 310 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
| 311 | 311 | return ''; |
@@ -322,33 +322,33 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | |
| 324 | 324 | if (isset($line['speed'])) { |
| 325 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2))); |
|
| 326 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 325 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2))); |
|
| 326 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 327 | 327 | } 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'])) { |
| 328 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 329 | - if ($distance > 1000 && $distance < 10000) { |
|
| 328 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 329 | + if ($distance > 1000 && $distance < 10000) { |
|
| 330 | 330 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 331 | 331 | $speed = $speed*3.6; |
| 332 | 332 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
| 333 | 333 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 334 | - } |
|
| 334 | + } |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 338 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 339 | - else unset($timediff); |
|
| 340 | - if ($this->tmd > 5 || |
|
| 341 | - !isset($timediff) || |
|
| 342 | - $timediff > $globalLiveInterval || |
|
| 343 | - ( |
|
| 344 | - $timediff > 30 && |
|
| 345 | - isset($this->all_tracked[$id]['latitude']) && |
|
| 346 | - isset($this->all_tracked[$id]['longitude']) && |
|
| 347 | - $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')) |
|
| 348 | - ) |
|
| 349 | - ) { |
|
| 337 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 338 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 339 | + else unset($timediff); |
|
| 340 | + if ($this->tmd > 5 || |
|
| 341 | + !isset($timediff) || |
|
| 342 | + $timediff > $globalLiveInterval || |
|
| 343 | + ( |
|
| 344 | + $timediff > 30 && |
|
| 345 | + isset($this->all_tracked[$id]['latitude']) && |
|
| 346 | + isset($this->all_tracked[$id]['longitude']) && |
|
| 347 | + $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')) |
|
| 348 | + ) |
|
| 349 | + ) { |
|
| 350 | 350 | 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'])) { |
| 351 | - 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'])) { |
|
| 351 | + 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'])) { |
|
| 352 | 352 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 353 | 353 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 354 | 354 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -356,217 +356,217 @@ discard block |
||
| 356 | 356 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
| 357 | 357 | $timeelapsed = microtime(true); |
| 358 | 358 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 359 | - $Marine = new Marine($this->db); |
|
| 360 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 361 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 362 | - $Marine->db = null; |
|
| 363 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 359 | + $Marine = new Marine($this->db); |
|
| 360 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 361 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 362 | + $Marine->db = null; |
|
| 363 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 364 | 364 | } |
| 365 | 365 | $this->tmd = 0; |
| 366 | 366 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
| 367 | - } |
|
| 367 | + } |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 371 | 371 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 372 | 372 | 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') { |
| 373 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 374 | - $dataFound = true; |
|
| 375 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 373 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 374 | + $dataFound = true; |
|
| 375 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 376 | 376 | } |
| 377 | 377 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 378 | 378 | } |
| 379 | 379 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 380 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 380 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 381 | 381 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 382 | 382 | 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') { |
| 383 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 384 | - $dataFound = true; |
|
| 385 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 383 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 384 | + $dataFound = true; |
|
| 385 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 386 | 386 | } |
| 387 | 387 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - } else if ($globalDebug && $timediff > 20) { |
|
| 390 | + } else if ($globalDebug && $timediff > 20) { |
|
| 391 | 391 | $this->tmd = $this->tmd + 1; |
| 392 | 392 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 393 | 393 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
| 394 | 394 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 395 | 395 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 396 | - } |
|
| 396 | + } |
|
| 397 | 397 | } |
| 398 | 398 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 399 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 400 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 399 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 400 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 401 | 401 | } |
| 402 | 402 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 403 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 403 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 404 | 404 | } |
| 405 | 405 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 406 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 406 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 407 | 407 | } |
| 408 | 408 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 409 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 409 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | if (isset($line['heading']) && $line['heading'] != '') { |
| 413 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 414 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 415 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 416 | - //$dataFound = true; |
|
| 413 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 414 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 415 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 416 | + //$dataFound = true; |
|
| 417 | 417 | } 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']) { |
| 418 | - $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']); |
|
| 419 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 420 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 421 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 418 | + $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']); |
|
| 419 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 420 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 421 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 422 | 422 | } |
| 423 | 423 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 424 | 424 | |
| 425 | 425 | |
| 426 | 426 | |
| 427 | 427 | if ($dataFound === true && (isset($this->all_tracked[$id]['mmsi']) || isset($this->all_tracked[$id]['id']))) { |
| 428 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 429 | - if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) { |
|
| 430 | - 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'])) { |
|
| 431 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 428 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 429 | + if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) { |
|
| 430 | + 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'])) { |
|
| 431 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 432 | 432 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 433 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 434 | - $timeelapsed = microtime(true); |
|
| 435 | - $MarineLive = new MarineLive($this->db); |
|
| 436 | - if (isset($line['id']) && isset($globalVM) && $globalVM) { |
|
| 433 | + if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 434 | + $timeelapsed = microtime(true); |
|
| 435 | + $MarineLive = new MarineLive($this->db); |
|
| 436 | + if (isset($line['id']) && isset($globalVM) && $globalVM) { |
|
| 437 | 437 | $Marine = new Marine($this->db); |
| 438 | 438 | $recent_ident = $Marine->checkId($line['id']); |
| 439 | 439 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 440 | 440 | $Marine->db=null; |
| 441 | - } elseif (isset($line['id'])) { |
|
| 441 | + } elseif (isset($line['id'])) { |
|
| 442 | 442 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 443 | 443 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 444 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 444 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 445 | 445 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 446 | 446 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 447 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 447 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 448 | 448 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 449 | 449 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 450 | - } else $recent_ident = ''; |
|
| 451 | - $MarineLive->db=null; |
|
| 452 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 453 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 450 | + } else $recent_ident = ''; |
|
| 451 | + $MarineLive->db=null; |
|
| 452 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 453 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 454 | 454 | } else $recent_ident = ''; |
| 455 | - } else { |
|
| 455 | + } else { |
|
| 456 | 456 | $recent_ident = ''; |
| 457 | 457 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
| 458 | - } |
|
| 459 | - //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 460 | - if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
| 461 | - { |
|
| 458 | + } |
|
| 459 | + //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 460 | + if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
| 461 | + { |
|
| 462 | 462 | if ($globalDebug) { |
| 463 | 463 | if ($this->all_tracked[$id]['mmsi'] == '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
| 464 | 464 | else echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
| 465 | 465 | } |
| 466 | 466 | //adds the spotter data for the archive |
| 467 | - $highlight = ''; |
|
| 468 | - 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'))); |
|
| 469 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 467 | + $highlight = ''; |
|
| 468 | + 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'))); |
|
| 469 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 470 | 470 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 471 | - $timeelapsed = microtime(true); |
|
| 472 | - $Marine = new Marine($this->db); |
|
| 473 | - if (isset($globalVM) && $globalVM && $this->all_tracked[$id]['race_begin'] != '') { |
|
| 471 | + $timeelapsed = microtime(true); |
|
| 472 | + $Marine = new Marine($this->db); |
|
| 473 | + if (isset($globalVM) && $globalVM && $this->all_tracked[$id]['race_begin'] != '') { |
|
| 474 | 474 | $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]['race_begin'], $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'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 475 | - } else { |
|
| 475 | + } else { |
|
| 476 | 476 | $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'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 477 | - } |
|
| 478 | - $Marine->db = null; |
|
| 479 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 480 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 477 | + } |
|
| 478 | + $Marine->db = null; |
|
| 479 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 480 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 481 | 481 | } |
| 482 | - } |
|
| 483 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 482 | + } |
|
| 483 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 484 | 484 | // Add source stat in DB |
| 485 | 485 | $Stats = new Stats($this->db); |
| 486 | 486 | if (!empty($this->stats)) { |
| 487 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 488 | - foreach($this->stats as $date => $data) { |
|
| 487 | + if ($globalDebug) echo 'Add source stats : '; |
|
| 488 | + foreach($this->stats as $date => $data) { |
|
| 489 | 489 | foreach($data as $source => $sourced) { |
| 490 | - //print_r($sourced); |
|
| 491 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 492 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 493 | - if (isset($sourced['msg'])) { |
|
| 494 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 495 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 496 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 497 | - unset($this->stats[$date][$source]['msg']); |
|
| 498 | - } |
|
| 499 | - } |
|
| 500 | - } |
|
| 501 | - if ($date != date('Y-m-d')) { |
|
| 502 | - unset($this->stats[$date]); |
|
| 503 | - } |
|
| 504 | - } |
|
| 505 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 490 | + //print_r($sourced); |
|
| 491 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 492 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 493 | + if (isset($sourced['msg'])) { |
|
| 494 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 495 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 496 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 497 | + unset($this->stats[$date][$source]['msg']); |
|
| 498 | + } |
|
| 499 | + } |
|
| 500 | + } |
|
| 501 | + if ($date != date('Y-m-d')) { |
|
| 502 | + unset($this->stats[$date]); |
|
| 503 | + } |
|
| 504 | + } |
|
| 505 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 506 | 506 | } |
| 507 | 507 | $Stats->db = null; |
| 508 | - } |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | - $this->del(); |
|
| 510 | + $this->del(); |
|
| 511 | 511 | //$ignoreImport = false; |
| 512 | 512 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 513 | 513 | //print_r($this->all_tracked[$id]); |
| 514 | 514 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 515 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 516 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 517 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 515 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 516 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 517 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 518 | 518 | $MarineLive = new MarineLive($this->db); |
| 519 | 519 | $MarineLive->deleteLiveMarineData(); |
| 520 | 520 | $MarineLive->db=null; |
| 521 | 521 | if ($globalDebug) echo " Done\n"; |
| 522 | - } |
|
| 523 | - $this->last_delete = time(); |
|
| 522 | + } |
|
| 523 | + $this->last_delete = time(); |
|
| 524 | 524 | } |
| 525 | - } elseif ($recent_ident != '') { |
|
| 525 | + } elseif ($recent_ident != '') { |
|
| 526 | 526 | $this->all_tracked[$id]['id'] = $recent_ident; |
| 527 | 527 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 528 | 528 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 529 | - if ((isset($globalDaemon) && !$globalDaemon) || (isset($globalVM) && $globalVM)) { |
|
| 529 | + if ((isset($globalDaemon) && !$globalDaemon) || (isset($globalVM) && $globalVM)) { |
|
| 530 | 530 | $Marine = new Marine($this->db); |
| 531 | 531 | if (isset($globalVM) && $globalVM) { |
| 532 | - if ($this->all_tracked[$id]['status'] == 'Racing') { |
|
| 532 | + if ($this->all_tracked[$id]['status'] == 'Racing') { |
|
| 533 | 533 | $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'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
| 534 | - } else { |
|
| 534 | + } else { |
|
| 535 | 535 | //$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
| 536 | 536 | $timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
| 537 | 537 | if ($timerace > time()) $finaldatetime = NULL; |
| 538 | 538 | else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
| 539 | 539 | |
| 540 | 540 | $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'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
| 541 | - } |
|
| 541 | + } |
|
| 542 | 542 | } else { |
| 543 | - $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'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
| 543 | + $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'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
| 544 | 544 | } |
| 545 | 545 | $Marine->db = null; |
| 546 | - } |
|
| 546 | + } |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - } |
|
| 549 | + } |
|
| 550 | 550 | } |
| 551 | - } |
|
| 552 | - //adds the spotter LIVE data |
|
| 553 | - if ($globalDebug) { |
|
| 551 | + } |
|
| 552 | + //adds the spotter LIVE data |
|
| 553 | + if ($globalDebug) { |
|
| 554 | 554 | 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"; |
| 555 | - } |
|
| 556 | - $ignoreImport = false; |
|
| 557 | - if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
|
| 558 | - if (!$ignoreImport) { |
|
| 555 | + } |
|
| 556 | + $ignoreImport = false; |
|
| 557 | + if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
|
| 558 | + if (!$ignoreImport) { |
|
| 559 | 559 | 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'])) { |
| 560 | 560 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 561 | 561 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 562 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 562 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 563 | 563 | $timeelapsed = microtime(true); |
| 564 | 564 | $MarineLive = new MarineLive($this->db); |
| 565 | 565 | $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'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 566 | 566 | $MarineLive->db = null; |
| 567 | 567 | if ($globalDebug) echo $result."\n"; |
| 568 | 568 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 569 | - } |
|
| 569 | + } |
|
| 570 | 570 | } |
| 571 | 571 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
| 572 | 572 | $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']); |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | if ($stats_heading == 16) $stats_heading = 0; |
| 602 | 602 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 603 | 603 | for ($i=0;$i<=15;$i++) { |
| 604 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 604 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 605 | 605 | } |
| 606 | 606 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 607 | 607 | } else { |
@@ -614,11 +614,11 @@ discard block |
||
| 614 | 614 | //var_dump($this->stats); |
| 615 | 615 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 616 | 616 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 617 | - end($this->stats[$current_date][$source]['hist']); |
|
| 618 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 617 | + end($this->stats[$current_date][$source]['hist']); |
|
| 618 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 619 | 619 | } else $mini = 0; |
| 620 | 620 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 621 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 621 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 622 | 622 | } |
| 623 | 623 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 624 | 624 | } else { |
@@ -634,30 +634,30 @@ discard block |
||
| 634 | 634 | |
| 635 | 635 | |
| 636 | 636 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 637 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 637 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 638 | 638 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
| 639 | 639 | $MarineLive = new MarineLive($this->db); |
| 640 | 640 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
| 641 | 641 | $MarineLive->db = null; |
| 642 | 642 | //MarineLive->deleteLiveMarineData(); |
| 643 | 643 | if ($globalDebug) echo " Done\n"; |
| 644 | - } |
|
| 645 | - $this->last_delete_hourly = time(); |
|
| 644 | + } |
|
| 645 | + $this->last_delete_hourly = time(); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | - } |
|
| 649 | - //$ignoreImport = false; |
|
| 648 | + } |
|
| 649 | + //$ignoreImport = false; |
|
| 650 | 650 | } |
| 651 | 651 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 652 | 652 | if ($send) return $this->all_tracked[$id]; |
| 653 | - } |
|
| 653 | + } |
|
| 654 | + } |
|
| 654 | 655 | } |
| 655 | - } |
|
| 656 | 656 | |
| 657 | - public function race_add($data) { |
|
| 658 | - $Marine = new Marine(); |
|
| 659 | - $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']); |
|
| 660 | - $Marine->db = null; |
|
| 661 | - } |
|
| 657 | + public function race_add($data) { |
|
| 658 | + $Marine = new Marine(); |
|
| 659 | + $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']); |
|
| 660 | + $Marine->db = null; |
|
| 661 | + } |
|
| 662 | 662 | } |
| 663 | 663 | ?> |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * Get SQL query part for filter used |
|
| 23 | - * @param Array $filter the filter |
|
| 24 | - * @return Array the SQL part |
|
| 25 | - */ |
|
| 22 | + * Get SQL query part for filter used |
|
| 23 | + * @param Array $filter the filter |
|
| 24 | + * @return Array the SQL part |
|
| 25 | + */ |
|
| 26 | 26 | |
| 27 | 27 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 28 | 28 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | - * Executes the SQL statements to get the spotter information |
|
| 99 | - * |
|
| 100 | - * @param String $query the SQL query |
|
| 101 | - * @param Array $params parameter of the query |
|
| 102 | - * @param String $limitQuery the limit query |
|
| 103 | - * @return Array the spotter information |
|
| 104 | - * |
|
| 105 | - */ |
|
| 98 | + * Executes the SQL statements to get the spotter information |
|
| 99 | + * |
|
| 100 | + * @param String $query the SQL query |
|
| 101 | + * @param Array $params parameter of the query |
|
| 102 | + * @param String $limitQuery the limit query |
|
| 103 | + * @return Array the spotter information |
|
| 104 | + * |
|
| 105 | + */ |
|
| 106 | 106 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 107 | 107 | { |
| 108 | 108 | global $globalVM; |
@@ -253,11 +253,11 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | - * Gets all the spotter information based on the latest data entry |
|
| 257 | - * |
|
| 258 | - * @return Array the spotter information |
|
| 259 | - * |
|
| 260 | - */ |
|
| 256 | + * Gets all the spotter information based on the latest data entry |
|
| 257 | + * |
|
| 258 | + * @return Array the spotter information |
|
| 259 | + * |
|
| 260 | + */ |
|
| 261 | 261 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
| 262 | 262 | { |
| 263 | 263 | global $global_marine_query; |
@@ -306,11 +306,11 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | - * Gets all the spotter information based on the callsign |
|
| 310 | - * |
|
| 311 | - * @return Array the spotter information |
|
| 312 | - * |
|
| 313 | - */ |
|
| 309 | + * Gets all the spotter information based on the callsign |
|
| 310 | + * |
|
| 311 | + * @return Array the spotter information |
|
| 312 | + * |
|
| 313 | + */ |
|
| 314 | 314 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 315 | 315 | { |
| 316 | 316 | global $global_marine_query; |
@@ -362,11 +362,11 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
| 365 | - * Gets all the marine information based on the type |
|
| 366 | - * |
|
| 367 | - * @return Array the marine information |
|
| 368 | - * |
|
| 369 | - */ |
|
| 365 | + * Gets all the marine information based on the type |
|
| 366 | + * |
|
| 367 | + * @return Array the marine information |
|
| 368 | + * |
|
| 369 | + */ |
|
| 370 | 370 | public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array()) |
| 371 | 371 | { |
| 372 | 372 | global $global_marine_query; |
@@ -472,11 +472,11 @@ discard block |
||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | /** |
| 475 | - * Gets all the marine information based on the captain |
|
| 476 | - * |
|
| 477 | - * @return Array the marine information |
|
| 478 | - * |
|
| 479 | - */ |
|
| 475 | + * Gets all the marine information based on the captain |
|
| 476 | + * |
|
| 477 | + * @return Array the marine information |
|
| 478 | + * |
|
| 479 | + */ |
|
| 480 | 480 | public function getMarineDataByCaptain($captain = '', $limit = '', $sort = '', $filter = array()) |
| 481 | 481 | { |
| 482 | 482 | global $global_marine_query; |
@@ -515,11 +515,11 @@ discard block |
||
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
| 518 | - * Gets all the marine information based on the race |
|
| 519 | - * |
|
| 520 | - * @return Array the marine information |
|
| 521 | - * |
|
| 522 | - */ |
|
| 518 | + * Gets all the marine information based on the race |
|
| 519 | + * |
|
| 520 | + * @return Array the marine information |
|
| 521 | + * |
|
| 522 | + */ |
|
| 523 | 523 | public function getMarineDataByRace($race = '', $limit = '', $sort = '', $filter = array()) |
| 524 | 524 | { |
| 525 | 525 | global $global_marine_query,$globalDBdriver; |
@@ -562,11 +562,11 @@ discard block |
||
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | /** |
| 565 | - * Count races by captain |
|
| 566 | - * |
|
| 567 | - * @return Integer number of race for a captain |
|
| 568 | - * |
|
| 569 | - */ |
|
| 565 | + * Count races by captain |
|
| 566 | + * |
|
| 567 | + * @return Integer number of race for a captain |
|
| 568 | + * |
|
| 569 | + */ |
|
| 570 | 570 | public function countRacesByCaptain($captain,$filters = array()) |
| 571 | 571 | { |
| 572 | 572 | $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
@@ -582,11 +582,11 @@ discard block |
||
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /** |
| 585 | - * Count captains by race |
|
| 586 | - * |
|
| 587 | - * @return String Duration of all races |
|
| 588 | - * |
|
| 589 | - */ |
|
| 585 | + * Count captains by race |
|
| 586 | + * |
|
| 587 | + * @return String Duration of all races |
|
| 588 | + * |
|
| 589 | + */ |
|
| 590 | 590 | public function countCaptainsByRace($race,$filters = array()) |
| 591 | 591 | { |
| 592 | 592 | $race = filter_var($race,FILTER_SANITIZE_STRING); |
@@ -602,11 +602,11 @@ discard block |
||
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | /** |
| 605 | - * Gets all boat types that have been used by a captain |
|
| 606 | - * |
|
| 607 | - * @return Array the boat list |
|
| 608 | - * |
|
| 609 | - */ |
|
| 605 | + * Gets all boat types that have been used by a captain |
|
| 606 | + * |
|
| 607 | + * @return Array the boat list |
|
| 608 | + * |
|
| 609 | + */ |
|
| 610 | 610 | public function countAllBoatTypesByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
| 611 | 611 | { |
| 612 | 612 | global $globalDBdriver; |
@@ -651,11 +651,11 @@ discard block |
||
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | /** |
| 654 | - * Gets all boat types that have been used on a race |
|
| 655 | - * |
|
| 656 | - * @return Array the boat list |
|
| 657 | - * |
|
| 658 | - */ |
|
| 654 | + * Gets all boat types that have been used on a race |
|
| 655 | + * |
|
| 656 | + * @return Array the boat list |
|
| 657 | + * |
|
| 658 | + */ |
|
| 659 | 659 | public function countAllBoatTypesByRace($race,$filters = array(),$year = '',$month = '',$day = '') |
| 660 | 660 | { |
| 661 | 661 | global $globalDBdriver; |
@@ -700,11 +700,11 @@ discard block |
||
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | /** |
| 703 | - * Gets race duration by captain |
|
| 704 | - * |
|
| 705 | - * @return String Duration of all race |
|
| 706 | - * |
|
| 707 | - */ |
|
| 703 | + * Gets race duration by captain |
|
| 704 | + * |
|
| 705 | + * @return String Duration of all race |
|
| 706 | + * |
|
| 707 | + */ |
|
| 708 | 708 | public function getRaceDurationByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
| 709 | 709 | { |
| 710 | 710 | global $globalDBdriver; |
@@ -750,11 +750,11 @@ discard block |
||
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | /** |
| 753 | - * Gets race duration by captains |
|
| 754 | - * |
|
| 755 | - * @return String Duration of all race |
|
| 756 | - * |
|
| 757 | - */ |
|
| 753 | + * Gets race duration by captains |
|
| 754 | + * |
|
| 755 | + * @return String Duration of all race |
|
| 756 | + * |
|
| 757 | + */ |
|
| 758 | 758 | public function getRaceDurationByCaptains($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
| 759 | 759 | { |
| 760 | 760 | global $globalDBdriver; |
@@ -813,11 +813,11 @@ discard block |
||
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | /** |
| 816 | - * Gets a list of all captain names and captain ids |
|
| 817 | - * |
|
| 818 | - * @return Array list of captain names and captain ids |
|
| 819 | - * |
|
| 820 | - */ |
|
| 816 | + * Gets a list of all captain names and captain ids |
|
| 817 | + * |
|
| 818 | + * @return Array list of captain names and captain ids |
|
| 819 | + * |
|
| 820 | + */ |
|
| 821 | 821 | public function getAllCaptainNames($filters = array()) |
| 822 | 822 | { |
| 823 | 823 | $filter_query = $this->getFilter($filters,true,true); |
@@ -831,11 +831,11 @@ discard block |
||
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | /** |
| 834 | - * Gets a list of all race names and race ids |
|
| 835 | - * |
|
| 836 | - * @return Array list of race names and race ids |
|
| 837 | - * |
|
| 838 | - */ |
|
| 834 | + * Gets a list of all race names and race ids |
|
| 835 | + * |
|
| 836 | + * @return Array list of race names and race ids |
|
| 837 | + * |
|
| 838 | + */ |
|
| 839 | 839 | public function getAllRaceNames($filters = array()) |
| 840 | 840 | { |
| 841 | 841 | $filter_query = $this->getFilter($filters,true,true); |
@@ -850,12 +850,12 @@ discard block |
||
| 850 | 850 | |
| 851 | 851 | |
| 852 | 852 | /** |
| 853 | - * Gets all source name |
|
| 854 | - * |
|
| 855 | - * @param String type format of source |
|
| 856 | - * @return Array list of source name |
|
| 857 | - * |
|
| 858 | - */ |
|
| 853 | + * Gets all source name |
|
| 854 | + * |
|
| 855 | + * @param String type format of source |
|
| 856 | + * @return Array list of source name |
|
| 857 | + * |
|
| 858 | + */ |
|
| 859 | 859 | public function getAllSourceName($type = '',$filters = array()) |
| 860 | 860 | { |
| 861 | 861 | $filter_query = $this->getFilter($filters,true,true); |
@@ -885,11 +885,11 @@ discard block |
||
| 885 | 885 | |
| 886 | 886 | |
| 887 | 887 | /** |
| 888 | - * Gets a list of all idents/callsigns |
|
| 889 | - * |
|
| 890 | - * @return Array list of ident/callsign names |
|
| 891 | - * |
|
| 892 | - */ |
|
| 888 | + * Gets a list of all idents/callsigns |
|
| 889 | + * |
|
| 890 | + * @return Array list of ident/callsign names |
|
| 891 | + * |
|
| 892 | + */ |
|
| 893 | 893 | public function getAllIdents($filters = array()) |
| 894 | 894 | { |
| 895 | 895 | $filter_query = $this->getFilter($filters,true,true); |
@@ -913,11 +913,11 @@ discard block |
||
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | /** |
| 916 | - * Gets all info from a mmsi |
|
| 917 | - * |
|
| 918 | - * @return Array ident |
|
| 919 | - * |
|
| 920 | - */ |
|
| 916 | + * Gets all info from a mmsi |
|
| 917 | + * |
|
| 918 | + * @return Array ident |
|
| 919 | + * |
|
| 920 | + */ |
|
| 921 | 921 | public function getIdentity($mmsi) |
| 922 | 922 | { |
| 923 | 923 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -930,9 +930,9 @@ discard block |
||
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | /** |
| 933 | - * Add identity |
|
| 934 | - * |
|
| 935 | - */ |
|
| 933 | + * Add identity |
|
| 934 | + * |
|
| 935 | + */ |
|
| 936 | 936 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
| 937 | 937 | { |
| 938 | 938 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -998,13 +998,13 @@ discard block |
||
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | /** |
| 1001 | - * Update ident tracker data |
|
| 1002 | - * |
|
| 1003 | - * @param String $fammarine_id the ID |
|
| 1004 | - * @param String $ident the marine ident |
|
| 1005 | - * @return String success or false |
|
| 1006 | - * |
|
| 1007 | - */ |
|
| 1001 | + * Update ident tracker data |
|
| 1002 | + * |
|
| 1003 | + * @param String $fammarine_id the ID |
|
| 1004 | + * @param String $ident the marine ident |
|
| 1005 | + * @return String success or false |
|
| 1006 | + * |
|
| 1007 | + */ |
|
| 1008 | 1008 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
| 1009 | 1009 | { |
| 1010 | 1010 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -1019,13 +1019,13 @@ discard block |
||
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | /** |
| 1022 | - * Update arrival marine data |
|
| 1023 | - * |
|
| 1024 | - * @param String $fammarine_id the ID |
|
| 1025 | - * @param String $arrival_code the marine ident |
|
| 1026 | - * @return String success or false |
|
| 1027 | - * |
|
| 1028 | - */ |
|
| 1022 | + * Update arrival marine data |
|
| 1023 | + * |
|
| 1024 | + * @param String $fammarine_id the ID |
|
| 1025 | + * @param String $arrival_code the marine ident |
|
| 1026 | + * @return String success or false |
|
| 1027 | + * |
|
| 1028 | + */ |
|
| 1029 | 1029 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
| 1030 | 1030 | { |
| 1031 | 1031 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -1040,19 +1040,19 @@ discard block |
||
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | /** |
| 1043 | - * Update Status data |
|
| 1044 | - * |
|
| 1045 | - * @param String $fammarine_id the ID |
|
| 1046 | - * @param String $status_id the marine status id |
|
| 1047 | - * @param String $status the marine status |
|
| 1048 | - * @return String success or false |
|
| 1049 | - * |
|
| 1050 | - */ |
|
| 1043 | + * Update Status data |
|
| 1044 | + * |
|
| 1045 | + * @param String $fammarine_id the ID |
|
| 1046 | + * @param String $status_id the marine status id |
|
| 1047 | + * @param String $status the marine status |
|
| 1048 | + * @return String success or false |
|
| 1049 | + * |
|
| 1050 | + */ |
|
| 1051 | 1051 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
| 1052 | 1052 | { |
| 1053 | 1053 | |
| 1054 | 1054 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
| 1055 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 1055 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 1056 | 1056 | |
| 1057 | 1057 | try { |
| 1058 | 1058 | $sth = $this->db->prepare($query); |
@@ -1065,13 +1065,13 @@ discard block |
||
| 1065 | 1065 | |
| 1066 | 1066 | } |
| 1067 | 1067 | /** |
| 1068 | - * Update latest marine data |
|
| 1069 | - * |
|
| 1070 | - * @param String $fammarine_id the ID |
|
| 1071 | - * @param String $ident the marine ident |
|
| 1072 | - * @return String success or false |
|
| 1073 | - * |
|
| 1074 | - */ |
|
| 1068 | + * Update latest marine data |
|
| 1069 | + * |
|
| 1070 | + * @param String $fammarine_id the ID |
|
| 1071 | + * @param String $ident the marine ident |
|
| 1072 | + * @return String success or false |
|
| 1073 | + * |
|
| 1074 | + */ |
|
| 1075 | 1075 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '',$distance = NULL,$race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
| 1076 | 1076 | { |
| 1077 | 1077 | if ($latitude == '') $latitude = NULL; |
@@ -1097,30 +1097,30 @@ discard block |
||
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | /** |
| 1100 | - * Adds a new marine data |
|
| 1101 | - * |
|
| 1102 | - * @param String $fammarine_id the ID |
|
| 1103 | - * @param String $ident the marine ident |
|
| 1104 | - * @param String $departure_airport_icao the departure airport |
|
| 1105 | - * @param String $arrival_airport_icao the arrival airport |
|
| 1106 | - * @param String $latitude latitude of flight |
|
| 1107 | - * @param String $longitude latitude of flight |
|
| 1108 | - * @param String $waypoints waypoints of flight |
|
| 1109 | - * @param String $heading heading of flight |
|
| 1110 | - * @param String $groundspeed speed of flight |
|
| 1111 | - * @param String $date date of flight |
|
| 1112 | - * @param String $departure_airport_time departure time of flight |
|
| 1113 | - * @param String $arrival_airport_time arrival time of flight |
|
| 1114 | - * @param String $squawk squawk code of flight |
|
| 1115 | - * @param String $route_stop route stop of flight |
|
| 1116 | - * @param String $highlight highlight or not |
|
| 1117 | - * @param String $ModeS ModesS code of flight |
|
| 1118 | - * @param String $registration registration code of flight |
|
| 1119 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 1120 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 1121 | - * @param String $verticalrate vertival rate of flight |
|
| 1122 | - * @return String success or false |
|
| 1123 | - */ |
|
| 1100 | + * Adds a new marine data |
|
| 1101 | + * |
|
| 1102 | + * @param String $fammarine_id the ID |
|
| 1103 | + * @param String $ident the marine ident |
|
| 1104 | + * @param String $departure_airport_icao the departure airport |
|
| 1105 | + * @param String $arrival_airport_icao the arrival airport |
|
| 1106 | + * @param String $latitude latitude of flight |
|
| 1107 | + * @param String $longitude latitude of flight |
|
| 1108 | + * @param String $waypoints waypoints of flight |
|
| 1109 | + * @param String $heading heading of flight |
|
| 1110 | + * @param String $groundspeed speed of flight |
|
| 1111 | + * @param String $date date of flight |
|
| 1112 | + * @param String $departure_airport_time departure time of flight |
|
| 1113 | + * @param String $arrival_airport_time arrival time of flight |
|
| 1114 | + * @param String $squawk squawk code of flight |
|
| 1115 | + * @param String $route_stop route stop of flight |
|
| 1116 | + * @param String $highlight highlight or not |
|
| 1117 | + * @param String $ModeS ModesS code of flight |
|
| 1118 | + * @param String $registration registration code of flight |
|
| 1119 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 1120 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 1121 | + * @param String $verticalrate vertival rate of flight |
|
| 1122 | + * @return String success or false |
|
| 1123 | + */ |
|
| 1124 | 1124 | 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 = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '',$race_rank = '', $race_time = '') |
| 1125 | 1125 | { |
| 1126 | 1126 | global $globalURL, $globalMarineImageFetch; |
@@ -1254,11 +1254,11 @@ discard block |
||
| 1254 | 1254 | |
| 1255 | 1255 | |
| 1256 | 1256 | /** |
| 1257 | - * Gets the aircraft ident within the last hour |
|
| 1258 | - * |
|
| 1259 | - * @return String the ident |
|
| 1260 | - * |
|
| 1261 | - */ |
|
| 1257 | + * Gets the aircraft ident within the last hour |
|
| 1258 | + * |
|
| 1259 | + * @return String the ident |
|
| 1260 | + * |
|
| 1261 | + */ |
|
| 1262 | 1262 | public function getIdentFromLastHour($ident) |
| 1263 | 1263 | { |
| 1264 | 1264 | global $globalDBdriver, $globalTimezone; |
@@ -1274,11 +1274,11 @@ discard block |
||
| 1274 | 1274 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 1275 | 1275 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
| 1276 | 1276 | $query_data = array(':ident' => $ident); |
| 1277 | - } |
|
| 1277 | + } |
|
| 1278 | 1278 | |
| 1279 | 1279 | $sth = $this->db->prepare($query); |
| 1280 | 1280 | $sth->execute($query_data); |
| 1281 | - $ident_result=''; |
|
| 1281 | + $ident_result=''; |
|
| 1282 | 1282 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 1283 | 1283 | { |
| 1284 | 1284 | $ident_result = $row['ident']; |
@@ -1289,11 +1289,11 @@ discard block |
||
| 1289 | 1289 | |
| 1290 | 1290 | |
| 1291 | 1291 | /** |
| 1292 | - * Gets the aircraft data from the last 20 seconds |
|
| 1293 | - * |
|
| 1294 | - * @return Array the marine data |
|
| 1295 | - * |
|
| 1296 | - */ |
|
| 1292 | + * Gets the aircraft data from the last 20 seconds |
|
| 1293 | + * |
|
| 1294 | + * @return Array the marine data |
|
| 1295 | + * |
|
| 1296 | + */ |
|
| 1297 | 1297 | public function getRealTimeData($q = '') |
| 1298 | 1298 | { |
| 1299 | 1299 | global $globalDBdriver; |
@@ -1331,11 +1331,11 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | |
| 1333 | 1333 | /** |
| 1334 | - * Gets all number of flight over countries |
|
| 1335 | - * |
|
| 1336 | - * @return Array the airline country list |
|
| 1337 | - * |
|
| 1338 | - */ |
|
| 1334 | + * Gets all number of flight over countries |
|
| 1335 | + * |
|
| 1336 | + * @return Array the airline country list |
|
| 1337 | + * |
|
| 1338 | + */ |
|
| 1339 | 1339 | |
| 1340 | 1340 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 1341 | 1341 | { |
@@ -1408,11 +1408,11 @@ discard block |
||
| 1408 | 1408 | |
| 1409 | 1409 | |
| 1410 | 1410 | /** |
| 1411 | - * Gets all callsigns that have flown over |
|
| 1412 | - * |
|
| 1413 | - * @return Array the callsign list |
|
| 1414 | - * |
|
| 1415 | - */ |
|
| 1411 | + * Gets all callsigns that have flown over |
|
| 1412 | + * |
|
| 1413 | + * @return Array the callsign list |
|
| 1414 | + * |
|
| 1415 | + */ |
|
| 1416 | 1416 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 1417 | 1417 | { |
| 1418 | 1418 | global $globalDBdriver; |
@@ -1479,11 +1479,11 @@ discard block |
||
| 1479 | 1479 | |
| 1480 | 1480 | |
| 1481 | 1481 | /** |
| 1482 | - * Counts all dates |
|
| 1483 | - * |
|
| 1484 | - * @return Array the date list |
|
| 1485 | - * |
|
| 1486 | - */ |
|
| 1482 | + * Counts all dates |
|
| 1483 | + * |
|
| 1484 | + * @return Array the date list |
|
| 1485 | + * |
|
| 1486 | + */ |
|
| 1487 | 1487 | public function countAllDates($filters = array()) |
| 1488 | 1488 | { |
| 1489 | 1489 | global $globalTimezone, $globalDBdriver; |
@@ -1529,11 +1529,11 @@ discard block |
||
| 1529 | 1529 | |
| 1530 | 1530 | |
| 1531 | 1531 | /** |
| 1532 | - * Counts all dates during the last 7 days |
|
| 1533 | - * |
|
| 1534 | - * @return Array the date list |
|
| 1535 | - * |
|
| 1536 | - */ |
|
| 1532 | + * Counts all dates during the last 7 days |
|
| 1533 | + * |
|
| 1534 | + * @return Array the date list |
|
| 1535 | + * |
|
| 1536 | + */ |
|
| 1537 | 1537 | public function countAllDatesLast7Days($filters = array()) |
| 1538 | 1538 | { |
| 1539 | 1539 | global $globalTimezone, $globalDBdriver; |
@@ -1555,7 +1555,7 @@ discard block |
||
| 1555 | 1555 | $query .= " GROUP BY date_name |
| 1556 | 1556 | ORDER BY date_name ASC"; |
| 1557 | 1557 | $query_data = array(':offset' => $offset); |
| 1558 | - } |
|
| 1558 | + } |
|
| 1559 | 1559 | |
| 1560 | 1560 | $sth = $this->db->prepare($query); |
| 1561 | 1561 | $sth->execute($query_data); |
@@ -1575,11 +1575,11 @@ discard block |
||
| 1575 | 1575 | } |
| 1576 | 1576 | |
| 1577 | 1577 | /** |
| 1578 | - * Counts all dates during the last month |
|
| 1579 | - * |
|
| 1580 | - * @return Array the date list |
|
| 1581 | - * |
|
| 1582 | - */ |
|
| 1578 | + * Counts all dates during the last month |
|
| 1579 | + * |
|
| 1580 | + * @return Array the date list |
|
| 1581 | + * |
|
| 1582 | + */ |
|
| 1583 | 1583 | public function countAllDatesLastMonth($filters = array()) |
| 1584 | 1584 | { |
| 1585 | 1585 | global $globalTimezone, $globalDBdriver; |
@@ -1601,7 +1601,7 @@ discard block |
||
| 1601 | 1601 | $query .= " GROUP BY date_name |
| 1602 | 1602 | ORDER BY date_name ASC"; |
| 1603 | 1603 | $query_data = array(':offset' => $offset); |
| 1604 | - } |
|
| 1604 | + } |
|
| 1605 | 1605 | |
| 1606 | 1606 | $sth = $this->db->prepare($query); |
| 1607 | 1607 | $sth->execute($query_data); |
@@ -1623,11 +1623,11 @@ discard block |
||
| 1623 | 1623 | |
| 1624 | 1624 | |
| 1625 | 1625 | /** |
| 1626 | - * Counts all month |
|
| 1627 | - * |
|
| 1628 | - * @return Array the month list |
|
| 1629 | - * |
|
| 1630 | - */ |
|
| 1626 | + * Counts all month |
|
| 1627 | + * |
|
| 1628 | + * @return Array the month list |
|
| 1629 | + * |
|
| 1630 | + */ |
|
| 1631 | 1631 | public function countAllMonths($filters = array()) |
| 1632 | 1632 | { |
| 1633 | 1633 | global $globalTimezone, $globalDBdriver; |
@@ -1672,11 +1672,11 @@ discard block |
||
| 1672 | 1672 | |
| 1673 | 1673 | |
| 1674 | 1674 | /** |
| 1675 | - * Counts all dates during the last year |
|
| 1676 | - * |
|
| 1677 | - * @return Array the date list |
|
| 1678 | - * |
|
| 1679 | - */ |
|
| 1675 | + * Counts all dates during the last year |
|
| 1676 | + * |
|
| 1677 | + * @return Array the date list |
|
| 1678 | + * |
|
| 1679 | + */ |
|
| 1680 | 1680 | public function countAllMonthsLastYear($filters) |
| 1681 | 1681 | { |
| 1682 | 1682 | global $globalTimezone, $globalDBdriver; |
@@ -1698,7 +1698,7 @@ discard block |
||
| 1698 | 1698 | $query .= " GROUP BY year_name, month_name |
| 1699 | 1699 | ORDER BY year_name, month_name ASC"; |
| 1700 | 1700 | $query_data = array(':offset' => $offset); |
| 1701 | - } |
|
| 1701 | + } |
|
| 1702 | 1702 | |
| 1703 | 1703 | $sth = $this->db->prepare($query); |
| 1704 | 1704 | $sth->execute($query_data); |
@@ -1721,11 +1721,11 @@ discard block |
||
| 1721 | 1721 | |
| 1722 | 1722 | |
| 1723 | 1723 | /** |
| 1724 | - * Counts all hours |
|
| 1725 | - * |
|
| 1726 | - * @return Array the hour list |
|
| 1727 | - * |
|
| 1728 | - */ |
|
| 1724 | + * Counts all hours |
|
| 1725 | + * |
|
| 1726 | + * @return Array the hour list |
|
| 1727 | + * |
|
| 1728 | + */ |
|
| 1729 | 1729 | public function countAllHours($orderby,$filters = array()) |
| 1730 | 1730 | { |
| 1731 | 1731 | global $globalTimezone, $globalDBdriver; |
@@ -1788,11 +1788,11 @@ discard block |
||
| 1788 | 1788 | |
| 1789 | 1789 | |
| 1790 | 1790 | /** |
| 1791 | - * Counts all hours by date |
|
| 1792 | - * |
|
| 1793 | - * @return Array the hour list |
|
| 1794 | - * |
|
| 1795 | - */ |
|
| 1791 | + * Counts all hours by date |
|
| 1792 | + * |
|
| 1793 | + * @return Array the hour list |
|
| 1794 | + * |
|
| 1795 | + */ |
|
| 1796 | 1796 | public function countAllHoursByDate($date, $filters = array()) |
| 1797 | 1797 | { |
| 1798 | 1798 | global $globalTimezone, $globalDBdriver; |
@@ -1836,11 +1836,11 @@ discard block |
||
| 1836 | 1836 | |
| 1837 | 1837 | |
| 1838 | 1838 | /** |
| 1839 | - * Counts all hours by a ident/callsign |
|
| 1840 | - * |
|
| 1841 | - * @return Array the hour list |
|
| 1842 | - * |
|
| 1843 | - */ |
|
| 1839 | + * Counts all hours by a ident/callsign |
|
| 1840 | + * |
|
| 1841 | + * @return Array the hour list |
|
| 1842 | + * |
|
| 1843 | + */ |
|
| 1844 | 1844 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1845 | 1845 | { |
| 1846 | 1846 | global $globalTimezone, $globalDBdriver; |
@@ -1883,11 +1883,11 @@ discard block |
||
| 1883 | 1883 | } |
| 1884 | 1884 | |
| 1885 | 1885 | /** |
| 1886 | - * Gets all aircraft registrations that have flown over |
|
| 1887 | - * |
|
| 1888 | - * @return Array the aircraft list |
|
| 1889 | - * |
|
| 1890 | - */ |
|
| 1886 | + * Gets all aircraft registrations that have flown over |
|
| 1887 | + * |
|
| 1888 | + * @return Array the aircraft list |
|
| 1889 | + * |
|
| 1890 | + */ |
|
| 1891 | 1891 | public function countAllCaptainsByRaces($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 1892 | 1892 | { |
| 1893 | 1893 | global $globalDBdriver; |
@@ -1926,11 +1926,11 @@ discard block |
||
| 1926 | 1926 | } |
| 1927 | 1927 | |
| 1928 | 1928 | /** |
| 1929 | - * Counts all vessels |
|
| 1930 | - * |
|
| 1931 | - * @return Integer the number of vessels |
|
| 1932 | - * |
|
| 1933 | - */ |
|
| 1929 | + * Counts all vessels |
|
| 1930 | + * |
|
| 1931 | + * @return Integer the number of vessels |
|
| 1932 | + * |
|
| 1933 | + */ |
|
| 1934 | 1934 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
| 1935 | 1935 | { |
| 1936 | 1936 | global $globalDBdriver; |
@@ -1965,11 +1965,11 @@ discard block |
||
| 1965 | 1965 | } |
| 1966 | 1966 | |
| 1967 | 1967 | /** |
| 1968 | - * Counts all vessel type |
|
| 1969 | - * |
|
| 1970 | - * @return Integer the number of vessels |
|
| 1971 | - * |
|
| 1972 | - */ |
|
| 1968 | + * Counts all vessel type |
|
| 1969 | + * |
|
| 1970 | + * @return Integer the number of vessels |
|
| 1971 | + * |
|
| 1972 | + */ |
|
| 1973 | 1973 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
| 1974 | 1974 | { |
| 1975 | 1975 | global $globalDBdriver; |
@@ -2003,11 +2003,11 @@ discard block |
||
| 2003 | 2003 | } |
| 2004 | 2004 | |
| 2005 | 2005 | /** |
| 2006 | - * Gets a number of all race |
|
| 2007 | - * |
|
| 2008 | - * @return Integer number of races |
|
| 2009 | - * |
|
| 2010 | - */ |
|
| 2006 | + * Gets a number of all race |
|
| 2007 | + * |
|
| 2008 | + * @return Integer number of races |
|
| 2009 | + * |
|
| 2010 | + */ |
|
| 2011 | 2011 | public function countOverallMarineRaces($filters = array(),$year = '',$month = '') |
| 2012 | 2012 | { |
| 2013 | 2013 | global $globalDBdriver; |
@@ -2041,11 +2041,11 @@ discard block |
||
| 2041 | 2041 | } |
| 2042 | 2042 | |
| 2043 | 2043 | /** |
| 2044 | - * Gets a number of all captain |
|
| 2045 | - * |
|
| 2046 | - * @return Integer number of captain |
|
| 2047 | - * |
|
| 2048 | - */ |
|
| 2044 | + * Gets a number of all captain |
|
| 2045 | + * |
|
| 2046 | + * @return Integer number of captain |
|
| 2047 | + * |
|
| 2048 | + */ |
|
| 2049 | 2049 | public function countOverallMarineCaptains($filters = array(),$year = '',$month = '') |
| 2050 | 2050 | { |
| 2051 | 2051 | global $globalDBdriver; |
@@ -2079,11 +2079,11 @@ discard block |
||
| 2079 | 2079 | } |
| 2080 | 2080 | |
| 2081 | 2081 | /** |
| 2082 | - * Counts all hours of today |
|
| 2083 | - * |
|
| 2084 | - * @return Array the hour list |
|
| 2085 | - * |
|
| 2086 | - */ |
|
| 2082 | + * Counts all hours of today |
|
| 2083 | + * |
|
| 2084 | + * @return Array the hour list |
|
| 2085 | + * |
|
| 2086 | + */ |
|
| 2087 | 2087 | public function countAllHoursFromToday($filters = array()) |
| 2088 | 2088 | { |
| 2089 | 2089 | global $globalTimezone, $globalDBdriver; |
@@ -2123,12 +2123,12 @@ discard block |
||
| 2123 | 2123 | } |
| 2124 | 2124 | |
| 2125 | 2125 | |
| 2126 | - /** |
|
| 2127 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 2128 | - * |
|
| 2129 | - * @return Integer the Barrie Spotter ID |
|
| 2126 | + /** |
|
| 2127 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 2128 | + * |
|
| 2129 | + * @return Integer the Barrie Spotter ID |
|
| 2130 | 2130 | q * |
| 2131 | - */ |
|
| 2131 | + */ |
|
| 2132 | 2132 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
| 2133 | 2133 | { |
| 2134 | 2134 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -2149,13 +2149,13 @@ discard block |
||
| 2149 | 2149 | |
| 2150 | 2150 | |
| 2151 | 2151 | /** |
| 2152 | - * Parses a date string |
|
| 2153 | - * |
|
| 2154 | - * @param String $dateString the date string |
|
| 2155 | - * @param String $timezone the timezone of a user |
|
| 2156 | - * @return Array the time information |
|
| 2157 | - * |
|
| 2158 | - */ |
|
| 2152 | + * Parses a date string |
|
| 2153 | + * |
|
| 2154 | + * @param String $dateString the date string |
|
| 2155 | + * @param String $timezone the timezone of a user |
|
| 2156 | + * @return Array the time information |
|
| 2157 | + * |
|
| 2158 | + */ |
|
| 2159 | 2159 | public function parseDateString($dateString, $timezone = '') |
| 2160 | 2160 | { |
| 2161 | 2161 | $time_array = array(); |
@@ -2188,12 +2188,12 @@ discard block |
||
| 2188 | 2188 | } |
| 2189 | 2189 | |
| 2190 | 2190 | /** |
| 2191 | - * Parses the direction degrees to working |
|
| 2192 | - * |
|
| 2193 | - * @param Float $direction the direction in degrees |
|
| 2194 | - * @return Array the direction information |
|
| 2195 | - * |
|
| 2196 | - */ |
|
| 2191 | + * Parses the direction degrees to working |
|
| 2192 | + * |
|
| 2193 | + * @param Float $direction the direction in degrees |
|
| 2194 | + * @return Array the direction information |
|
| 2195 | + * |
|
| 2196 | + */ |
|
| 2197 | 2197 | public function parseDirection($direction = 0) |
| 2198 | 2198 | { |
| 2199 | 2199 | if ($direction == '') $direction = 0; |
@@ -2272,12 +2272,12 @@ discard block |
||
| 2272 | 2272 | |
| 2273 | 2273 | |
| 2274 | 2274 | /** |
| 2275 | - * Gets Country from latitude/longitude |
|
| 2276 | - * |
|
| 2277 | - * @param Float $latitude latitute of the flight |
|
| 2278 | - * @param Float $longitude longitute of the flight |
|
| 2279 | - * @return String the countrie |
|
| 2280 | - */ |
|
| 2275 | + * Gets Country from latitude/longitude |
|
| 2276 | + * |
|
| 2277 | + * @param Float $latitude latitute of the flight |
|
| 2278 | + * @param Float $longitude longitute of the flight |
|
| 2279 | + * @return String the countrie |
|
| 2280 | + */ |
|
| 2281 | 2281 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 2282 | 2282 | { |
| 2283 | 2283 | global $globalDBdriver, $globalDebug; |
@@ -2314,11 +2314,11 @@ discard block |
||
| 2314 | 2314 | } |
| 2315 | 2315 | |
| 2316 | 2316 | /** |
| 2317 | - * Gets Country from iso2 |
|
| 2318 | - * |
|
| 2319 | - * @param String $iso2 ISO2 country code |
|
| 2320 | - * @return String the countrie |
|
| 2321 | - */ |
|
| 2317 | + * Gets Country from iso2 |
|
| 2318 | + * |
|
| 2319 | + * @param String $iso2 ISO2 country code |
|
| 2320 | + * @return String the countrie |
|
| 2321 | + */ |
|
| 2322 | 2322 | public function getCountryFromISO2($iso2) |
| 2323 | 2323 | { |
| 2324 | 2324 | global $globalDBdriver, $globalDebug; |
@@ -2347,12 +2347,12 @@ discard block |
||
| 2347 | 2347 | |
| 2348 | 2348 | |
| 2349 | 2349 | /** |
| 2350 | - * Gets the short url from bit.ly |
|
| 2351 | - * |
|
| 2352 | - * @param String $url the full url |
|
| 2353 | - * @return String the bit.ly url |
|
| 2354 | - * |
|
| 2355 | - */ |
|
| 2350 | + * Gets the short url from bit.ly |
|
| 2351 | + * |
|
| 2352 | + * @param String $url the full url |
|
| 2353 | + * @return String the bit.ly url |
|
| 2354 | + * |
|
| 2355 | + */ |
|
| 2356 | 2356 | public function getBitlyURL($url) |
| 2357 | 2357 | { |
| 2358 | 2358 | global $globalBitlyAccessToken; |
@@ -2379,11 +2379,11 @@ discard block |
||
| 2379 | 2379 | |
| 2380 | 2380 | |
| 2381 | 2381 | /** |
| 2382 | - * Gets all vessels types that have flown over |
|
| 2383 | - * |
|
| 2384 | - * @return Array the vessel type list |
|
| 2385 | - * |
|
| 2386 | - */ |
|
| 2382 | + * Gets all vessels types that have flown over |
|
| 2383 | + * |
|
| 2384 | + * @return Array the vessel type list |
|
| 2385 | + * |
|
| 2386 | + */ |
|
| 2387 | 2387 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 2388 | 2388 | { |
| 2389 | 2389 | global $globalDBdriver; |
@@ -2449,11 +2449,11 @@ discard block |
||
| 2449 | 2449 | } |
| 2450 | 2450 | |
| 2451 | 2451 | /** |
| 2452 | - * Gets all the tracker information |
|
| 2453 | - * |
|
| 2454 | - * @return Array the tracker information |
|
| 2455 | - * |
|
| 2456 | - */ |
|
| 2452 | + * Gets all the tracker information |
|
| 2453 | + * |
|
| 2454 | + * @return Array the tracker information |
|
| 2455 | + * |
|
| 2456 | + */ |
|
| 2457 | 2457 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$captain_id = '',$captain_name = '',$race_id = '',$race_name = '',$filters = array()) |
| 2458 | 2458 | { |
| 2459 | 2459 | global $globalTimezone, $globalDBdriver; |
@@ -2630,11 +2630,11 @@ discard block |
||
| 2630 | 2630 | } |
| 2631 | 2631 | |
| 2632 | 2632 | /** |
| 2633 | - * Check marine by id |
|
| 2634 | - * |
|
| 2635 | - * @return String the ident |
|
| 2636 | - * |
|
| 2637 | - */ |
|
| 2633 | + * Check marine by id |
|
| 2634 | + * |
|
| 2635 | + * @return String the ident |
|
| 2636 | + * |
|
| 2637 | + */ |
|
| 2638 | 2638 | public function checkId($id) |
| 2639 | 2639 | { |
| 2640 | 2640 | global $globalDBdriver, $globalTimezone; |
@@ -2651,11 +2651,11 @@ discard block |
||
| 2651 | 2651 | } |
| 2652 | 2652 | |
| 2653 | 2653 | /** |
| 2654 | - * Gets all info from a race |
|
| 2655 | - * |
|
| 2656 | - * @return Array race |
|
| 2657 | - * |
|
| 2658 | - */ |
|
| 2654 | + * Gets all info from a race |
|
| 2655 | + * |
|
| 2656 | + * @return Array race |
|
| 2657 | + * |
|
| 2658 | + */ |
|
| 2659 | 2659 | public function getRaceByName($race_name) |
| 2660 | 2660 | { |
| 2661 | 2661 | $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
@@ -2668,11 +2668,11 @@ discard block |
||
| 2668 | 2668 | } |
| 2669 | 2669 | |
| 2670 | 2670 | /** |
| 2671 | - * Gets all info from a race |
|
| 2672 | - * |
|
| 2673 | - * @return Array race |
|
| 2674 | - * |
|
| 2675 | - */ |
|
| 2671 | + * Gets all info from a race |
|
| 2672 | + * |
|
| 2673 | + * @return Array race |
|
| 2674 | + * |
|
| 2675 | + */ |
|
| 2676 | 2676 | public function getRace($race_id) |
| 2677 | 2677 | { |
| 2678 | 2678 | $race_id = filter_var($race_id,FILTER_SANITIZE_NUMBER_INT); |
@@ -2685,9 +2685,9 @@ discard block |
||
| 2685 | 2685 | } |
| 2686 | 2686 | |
| 2687 | 2687 | /** |
| 2688 | - * Add race |
|
| 2689 | - * |
|
| 2690 | - */ |
|
| 2688 | + * Add race |
|
| 2689 | + * |
|
| 2690 | + */ |
|
| 2691 | 2691 | public function addRace($race_id,$race_name,$race_creator,$race_desc,$race_startdate,$race_markers) |
| 2692 | 2692 | { |
| 2693 | 2693 | $race_id = filter_var($race_id,FILTER_SANITIZE_NUMBER_INT); |
@@ -91,32 +91,32 @@ |
||
| 91 | 91 | $limit_previous_2 = $limit_end - $absolute_difference; |
| 92 | 92 | |
| 93 | 93 | if ( |
| 94 | - (isset($_GET['q']) && $_GET['q'] != '') || |
|
| 95 | - (isset($_GET['registration']) && $_GET['registration'] != '') || |
|
| 96 | - (isset($_GET['aircraft']) && $_GET['aircraft'] != '') || |
|
| 97 | - (isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') || |
|
| 98 | - (isset($_GET['highlights']) && $_GET['highlights'] != '') || |
|
| 99 | - (isset($_GET['airline']) && $_GET['airline'] != '') || |
|
| 100 | - (isset($_GET['airline_country']) && $_GET['airline_country'] != '') || |
|
| 101 | - (isset($_GET['airline_type']) && $_GET['airline_type'] != '') || |
|
| 102 | - (isset($_GET['airport']) && $_GET['airport'] != '') || |
|
| 103 | - (isset($_GET['airport_country']) && $_GET['airport_country'] != '') || |
|
| 104 | - (isset($_GET['callsign']) && $_GET['callsign'] != '') || |
|
| 105 | - (isset($_GET['captain_id']) && $_GET['captain_id'] != '') || |
|
| 106 | - (isset($_GET['race_id']) && $_GET['race_id'] != '') || |
|
| 107 | - (isset($_GET['captain_name']) && $_GET['captain_name'] != '') || |
|
| 108 | - (isset($_GET['race_name']) && $_GET['race_name'] != '') || |
|
| 109 | - (isset($_GET['owner']) && $_GET['owner'] != '') || |
|
| 110 | - (isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') || |
|
| 111 | - (isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') || |
|
| 112 | - (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') || |
|
| 113 | - (isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') || |
|
| 114 | - (isset($_GET['mmsi']) && $_GET['mmsi'] != '') || |
|
| 115 | - (isset($_GET['imo']) && $_GET['imo'] != '') || |
|
| 116 | - ((isset($_GET['origlat']) && $_GET['origlat'] != '') && |
|
| 117 | - (isset($_GET['origlon']) && $_GET['origlon'] != '') && |
|
| 118 | - (isset($_GET['dist']) && $_GET['dist'] != '')) |
|
| 119 | - ){ |
|
| 94 | + (isset($_GET['q']) && $_GET['q'] != '') || |
|
| 95 | + (isset($_GET['registration']) && $_GET['registration'] != '') || |
|
| 96 | + (isset($_GET['aircraft']) && $_GET['aircraft'] != '') || |
|
| 97 | + (isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') || |
|
| 98 | + (isset($_GET['highlights']) && $_GET['highlights'] != '') || |
|
| 99 | + (isset($_GET['airline']) && $_GET['airline'] != '') || |
|
| 100 | + (isset($_GET['airline_country']) && $_GET['airline_country'] != '') || |
|
| 101 | + (isset($_GET['airline_type']) && $_GET['airline_type'] != '') || |
|
| 102 | + (isset($_GET['airport']) && $_GET['airport'] != '') || |
|
| 103 | + (isset($_GET['airport_country']) && $_GET['airport_country'] != '') || |
|
| 104 | + (isset($_GET['callsign']) && $_GET['callsign'] != '') || |
|
| 105 | + (isset($_GET['captain_id']) && $_GET['captain_id'] != '') || |
|
| 106 | + (isset($_GET['race_id']) && $_GET['race_id'] != '') || |
|
| 107 | + (isset($_GET['captain_name']) && $_GET['captain_name'] != '') || |
|
| 108 | + (isset($_GET['race_name']) && $_GET['race_name'] != '') || |
|
| 109 | + (isset($_GET['owner']) && $_GET['owner'] != '') || |
|
| 110 | + (isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') || |
|
| 111 | + (isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') || |
|
| 112 | + (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') || |
|
| 113 | + (isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') || |
|
| 114 | + (isset($_GET['mmsi']) && $_GET['mmsi'] != '') || |
|
| 115 | + (isset($_GET['imo']) && $_GET['imo'] != '') || |
|
| 116 | + ((isset($_GET['origlat']) && $_GET['origlat'] != '') && |
|
| 117 | + (isset($_GET['origlon']) && $_GET['origlon'] != '') && |
|
| 118 | + (isset($_GET['dist']) && $_GET['dist'] != '')) |
|
| 119 | + ){ |
|
| 120 | 120 | $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
| 121 | 121 | $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
| 122 | 122 | $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |