public/index.php line 67

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. header("X-Frame-Options: SAMEORIGIN");
  18. // only allow GET,POST if not admin
  19. header("Access-Control-Allow-Origin: *");
  20. header("Access-Control-Allow-Headers: *");
  21. if (substr($_SERVER['REQUEST_URI'], 06) == '/admin') {
  22.     header("Access-Control-Allow-Methods: *");
  23. } else {
  24.     header("Access-Control-Allow-Methods: GET,POST");
  25. }
  26. header("Allow: *");
  27. if (substr($_SERVER['REQUEST_URI'], 06) !== '/admin') {
  28.     $method $_SERVER['REQUEST_METHOD'];
  29.     if (!in_array($method, ['GET''POST'])) {
  30.         if ($method == 'OPTIONS') {
  31.             die();
  32.         } else {
  33.             header($_SERVER["SERVER_PROTOCOL"]." 405 Method Not Allowed"true405);
  34.             exit();
  35.         }
  36.     }
  37. }
  38. // if (substr($_SERVER['REQUEST_URI'], 0, 31) == '/admin/external_adminer/adminer'
  39. //     || substr($_SERVER['REQUEST_URI'], 0, 24) == '/admin/misc/fileexplorer'
  40. // ) {
  41. //     header("403 Forbidden", true, 403);
  42. //     exit();
  43. // }
  44. \Pimcore\Bootstrap::setProjectRoot();
  45. \Pimcore\Bootstrap::bootstrap();
  46. $request Request::createFromGlobals();
  47. // set current request as property on tool as there's no
  48. // request stack available yet
  49. Tool::setCurrentRequest($request);
  50. /** @var \Pimcore\Kernel $kernel */
  51. $kernel \Pimcore\Bootstrap::kernel();
  52. // reset current request - will be read from request stack from now on
  53. Tool::setCurrentRequest(null);
  54. $response $kernel->handle($request);
  55. $response->send();
  56. $kernel->terminate($request$response);