public/index.php line 63

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Enterprise License (PEL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  * @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  * @license    http://www.pimcore.org/license     GPLv3 and PEL
  13.  */
  14. // Allow from valid origins only
  15. if (isset($_SERVER['HTTP_ORIGIN'])) {
  16.     $httpOrigin $_SERVER['HTTP_ORIGIN'];
  17.     if (in_array($httpOrigin, [
  18.         'http://zmapp.local'// dev
  19.         'https://atunpvue.atumobile.com'// staging
  20.         'https://atunpvue.atumobile.com'// production
  21.     ])) header("Access-Control-Allow-Origin: $httpOrigin");
  22.     header('Access-Control-Allow-Credentials: true');
  23.     header('Access-Control-Max-Age: 86400');    // cache for 1 day
  24. }
  25. // Access-Control headers are received during OPTIONS requests
  26. if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
  27.     if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
  28.         header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
  29.     }
  30.     if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
  31.         header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
  32.     }
  33.     exit(0);
  34. }
  35. use Pimcore\Tool;
  36. use Symfony\Component\HttpFoundation\Request;
  37. include __DIR__ "/../vendor/autoload.php";
  38. \Pimcore\Bootstrap::setProjectRoot();
  39. \Pimcore\Bootstrap::bootstrap();
  40. $request Request::createFromGlobals();
  41. // set current request as property on tool as there's no
  42. // request stack available yet
  43. Tool::setCurrentRequest($request);
  44. /** @var \Pimcore\Kernel $kernel */
  45. $kernel \Pimcore\Bootstrap::kernel();
  46. // reset current request - will be read from request stack from now on
  47. Tool::setCurrentRequest(null);
  48. $response $kernel->handle($request);
  49. $response->send();
  50. $kernel->terminate($request$response);