<?php
// identify NextTuesday env
$env = 'NONE';
if (strpos($_SERVER['HTTP_REFERER'], "mein.kombiverkehr.de") !== FALSE) {
$allowedOrigins = [
'https://mein.kombiverkehr.de',
'https://system.kombiverkehr.de'
];
$ref = rtrim($_SERVER['HTTP_REFERER'], '/');
if (in_array($ref, $allowedOrigins)) {
$env = $ref;
}
header("Access-Control-Allow-Origin: $env");
} else if (strpos($_SERVER['HTTP_REFERER'], "staging") !== FALSE) {
$allowedOrigins = [
'https://mein.staging.kombiverkehr.de',
'https://system.staging.kombiverkehr.de'
];
$ref = rtrim($_SERVER['HTTP_REFERER'], '/');
if (in_array($ref, $allowedOrigins)) {
$env = $ref;
}
header("Access-Control-Allow-Origin: $env");
} else if (strpos($_SERVER['HTTP_REFERER'], "development") !== FALSE) {
$allowedOrigins = [
'https://mein.development.kombiverkehr.de',
'https://system.development.kombiverkehr.de'
];
$ref = rtrim($_SERVER['HTTP_REFERER'], '/');
if (in_array($ref, $allowedOrigins)) {
$env = $ref;
}
header("Access-Control-Allow-Origin: $env");
}
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Headers: origin, x-requested-with, content-type");
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Enterprise License (PEL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PEL
*/
use Pimcore\Tool;
use Symfony\Component\HttpFoundation\Request;
include __DIR__ . "/../vendor/autoload.php";
\Pimcore\Bootstrap::setProjectRoot();
\Pimcore\Bootstrap::bootstrap();
$request = Request::createFromGlobals();
// set current request as property on tool as there's no
// request stack available yet
Tool::setCurrentRequest($request);
/** @var \Pimcore\Kernel $kernel */
$kernel = \Pimcore\Bootstrap::kernel();
// reset current request - will be read from request stack from now on
Tool::setCurrentRequest(null);
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);