123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?php
- define('LARAVEL_START', microtime(true));
- define('BASE_PATH', realpath('../').'/');
- define('APP_PATH', realpath('../application').'/');
- define('SYS_PATH', realpath('../system').'/');
- define('PUBLIC_PATH', realpath(__DIR__.'/'));
- define('PACKAGE_PATH', APP_PATH.'packages/');
- define('EXT', '.php');
- require SYS_PATH.'config'.EXT;
- require SYS_PATH.'arr'.EXT;
- spl_autoload_register(require SYS_PATH.'loader'.EXT);
- error_reporting((System\Config::get('error.detail')) ? E_ALL | E_STRICT : 0);
- set_exception_handler(function($e)
- {
- require_once SYS_PATH.'error'.EXT;
- System\Error::handle($e);
- });
- set_error_handler(function($number, $error, $file, $line)
- {
- require_once SYS_PATH.'error'.EXT;
- System\Error::handle(new ErrorException($error, 0, $number, $file, $line));
- });
- register_shutdown_function(function()
- {
- if ( ! is_null($error = error_get_last()))
- {
- require_once SYS_PATH.'error'.EXT;
- System\Error::handle(new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']));
- }
- });
- date_default_timezone_set(System\Config::get('application.timezone'));
- if (System\Config::get('session.driver') != '')
- {
- System\Session::load();
- }
- $response = System\Route\Filter::call('before', array(), true);
- if (is_null($response))
- {
-
-
-
- $route = System\Router::route(Request::method(), Request::uri());
-
-
-
- if ( ! is_null($route))
- {
- $response = $route->call();
- }
- else
- {
- $response = System\Response::make(View::make('error/404'), 404);
- }
- }
- else
- {
- $response = System\Response::prepare($response);
- }
- System\Route\Filter::call('after', array($response));
- $response->content = (string) $response->content;
- if (System\Config::get('session.driver') != '')
- {
- System\Session::close();
- }
- $response->send();
|