dolibarr  13.0.2
database.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
5  * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
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 
26 require '../../main.inc.php';
27 
28 $langs->load("admin");
29 
30 if (!$user->admin) accessforbidden();
31 
32 
33 
34 /*
35  * View
36  */
37 
38 $form = new Form($db);
39 
40 llxHeader();
41 
42 print load_fiche_titre($langs->trans("InfoDatabase"), '', 'title_setup');
43 
44 // Database
45 print '<div class="div-table-responsive-no-min">';
46 print '<table class="noborder centpercent">';
47 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
48 print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td>'.$db::LABEL.' '.$db->getVersion().'</td></tr>'."\n";
49 print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n";
50 print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabasePort").'</td><td>'.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'</td></tr>'."\n";
51 print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n";
52 print '<tr class="oddeven"><td width="300">'.$langs->trans("DriverType").'</td><td>'.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'</td></tr>'."\n";
53 print '<tr class="oddeven"><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n";
54 print '<tr class="oddeven"><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'</td></tr>'."\n";
55 print '<tr class="oddeven"><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n";
56 print '<tr class="oddeven"><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase().'</td></tr>'."\n";
57 print '</table>';
58 print '</div>';
59 
60 // Tables
61 print '<br>';
62 print '<div class="div-table-responsive-no-min">';
63 print '<table class="noborder centpercent">';
64 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Tables").'</td></tr>'."\n";
65 print '<tr class="oddeven"><td width="300"><a href="'.DOL_URL_ROOT.'/admin/system/database-tables.php?mainmenu=home">'.$langs->trans("List").'</a></td></tr>'."\n";
66 print '</table>';
67 print '</div>';
68 
69 $listofvars = $db->getServerParametersValues();
70 $listofstatus = $db->getServerStatusValues();
71 $arraylist = array('listofvars', 'listofstatus');
72 
73 if (!count($listofvars) && !count($listofstatus))
74 {
75  print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver");
76 } else {
77  foreach ($arraylist as $listname)
78  {
79  print '<br>';
80  print '<div class="div-table-responsive-no-min">';
81  print '<table class="noborder centpercent">';
82  print '<tr class="liste_titre">';
83  print '<td width="300">'.$langs->trans("Parameters").'</td>';
84  print '<td>'.$langs->trans("Value").'</td>';
85  print '</tr>'."\n";
86 
87  // arraytest is an array of test to do
88  $arraytest = array();
89  if (preg_match('/mysql/i', $db->type))
90  {
91  $arraytest = array(
92  'character_set_database'=>array('var'=>'dolibarr_main_db_character_set', 'valifempty'=>'utf8'),
93  'collation_database'=>array('var'=>'dolibarr_main_db_collation', 'valifempty'=>'utf8_unicode_ci')
94  );
95  }
96 
97  $listtouse = array();
98  if ($listname == 'listofvars') $listtouse = $listofvars;
99  if ($listname == 'listofstatus') $listtouse = $listofstatus;
100 
101  foreach ($listtouse as $param => $paramval)
102  {
103  print '<tr class="oddeven">';
104  print '<td>';
105  print $param;
106  print '</td>';
107  print '<td class="wordbreak">';
108  $show = 0; $text = '';
109  foreach ($arraytest as $key => $val)
110  {
111  if ($key != $param) continue;
112  $val2 = ${$val['var']};
113  $text = 'Should be in line with value of param <b>'.$val['var'].'</b> thas is <b>'.($val2 ? $val2 : "'' (=".$val['valifempty'].")").'</b>';
114  $show = 1;
115  }
116  if ($show == 0) print $paramval;
117  if ($show == 1) print $form->textwithpicto($paramval, $text);
118  if ($show == 2) print $form->textwithpicto($paramval, $text, 1, 'warning');
119  print '</td>';
120  print '</tr>'."\n";
121  }
122  print '</table>'."\n";
123  print '</div>';
124  }
125 }
126 
127 // End of page
128 llxFooter();
129 $db->close();
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
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 ...
print
Draft customers invoices.
Definition: index.php:89
llxFooter()
Empty footer.
Definition: wrapper.php:59