<?php
use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
/*
function test($chain) {
if(filter_var($chain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$xp = explode(':',$chain);
$xp = $xp[0].":".$xp[1].":".$xp[2].":".$xp[3];
return $xp;
}
return $chain;
}
$allowedIp[] = "89.89.11.243";
$allowedIp[] = "92.140.230.229";
$allowedIp[] = test("2a01:cb10:29d:9100:b0cf:2f76:ade:d1b6");
$allowedIp[] = test("2a01:e0a:2d8:7b70:f99c:476e:ae40:8c2d");
$allowedIp[] = "81.250.218.17"; // PB School
$allowedIp[] = "176.136.245.81"; // PB
$allowedIp[] = test("2001:861:4285:8fc0:edd9:f5cc:860e:795b"); // PB
if(!in_array(@test($_SERVER['REMOTE_ADDR']),$allowedIp)) {
header('HTTP/1.0 403 Forbidden');
exit();
}
*/
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);