dolibarr 21.0.0-alpha
constall.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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// Load translation files required by the page
30$langs->loadLangs(array("install", "user", "admin"));
31
32
33if (!$user->admin) {
35}
36
37$lastkeyshown = null;
38
39
40/*
41 * View
42 */
43
44llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-admin page-system_constall');
45
46print load_fiche_titre($langs->trans("SummaryConst"), '', 'title_setup');
47
48
49print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')');
50// Parameters in conf.php file (when a parameter start with ?, it is shown only if defined)
51$configfileparameters = array(
52 'dolibarr_main_url_root',
53 'dolibarr_main_url_root_alt',
54 'dolibarr_main_document_root',
55 'dolibarr_main_document_root_alt',
56 'dolibarr_main_data_root',
57 'separator',
58 'dolibarr_main_db_host',
59 'dolibarr_main_db_port',
60 'dolibarr_main_db_name',
61 'dolibarr_main_db_type',
62 'dolibarr_main_db_user',
63 'dolibarr_main_db_pass',
64 'dolibarr_main_db_character_set',
65 'dolibarr_main_db_collation',
66 '?dolibarr_main_db_prefix',
67 'separator',
68 'dolibarr_main_authentication',
69 'separator',
70 '?dolibarr_main_auth_ldap_login_attribute',
71 '?dolibarr_main_auth_ldap_host',
72 '?dolibarr_main_auth_ldap_port',
73 '?dolibarr_main_auth_ldap_version',
74 '?dolibarr_main_auth_ldap_dn',
75 '?dolibarr_main_auth_ldap_admin_login',
76 '?dolibarr_main_auth_ldap_admin_pass',
77 '?dolibarr_main_auth_ldap_debug',
78 'separator',
79 '?dolibarr_lib_FPDF_PATH',
80 '?dolibarr_lib_TCPDF_PATH',
81 '?dolibarr_lib_FPDI_PATH',
82 '?dolibarr_lib_TCPDI_PATH',
83 '?dolibarr_lib_NUSOAP_PATH',
84 '?dolibarr_lib_GEOIP_PATH',
85 '?dolibarr_lib_ODTPHP_PATH',
86 '?dolibarr_lib_ODTPHP_PATHTOPCLZIP',
87 '?dolibarr_js_CKEDITOR',
88 '?dolibarr_js_JQUERY',
89 '?dolibarr_js_JQUERY_UI',
90 '?dolibarr_font_DOL_DEFAULT_TTF',
91 '?dolibarr_font_DOL_DEFAULT_TTF_BOLD',
92 'separator',
93 '?dolibarr_mailing_limit_sendbyweb',
94 '?dolibarr_mailing_limit_sendbycli',
95 '?dolibarr_mailing_limit_sendbyday',
96 '?dolibarr_strict_mode'
97 );
98$configfilelib = array(
99// 'separator',
100 $langs->trans("URLRoot"),
101 $langs->trans("URLRoot").' (alt)',
102 $langs->trans("DocumentRootServer"),
103 $langs->trans("DocumentRootServer").' (alt)',
104 $langs->trans("DataRootServer"),
105 'separator',
106 $langs->trans("DatabaseServer"),
107 $langs->trans("DatabasePort"),
108 $langs->trans("DatabaseName"),
109 $langs->trans("DriverType"),
110 $langs->trans("DatabaseUser"),
111 $langs->trans("DatabasePassword"),
112 $langs->trans("DBStoringCharset"),
113 $langs->trans("DBSortingCharset"),
114 $langs->trans("Prefix"),
115 'separator',
116 $langs->trans("AuthenticationMode"),
117 'separator',
118 'dolibarr_main_auth_ldap_login_attribute',
119 'dolibarr_main_auth_ldap_host',
120 'dolibarr_main_auth_ldap_port',
121 'dolibarr_main_auth_ldap_version',
122 'dolibarr_main_auth_ldap_dn',
123 'dolibarr_main_auth_ldap_admin_login',
124 'dolibarr_main_auth_ldap_admin_pass',
125 'dolibarr_main_auth_ldap_debug',
126 'separator',
127 'dolibarr_lib_TCPDF_PATH',
128 'dolibarr_lib_FPDI_PATH',
129 'dolibarr_lib_NUSOAP_PATH',
130 'dolibarr_lib_GEOIP_PATH',
131 'dolibarr_lib_ODTPHP_PATH',
132 'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
133 'dolibarr_js_CKEDITOR',
134 'dolibarr_js_JQUERY',
135 'dolibarr_js_JQUERY_UI',
136 'dolibarr_font_DOL_DEFAULT_TTF',
137 'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
138 'separator',
139 'Limit nb of email sent by page',
140 'Strict mode is on/off'
141 );
142
143print '<table class="noborder centpercent">';
144print '<tr class="liste_titre"><td width="280">'.$langs->trans("Label").'</td>';
145print '<td>'.$langs->trans("Parameter").'</td>';
146print '<td></td>';
147print '</tr>'."\n";
148$i = 0;
149foreach ($configfileparameters as $key) {
150 $ignore = 0;
151
152 if ($key == 'dolibarr_main_url_root_alt' && empty(${$key})) {
153 $ignore = 1;
154 }
155 if ($key == 'dolibarr_main_document_root_alt' && empty(${$key})) {
156 $ignore = 1;
157 }
158
159 if (empty($ignore)) {
160 $newkey = preg_replace('/^\?/', '', $key);
161
162 if (preg_match('/^\?/', $key) && empty(${$newkey})) {
163 $i++;
164 continue; // We discard parameters starting with ?
165 }
166
167 if ($newkey == 'separator' && $lastkeyshown == 'separator') {
168 $i++;
169 continue;
170 }
171
172 print '<tr class="oddeven">';
173 if ($newkey == 'separator') {
174 print '<td colspan="3">&nbsp;</td>';
175 } else {
176 // Label
177 print "<td>".$configfilelib[$i].'</td>';
178 // Key
179 print '<td>'.$newkey.'</td>';
180 // Value
181 print "<td>";
182 if ($newkey == 'dolibarr_main_db_pass') {
183 print preg_replace('/./i', '*', ${$newkey});
184 } elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/', ${$newkey})) {
185 print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
186 } else {
187 print ${$newkey};
188 }
189 if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) {
190 print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
191 }
192 print "</td>";
193 }
194 print "</tr>\n";
195 $lastkeyshown = $newkey;
196 }
197 $i++;
198}
199print '</table>';
200print '<br>';
201
202
203
204// Parameters in database
205print load_fiche_titre($langs->trans("Database"));
206print '<table class="noborder">';
207print '<tr class="liste_titre">';
208print '<td>'.$langs->trans("Parameter").'</td>';
209print '<td></td>';
210if (!isModEnabled('multicompany') || !$user->entity) {
211 print '<td>'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
212}
213print "</tr>\n";
214
215$sql = "SELECT";
216$sql .= " rowid";
217$sql .= ", ".$db->decrypt('name')." as name";
218$sql .= ", ".$db->decrypt('value')." as value";
219$sql .= ", type";
220$sql .= ", note";
221$sql .= ", entity";
222$sql .= " FROM ".MAIN_DB_PREFIX."const";
223if (!isModEnabled('multicompany')) {
224 // If no multicompany mode, admins can see global and their constantes
225 $sql .= " WHERE entity IN (0,".$conf->entity.")";
226} else {
227 // If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
228 if ($user->entity) {
229 $sql .= " WHERE entity IN (".$db->sanitize($user->entity.",".$conf->entity).")";
230 }
231}
232$sql .= " ORDER BY entity, name ASC";
233$resql = $db->query($sql);
234if ($resql) {
235 $num = $db->num_rows($resql);
236 $i = 0;
237
238 while ($i < $num) {
239 $obj = $db->fetch_object($resql);
240
241 print '<tr class="oddeven">';
242 print '<td>'.$obj->name.'</td>'."\n";
243 print '<td>'.$obj->value.'</td>'."\n";
244 if (!isModEnabled('multicompany') || !$user->entity) {
245 print '<td>'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
246 }
247 print "</tr>\n";
248
249 $i++;
250 }
251}
252
253print '</table>';
254
255// End of page
256llxFooter();
257$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $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.