public/index.php line 71

Open in your IDE?
  1. <?php
  2. use App\Kernel;
  3. use Symfony\Component\ErrorHandler\Debug;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Session\Session;
  6. use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage;
  7. ob_start();
  8. require dirname(__DIR__).'/config/bootstrap.php';
  9. require_once dirname(__DIR__).'/bb-legacy/app/defines.php';
  10. $isMobile false;
  11. if (MOBILE_SWITCH_VIEWS) {
  12.     $detection = new Mobile_Detect();
  13.     $isMobile = ($detection->isMobile() || $detection->isTablet());
  14. }
  15. if (!\defined('USER_TIMEZONE')) {
  16.     $GLOBALS['USER_TIMEZONE'] = date_default_timezone_get();
  17. }
  18. define('IS_MOBILE'$isMobile);
  19. /*
  20.  * The kernel will always be available globally, allowing you to
  21.  * access it from your existing application and through it the
  22.  * service container. This allows for introducing new features in
  23.  * the existing application.
  24.  */
  25. global $kernel;
  26. if ($_SERVER['APP_DEBUG']) {
  27.     umask(0000);
  28.     Debug::enable();
  29. }
  30. if ($trustedProxies $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
  31.     Request::setTrustedProxies(
  32.         explode(','$trustedProxies),
  33.         Request::HEADER_X_FORWARDED_ALL Request::HEADER_X_FORWARDED_HOST
  34.     );
  35. }
  36. if ($trustedHosts $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
  37.     Request::setTrustedHosts([$trustedHosts]);
  38. }
  39. ini_set("session.cookie_lifetime"172800);
  40. ini_set("session.gc_maxlifetime"172800);
  41. ini_set("session.cookie_domain"PARENT_DOMAIN);
  42. session_name(SESSION_NAME);
  43. session_start();
  44. $session = new Session(new PhpBridgeSessionStorage());
  45. // symfony will now interface with the existing PHP session
  46. $session->start();
  47. $kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
  48. $request Request::createFromGlobals();
  49. // Restrict uris depending on environment.
  50. $uri substr($request->getPathInfo(), 1);
  51. $_GET['url'] = $uri;
  52. $response $kernel->handle($request);
  53. $response->send();
  54. $kernel->terminate($request$response);