diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/engelsystem.php | 77 | ||||
-rw-r--r-- | includes/includes.php (renamed from includes/engelsystem_provider.php) | 70 |
2 files changed, 77 insertions, 70 deletions
diff --git a/includes/engelsystem.php b/includes/engelsystem.php new file mode 100644 index 00000000..f9535847 --- /dev/null +++ b/includes/engelsystem.php @@ -0,0 +1,77 @@ +<?php + +use Engelsystem\Application; +use Engelsystem\Config\Config; +use Engelsystem\Exceptions\Handler as ExceptionHandler; +use Engelsystem\Http\Request; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; +use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; + +/** + * This file includes all needed functions, connects to the db etc. + */ +require_once __DIR__ . '/autoload.php'; + + +/** + * Initialize and bootstrap the application + */ +$app = new Application(realpath(__DIR__ . DIRECTORY_SEPARATOR . '..')); +$appConfig = $app->make(Config::class); +$appConfig->set(require config_path('app.php')); +$app->bootstrap($appConfig); + + +/** + * Configure application + */ +date_default_timezone_set($app->get('config')->get('timezone')); + +if (config('environment') == 'development') { + $errorHandler = $app->get('error.handler'); + $errorHandler->setEnvironment(ExceptionHandler::ENV_DEVELOPMENT); + ini_set('display_errors', true); + error_reporting(E_ALL); +} else { + ini_set('display_errors', false); +} + + +/** + * Check for maintenance + */ +if ($app->get('config')->get('maintenance')) { + echo file_get_contents(__DIR__ . '/../templates/maintenance.html'); + die(); +} + + +/** + * Initialize Request + * + * @var Request $request + */ +$request = Request::createFromGlobals(); +$app->instance('request', $request); + + +/** + * Include legacy code + */ +require __DIR__ . '/includes.php'; + + +/** + * Init application + */ +$sessionStorage = (PHP_SAPI != 'cli' ? new NativeSessionStorage(['cookie_httponly' => true]) : new MockArraySessionStorage()); +$session = new Session($sessionStorage); +$app->instance('session', $session); +$session->start(); +$request->setSession($session); + + +gettext_init(); + +load_auth(); diff --git a/includes/engelsystem_provider.php b/includes/includes.php index 48206cb6..a42f960f 100644 --- a/includes/engelsystem_provider.php +++ b/includes/includes.php @@ -1,61 +1,5 @@ <?php -use Engelsystem\Application; -use Engelsystem\Config\Config; -use Engelsystem\Exceptions\Handler as ExceptionHandler; -use Engelsystem\Http\Request; -use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; - -/** - * This file includes all needed functions, connects to the db etc. - */ -require_once __DIR__ . '/autoload.php'; - - -/** - * Initialize and bootstrap the application - */ -$app = new Application(realpath(__DIR__ . DIRECTORY_SEPARATOR . '..')); -$appConfig = $app->make(Config::class); -$appConfig->set(require config_path('app.php')); -$app->bootstrap($appConfig); - - -/** - * Configure application - */ -date_default_timezone_set($app->get('config')->get('timezone')); - -if (config('environment') == 'development') { - $errorHandler = $app->get('error.handler'); - $errorHandler->setEnvironment(ExceptionHandler::ENV_DEVELOPMENT); - ini_set('display_errors', true); - error_reporting(E_ALL); -} else { - ini_set('display_errors', false); -} - - -/** - * Check for maintenance - */ -if ($app->get('config')->get('maintenance')) { - echo file_get_contents(__DIR__ . '/../templates/maintenance.html'); - die(); -} - - -/** - * Initialize Request - * - * @var Request $request - */ -$request = Request::createFromGlobals(); -$app->instance('request', $request); - - /** * Include legacy code */ @@ -140,17 +84,3 @@ $includeFiles = [ foreach ($includeFiles as $file) { require_once realpath($file); } - - -/** - * Init application - */ -$sessionStorage = (PHP_SAPI != 'cli' ? new NativeSessionStorage(['cookie_httponly' => true]) : new MockArraySessionStorage()); -$session = new Session($sessionStorage); -$app->instance('session', $session); -$session->start(); -$request->setSession($session); - -gettext_init(); - -load_auth(); |