index.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. use Chamilo\Kernel;
  3. use Symfony\Component\Dotenv\Dotenv;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\Debug\Debug;
  6. require __DIR__.'/../vendor/autoload.php';
  7. // The check is to ensure we don't use .env in production
  8. if (!getenv('APP_ENV')) {
  9. (new Dotenv())->load(__DIR__.'/../.env');
  10. }
  11. if (getenv('APP_DEBUG')) {
  12. // WARNING: You should setup permissions the proper way!
  13. // REMOVE the following PHP line and read
  14. // https://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
  15. umask(0000);
  16. Debug::enable();
  17. }
  18. // Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_FORWARDED);
  19. require_once __DIR__.'/legacy.php';
  20. $kernel = new Kernel(getenv('APP_ENV'), getenv('APP_DEBUG'));
  21. //$request = Request::createFromGlobals();
  22. $request = Sonata\PageBundle\Request\RequestFactory::createFromGlobals(
  23. 'host_with_path_by_locale'
  24. );
  25. $response = $kernel->handle($request);
  26. $response->send();
  27. $kernel->terminate($request, $response);