PageRenderTime 123ms CodeModel.GetById 50ms app.highlight 10ms RepoModel.GetById 40ms app.codeStats 1ms

/htdocs/admin/system/constall.php

https://github.com/asterix14/dolibarr
PHP | 240 lines | 181 code | 26 blank | 33 comment | 35 complexity | d4376b082cdf77aa99c6846c84e44e85 MD5 | raw 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@dolibarr.fr>
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License as published by
  8 * the Free Software Foundation; either version 2 of the License, or
  9 * (at your option) any later version.
 10 *
 11 * This program is distributed in the hope that it will be useful,
 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14 * GNU General Public License for more details.
 15 *
 16 * You should have received a copy of the GNU General Public License
 17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 18 */
 19
 20/**
 21 *		\file 		htdocs/admin/system/constall.php
 22 *		\brief      Page to show all Dolibarr setup (config file and database constants)
 23 */
 24
 25require("../../main.inc.php");
 26
 27$langs->load("admin");
 28$langs->load("user");
 29$langs->load("install");
 30
 31
 32if (!$user->admin)
 33  accessforbidden();
 34
 35
 36/*
 37 * View
 38 */
 39
 40llxHeader();
 41
 42print_fiche_titre($langs->trans("SummaryConst"),'','setup');
 43
 44
 45print_titre($langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')');
 46// Parameters in conf.php file
 47$configfileparameters=array(
 48//							'separator',
 49							'dolibarr_main_url_root',
 50							'dolibarr_main_url_root_alt',
 51							'dolibarr_main_document_root',
 52							'dolibarr_main_document_root_alt',
 53							'dolibarr_main_data_root',
 54							'separator',
 55							'dolibarr_main_db_host',
 56							'dolibarr_main_db_port',
 57							'dolibarr_main_db_name',
 58							'dolibarr_main_db_type',
 59							'dolibarr_main_db_user',
 60							'dolibarr_main_db_pass',
 61							'dolibarr_main_db_character_set',
 62							'dolibarr_main_db_collation',
 63							'separator',
 64							'dolibarr_main_authentication',
 65							'separator',
 66							'?dolibarr_main_auth_ldap_login_attribute',
 67							'?dolibarr_main_auth_ldap_host',
 68							'?dolibarr_main_auth_ldap_port',
 69							'?dolibarr_main_auth_ldap_version',
 70							'?dolibarr_main_auth_ldap_dn',
 71							'?dolibarr_main_auth_ldap_admin_login',
 72							'?dolibarr_main_auth_ldap_admin_pass',
 73							'?dolibarr_main_auth_ldap_debug',
 74                            'separator',
 75                            '?dolibarr_lib_ADODB_PATH',
 76                            '?dolibarr_lib_TCPDF_PATH',
 77                            '?dolibarr_lib_FPDFI_PATH',
 78                            '?dolibarr_lib_NUSOAP_PATH',
 79                            '?dolibarr_lib_PHPEXCEL_PATH',
 80                            '?dolibarr_lib_GEOIP_PATH',
 81							'?dolibarr_lib_ODTPHP_PATH',
 82                            '?dolibarr_lib_ODTPHP_PATHTOPCLZIP',
 83                            '?dolibarr_font_DOL_DEFAULT_TTF',
 84                            '?dolibarr_font_DOL_DEFAULT_TTF_BOLD'
 85						);
 86$configfilelib=array(
 87//					'separator',
 88					$langs->trans("URLRoot"),
 89					$langs->trans("URLRoot").' (alt)',
 90					$langs->trans("DocumentRootServer"),
 91					$langs->trans("DocumentRootServer").' (alt)',
 92					$langs->trans("DataRootServer"),
 93					'separator',
 94					$langs->trans("DatabaseServer"),
 95					$langs->trans("DatabasePort"),
 96					$langs->trans("DatabaseName"),
 97					$langs->trans("DriverType"),
 98					$langs->trans("DatabaseUser"),
 99					$langs->trans("DatabasePassword"),
100					$langs->trans("DBStoringCharset"),
101					$langs->trans("DBSortingCharset"),
102					'separator',
103					$langs->trans("AuthenticationMode"),
104					'separator',
105					'dolibarr_main_auth_ldap_login_attribute',
106					'dolibarr_main_auth_ldap_host',
107					'dolibarr_main_auth_ldap_port',
108					'dolibarr_main_auth_ldap_version',
109					'dolibarr_main_auth_ldap_dn',
110					'dolibarr_main_auth_ldap_admin_login',
111					'dolibarr_main_auth_ldap_admin_pass',
112					'dolibarr_main_auth_ldap_debug',
113					'separator',
114                    'dolibarr_lib_ADODB_PATH',
115                    'dolibarr_lib_TCPDF_PATH',
116                    'dolibarr_lib_FPDFI_PATH',
117                    'dolibarr_lib_NUSOAP_PATH',
118                    'dolibarr_lib_PHPEXCEL_PATH',
119                    'dolibarr_lib_GEOIP_PATH',
120					'dolibarr_lib_ODTPHP_PATH',
121                    'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
122                    'dolibarr_font_DOL_DEFAULT_TTF',
123                    'dolibarr_font_DOL_DEFAULT_TTF_BOLD'
124					);
125$var=true;
126print '<table class="noborder" width="100%">';
127print '<tr class="liste_titre"><td width="280">'.$langs->trans("Label").'</td>';
128print '<td>'.$langs->trans("Parameter").'</td>';
129print '<td>'.$langs->trans("Value").'</td>';
130print '</tr>'."\n";
131$i=0;
132foreach($configfileparameters as $key)
133{
134	$ignore=0;
135
136	if ($key == 'dolibarr_main_url_root_alt' && empty(${$key})) $ignore=1;
137	if ($key == 'dolibarr_main_document_root_alt' && empty(${$key})) $ignore=1;
138
139	if (empty($ignore))
140	{
141        $newkey = preg_replace('/^\?/','',$key);
142
143        if (preg_match('/^\?/',$key) && empty(${$newkey}))
144        {
145            $i++;
146            continue;    // We discard parametes starting with ?
147        }
148
149        if ($newkey == 'separator' && $lastkeyshown == 'separator')
150        {
151            $i++;
152            continue;
153        }
154
155		$var=!$var;
156		print "<tr ".$bc[$var].">";
157		if ($newkey == 'separator')
158		{
159			print '<td colspan="3">&nbsp;</td>';
160		}
161		else
162		{
163			// Label
164			print "<td>".$configfilelib[$i].'</td>';
165			// Key
166			print '<td>'.$newkey.'</td>';
167			// Value
168			print "<td>";
169			if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey});
170			else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
171			else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
172			else print ${$newkey};
173			print "</td>";
174		}
175		print "</tr>\n";
176		$lastkeyshown=$newkey;
177	}
178	$i++;
179}
180print '</table>';
181print '<br>';
182
183
184
185// Parameters in database
186print_titre($langs->trans("Database"));
187print '<table class="noborder">';
188print '<tr class="liste_titre">';
189print '<td>'.$langs->trans("Parameter").'</td>';
190print '<td>'.$langs->trans("Value").'</td>';
191if (empty($conf->multicompany->enabled) || !$user->entity) print '<td>'.$langs->trans("Entity").'</td>';	// If superadmin or multicompany disabled
192print "</tr>\n";
193
194$sql = "SELECT";
195$sql.= " rowid";
196$sql.= ", ".$db->decrypt('name')." as name";
197$sql.= ", ".$db->decrypt('value')." as value";
198$sql.= ", type";
199$sql.= ", note";
200$sql.= ", entity";
201$sql.= " FROM ".MAIN_DB_PREFIX."const";
202if (empty($conf->multicompany->enabled))
203{
204	// If no multicompany mode, admins can see global and their constantes
205	$sql.= " WHERE entity IN (0,".$conf->entity.")";
206}
207else
208{
209	// If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
210	if ($user->entity) $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
211}
212$sql.= " ORDER BY entity, name ASC";
213$resql = $db->query($sql);
214if ($resql)
215{
216	$num = $db->num_rows($resql);
217	$i = 0;
218	$var=True;
219
220	while ($i < $num)
221    {
222    	$obj = $db->fetch_object($resql);
223    	$var=!$var;
224
225    	print '<tr '.$bc[$var].'>';
226    	print '<td>'.$obj->name.'</td>'."\n";
227    	print '<td>'.$obj->value.'</td>'."\n";
228    	if (empty($conf->multicompany->enabled) || !$user->entity) print '<td>'.$obj->entity.'</td>'."\n";	// If superadmin or multicompany disabled
229    	print "</tr>\n";
230
231    	$i++;
232    }
233}
234
235print '</table>';
236
237$db->close();
238
239llxFooter();
240?>