debugbar.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. /* Copyright (C) 2005-2019 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
  4. * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  5. * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/admin/debugbar.php
  22. * \ingroup debugbar
  23. * \brief Setup page for debugbar module
  24. */
  25. require '../main.inc.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  27. global $conf;
  28. if (!$user->admin) accessforbidden();
  29. // Load translation files required by the page
  30. $langs->loadLangs(array("admin", "other"));
  31. $error = 0;
  32. $action = GETPOST('action', 'aZ09');
  33. /*
  34. * Actions
  35. */
  36. // Set modes
  37. if ($action == 'set')
  38. {
  39. $db->begin();
  40. $result1 = dolibarr_set_const($db, "DEBUGBAR_LOGS_LINES_NUMBER", GETPOST('DEBUGBAR_LOGS_LINES_NUMBER', 'int'), 'chaine', 0, '', 0);
  41. $result2 = dolibarr_set_const($db, "DEBUGBAR_USE_LOG_FILE", GETPOST('DEBUGBAR_USE_LOG_FILE', 'int'), 'chaine', 0, '', 0);
  42. if ($result1 < 0 || $result2 < 0)
  43. {
  44. $error++;
  45. }
  46. if (!$error)
  47. {
  48. $db->commit();
  49. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  50. }
  51. else
  52. {
  53. $db->rollback();
  54. setEventMessages($error, null, 'errors');
  55. }
  56. }
  57. /*
  58. * View
  59. */
  60. llxHeader();
  61. $form = new Form($db);
  62. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  63. print load_fiche_titre($langs->trans("DebugBarSetup"), $linkback, 'title_setup');
  64. //print load_fiche_titre($langs->trans("DebugBar"));
  65. if (!function_exists('mb_check_encoding'))
  66. {
  67. $langs->load("errors");
  68. print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error');
  69. }
  70. print '<br>';
  71. // Level
  72. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  73. print '<input type="hidden" name="token" value="'.newToken().'">';
  74. print '<input type="hidden" name="action" value="set">';
  75. print '<table class="noborder centpercent">';
  76. print '<tr class="liste_titre">';
  77. print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>';
  78. print '<td class="right"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>';
  79. print "</tr>\n";
  80. print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>';
  81. print '<td colspan="2"><input type="text" class="flat" name="DEBUGBAR_LOGS_LINES_NUMBER" value="'.(empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER).'">'; // This slow seriously output
  82. print ' '.$langs->trans("WarningValueHigherSlowsDramaticalyOutput");
  83. print '</td></tr>';
  84. print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_USE_LOG_FILE").'</td>';
  85. print '<td colspan="2">';
  86. print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1);
  87. print ' '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower");
  88. print '</td></tr>';
  89. print '</table>';
  90. print "</form>\n";
  91. // End of page
  92. llxFooter();
  93. $db->close();