dolibarr 18.0.6
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// Load Dolibarr environment
27require '../../main.inc.php';
28
29$langs->load("admin");
30
31if (!$user->admin) {
33}
34
35
36
37/*
38 * View
39 */
40
41$form = new Form($db);
42
43llxHeader();
44
45print load_fiche_titre($langs->trans("InfoDatabase"), '', 'title_setup');
46
47// Database
48print '<div class="div-table-responsive-no-min">';
49print '<table class="noborder centpercent">';
50print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
51print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td>'.$db::LABEL.' '.$db->getVersion().'</td></tr>'."\n";
52print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n";
53print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabasePort").'</td><td>'.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'</td></tr>'."\n";
54print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n";
55print '<tr class="oddeven"><td width="300">'.$langs->trans("DriverType").'</td><td>'.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'</td></tr>'."\n";
56print '<tr class="oddeven"><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n";
57print '<tr class="oddeven"><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'</td></tr>'."\n";
58print '<tr class="oddeven"><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n";
59print '<tr class="oddeven"><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase().'</td></tr>'."\n";
60print '</table>';
61print '</div>';
62
63// Tables
64print '<br>';
65print '<div class="div-table-responsive-no-min">';
66print '<table class="noborder centpercent">';
67print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Tables").'</td></tr>'."\n";
68print '<tr class="oddeven"><td class=""><a href="'.DOL_URL_ROOT.'/admin/system/database-tables.php?mainmenu=home">'.img_picto('', 'list', 'class="pictofixedwidth"').$langs->trans("List").'</a></td></tr>'."\n";
69print '</table>';
70print '</div>';
71
72$listofvars = $db->getServerParametersValues();
73$listofstatus = $db->getServerStatusValues();
74$arraylist = array('listofvars', 'listofstatus');
75
76if (!count($listofvars) && !count($listofstatus)) {
77 print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver");
78} else {
79 foreach ($arraylist as $listname) {
80 print '<br>';
81 print '<div class="div-table-responsive-no-min">';
82 print '<table class="noborder centpercent">';
83 print '<tr class="liste_titre">';
84 print '<td width="300">'.$langs->trans("Parameters").'</td>';
85 print '<td>'.$langs->trans("Value").'</td>';
86 print '</tr>'."\n";
87
88 // arraytest is an array of test to do
89 $arraytest = array();
90 if (preg_match('/mysql/i', $db->type)) {
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') {
99 $listtouse = $listofvars;
100 }
101 if ($listname == 'listofstatus') {
102 $listtouse = $listofstatus;
103 }
104
105 foreach ($listtouse as $param => $paramval) {
106 print '<tr class="oddeven">';
107 print '<td>';
108 print $param;
109 print '</td>';
110 print '<td class="wordbreak">';
111 $show = 0; $text = '';
112 foreach ($arraytest as $key => $val) {
113 if ($key != $param) {
114 continue;
115 }
116 $tmpvar = $val['var'];
117 $val2 = ${$tmpvar};
118 $text = 'Should be in line with value of param <b>'.$val['var'].'</b> thas is <b>'.($val2 ? $val2 : "'' (=".$val['valifempty'].")").'</b>';
119 $show = 1;
120 }
121 if ($show == 0) {
122 print $paramval;
123 }
124 if ($show == 1) {
125 print $form->textwithpicto($paramval, $text);
126 }
127 if ($show == 2) {
128 print $form->textwithpicto($paramval, $text, 1, 'warning');
129 }
130 print '</td>';
131 print '</tr>'."\n";
132 }
133 print '</table>'."\n";
134 print '</div>';
135 }
136}
137
138// End of page
139llxFooter();
140$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.