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/** 22 * \file htdocs/admin/debugbar.php 23 * \ingroup debugbar 24 * \brief Setup page for debugbar module 25 */ 26 27require '../main.inc.php'; 28require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; 29 30global $conf; 31 32if (!$user->admin) accessforbidden(); 33 34// Load translation files required by the page 35$langs->loadLangs(array("admin", "other")); 36 37$error = 0; 38$action = GETPOST('action', 'aZ09'); 39 40 41/* 42 * Actions 43 */ 44 45// Set modes 46if ($action == 'set') 47{ 48 $db->begin(); 49 50 $result1 = dolibarr_set_const($db, "DEBUGBAR_LOGS_LINES_NUMBER", GETPOST('DEBUGBAR_LOGS_LINES_NUMBER', 'int'), 'chaine', 0, '', 0); 51 $result2 = dolibarr_set_const($db, "DEBUGBAR_USE_LOG_FILE", GETPOST('DEBUGBAR_USE_LOG_FILE', 'int'), 'chaine', 0, '', 0); 52 if ($result1 < 0 || $result2 < 0) 53 { 54 $error++; 55 } 56 57 if (!$error) 58 { 59 $db->commit(); 60 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); 61 } else { 62 $db->rollback(); 63 setEventMessages($error, null, 'errors'); 64 } 65} 66 67 68/* 69 * View 70 */ 71 72llxHeader(); 73 74$form = new Form($db); 75 76$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; 77print load_fiche_titre($langs->trans("DebugBarSetup"), $linkback, 'title_setup'); 78 79if (!function_exists('mb_check_encoding')) 80{ 81 $langs->load("errors"); 82 print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error'); 83} 84 85print '<br>'; 86 87// Level 88print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; 89print '<input type="hidden" name="token" value="'.newToken().'">'; 90print '<input type="hidden" name="action" value="set">'; 91 92print '<table class="noborder centpercent">'; 93print '<tr class="liste_titre">'; 94print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>'; 95print '<td class="right"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>'; 96print "</tr>\n"; 97 98print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>'; 99print '<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 100print ' '.$langs->trans("WarningValueHigherSlowsDramaticalyOutput"); 101print '</td></tr>'; 102 103print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_USE_LOG_FILE").'</td>'; 104print '<td colspan="2">'; 105print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1); 106print ' '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower"); 107print '</td></tr>'; 108 109print '</table>'; 110print "</form>\n"; 111 112// End of page 113llxFooter(); 114$db->close(); 115