2021-03-30 19:12:01 +01:00
|
|
|
<?php
|
|
|
|
|
2020-02-03 18:01:16 +00:00
|
|
|
use App\Kernel;
|
2019-12-30 11:36:29 +00:00
|
|
|
use Symfony\Component\ErrorHandler\Debug;
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
2020-11-27 16:29:41 +00:00
|
|
|
require __DIR__ . '/../config/bootstrap.php';
|
2019-12-30 11:36:29 +00:00
|
|
|
|
|
|
|
if ($_SERVER['APP_DEBUG']) {
|
|
|
|
umask(0000);
|
|
|
|
|
|
|
|
Debug::enable();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
|
2021-10-29 17:51:24 +01:00
|
|
|
Request::setTrustedProxies(
|
|
|
|
explode(',', $trustedProxies),
|
|
|
|
Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST
|
|
|
|
);
|
2019-12-30 11:36:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
|
|
|
|
Request::setTrustedHosts([$trustedHosts]);
|
|
|
|
}
|
|
|
|
|
2024-03-18 15:48:42 +00:00
|
|
|
if (!file_exists('legacy/config.php') && !file_exists('../.installed_checked') && !file_exists('../.curl_check_main_page')){
|
2024-01-09 10:12:09 +00:00
|
|
|
header('Location: install.php');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-30 19:12:01 +01:00
|
|
|
// Get the autoloader class
|
2020-11-27 16:29:41 +00:00
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
2021-03-30 19:12:01 +01:00
|
|
|
|
2019-12-30 11:36:29 +00:00
|
|
|
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
|
|
|
|
$request = Request::createFromGlobals();
|
2021-10-29 17:51:24 +01:00
|
|
|
|
2024-05-28 10:34:28 +01:00
|
|
|
$kernel->init();
|
|
|
|
|
2021-10-29 17:51:24 +01:00
|
|
|
global $legacyRoute;
|
|
|
|
|
|
|
|
$legacyRoute = $kernel->getLegacyRoute($request);
|
|
|
|
|
|
|
|
if (!empty($legacyRoute)) {
|
|
|
|
|
|
|
|
$path = './legacy';
|
|
|
|
if (!empty($legacyRoute['dir'])) {
|
|
|
|
$path .= '/' . $legacyRoute['dir'];
|
|
|
|
}
|
|
|
|
|
|
|
|
chdir($path);
|
|
|
|
|
2021-11-12 12:40:49 +00:00
|
|
|
$access = $legacyRoute['access'] ?? false;
|
|
|
|
if ($access === false) {
|
|
|
|
http_response_code(404);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (file_exists($legacyRoute['file'])) {
|
|
|
|
|
|
|
|
/* @noinspection PhpIncludeInspection */
|
2024-05-28 10:34:28 +01:00
|
|
|
require './' . $legacyRoute['file'];
|
2021-11-12 12:40:49 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
http_response_code(404);
|
|
|
|
exit;
|
|
|
|
}
|
2021-10-29 17:51:24 +01:00
|
|
|
|
|
|
|
} else {
|
2023-11-06 16:03:39 +00:00
|
|
|
$kernel->configureGraphqlIntrospection();
|
2021-10-29 17:51:24 +01:00
|
|
|
$response = $kernel->handle($request);
|
|
|
|
$response->send();
|
|
|
|
$kernel->terminate($request, $response);
|
|
|
|
}
|