summaryrefslogtreecommitdiff
path: root/includes/engelsystem.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-11-12 13:25:56 +0100
committerGitHub <noreply@github.com>2017-11-12 13:25:56 +0100
commitebc973bf221bfbde327868975221e62704e4cb99 (patch)
tree9011a160f3d6f9cae37fc02836e7d6e8c25242ca /includes/engelsystem.php
parent801c17aa6cef91be988a25a90442be8d2078a70d (diff)
parentad948bdd3201e922b626a736b0122533bdd37cae (diff)
Merge pull request #349 from MyIgel/master
Changed container to Illuminate/Container and added service providers
Diffstat (limited to 'includes/engelsystem.php')
-rw-r--r--includes/engelsystem.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/includes/engelsystem.php b/includes/engelsystem.php
new file mode 100644
index 00000000..97076895
--- /dev/null
+++ b/includes/engelsystem.php
@@ -0,0 +1,61 @@
+<?php
+
+use Engelsystem\Application;
+use Engelsystem\Config\Config;
+use Engelsystem\Exceptions\Handler as ExceptionHandler;
+
+/**
+ * This file includes all needed functions, connects to the db etc.
+ */
+require_once __DIR__ . '/autoload.php';
+
+
+/**
+ * Include legacy code
+ */
+require __DIR__ . '/includes.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();
+}
+
+
+/**
+ * Init translations
+ */
+gettext_init();
+
+
+/**
+ * Init authorization
+ */
+load_auth();