dolibarr  13.0.2
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;
88 
89  $info = $langs->trans('Method').': <strong>'.$conf->global->MAIN_MAIL_SENDMODE.'</strong><br>';
90  $info .= $langs->trans('Server').': <strong>'.$conf->global->MAIN_MAIL_SMTP_SERVER.'</strong><br>';
91  $info .= $langs->trans('Port').': <strong>'.$conf->global->MAIN_MAIL_SMTP_PORT.'</strong><br>';
92  $info .= $langs->trans('ID').': <strong>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</strong><br>';
93  $info .= $langs->trans('Pwd').': <strong>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'</strong><br>';
94  $info .= $langs->trans('TLS/STARTTLS').': <strong>'.(empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? '' : $conf->global->MAIN_MAIL_EMAIL_TLS).'</strong> / <strong>'.(empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? '' : $conf->global->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 
98  return $info;
99  }
100 
106  public function getWidgets()
107  {
108  return array(
109  "database_info" => array(
110  "icon" => "database",
111  "indicator" => "PhpDebugBar.DebugBar.TooltipIndicator",
112  "tooltip" => array(
113  "html" => $this->getDatabaseInfo(),
114  "class" => "tooltip-wide"
115  ),
116  "map" => "",
117  "default" => ""
118  ),
119  "dolibarr_info" => array(
120  "icon" => "desktop",
121  "indicator" => "PhpDebugBar.DebugBar.TooltipIndicator",
122  "tooltip" => array(
123  "html" => $this->getDolibarrInfo(),
124  "class" => "tooltip-wide"
125  ),
126  "map" => "",
127  "default" => ""
128  ),
129  "mail_info" => array(
130  "icon" => "envelope",
131  "indicator" => "PhpDebugBar.DebugBar.TooltipIndicator",
132  "tooltip" => array(
133  "html" => $this->getMailInfo(),
134  "class" => "tooltip-extra-wide"
135  ),
136  "map" => "",
137  "default" => ""
138  )
139  );
140  }
141 
147  public function getAssets()
148  {
149  return array(
150  'base_url' => dol_buildpath('/debugbar', 1),
151  'js' => 'js/widgets.js'
152  );
153  }
154 }
getDatabaseInfo()
Return database info as an HTML string.
getAssets()
Return collector assests.
getMailInfo()
Return mail info as an HTML string.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
DolibarrCollector class.
getName()
Return collector name.
getDolibarrInfo()
Return dolibarr info as an HTML string.
getWidgets()
Return widget settings.
collect()
Return collected data.