SuiteCRM-Core/index.php
Clemente Raposo b809e5c85b Add ClassicView routing
Redirect Suite7 requests to Suite8 ClassicView routes for valid actions
- Use Symfony kernel events
- Use Symfony service configuration and DI for module mapping

Add legacy redirection tests
- Add acceptance test support
-- Add config helper
- Fix issue when running `codcept run`
-- functional tests missing
- Add functional tests for legacy routing
- Add unit tests for legacy routing
2021-03-30 19:21:31 +01:00

43 lines
1.2 KiB
PHP

<?php
use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require __DIR__ . '/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies),
Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
if (empty($_GET) && strpos($_SERVER['REQUEST_URI'], 'api') === false) {
if (!file_exists('public/index.html')) {
throw new RuntimeException('Please run bin/cli frontend:rebuild from terminal');
}
include __DIR__ . '/public/index.html';
die();
}
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
// Get the autoloader class
require __DIR__ . '/vendor/autoload.php';
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);