<?php
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) || 'cli-server' === php_sapi_name())
) {
if (!file_exists(__DIR__.'/../app/data/dev.lock')) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
}
if (file_exists(__DIR__.'/../app/data/sync_template.lock')) {
$time = file_get_contents(__DIR__.'/../app/data/sync_template.lock');
date_default_timezone_set('Asia/Shanghai');
$currentTime = time();
if ($currentTime <= (int) $time) {
header('Content-Type: text/html; charset=utf-8');
echo file_get_contents(__DIR__.'/../app/Resources/TwigBundle/views/Exception/sync-template-info.html');
exit();
}
}
$loader = require_once __DIR__.'/../app/autoload.php';
Debug::enable();
$kernel = new AppKernel('dev', true);
$request = Request::createFromGlobals();
if (file_exists(__DIR__.'/../app/config/proxy.php')) {
$ips = require_once __DIR__.'/../app/config/proxy.php';
// @see https://symfony.com/doc/3.x/deployment/proxies.html
Request::setTrustedProxies(
$ips,
Request::HEADER_X_FORWARDED_ALL
);
}
$kernel->setRequest($request);
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);