web/index.php line 6

Open in your IDE?
  1. <?php
  2. use App\Kernel;
  3. date_default_timezone_set('Europe/Kiev');
  4. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  5. return function (array $context) {
  6.     if ($context['APP_ENV'] == 'prod' || $_SERVER['SERVER_NAME'] == 'atb.e-sim.in.ua') {
  7.         $_SERVER['HTTPS'] = 'on';
  8.         $_SERVER['REQUEST_SCHEME'] = 'https';
  9.         $_SERVER['SERVER_PORT'] = 443;
  10.     }
  11.     if (strpos($_SERVER['SERVER_NAME'], '.loc') === false && ($context['APP_ENV'] == 'dev1' || $context['APP_ENV'] == 'stage')
  12.         && (
  13.             !preg_match('/^\/api\/.+\/.+/'$_SERVER['REQUEST_URI'])
  14.             && !preg_match('/^\/kyivstar\/.+/'$_SERVER['REQUEST_URI'])
  15.             && !preg_match('/^\/_wdt\/.*/'$_SERVER['REQUEST_URI'])
  16.             && !preg_match('/^\/_profiler\/.*/'$_SERVER['REQUEST_URI'])
  17.             && '/payment/service' != $_SERVER['REQUEST_URI']
  18.         )
  19.     ) {
  20.         if (isset($_SERVER ['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic+(.*)$/i'$_SERVER ['REDIRECT_HTTP_AUTHORIZATION'], $matches)) {
  21.             list($_SERVER ['PHP_AUTH_USER'], $_SERVER ['PHP_AUTH_PW']) = explode(':'base64_decode(substr($_SERVER ['REDIRECT_HTTP_AUTHORIZATION'], 6)));
  22.         }
  23.         if (!isset($_SERVER['PHP_AUTH_USER']) || ($_SERVER['PHP_AUTH_USER'] !== 'forforce') || ($_SERVER['PHP_AUTH_PW'] !== 'FFbundlegate')) {
  24.             header('WWW-Authenticate: Basic realm="Project private area"');
  25.             header('HTTP/1.0 401 Unauthorized');
  26.             echo 'You must enter correct username/password.';
  27.             exit;
  28.         }
  29.     }
  30.     return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  31. };