dolibarr  16.0.5
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) {
32 }
33 
34 
35 
36 /*
37  * View
38  */
39 
40 $form = new Form($db);
41 
42 llxHeader();
43 
44 print load_fiche_titre($langs->trans("InfoDatabase"), '', 'title_setup');
45 
46 // Database
47 print '<div class="div-table-responsive-no-min">';
48 print '<table class="noborder centpercent">';
49 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
50 print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td>'.$db::LABEL.' '.$db->getVersion().'</td></tr>'."\n";
51 print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n";
52 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";
53 print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n";
54 print '<tr class="oddeven"><td width="300">'.$langs->trans("DriverType").'</td><td>'.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'</td></tr>'."\n";
55 print '<tr class="oddeven"><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n";
56 print '<tr class="oddeven"><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'</td></tr>'."\n";
57 print '<tr class="oddeven"><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n";
58 print '<tr class="oddeven"><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase().'</td></tr>'."\n";
59 print '</table>';
60 print '</div>';
61 
62 // Tables
63 print '<br>';
64 print '<div class="div-table-responsive-no-min">';
65 print '<table class="noborder centpercent">';
66 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Tables").'</td></tr>'."\n";
67 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";
68 print '</table>';
69 print '</div>';
70 
71 $listofvars = $db->getServerParametersValues();
72 $listofstatus = $db->getServerStatusValues();
73 $arraylist = array('listofvars', 'listofstatus');
74 
75 if (!count($listofvars) && !count($listofstatus)) {
76  print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver");
77 } else {
78  foreach ($arraylist as $listname) {
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  $arraytest = array(
91  'character_set_database'=>array('var'=>'dolibarr_main_db_character_set', 'valifempty'=>'utf8'),
92  'collation_database'=>array('var'=>'dolibarr_main_db_collation', 'valifempty'=>'utf8_unicode_ci')
93  );
94  }
95 
96  $listtouse = array();
97  if ($listname == 'listofvars') {
98  $listtouse = $listofvars;
99  }
100  if ($listname == 'listofstatus') {
101  $listtouse = $listofstatus;
102  }
103 
104  foreach ($listtouse as $param => $paramval) {
105  print '<tr class="oddeven">';
106  print '<td>';
107  print $param;
108  print '</td>';
109  print '<td class="wordbreak">';
110  $show = 0; $text = '';
111  foreach ($arraytest as $key => $val) {
112  if ($key != $param) {
113  continue;
114  }
115  $val2 = ${$val['var']};
116  $text = 'Should be in line with value of param <b>'.$val['var'].'</b> thas is <b>'.($val2 ? $val2 : "'' (=".$val['valifempty'].")").'</b>';
117  $show = 1;
118  }
119  if ($show == 0) {
120  print $paramval;
121  }
122  if ($show == 1) {
123  print $form->textwithpicto($paramval, $text);
124  }
125  if ($show == 2) {
126  print $form->textwithpicto($paramval, $text, 1, 'warning');
127  }
128  print '</td>';
129  print '</tr>'."\n";
130  }
131  print '</table>'."\n";
132  print '</div>';
133  }
134 }
135 
136 // End of page
137 llxFooter();
138 $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
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
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