dolibarr  16.0.5
DolibarrCollector.php
1 <?php
2 
3 use DebugBar\DataCollector\AssetProvider;
4 use DebugBar\DataCollector\DataCollector;
5 use DebugBar\DataCollector\Renderable;
6 use DebugBar\DebugBarException;
7 
12 class DolibarrCollector extends DataCollector implements Renderable, AssetProvider
13 {
19  public function getName()
20  {
21  return 'dolibarr';
22  }
23 
29  public function collect()
30  {
31  return array();
32  }
33 
39  protected function getDatabaseInfo()
40  {
41  global $conf, $langs;
42 
43  $info = $langs->trans('Host').': <strong>'.$conf->db->host.'</strong><br>';
44  $info .= $langs->trans('Port').': <strong>'.$conf->db->port.'</strong><br>';
45  $info .= $langs->trans('Name').': <strong>'.$conf->db->name.'</strong><br>';
46  $info .= $langs->trans('User').': <strong>'.$conf->db->user.'</strong><br>';
47  $info .= $langs->trans('Type').': <strong>'.$conf->db->type.'</strong><br>';
48  $info .= $langs->trans('Prefix').': <strong>'.$conf->db->prefix.'</strong><br>';
49  $info .= $langs->trans('Charset').': <strong>'.$conf->db->character_set.'</strong>';
50 
51  return $info;
52  }
53 
59  protected function getDolibarrInfo()
60  {
61  global $conf, $langs;
62  global $dolibarr_main_prod, $dolibarr_nocsrfcheck;
63 
64  $info = $langs->trans('Version').': <strong>'.DOL_VERSION.'</strong><br>';
65  $info .= $langs->trans('Theme').': <strong>'.$conf->theme.'</strong><br>';
66  $info .= $langs->trans('Locale').': <strong>'.$conf->global->MAIN_LANG_DEFAULT.'</strong><br>';
67  $info .= $langs->trans('Currency').': <strong>'.$conf->currency.'</strong><br>';
68  $info .= $langs->trans('Entity').': <strong>'.$conf->entity.'</strong><br>';
69  $info .= $langs->trans('MaxSizeList').': <strong>'.($conf->liste_limit ?: $conf->global->MAIN_SIZE_LISTE_LIMIT).'</strong><br>';
70  $info .= $langs->trans('MaxSizeForUploadedFiles').': <strong>'.$conf->global->MAIN_UPLOAD_DOC.'</strong><br>';
71  $info .= '$dolibarr_main_prod = <strong>'.$dolibarr_main_prod.'</strong><br>';
72  $info .= '$dolibarr_nocsrfcheck = <strong>'.$dolibarr_nocsrfcheck.'</strong><br>';
73  $info .= 'MAIN_SECURITY_CSRF_WITH_TOKEN = <strong>'.$conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN.'</strong><br>';
74  $info .= 'MAIN_FEATURES_LEVEL = <strong>'.$conf->global->MAIN_FEATURES_LEVEL.'</strong><br>';
75 
76  return $info;
77  }
78 
84  protected function getMailInfo()
85  {
86  global $conf, $langs;
87  global $dolibarr_mailing_limit_sendbyweb, $dolibarr_mailing_limit_sendbycli, $dolibarr_mailing_limit_sendbyday;
88 
89  $info = $langs->trans('Method').': <strong>'.getDolGlobalString("MAIN_MAIL_SENDMODE").'</strong><br>';
90  $info .= $langs->trans('Server').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTP_SERVER").'</strong><br>';
91  $info .= $langs->trans('Port').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTP_PORT").'</strong><br>';
92  $info .= $langs->trans('ID').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTPS_IDT").'</strong><br>';
93  $info .= $langs->trans('Pwd').': <strong>'.preg_replace('/./', '*', getDolGlobalString("MAIN_MAIL_SMTPS_PW")).'</strong><br>';
94  $info .= $langs->trans('TLS/STARTTLS').': <strong>'.getDolGlobalString("MAIN_MAIL_EMAIL_TLS").'</strong> / <strong>'.getDolGlobalString("MAIN_MAIL_EMAIL_STARTTLS").'</strong><br>';
95  $info .= $langs->trans('MAIN_DISABLE_ALL_MAILS').': <strong>'.(empty($conf->global->MAIN_DISABLE_ALL_MAILS) ? $langs->trans('No') : $langs->trans('Yes')).'</strong><br>';
96  $info .= 'dolibarr_mailing_limit_sendbyweb = <strong>'.$dolibarr_mailing_limit_sendbyweb.'</strong><br>';
97  $info .= 'dolibarr_mailing_limit_sendbycli = <strong>'.$dolibarr_mailing_limit_sendbycli.'</strong><br>';
98  $info .= 'dolibarr_mailing_limit_sendbyday = <strong>'.$dolibarr_mailing_limit_sendbyday.'</strong><br>';
99 
100  return $info;
101  }
102 
108  public function getWidgets()
109  {
110  return array(
111  "database_info" => array(
112  "icon" => "database",
113  "indicator" => "PhpDebugBar.DebugBar.TooltipIndicator",
114  "tooltip" => array(
115  "html" => $this->getDatabaseInfo(),
116  "class" => "tooltip-wide"
117  ),
118  "map" => "",
119  "default" => ""
120  ),
121  "dolibarr_info" => array(
122  "icon" => "desktop",
123  "indicator" => "PhpDebugBar.DebugBar.TooltipIndicator",
124  "tooltip" => array(
125  "html" => $this->getDolibarrInfo(),
126  "class" => "tooltip-wide"
127  ),
128  "map" => "",
129  "default" => ""
130  ),
131  "mail_info" => array(
132  "icon" => "envelope",
133  "indicator" => "PhpDebugBar.DebugBar.TooltipIndicator",
134  "tooltip" => array(
135  "html" => $this->getMailInfo(),
136  "class" => "tooltip-extra-wide"
137  ),
138  "map" => "",
139  "default" => ""
140  )
141  );
142  }
143 
149  public function getAssets()
150  {
151  return array(
152  'base_url' => dol_buildpath('/debugbar', 1),
153  'js' => 'js/widgets.js'
154  );
155  }
156 }
dol_buildpath
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Definition: functions.lib.php:1062
DolibarrCollector\getName
getName()
Return collector name.
Definition: DolibarrCollector.php:19
DolibarrCollector
DolibarrCollector class.
Definition: DolibarrCollector.php:12
DolibarrCollector\getAssets
getAssets()
Return collector assests.
Definition: DolibarrCollector.php:149
DolibarrCollector\getDatabaseInfo
getDatabaseInfo()
Return database info as an HTML string.
Definition: DolibarrCollector.php:39
DolibarrCollector\getDolibarrInfo
getDolibarrInfo()
Return dolibarr info as an HTML string.
Definition: DolibarrCollector.php:59
DolibarrCollector\collect
collect()
Return collected data.
Definition: DolibarrCollector.php:29
DolibarrCollector\getWidgets
getWidgets()
Return widget settings.
Definition: DolibarrCollector.php:108
DolibarrCollector\getMailInfo
getMailInfo()
Return mail info as an HTML string.
Definition: DolibarrCollector.php:84
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:80