app_dev.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use Symfony\Component\HttpFoundation\Request;
  3. use Symfony\Component\Debug\Debug;
  4. // If you don't want to setup permissions the proper way, just uncomment the following PHP line
  5. // read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
  6. // for more information
  7. umask(0000);
  8. // This check prevents access to debug front controllers that are deployed by accident to production servers.
  9. // Feel free to remove this, extend it, or make something more sophisticated.
  10. if (isset($_SERVER['HTTP_CLIENT_IP'])
  11. || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
  12. || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')
  13. ) {
  14. header('HTTP/1.0 403 Forbidden');
  15. exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
  16. }
  17. /**
  18. * @var Composer\Autoload\ClassLoader $loader
  19. */
  20. $loader = require __DIR__.'/../app/autoload.php';
  21. Debug::enable();
  22. // Classic
  23. /*$kernel = new AppKernel('dev', true);
  24. $kernel->loadClassCache();
  25. $request = Request::createFromGlobals();
  26. $response = $kernel->handle($request);
  27. $response->send();
  28. $kernel->terminate($request, $response);*/
  29. require_once __DIR__.'/../app/AppKernel.php';
  30. require_once __DIR__.'/legacy.php';
  31. $request = Sonata\PageBundle\Request\RequestFactory::createFromGlobals(
  32. 'host_with_path_by_locale'
  33. );
  34. $kernel = new AppKernel('dev', true);
  35. $kernel->loadClassCache();
  36. $response = $kernel->handle($request);
  37. $response->send();
  38. $kernel->terminate($request, $response);