mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 07:50:08 +08:00
- Converted all non-flex bundles with available bundles into Symfony/Flex. - Updated namespaces to more closely match Symfony. - Removed unnecessary dependencies and recipes. - Executed Symfony/Flex recipes to create default configs. - Improved composer.json scripts.
48 lines
1.4 KiB
PHP
48 lines
1.4 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 Application Path
|
|
define('BASE_PATH', __DIR__);
|
|
define('APP_PATH', __DIR__ . '/core/modules/');
|
|
define('LEGACY_PATH', __DIR__ . '/legacy/');
|
|
|
|
// Get the autoloader class
|
|
require BASE_PATH . '/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);
|