<?php
use webbi\util\ErrorHandler;
use webbi\config\Config;
/*
* Session management
* ----------------------
* Session is manually expired if client been inactive for more
* then 30 minutes.
*/
if(is_writeable(Config::instance()->getParameter(Config::SESSION_PATH)))
session_save_path(Config::instance()->getParameter(Config::SESSION_PATH));
session_start();
$session_expire_time = isset($_SESSION['webbi_sess_expires']) ? $_SESSION['webbi_sess_expires']:0;
if(time() > $session_expire_time)
$_SESSION = array();
$_SESSION['webbi_sess_expires'] = time() + 1800;
/*
* Error management
* -------------------------
* All errors will be sent to client if application is configured to run in
* test mode. Webbi framework has an internal error handler. This function
* will output information about the error to client if application is
* configured to run in test mode. Error messages will also be written to
* log file declared in config.ini
*/
error_reporting(config::instance()->isTrue(Config::TEST_MODE) ? E_ALL : 0);
set_error_handler(function($errno, $errstr, $errfile, $errline) {
$eh = new ErrorHandler($errno, $errstr, $errfile, $errline);
$eh->execute();
return true;
});
// Set locale
setlocale(LC_ALL, Config::instance()->getParameter(Config::LOCALE));