dolibarr  7.0.0-beta
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 <http://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" width="100%">';
47 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
48 print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Version").'</td><td>'.$db::LABEL.' '.$db->getVersion().'</td></tr>'."\n";
49 print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n";
50 print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DatabasePort").'</td><td>'.(empty($conf->db->port)?$langs->trans("Default"):$conf->db->port).'</td></tr>'."\n";
51 print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n";
52 print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DriverType").'</td><td>'.$conf->db->type . ($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')':'').'</td></tr>'."\n";
53 print '<tr '.$bc[1].'><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n";
54 print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i','*',$dolibarr_main_db_pass).'</td></tr>'."\n";
55 print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n";
56 print '<tr '.$bc[0].'><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" width="100%">';
64 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Tables").'</td></tr>'."\n";
65 print '<tr '.$bc[0].'><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 }
77 else
78 {
79  foreach($arraylist as $listname)
80  {
81  print '<br>';
82  print '<div class="div-table-responsive-no-min">';
83  print '<table class="noborder" width="100%">';
84  print '<tr class="liste_titre">';
85  print '<td width="300">'.$langs->trans("Parameters").'</td>';
86  print '<td>'.$langs->trans("Value").'</td>';
87  print '</tr>'."\n";
88 
89  // arraytest is an array of test to do
90  $arraytest=array();
91  if (preg_match('/mysql/i',$db->type))
92  {
93  $arraytest=array(
94  'character_set_database'=>array('var'=>'dolibarr_main_db_character_set','valifempty'=>'utf8'),
95  'collation_database'=>array('var'=>'dolibarr_main_db_collation','valifempty'=>'utf8_unicode_ci')
96  );
97  }
98 
99  $listtouse=array();
100  if ($listname == 'listofvars') $listtouse=$listofvars;
101  if ($listname == 'listofstatus') $listtouse=$listofstatus;
102 
103  foreach($listtouse as $param => $paramval)
104  {
105  print '<tr class="oddeven">';
106  print '<td>';
107  print $param;
108  print '</td>';
109  print '<td>';
110  $show=0;$text='';
111  foreach($arraytest as $key => $val)
112  {
113  if ($key != $param) continue;
114  $val2=${$val['var']};
115  $text='Should be in line with value of param <b>'.$val['var'].'</b> thas is <b>'.($val2?$val2:"'' (=".$val['valifempty'].")").'</b>';
116  $show=1;
117  }
118  if ($show==0) print $paramval;
119  if ($show==1) print $form->textwithpicto($paramval,$text);
120  if ($show==2) print $form->textwithpicto($paramval,$text,1,'warning');
121  print '</td>';
122  print '</tr>'."\n";
123  }
124  print '</table>'."\n";
125  print '</div>';
126  }
127 }
128 
129 llxFooter();
130 
131 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
if(empty($reshook)) $form
View.
Definition: perms.php:103
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
print
Draft customers invoices.
Definition: index.php:91