public/index.php line 72

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. #### Elements debugging - start ####
  17. ####################################
  18. if (php_sapi_name() != "cli") {
  19.     //If you are behind a load balancer you have to use $_SERVER["HTTP_X_FORWARDED_FOR"]
  20.     //Do not active check for HTTP_X_FORWARDED_FOR if you are not behind a load balancer because sensitive data could be exposed!
  21.     #$remoteIpAddress = $_SERVER["HTTP_X_FORWARDED_FOR"] ?? '';
  22.     $remoteIpAddress $_SERVER["REMOTE_ADDR"] ?? '';
  23.     $privilegedIpAddresses = [
  24.         '89.26.34.65'//Elements Devs
  25.         '89.26.34.74'//Elements Pms
  26.         '192.80.196.1'
  27.     ];
  28.     $profilingPrivilegedIpAddresses = [
  29.         '89.26.34.65'//Elements Devs
  30.     ];
  31.     if (in_array($remoteIpAddress$privilegedIpAddresses) || (isset($_ENV["APP_DEBUG_COOKIE"]) && $_ENV["APP_DEBUG_COOKIE"]) ) {
  32.         if ($_COOKIE["XDEBUG_SESSION"] ?? null) {
  33.             $_ENV["APP_DEBUG"] = $_SERVER["APP_DEBUG"] = true//display errors and send E-Mails to dev email addresses
  34.             error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
  35.         }
  36.         if (in_array($remoteIpAddress$privilegedIpAddresses)  &&  ($_COOKIE["XDEBUG_PROFILE"] ?? null)) {
  37.             $_ENV["APP_ENV"] = $_SERVER["APP_ENV"] = "dev"//switch to dev environment to display profiler - only enable it if you really need it, because it exposes sensitive data
  38.         }
  39.     }
  40. }
  41. ##################################
  42. #### Elements debugging - end ####
  43. ##################################
  44. include __DIR__ "/../vendor/autoload.php";
  45. \Pimcore\Bootstrap::setProjectRoot();
  46. \Pimcore\Bootstrap::bootstrap();
  47. $request Request::createFromGlobals();
  48. // set current request as property on tool as there's no
  49. // request stack available yet
  50. Tool::setCurrentRequest($request);
  51. /** @var \Pimcore\Kernel $kernel */
  52. $kernel \Pimcore\Bootstrap::kernel();
  53. // reset current request - will be read from request stack from now on
  54. Tool::setCurrentRequest(null);
  55. $response $kernel->handle($request);
  56. $response->send();
  57. $kernel->terminate($request$response);