public/index.php line 56

Open in your IDE?
  1. <?php
  2. ini_set("log_errors"1);
  3. ini_set("error_log"__DIR__."/../var/log/php-error.log");
  4. putenv('LC_ALL=pl_PL');
  5. setlocale(LC_ALL'pl_PL');
  6. use App\Kernel;
  7. use Symfony\Component\Debug\Debug;
  8. use Symfony\Component\HttpFoundation\Request;
  9. require dirname(__DIR__).'/config/bootstrap.php';
  10. if ($_SERVER['APP_DEBUG']) {
  11.     ini_set('memory_limit''2G');
  12.     error_reporting(E_ALL);
  13.     ini_set('display_errors'1);
  14.     umask(0000);
  15.     Debug::enable();
  16. }
  17. if($_SERVER['SERVER_NAME'] === 'api.autopunkt.pl') {
  18.     if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === "off") {
  19.         $location 'https://' $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  20.         header('HTTP/1.1 301 Moved Permanently');
  21.         header('Location: ' $location);
  22.         exit;
  23.     }
  24. }
  25. else {
  26.     $_SERVER['HTTPS'] = 'on';
  27.     $_SERVER['SERVER_PORT'] = 443;
  28.     $_SERVER['REQUEST_SCHEME'] = 'https';
  29.     if(isset($_SERVER['SCRIPT_URI'])) {
  30.         $_SERVER['SCRIPT_URI'] = str_replace('http','https'$_SERVER['SCRIPT_URI']);
  31.     }
  32. }
  33. if (in_array(@$_SERVER['REMOTE_ADDR'], ['85.14.122.42''93.105.223.55''127.0.0.1''::1'], true)) {
  34.     $_SERVER['APP_ENV'] = 'dev';
  35.     $_SERVER['APP_DEBUG'] = 1;
  36. }
  37. if ($trustedProxies $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
  38.     Request::setTrustedProxies(explode(','$trustedProxies), Request::HEADER_X_FORWARDED_ALL Request::HEADER_X_FORWARDED_HOST);
  39. }
  40. if ($trustedHosts $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
  41.     Request::setTrustedHosts([$trustedHosts]);
  42. }
  43. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  44. $request Request::createFromGlobals();
  45. $response $kernel->handle($request);
  46. $response->send();
  47. $kernel->terminate($request$response);