public/index.php line 52

Open in your IDE?
  1. <?php
  2. use App\Kernel;
  3. use Symfony\Component\ErrorHandler\Debug;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Request as LegacyRequest;
  6. ob_start();
  7. require dirname(__DIR__).'/config/bootstrap.php';
  8. require_once dirname(__DIR__).'/bb-legacy/app/defines.php';
  9. $isMobile = false;
  10. $detection = new Mobile_Detect();
  11. $isMobile = ($detection->isMobile() || $detection->isTablet());
  12. if (!\defined('USER_TIMEZONE')) {
  13. $GLOBALS['USER_TIMEZONE'] = date_default_timezone_get();
  14. }
  15. define('IS_MOBILE', $isMobile);
  16. /*
  17. * The kernel will always be available globally, allowing you to
  18. * access it from your existing application and through it the
  19. * service container. This allows for introducing new features in
  20. * the existing application.
  21. */
  22. global $kernel;
  23. if ($_SERVER['APP_DEBUG']) {
  24. umask(0000);
  25. Debug::enable();
  26. }
  27. if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
  28. Request::setTrustedProxies(
  29. explode(',', $trustedProxies),
  30. Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST
  31. );
  32. }
  33. if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
  34. Request::setTrustedHosts([$trustedHosts]);
  35. }
  36. $kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
  37. $request = Request::createFromGlobals();
  38. LegacyRequest::setUrlFromRequest($request);
  39. $response = $kernel->handle($request);
  40. $response->send();
  41. $kernel->terminate($request, $response);