public/index.php line 46

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. use Pimcore\Tool;
  15. use Symfony\Component\HttpFoundation\Request;
  16. include __DIR__ "/../vendor/autoload.php";
  17. const PIMCORE_KERNEL_CLASS '\WebAppBundle\Kernel';
  18. \Pimcore\Bootstrap::setProjectRoot();
  19. \Pimcore\Bootstrap::bootstrap();
  20. // CORS headers
  21. header('Access-Control-Allow-Origin: *');
  22. header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, PATCH');
  23. header('Access-Control-Allow-Headers: DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range, Authorization');
  24. header('Access-Control-Expose-Headers: Content-Length, Content-Range');
  25. // Handle OPTIONS preflight request
  26. if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
  27.     header('Access-Control-Max-Age: 1728000');
  28.     header('Content-Type: text/plain; charset=utf-8');
  29.     header('Content-Length: 0');
  30.     http_response_code(204);
  31.     exit;
  32. }
  33. $request Request::createFromGlobals();
  34. // set current request as property on tool as there's no
  35. // request stack available yet
  36. Tool::setCurrentRequest($request);
  37. /** @var \Pimcore\Kernel $kernel */
  38. $kernel \Pimcore\Bootstrap::kernel();
  39. // reset current request - will be read from request stack from now on
  40. Tool::setCurrentRequest(null);
  41. $response $kernel->handle($request);
  42. $response->send();
  43. $kernel->terminate($request$response);