Inheritance: extends ApplicationController
示例#1
0
文件: index.php 项目: ben33/framework
}
$request->langue = $response->langue = $userLangue;
define('LANGUE', $request->langue->code);
define('BASE_URL_LANGUE', BASE_URL . $request->langue->code . '/');
ini_set('default_charset', CHARSET);
setlocale(LC_TIME, $request->langue->locale . '.' . mb_strtolower(CHARSET));
if (in_array('translations', $backoModules) && file_exists(ROOT . 'traductions.inc.php')) {
    Translator::init($request->langue->code, DEFAULT_LANG);
}
require_once APPLICATION_ROOT . 'UrlFactory.php';
UrlSingleton::init(new UrlFactory(), $request->langue);
if (in_array('admins', $allowedModules) && (empty($_SESSION['admin']) || !($admin = DBFactory::get('admins')->get($_SESSION['admin'])) instanceof Admin) && $request->url != UrlFactory::module('admins', 'login') && $request->url != UrlFactory::module('admins', 'init')) {
    Header::location(UrlFactory::module('admins', 'login'));
}
try {
    if (!file_exists($file = APPLICATION_MODULES . $request->module . DS . $request->controller . '.php')) {
        throw new Error404Exception($response);
    }
    require $file;
    $controller = new $request->controller($response);
    Logger::addPhpLog($request);
    if (!method_exists($controller, $request->method)) {
        throw new Error404Exception($response);
    }
    $controller->handleRequest($request);
} catch (Error404Exception $exception) {
    require APPLICATION_MODULES . 'errors' . DS . 'ErrorsController.php';
    $controller = new ErrorsController($response);
    $controller->get404();
}
$response->send($request);
示例#2
0
 /**
  * display system error page as result or error or exception
  *
  */
 private static function viewError()
 {
     $controller = new ErrorsController();
     $controller->error("system");
 }