2017-11-01 12:35:45 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Engelsystem\Application;
|
|
|
|
use Engelsystem\Config\Config;
|
2017-11-20 17:08:05 +01:00
|
|
|
use Engelsystem\Exceptions\BasicHandler as ExceptionHandler;
|
2017-11-01 12:35:45 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This file includes all needed functions, connects to the db etc.
|
|
|
|
*/
|
|
|
|
require_once __DIR__ . '/autoload.php';
|
|
|
|
|
|
|
|
|
2017-11-01 14:47:09 +01:00
|
|
|
/**
|
|
|
|
* Include legacy code
|
|
|
|
*/
|
|
|
|
require __DIR__ . '/includes.php';
|
|
|
|
|
|
|
|
|
2017-11-01 12:35:45 +01:00
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2017-11-01 14:47:09 +01:00
|
|
|
* Init translations
|
2017-11-01 12:35:45 +01:00
|
|
|
*/
|
2017-11-01 14:47:09 +01:00
|
|
|
gettext_init();
|
2017-11-01 12:35:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2017-11-01 14:47:09 +01:00
|
|
|
* Init authorization
|
2017-11-01 12:35:45 +01:00
|
|
|
*/
|
|
|
|
load_auth();
|