function audit($msg) { if (defined('AUDIT') && AUDIT) { $db = DB::Instance(); $debug = $db->debug; $db->debug = FALSE; $audit = Audit::Instance(); $audit->write($msg, TRUE, microtime(TRUE) - START_TIME); $db->debug($debug); } }
$email_body = "Request: " . $_SERVER['REQUEST_URI'] . "\n"; $email_body .= "uzERP Version: " . $config->get('SYSTEM_VERSION') . "\n\n" . $exception->getMessage(); $smarty->assign('email_body', rawurlencode($email_body)); $smarty->display(STANDARD_TPL_ROOT . 'error.tpl'); } // set the error reporting based on the environment switch (strtolower(get_config('ENVIRONMENT'))) { case 'development': error_reporting(E_ALL ^ E_USER_DEPRECATED ^ E_DEPRECATED ^ E_NOTICE); // error_reporting(E_ALL); break; case 'production': default: error_reporting(E_ERROR); break; } // define where the log should go, syslog or a file of your liking with $log = $_SERVER["DOCUMENT_ROOT"] . 'data/logs/' . session_id() . '.log'; // set the php_ini error log value with the log path ini_set("error_log", $log); // ******************* // LOAD THE FRAMEWORK $system->display(); if (AUDIT || get_config('AUDIT_LOGIN')) { if (is_array($system->controller->_data) && isset($system->controller->_data['password'])) { $system->controller->_data['password'] = '******'; } $audit = Audit::Instance(); $audit->write(print_r($system->controller->_data, TRUE) . print_r($system->flash, TRUE), TRUE, microtime(TRUE) - START_TIME); $audit->update(); }
function logout() { if (AUDIT || get_config('AUDIT_LOGIN')) { $audit = Audit::Instance(); $audit->write('logout', TRUE, microtime(TRUE) - START_TIME); $audit->update(); } session_destroy(); session_unset(); //remove session cookie $params = session_get_cookie_params(); setcookie(session_name(), '', 0, $params['path'], $params['domain'], $params['secure'], isset($params['httponly'])); // don't show the login form for non-interactive logins $injector = $this->_injector; $authentication = $injector->Instantiate('LoginHandler'); if (!$authentication->interactive()) { $this->view->display($this->getTemplateName('logout')); exit; } header("Location: /"); exit; }