userlogouthandler_list.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. $res = 0;
  3. // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
  4. if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
  5. $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
  6. }
  7. // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
  8. $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
  9. $tmp2 = realpath(__FILE__);
  10. $i = strlen($tmp) - 1;
  11. $j = strlen($tmp2) - 1;
  12. while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
  13. $i--;
  14. $j--;
  15. }
  16. if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
  17. $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
  18. }
  19. if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
  20. $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
  21. }
  22. // Try main.inc.php using relative path
  23. if (!$res && file_exists("../main.inc.php")) {
  24. $res = @include "../main.inc.php";
  25. }
  26. if (!$res && file_exists("../../main.inc.php")) {
  27. $res = @include "../../main.inc.php";
  28. }
  29. if (!$res && file_exists("../../../main.inc.php")) {
  30. $res = @include "../../../main.inc.php";
  31. }
  32. if (!$res) {
  33. die("Include of main fails");
  34. }
  35. require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
  36. require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
  37. require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
  38. require_once DOL_DOCUMENT_ROOT . '/custom/settlements/class/helper.class.php';
  39. // load financialreport libraries
  40. require_once __DIR__ . '/../bbus/class/userloginnaplo.class.php';
  41. // for other modules
  42. //dol_include_once('/othermodule/class/otherobject.class.php');
  43. // Load translation files required by the page
  44. $langs->loadLangs(array("settlements@settlements", "other"));
  45. $id = GETPOST('id', 'int');
  46. $ref = GETPOST('ref', 'alpha');
  47. $user_id = GETPOST('user_id', 'int');
  48. $idmenu = GETPOST('idmenu', 'int');
  49. $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
  50. $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
  51. $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
  52. $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
  53. $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
  54. $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
  55. $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)) . basename(__FILE__, '.php')); // To manage different context of search
  56. $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
  57. $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
  58. $mode = GETPOST('mode', 'aZ');
  59. // Initialize technical objects
  60. $object = new UserLoginNaplo($db);
  61. $extrafields = new ExtraFields($db);
  62. $enablepermissioncheck = 0;
  63. if ($enablepermissioncheck) {
  64. $permissiontoread = $user->rights->financialreport->userinvoice->read;
  65. $permissiontoadd = $user->rights->financialreport->userinvoice->write;
  66. $permissiontodelete = $user->rights->financialreport->userinvoice->delete;
  67. } else {
  68. $permissiontoread = 1;
  69. $permissiontoadd = 1;
  70. $permissiontodelete = 1;
  71. }
  72. // Security check (enable the most restrictive one)
  73. if ($user->socid > 0)
  74. accessforbidden();
  75. //if ($user->socid > 0) accessforbidden();
  76. //$socid = 0; if ($user->socid > 0) $socid = $user->socid;
  77. //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
  78. //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
  79. if (empty($conf->financialreport->enabled))
  80. accessforbidden('Module not enabled');
  81. if (!$permissiontoread)
  82. accessforbidden();
  83. $form = new Form($db);
  84. $helper = new Helper($db);
  85. $now = dol_now();
  86. //$help_url = "EN:Module_UserInvoice|FR:Module_UserInvoice_FR|ES:Módulo_UserInvoice";
  87. $help_url = '';
  88. $title = $langs->trans('userLogoutHandler');
  89. $morejs = array();
  90. $morecss = array();
  91. llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
  92. $linkback = '<a href="' . dol_buildpath("/settlements/userloginnaplo_list.php", 1) . '?user_id=' . $user_id . '&idmenu=' . $idmenu . '&mainmenu=settlements&leftmenu=">' . '<b><span class="fa fa-arrow-left"></span> ' . $langs->trans("BackToList") . '</b></a>';
  93. print $linkback;
  94. print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">' . "\n";
  95. print '<input type="hidden" name="token" value="' . newToken() . '">';
  96. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  97. print '<input type="hidden" name="action" value="list">';
  98. print '<input type="hidden" name="user_id" value="' . $user_id . '">';
  99. print '<input type="hidden" name="id" value="' . $id . '">';
  100. $newcardbutton = '';
  101. print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', 0, 0, 0, 1);
  102. print $id;
  103. print '</form>' . "\n";
  104. // End of page
  105. llxFooter();
  106. $db->close();