Returns a Horde_History_Log corresponding to the named history entry,
with the data retrieved appropriately.
public getHistory ( string $guid ) : Horde_History_Log | ||
$guid | string | The name of the history entry to retrieve. |
리턴 | Horde_History_Log | A Horde_History_Log object. |
/** */ public function getLog(IMP_Maillog_Message $msg, array $types = array()) { global $conf; $out = array(); /* Unless configured, this driver doesn't support MDN. */ if (!empty($types) && empty($conf['maillog']['mdn_history'])) { $types = array_diff($types, array('IMP_Maillog_Log_Mdn')); if (empty($types)) { return $out; } } try { $history = $this->_history->getHistory($this->_getUniqueHistoryId($msg)); } catch (Exception $e) { return $out; } foreach ($history as $val) { if (!isset(static::$drivers[$val['action']])) { continue; } $ob = new static::$drivers[$val['action']]($val); if (!empty($types) && !in_array(get_class($ob), $types)) { continue; } $ob->timestamp = $val['ts']; $out[] = $ob; } return $out; }
/** */ public function getLog(IMP_Maillog_Message $msg, array $filter = array()) { $out = array(); try { $history = $this->_history->getHistory($this->_getUniqueHistoryId($msg)); } catch (Exception $e) { return $out; } foreach ($history as $val) { if (!in_array($val['action'], $filter)) { switch ($val['action']) { case 'forward': $ob = new IMP_Maillog_Log_Forward($val['recipients']); break; case 'mdn': $ob = new IMP_Maillog_Log_Mdn(); break; case 'redirect': $ob = new IMP_Maillog_Log_Redirect($val['recipients']); break; case 'reply': $ob = new IMP_Maillog_Log_Reply(); break; case 'reply_all': $ob = new IMP_Maillog_Log_Replyall(); break; case 'reply_list': $ob = new IMP_Maillog_Log_Replylist(); break; default: continue 2; } $ob->timestamp = $val['ts']; $out[] = $ob; } } return $out; }
/** * Handles a bad login. * * @param string $userId The user with a bad login. * * @throws Horde_Auth_Exception */ protected function _badLogin($userId) { if (!$this->_history_api) { throw new Horde_Auth_Exception('Unsupported.'); } $history_identifier = $userId . '@logins.failed'; try { $this->_history_api->log($history_identifier, array('action' => 'login_failed', 'who' => $userId)); $history_log = $this->_history_api->getHistory($history_identifier); if ($this->_params['login_block_count'] > 0 && $this->_params['login_block_count'] <= $history_log->count() && $this->hasCapability('lock')) { $this->lockUser($userId, $this->_params['login_block_time']); } } catch (Horde_History_Exception $e) { throw new Horde_Auth_Exception($e); } }
/** * Update the history log for an object. * * @param string $object The object ID. * @param string $bid The backend ID of * the object. * @param Horde_Kolab_Storage_Folder_Stamp $stamp The folder stamp. * * @return NULL */ private function _updateLog($object, $bid, $stamp) { $log = $this->history->getHistory($object); if (count($log) == 0) { $this->history->log($object, array('action' => 'add', 'bid' => $bid, 'stamp' => $stamp)); } else { $last = array('ts' => 0); foreach ($log as $entry) { if ($entry['ts'] > $last['ts']) { $last = $entry; } } if (!isset($last['bid']) || $last['bid'] != $bid || isset($last['stamp']) && $last['stamp']->isReset($stamp)) { $this->history->log($object, array('action' => 'modify', 'bid' => $bid, 'stamp' => $stamp)); } } }
/** * @see Horde_History::getHistory() */ public function getHistory($guid) { return $this->_history->getHistory($guid); }