public/index.php line 69

  1. <?php
  2. declare(strict_types=1);
  3. $allowedIPs = ['109.182.248.23''109.182.66.203''192.168.1.18' ];
  4. /*
  5.  * This file is part of Sulu.
  6.  *
  7.  * (c) Sulu GmbH
  8.  *
  9.  * This source file is subject to the MIT license that is bundled
  10.  * with this source code in the file LICENSE.
  11.  */
  12. use App\Kernel;
  13. use Sulu\Component\HttpKernel\SuluKernel;
  14. use Symfony\Component\Dotenv\Dotenv;
  15. use Symfony\Component\ErrorHandler\Debug;
  16. use Symfony\Component\HttpFoundation\Request;
  17. \defined('SULU_MAINTENANCE') || \define('SULU_MAINTENANCE'\getenv('SULU_MAINTENANCE') ?: false);
  18. // maintenance mode
  19. if (SULU_MAINTENANCE) {
  20.     $maintenanceFilePath __DIR__ '/maintenance.php';
  21.     // show maintenance mode and exit if no allowed IP is met
  22.     if (require $maintenanceFilePath) {
  23.         exit;
  24.     }
  25. }
  26. require \dirname(__DIR__) . '/vendor/autoload.php';
  27. (new Dotenv())->bootEnv(\dirname(__DIR__) . '/.env');
  28. if ($_SERVER['APP_DEBUG']) {
  29.     \umask(0000);
  30.     Debug::enable();
  31. }
  32. if ($trustedProxies $_SERVER['TRUSTED_PROXIES'] ?? false) {
  33.     Request::setTrustedProxies(\explode(','$trustedProxies), Request::HEADER_X_FORWARDED_FOR Request::HEADER_X_FORWARDED_PORT Request::HEADER_X_FORWARDED_PROTO);
  34. }
  35. if ($trustedHosts $_SERVER['TRUSTED_HOSTS'] ?? false) {
  36.     Request::setTrustedHosts([$trustedHosts]);
  37. }
  38. $suluContext SuluKernel::CONTEXT_WEBSITE;
  39. if (\preg_match('/^\/admin(\/|$)/'$_SERVER['REQUEST_URI'])) {
  40.     $suluContext SuluKernel::CONTEXT_ADMIN;
  41. }
  42. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG'], $suluContext);
  43. // Comment this line if you want to use the "varnish" http
  44. // caching strategy. See http://sulu.readthedocs.org/en/latest/cookbook/caching-with-varnish.html
  45. if ('dev' !== $_SERVER['APP_ENV'] && SuluKernel::CONTEXT_WEBSITE === $suluContext) {
  46.     $kernel $kernel->getHttpCache();
  47. }
  48. // When using the HttpCache, you need to call the method in your front controller
  49. // instead of relying on the configuration parameter
  50. // https://symfony.com/doc/3.4/reference/configuration/framework.html#http-method-override
  51. Request::enableHttpMethodParameterOverride();
  52. $request Request::createFromGlobals();
  53. $response $kernel->handle($request);
  54. $response->send();
  55. $kernel->terminate($request$response);