summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/engelsystem.php77
-rw-r--r--includes/includes.php (renamed from includes/engelsystem_provider.php)70
-rw-r--r--public/index.php6
-rw-r--r--tests/Feature/Logger/EngelsystemLoggerTest.php2
-rw-r--r--tests/Feature/Model/LogEntriesModelTest.php2
-rw-r--r--tests/Feature/Model/RoomModelTest.php2
6 files changed, 85 insertions, 74 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();
diff --git a/public/index.php b/public/index.php
index c65dbdf8..69d92127 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,6 +1,8 @@
<?php
-require_once realpath(__DIR__ . '/../includes/engelsystem_provider.php');
+use Engelsystem\Http\Request;
+
+require_once realpath(__DIR__ . '/../includes/engelsystem.php');
$free_pages = [
'admin_event_config',
@@ -25,6 +27,8 @@ $page = '';
$title = '';
$content = '';
+/** @var Request $request */
+$request = $app->get('request');
$page = $request->query->get('p');
if (empty($page)) {
$page = $request->path();
diff --git a/tests/Feature/Logger/EngelsystemLoggerTest.php b/tests/Feature/Logger/EngelsystemLoggerTest.php
index 9f502198..8886d4ba 100644
--- a/tests/Feature/Logger/EngelsystemLoggerTest.php
+++ b/tests/Feature/Logger/EngelsystemLoggerTest.php
@@ -12,7 +12,7 @@ class EngelsystemLoggerTest extends TestCase
{
public static function setUpBeforeClass()
{
- require_once __DIR__ . '/../../../includes/engelsystem_provider.php';
+ require_once __DIR__ . '/../../../includes/engelsystem.php';
}
/**
diff --git a/tests/Feature/Model/LogEntriesModelTest.php b/tests/Feature/Model/LogEntriesModelTest.php
index 2678dcb5..036f5692 100644
--- a/tests/Feature/Model/LogEntriesModelTest.php
+++ b/tests/Feature/Model/LogEntriesModelTest.php
@@ -9,7 +9,7 @@ class LogEntriesModelTest extends TestCase
{
public static function setUpBeforeClass()
{
- require_once __DIR__ . '/../../../includes/engelsystem_provider.php';
+ require_once __DIR__ . '/../../../includes/engelsystem.php';
}
public function testCreateLogEntry()
diff --git a/tests/Feature/Model/RoomModelTest.php b/tests/Feature/Model/RoomModelTest.php
index 20b9e34d..3114ba2d 100644
--- a/tests/Feature/Model/RoomModelTest.php
+++ b/tests/Feature/Model/RoomModelTest.php
@@ -10,7 +10,7 @@ class RoomModelTest extends TestCase
public static function setUpBeforeClass()
{
- require_once __DIR__ . '/../../../includes/engelsystem_provider.php';
+ require_once __DIR__ . '/../../../includes/engelsystem.php';
}
public function create_Room()