about.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2023 László Szollősi
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file settlements/admin/about.php
  20. * \ingroup settlements
  21. * \brief About page of module Settlements.
  22. */
  23. // Load Dolibarr environment
  24. $res = 0;
  25. // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
  26. if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
  27. $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
  28. }
  29. // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
  30. $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
  31. while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
  32. $i--; $j--;
  33. }
  34. if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
  35. $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
  36. }
  37. if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
  38. $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
  39. }
  40. // Try main.inc.php using relative path
  41. if (!$res && file_exists("../../main.inc.php")) {
  42. $res = @include "../../main.inc.php";
  43. }
  44. if (!$res && file_exists("../../../main.inc.php")) {
  45. $res = @include "../../../main.inc.php";
  46. }
  47. if (!$res) {
  48. die("Include of main fails");
  49. }
  50. // Libraries
  51. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  52. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  53. require_once '../lib/settlements.lib.php';
  54. // Translations
  55. $langs->loadLangs(array("errors", "admin", "settlements@settlements"));
  56. // Access control
  57. if (!$user->admin) {
  58. accessforbidden();
  59. }
  60. // Parameters
  61. $action = GETPOST('action', 'aZ09');
  62. $backtopage = GETPOST('backtopage', 'alpha');
  63. /*
  64. * Actions
  65. */
  66. // None
  67. /*
  68. * View
  69. */
  70. $form = new Form($db);
  71. $help_url = '';
  72. $page_name = "SettlementsAbout";
  73. llxHeader('', $langs->trans($page_name), $help_url);
  74. // Subheader
  75. $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
  76. print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
  77. // Configuration header
  78. $head = settlementsAdminPrepareHead();
  79. print dol_get_fiche_head($head, 'about', $langs->trans($page_name), 0, 'settlements@settlements');
  80. dol_include_once('/settlements/core/modules/modSettlements.class.php');
  81. $tmpmodule = new modSettlements($db);
  82. print $tmpmodule->getDescLong();
  83. // Page end
  84. print dol_get_fiche_end();
  85. llxFooter();
  86. $db->close();