dolibarr 19.0.4
DolibarrCollector.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24use DebugBar\DataCollector\AssetProvider;
25use DebugBar\DataCollector\DataCollector;
26use DebugBar\DataCollector\Renderable;
27use DebugBar\DebugBarException;
28
33class DolibarrCollector extends DataCollector implements Renderable, AssetProvider
34{
40 public function getName()
41 {
42 return 'dolibarr';
43 }
44
50 public function collect()
51 {
52 return array();
53 }
54
60 protected function getDatabaseInfo()
61 {
62 global $conf, $langs;
63
64 $info = $langs->trans('Host').': <strong>'.$conf->db->host.'</strong><br>';
65 $info .= $langs->trans('Port').': <strong>'.$conf->db->port.'</strong><br>';
66 $info .= $langs->trans('Name').': <strong>'.$conf->db->name.'</strong><br>';
67 $info .= $langs->trans('User').': <strong>'.$conf->db->user.'</strong><br>';
68 $info .= $langs->trans('Type').': <strong>'.$conf->db->type.'</strong><br>';
69 $info .= $langs->trans('Prefix').': <strong>'.$conf->db->prefix.'</strong><br>';
70 $info .= $langs->trans('Charset').': <strong>'.$conf->db->character_set.'</strong>';
71
72 return $info;
73 }
74
80 protected function getDolibarrInfo()
81 {
82 global $conf, $langs;
83 global $dolibarr_main_prod, $dolibarr_nocsrfcheck;
84
85 $info = $langs->trans('Version').': <strong>'.DOL_VERSION.'</strong><br>';
86 $info .= $langs->trans('Theme').': <strong>'.$conf->theme.'</strong><br>';
87 $info .= $langs->trans('Locale').': <strong>' . getDolGlobalString('MAIN_LANG_DEFAULT').'</strong><br>';
88 $info .= $langs->trans('Currency').': <strong>'.$conf->currency.'</strong><br>';
89 $info .= $langs->trans('Entity').': <strong>'.$conf->entity.'</strong><br>';
90 $info .= $langs->trans('MaxSizeList').': <strong>'.($conf->liste_limit ?: $conf->global->MAIN_SIZE_LISTE_LIMIT).'</strong><br>';
91 $info .= $langs->trans('MaxSizeForUploadedFiles').': <strong>' . getDolGlobalString('MAIN_UPLOAD_DOC').'</strong><br>';
92 $info .= '$dolibarr_main_prod = <strong>'.$dolibarr_main_prod.'</strong><br>';
93 $info .= '$dolibarr_nocsrfcheck = <strong>'.$dolibarr_nocsrfcheck.'</strong><br>';
94 $info .= 'MAIN_SECURITY_CSRF_WITH_TOKEN = <strong>' . getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN').'</strong><br>';
95 $info .= 'MAIN_FEATURES_LEVEL = <strong>' . getDolGlobalString('MAIN_FEATURES_LEVEL').'</strong><br>';
96
97 return $info;
98 }
99
105 protected function getMailInfo()
106 {
107 global $conf, $langs;
108 global $dolibarr_mailing_limit_sendbyweb, $dolibarr_mailing_limit_sendbycli, $dolibarr_mailing_limit_sendbyday;
109
110 $info = $langs->trans('Method').': <strong>'.getDolGlobalString("MAIN_MAIL_SENDMODE").'</strong><br>';
111 $info .= $langs->trans('Server').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTP_SERVER").'</strong><br>';
112 $info .= $langs->trans('Port').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTP_PORT").'</strong><br>';
113 $info .= $langs->trans('ID').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTPS_IDT").'</strong><br>';
114 $info .= $langs->trans('Pwd').': <strong>'.preg_replace('/./', '*', getDolGlobalString("MAIN_MAIL_SMTPS_PW")).'</strong><br>';
115 $info .= $langs->trans('TLS/STARTTLS').': <strong>'.getDolGlobalString("MAIN_MAIL_EMAIL_TLS").'</strong> / <strong>'.getDolGlobalString("MAIN_MAIL_EMAIL_STARTTLS").'</strong><br>';
116 $info .= $langs->trans('MAIN_DISABLE_ALL_MAILS').': <strong>'.(!getDolGlobalString('MAIN_DISABLE_ALL_MAILS') ? $langs->trans('No') : $langs->trans('Yes')).'</strong><br>';
117 $info .= 'dolibarr_mailing_limit_sendbyweb = <strong>'.$dolibarr_mailing_limit_sendbyweb.'</strong><br>';
118 $info .= 'dolibarr_mailing_limit_sendbycli = <strong>'.$dolibarr_mailing_limit_sendbycli.'</strong><br>';
119 $info .= 'dolibarr_mailing_limit_sendbyday = <strong>'.$dolibarr_mailing_limit_sendbyday.'</strong><br>';
120
121 return $info;
122 }
123
129 public function getWidgets()
130 {
131 return array(
132 "database_info" => array(
133 "icon" => "database",
134 "indicator" => "PhpDebugBar.DebugBar.TooltipIndicator",
135 "tooltip" => array(
136 "html" => $this->getDatabaseInfo(),
137 "class" => "tooltip-wide"
138 ),
139 "map" => "",
140 "default" => ""
141 ),
142 "dolibarr_info" => array(
143 "icon" => "desktop",
144 "indicator" => "PhpDebugBar.DebugBar.TooltipIndicator",
145 "tooltip" => array(
146 "html" => $this->getDolibarrInfo(),
147 "class" => "tooltip-wide"
148 ),
149 "map" => "",
150 "default" => ""
151 ),
152 "mail_info" => array(
153 "icon" => "envelope",
154 "indicator" => "PhpDebugBar.DebugBar.TooltipIndicator",
155 "tooltip" => array(
156 "html" => $this->getMailInfo(),
157 "class" => "tooltip-extra-wide"
158 ),
159 "map" => "",
160 "default" => ""
161 )
162 );
163 }
164
170 public function getAssets()
171 {
172 return array(
173 'base_url' => dol_buildpath('/debugbar', 1),
174 'js' => 'js/widgets.js'
175 );
176 }
177}
DolibarrCollector class.
getWidgets()
Return widget settings.
getAssets()
Return collector assests.
collect()
Return collected data.
getDatabaseInfo()
Return database info as an HTML string.
getDolibarrInfo()
Return dolibarr info as an HTML string.
getMailInfo()
Return mail info as an HTML string.
getName()
Return collector name.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.