dolibarr  16.0.5
debugbar.php
Go to the documentation of this file.
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 
27 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29 
30 global $conf;
31 
32 if (!$user->admin) {
34 }
35 
36 // Load translation files required by the page
37 $langs->loadLangs(array("admin", "other"));
38 
39 $error = 0;
40 $action = GETPOST('action', 'aZ09');
41 
42 
43 /*
44  * Actions
45  */
46 
47 // Set modes
48 if ($action == 'set') {
49  $db->begin();
50 
51  $result1 = dolibarr_set_const($db, "DEBUGBAR_LOGS_LINES_NUMBER", GETPOST('DEBUGBAR_LOGS_LINES_NUMBER', 'int'), 'chaine', 0, '', 0);
52  $result2 = dolibarr_set_const($db, "DEBUGBAR_USE_LOG_FILE", GETPOST('DEBUGBAR_USE_LOG_FILE', 'int'), 'chaine', 0, '', 0);
53  if ($result1 < 0 || $result2 < 0) {
54  $error++;
55  }
56 
57  if (!$error) {
58  $db->commit();
59  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
60  } else {
61  $db->rollback();
62  setEventMessages($error, null, 'errors');
63  }
64 }
65 
66 
67 /*
68  * View
69  */
70 
71 llxHeader();
72 
73 $form = new Form($db);
74 
75 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
76 print load_fiche_titre($langs->trans("DebugBarSetup"), $linkback, 'title_setup');
77 
78 if (!function_exists('mb_check_encoding')) {
79  $langs->load("errors");
80  print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error');
81 }
82 
83 print '<br>';
84 
85 // Level
86 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
87 print '<input type="hidden" name="token" value="'.newToken().'">';
88 print '<input type="hidden" name="action" value="set">';
89 
90 print '<table class="noborder centpercent">';
91 print '<tr class="liste_titre">';
92 print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>';
93 print '<td class="right"><input type="submit" class="button button-edit" '.$option.' value="'.$langs->trans("Modify").'"></td>';
94 print "</tr>\n";
95 
96 print '<tr class="oddeven"><td class="nowrap">'.$langs->trans("DEBUGBAR_USE_LOG_FILE").'</td>';
97 print '<td>';
98 print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1);
99 print '</td><td>';
100 print '<span class="opacitymedium"> '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower").'</span>';
101 print '</td></tr>';
102 
103 print '<tr class="oddeven"><td class="nowrap">'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>';
104 print '<td><input type="text" class="flat width75" name="DEBUGBAR_LOGS_LINES_NUMBER" value="'.(empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER).'">'; // This slow seriously output
105 print '</td><td>';
106 print '<span class="opacitymedium">'.$langs->trans("WarningValueHigherSlowsDramaticalyOutput").'</span>';
107 print '</td></tr>';
108 
109 print '</table>';
110 print "</form>\n";
111 
112 // End of page
113 llxFooter();
114 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
info_admin
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
Definition: functions.lib.php:4800
dolibarr_set_const
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:627
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59