本文整理汇总了PHP中Audit类的典型用法代码示例。如果您正苦于以下问题:PHP Audit类的具体用法?PHP Audit怎么用?PHP Audit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Audit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPrepare
public function testPrepare()
{
$this->_initSequenceTables();
// test audit first
$audit = new Audit();
$audit->_ormPersist = true;
$audit->objectClass = 'StdClass';
$audit->persist();
$this->assertTrue($audit->auditId > 0, 'Audit: Failed to persist');
if ($audit->auditId > 0) {
$audit->setPersistMode(WebVista_Model_ORM::DELETE);
$audit->persist();
}
$auditValue = new AuditValue();
$auditValue->_ormPersist = true;
$auditValue->key = 'Key';
$auditValue->value = 'Value';
$auditValue->persist();
$this->assertTrue($auditValue->auditValueId > 0, 'AuditValue: Failed to persist');
if ($auditValue->auditValueId > 0) {
$auditValue->setPersistMode(WebVista_Model_ORM::DELETE);
$auditValue->persist();
}
if ($this->_autoLoggedIn) {
$this->_setupAutoLogin();
}
}
示例2: logAudit
public static function logAudit($entity, $action, $description)
{
$audit = new Audit();
$audit->date = date('Y-m-d');
$audit->description = $description;
$audit->user = Confide::user()->username;
$audit->entity = $entity;
$audit->action = $action;
$audit->save();
}
示例3: action_logs
public function action_logs($page = 1)
{
if (!$this->getAuth()->hasAccess('maccess.admin')) {
return $this->redirectToAdmin();
}
$this->param_manager->setParam('method_title', [_i('Audit'), _i('Logs')]);
if ($page < 1 || !ctype_digit((string) $page)) {
$page = 1;
}
$logs = $this->audit->getPagedBy('id', 'desc', $page);
$this->builder->createPartial('body', 'moderation/audit_log')->getParamManager()->setParams(['logs' => $logs, 'page' => $page, 'page_url' => $this->uri->create('admin/moderation/logs')]);
return new Response($this->builder->build());
}
示例4: addDbAuditLogEntry
function addDbAuditLogEntry($action, $class, $id)
{
if ($class != "Audit") {
$log = new Audit($this->w);
$log->module = $this->w->currentModule();
$log->submodule = $this->w->currentSubModule();
$log->action = $this->w->currentAction();
$log->path = $_SERVER['REQUEST_URI'];
$log->ip = $this->w->requestIpAddress();
$log->db_action = $action;
$log->db_class = $class;
$log->db_id = $id;
$log->insert();
}
}
示例5: hookExpiredSession
public static function hookExpiredSession($sessionContents)
{
if (session_decode($sessionContents)) {
if (Zend_Auth::getInstance()->hasIdentity()) {
$identity = Zend_Auth::getInstance()->getIdentity();
$audit = new Audit();
$audit->objectClass = 'Logout';
$audit->userId = (int) $identity->personId;
$audit->message = __('user') . ': ' . $identity->username . ' ' . __('was logged out due to session expiration');
$audit->dateTime = date('Y-m-d H:i:s');
$audit->_ormPersist = true;
$audit->persist();
}
}
}
示例6: testUserLoggedOut
public function testUserLoggedOut()
{
$this->_objects = GeneralAlertHandler::generateUserLoggedOut();
$objects = array();
$db = Zend_Registry::get('dbAdapter');
$audit = new Audit();
$audit->_ormPersist = true;
$audit->objectClass = 'Logout';
$audit->objectId = 0;
$audit->dateTime = date('Y-m-d H:i:s');
$audit->type = WebVista_Model_ORM::REPLACE;
$audit->userId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
$audit->persist();
$objects['audit'] = $audit;
$clinicalNote = new ClinicalNote();
$clinicalNote->personId = $this->_objects['person']->person_id;
$clinicalNote->visitId = 100;
$clinicalNote->clinicalNoteDefinitionId = 19;
$clinicalNote->dateTime = date('Y-m-d H:i:s');
$clinicalNote->eSignatureId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
$clinicalNote->persist();
$objects['clinicalNote'] = $clinicalNote;
$eSign = new ESignature();
// cleanup all generalAlerts
$db->query('DELETE FROM ' . $eSign->_table);
$eSign->dateTime = date('Y-m-d H:i:s');
$eSign->signedDateTime = '0000-00-00 00:00:00';
$eSign->signingUserId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
$eSign->objectId = $clinicalNote->clinicalNoteId;
$eSign->objectClass = get_class($clinicalNote);
$eSign->summary = ' **Unsigned**';
$eSign->persist();
$objects['eSignature'] = $eSign;
// cleanup all generalAlerts
$generalAlert = new GeneralAlert();
$db->query('DELETE FROM ' . $generalAlert->_table);
$process = Processingd::getInstance();
$process->clearProcesses();
$process->addProcess(new ProcessAlert());
$process->startProcessing(false);
$generalAlertIterator = $generalAlert->getIterator();
$ctr = 0;
foreach ($generalAlertIterator as $alert) {
$objects['generalAlert' . $ctr++] = $alert;
}
$this->assertEquals($ctr, 1, 'No alert created even with signed items');
$this->_cleanUpObjects($objects);
}
示例7: getInstance
/**
* @param Registry $registry
* @return Audit
*/
public static function getInstance($registry)
{
if (empty(Audit::$instance)) {
Audit::$instance = new Audit($registry);
}
return Audit::$instance;
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$save = $this->category->create(Input::all());
//store the logs
Audit::store('Settings', 'Added a new category with an id of ' . $save->id);
return Redirect::to('/categories')->with(['flash_message' => 'Category has been saved.', 'flash_type' => 'alert-success', 'title' => 'Category list', 'categories' => $this->category->all()]);
}
示例9: addPlugin
private function addPlugin()
{
$audit = \Audit::instance();
$this->f3->scrub($_POST);
$this->f3->set('SESSION.flash', array());
// process form if > 0 plugins have been selected
if ($this->f3->exists('POST.plugins') && count($this->f3->get('POST.plugins')) > 0) {
foreach ($this->f3->get('POST.plugins') as $package) {
// validate plugin
if ($this->plugins->getPackage($package) !== false) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => '"' . $package . '" is already installed. Skipping.'));
} else {
if (!($config = $this->plugins->getRemoteConfig($package))) {
$this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => '"' . $package . '" could not be installed. (missing mytcg.json config file)'));
} else {
if (!isset($config['name']) || !isset($config['author']) || !isset($config['version']) || !isset($config['description'])) {
$this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => '"' . $package . '" could not be installed. (invalid mytcg.json config file)'));
}
}
}
// process install if there are no errors
if (count($this->f3->get('SESSION.flash')) === 0) {
if ($this->plugins->install($package, $this->plugins)) {
$this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => '"' . $package . '" has been installed successfully!'));
} else {
$this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => '"' . $package . '" could not be installed.'));
}
}
}
}
}
示例10: __construct
function __construct()
{
parent::__construct();
$this->user = new \DB\SQL\Mapper($this->db, 'users');
$this->audit = \Audit::instance();
$this->bcrypt = \BCrypt::instance();
}
示例11: audit
private function audit($markerSite, $action)
{
Log::info("Auditing " . $markerSite->id . "for " . $action);
$data = $this->getAuditData($markerSite);
$data["action"] = $action;
Audit::create($data);
}
示例12: email
/**
* validate email address
* @param string $val
* @param string $context
* @param bool $mx
* @return bool
*/
function email($val, $context = null, $mx = true)
{
$valid = true;
if (!$context) {
$context = 'error.validation.email';
}
if (!empty($val)) {
if (!\Audit::instance()->email($val, false)) {
$val = NULL;
if (!$this->f3->exists($context . '.invalid', $errText)) {
$errText = 'e-mail is not valid';
}
$this->f3->error(400, $errText);
$valid = false;
} elseif ($mx && !\Audit::instance()->email($val, true)) {
$val = NULL;
if (!$this->f3->exists($context . '.host', $errText)) {
$errText = 'unknown mail mx.host';
}
$this->f3->error(400, $errText);
$valid = false;
}
}
if (!$valid) {
\Flash::instance()->setKey($context, 'has-error');
}
return $valid;
}
示例13: process
private function process()
{
$this->f3->scrub($_POST);
$audit = \Audit::instance();
$this->f3->set('SESSION.flash', array());
// validate form
if (!preg_match("/^[\\w\\- ]{2,30}\$/", $this->f3->get('POST.name'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid name.'));
}
if (!$audit->email($this->f3->get('POST.email'), FALSE)) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid email address'));
}
if (!empty($this->f3->get('POST.url')) && !$audit->url($this->f3->get('POST.url'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid URL.'));
}
if (empty($this->f3->get('POST.message'))) {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Please include a message!'));
}
// honey pot
if ($this->f3->get('POST.username') !== '') {
$this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Please do not use autofill or similar tools!'));
}
// if there are no errors, process the form
if (count($this->f3->get('SESSION.flash')) === 0) {
$this->f3->set('POST.level', $this->f3->get('member')->level + 1);
$mailer = new Mailer();
$message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Contact Form')->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG'))->setTo(array($this->f3->get('tcgemail')))->setReplyTo(array($this->f3->get('POST.email')))->setBody(Template::instance()->render('app/templates/emails/contact.htm'), 'text/html');
if ($mailer->send($message)) {
$this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your form has been sent. Thanks for contacting us!'));
} else {
$this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'There was a problem processing your request. Please try again or contact us for assistance!'));
}
}
}
示例14: Audit
static function &Instance($type = null)
{
static $audit = NULL;
if (!$audit) {
$audit = new Audit();
$result = false;
$result = $audit->loadBy('sessionid', session_id());
if ($result === false) {
$data = array('sessionid' => session_id(), 'username' => '', 'customer_id' => '');
if (isset($_SESSION['username'])) {
$data['username'] = $_SESSION['username'];
}
if (isset($_SESSION['customer_id'])) {
$data['customer_id'] = $_SESSION['customer_id'];
}
$errors = array();
$audit = Audit::Factory($data, $errors, 'Audit');
$audit->save();
}
}
if (isset($_SESSION['username']) && $audit->username != $_SESSION['username']) {
$audit->username = $_SESSION['username'];
$audit->save();
}
return $audit;
}
示例15: _populateAudits
protected function _populateAudits()
{
$audit = new Audit();
$db = Zend_Registry::get('dbAdapter');
$dbSelect = $db->select()->from($audit->_table)->where("startProcessing = '0000-00-00 00:00:00'")->orWhere("endProcessing = '0000-00-00 00:00:00'");
$this->_audits = $audit->getIterator($dbSelect);
}