web/app_dev.php line 46

Open in your IDE?
  1. <?php
  2. use Symfony\Component\Debug\Debug;
  3. use Symfony\Component\HttpFoundation\Request;
  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#configuration-and-setup for more information
  6. //umask(0000);
  7. // This check prevents access to debug front controllers that are deployed by accident to production servers.
  8. // Feel free to remove this, extend it, or make something more sophisticated.
  9. if (isset($_SERVER['HTTP_CLIENT_IP'])
  10.     || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
  11.     || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1''::1']) || 'cli-server' === php_sapi_name())
  12. ) {
  13.     if (!file_exists(__DIR__.'/../app/data/dev.lock')) {
  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. if (isOldApiCall()) {
  19.     define('API_ENV''dev');
  20.     include __DIR__.'/../api/index.php';
  21.     exit();
  22. }
  23. $loader = require_once __DIR__.'/../app/autoload.php';
  24. Debug::enable();
  25. $kernel = new AppKernel('dev'true);
  26. //$kernel->loadClassCache();
  27. $request Request::createFromGlobals();
  28. if (file_exists(__DIR__.'/../app/config/proxy.php')) {
  29.     $ips = require_once __DIR__.'/../app/config/proxy.php';
  30.     // @see https://symfony.com/doc/3.x/deployment/proxies.html
  31.     Request::setTrustedProxies(
  32.         $ips,
  33.         Request::HEADER_X_FORWARDED_ALL
  34.     );
  35. }
  36. $kernel->setRequest($request);
  37. $response $kernel->handle($request);
  38. $response->send();
  39. $kernel->terminate($request$response);
  40. function isOldApiCall()
  41. {
  42.     return (!(isset($_SERVER['HTTP_ACCEPT']) && 'application/vnd.edusoho.v2+json' == $_SERVER['HTTP_ACCEPT']))
  43.     && ((=== strpos($_SERVER['REQUEST_URI'], '/api')) || (=== strpos($_SERVER['REQUEST_URI'], '/app_dev.php/api')));
  44. }