index.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. // Copyright (C) 2010-2017 Combodo SARL
  3. //
  4. // This file is part of iTop.
  5. //
  6. // iTop is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Affero General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // iTop is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU Affero General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU Affero General Public License
  17. // along with iTop. If not, see <http://www.gnu.org/licenses/>
  18. /**
  19. * Backward Compatibility file for default portal.
  20. * Needed when:
  21. * - PortalDispatcher uses the old url "pages/exec.php?exec_module=itop-portal&amp;exec_page=index.php"
  22. * - Portal xml has no //properties/urlmaker_class tag
  23. * - Checks are necessary (eg. UserRequest/Incident class detection)
  24. *
  25. * NOT needed when:
  26. * - PortalDispatcher uses the new url "pages/exec.php?exec_module=itop-portal-base&amp;exec_page=index.php&amp;portal_id=itop-portal"
  27. * - Portal xml has a //properties/urlmaker_class tag (or doesn't need to register a UrlMakerClass)
  28. */
  29. if (file_exists(__DIR__ . '/../../approot.inc.php'))
  30. {
  31. require_once __DIR__ . '/../../approot.inc.php'; // When in env-xxxx folder
  32. }
  33. else
  34. {
  35. require_once __DIR__ . '/../../../approot.inc.php'; // When in datamodels/x.x folder
  36. }
  37. require_once APPROOT . '/application/startup.inc.php';
  38. // Protection against setup in the following configuration : ITIL Ticket with Enhanced Portal selected but neither UserRequest or Incident. Which would crash the portal.
  39. if (!class_exists('UserRequest') && !class_exists('Incident'))
  40. {
  41. die('iTop has neither been installed with User Request nor Incident tickets. Please contact your administrator.');
  42. }
  43. // Defining portal constants
  44. $sDir = basename(__DIR__);
  45. define('PORTAL_MODULE_ID', $sDir);
  46. define('PORTAL_ID', $sDir);
  47. require_once APPROOT . '/env-' . utils::GetCurrentEnvironment() . '/itop-portal-base/index.php';