public/index.php line 51

Open in your IDE?
  1. <?php
  2. use App\Kernel;
  3. use Symfony\Component\Dotenv\Dotenv;
  4. use Symfony\Component\ErrorHandler\Debug;
  5. use Symfony\Component\HttpFoundation\Request;
  6. require dirname(__DIR__).'/vendor/autoload.php';
  7. (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
  8. /*
  9. function test($chain) {
  10.     if(filter_var($chain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
  11.         $xp = explode(':',$chain);
  12.         $xp = $xp[0].":".$xp[1].":".$xp[2].":".$xp[3];
  13.         return $xp;
  14.     }
  15.     return $chain;
  16. }
  17. $allowedIp[] = "89.89.11.243";
  18. $allowedIp[] = "92.140.230.229";
  19. $allowedIp[] = test("2a01:cb10:29d:9100:b0cf:2f76:ade:d1b6");
  20. $allowedIp[] = test("2a01:e0a:2d8:7b70:f99c:476e:ae40:8c2d");
  21. $allowedIp[] = "81.250.218.17"; // PB School
  22. $allowedIp[] = "176.136.245.81"; // PB
  23. $allowedIp[] = test("2001:861:4285:8fc0:edd9:f5cc:860e:795b"); // PB
  24. if(!in_array(@test($_SERVER['REMOTE_ADDR']),$allowedIp)) {
  25.     header('HTTP/1.0 403 Forbidden');
  26.     exit();
  27. }
  28. */
  29. if ($_SERVER['APP_DEBUG']) {
  30.     umask(0000);
  31.     Debug::enable();
  32. }
  33. if ($trustedProxies $_SERVER['TRUSTED_PROXIES'] ?? false) {
  34.     Request::setTrustedProxies(explode(','$trustedProxies), Request::HEADER_X_FORWARDED_ALL Request::HEADER_X_FORWARDED_HOST);
  35. }
  36. if ($trustedHosts $_SERVER['TRUSTED_HOSTS'] ?? false) {
  37.     Request::setTrustedHosts([$trustedHosts]);
  38. }
  39. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  40. $request Request::createFromGlobals();
  41. $response $kernel->handle($request);
  42. $response->send();
  43. $kernel->terminate($request$response);