dolibarr/htdocs/admin/system/dolibarr.php

573 lines
24 KiB
PHP
Raw Permalink Normal View History

<?php
2020-10-04 19:09:25 +02:00
/* Copyright (C) 2005-2020 Laurent Destailleur <eldy@users.sourceforge.net>
2012-08-02 10:07:55 +02:00
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2018-10-27 14:43:12 +02:00
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/system/dolibarr.php
2020-10-04 19:09:25 +02:00
* \brief Page to show Dolibarr information
2008-08-07 08:33:35 +02:00
*/
2022-09-07 20:08:59 +02:00
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
2017-02-22 02:32:35 +01:00
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
'
@phan-var-force string $dolibarr_main_document_root_alt
';
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_document_root_alt
*/
2018-09-07 14:58:22 +02:00
// Load translation files required by the page
$langs->loadLangs(array("install", "other", "admin"));
2020-09-16 19:39:50 +02:00
$action = GETPOST('action', 'aZ09');
2017-02-22 02:32:35 +01:00
2021-02-26 22:04:03 +01:00
if (!$user->admin) {
2012-08-02 10:07:55 +02:00
accessforbidden();
2021-02-26 22:04:03 +01:00
}
2017-02-22 02:32:35 +01:00
$sfurl = '';
$version = '0.0';
2017-02-22 02:32:35 +01:00
/*
* Actions
*/
2021-02-26 22:04:03 +01:00
if ($action == 'getlastversion') {
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
2020-11-04 17:45:10 +01:00
if (function_exists('simplexml_load_string')) {
if (LIBXML_VERSION < 20900) {
// Avoid load of external entities (security problem).
// Required only if LIBXML_VERSION < 20900
// @phan-suppress-next-line PhanDeprecatedFunctionInternal
libxml_disable_entity_loader(true);
}
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET);
2020-11-04 17:45:10 +01:00
} else {
setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors');
}
2017-02-22 02:32:35 +01:00
}
2017-10-09 22:52:26 +02:00
2008-08-07 08:33:35 +02:00
/*
* View
*/
2008-10-12 13:41:13 +02:00
$form = new Form($db);
2021-02-16 11:15:42 +01:00
$help_url = '';
$title = $langs->trans("InfoDolibarr");
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-admin page-system_dolibarr');
2016-11-06 12:16:10 +01:00
print load_fiche_titre($title, '', 'title_setup');
// Version
2017-01-17 20:04:41 +01:00
print '<div class="div-table-responsive-no-min">';
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">';
2024-09-03 11:19:01 +02:00
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Version").'</td><td></td></tr>'."\n";
2024-01-14 21:48:35 +01:00
print '<tr class="oddeven"><td>'.$langs->trans("CurrentVersion").'<br><span class="opacitymedium">('.$langs->trans("Programs").')</span></td><td>'.DOL_VERSION;
2009-08-04 16:36:29 +02:00
// If current version differs from last upgrade
if (!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')) {
// Compare version with last install database version (upgrades never occurred)
2021-02-26 22:04:03 +01:00
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) {
2024-01-05 04:18:53 +01:00
print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_INSTALL')));
2021-02-26 22:04:03 +01:00
}
2020-05-21 09:35:30 +02:00
} else {
// Compare version with last upgrade database version
2021-02-26 22:04:03 +01:00
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) {
2024-01-05 04:18:53 +01:00
print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')));
2021-02-26 22:04:03 +01:00
}
}
2017-02-22 02:19:50 +01:00
2020-12-03 16:35:42 +01:00
$version = DOL_VERSION;
2021-02-26 22:04:03 +01:00
if (preg_match('/[a-z]+/i', $version)) {
$version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
}
2021-11-22 02:35:55 +01:00
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank" rel="noopener noreferrer external">'.$langs->trans("SeeChangeLog").'</a>';
2020-12-03 16:35:42 +01:00
$newversion = '';
2021-02-26 22:04:03 +01:00
if (function_exists('curl_init')) {
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
if ($action == 'getlastversion') {
if ($sfurl) {
$i = 0;
while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) {
$title = $sfurl->channel[0]->item[$i]->title;
$reg = array();
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) {
$newversion = $reg[1];
$newversionarray = explode('.', $newversion);
$versionarray = explode('.', $version);
//var_dump($newversionarray);var_dump($versionarray);
if (versioncompare($newversionarray, $versionarray) > 0) {
$version = $newversion;
}
}
$i++;
}
// Show version
print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b>';
if ($version != '0.0') {
2021-11-22 02:35:55 +01:00
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank" rel="noopener noreferrer external">'.$langs->trans("SeeChangeLog").'</a>';
}
2021-02-26 22:04:03 +01:00
} else {
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>';
}
} else {
2021-02-21 12:10:07 +01:00
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="butAction smallpaddingimp">'.$langs->trans("Check").'</a>';
}
2017-02-22 02:19:50 +01:00
}
2017-11-30 11:16:28 +01:00
// Now show link to the changelog
2020-12-03 16:35:42 +01:00
//print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
2017-11-30 11:16:28 +01:00
$version = DOL_VERSION;
2021-02-26 22:04:03 +01:00
if (preg_match('/[a-z]+/i', $version)) {
$version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
}
2017-11-30 11:16:28 +01:00
print '</td></tr>'."\n";
2024-01-14 21:48:35 +01:00
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").'<br><span class="opacitymedium">('.$langs->trans("Database").')</span></td><td>'.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'<br><span class="opacitymedium">('.$langs->trans("Database").')</span></td><td>'.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'</td></tr>'."\n";
print '</table>';
2017-01-17 20:04:41 +01:00
print '</div>';
print '<br>';
// Session
2017-01-17 20:04:41 +01:00
print '<div class="div-table-responsive-no-min">';
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">';
2024-09-03 11:19:01 +02:00
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Session").'</td><td></td></tr>'."\n";
2022-10-28 12:34:49 +02:00
print '<tr class="oddeven"><td>'.$langs->trans("SessionSavePath").'</td><td>'.session_save_path().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionName").'</td><td>'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionId").'</td><td>'.session_id().'</td></tr>'."\n";
2024-01-14 21:48:35 +01:00
print '<tr class="oddeven"><td>';
print $langs->trans("CurrentSessionTimeOut");
print '</td>';
2022-10-28 12:34:49 +02:00
print '<td>';
print ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds");
2018-11-11 14:36:35 +01:00
print '<!-- session.gc_maxlifetime = '.ini_get("session.gc_maxlifetime").' -->'."\n";
print '<!-- session.gc_probability = '.ini_get("session.gc_probability").' -->'."\n";
print '<!-- session.gc_divisor = '.ini_get("session.gc_divisor").' -->'."\n";
2024-01-14 21:48:35 +01:00
print $form->textwithpicto('', $langs->trans("Parameter").' <b>php.ini</b>: <b>session.gc_maxlifetime</b><br>'.$langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor")));
print "</td></tr>\n";
2022-10-28 12:34:49 +02:00
print '<tr class="oddeven"><td>'.$langs->trans("CurrentTheme").'</td><td>'.$conf->theme.'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentMenuHandler").'</td><td>';
print $conf->standard_menu;
print '</td></tr>'."\n";
2022-10-28 12:34:49 +02:00
print '<tr class="oddeven"><td>'.$langs->trans("Screen").'</td><td>';
print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight'];
print '</td></tr>'."\n";
2022-10-28 12:39:37 +02:00
print '<tr class="oddeven"><td>'.$langs->trans("Session").'</td><td class="wordbreak">';
$i = 0;
2021-02-26 22:04:03 +01:00
foreach ($_SESSION as $key => $val) {
if ($i > 0) {
print ', ';
}
if (is_array($val)) {
print $key.' => array(...)';
} else {
print $key.' => '.dol_escape_htmltag($val);
}
$i++;
}
print '</td></tr>'."\n";
print '</table>';
2017-01-17 20:04:41 +01:00
print '</div>';
print '<br>';
2010-01-04 21:10:10 +01:00
// Shmop
2024-01-05 03:41:22 +01:00
if (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) {
$shmoparray = dol_listshmop();
2010-05-29 00:15:56 +02:00
print '<div class="div-table-responsive-no-min">';
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">';
2010-01-12 13:21:29 +01:00
print '<tr class="liste_titre">';
2021-02-02 09:44:51 +01:00
print '<td class="titlefieldcreate">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
2010-01-12 13:21:29 +01:00
print '<td>'.$langs->trans("NbOfEntries").'</td>';
2019-01-21 22:36:14 +01:00
print '<td class="right">'.$langs->trans("Address").'</td>';
2010-01-12 13:21:29 +01:00
print '</tr>'."\n";
2010-01-04 21:10:10 +01:00
2021-02-26 22:04:03 +01:00
foreach ($shmoparray as $key => $val) {
2017-04-12 17:44:01 +02:00
print '<tr class="oddeven"><td>'.$key.'</td>';
print '<td>'.count($val).'</td>';
2019-01-21 22:36:14 +01:00
print '<td class="right">'.dol_getshmopaddress($key).'</td>';
print '</tr>'."\n";
2010-01-04 21:10:10 +01:00
}
print '</table>';
2017-01-17 20:04:41 +01:00
print '</div>';
2010-01-04 21:10:10 +01:00
print '<br>';
}
// Localisation
2017-01-17 20:04:41 +01:00
print '<div class="div-table-responsive-no-min">';
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">';
2024-09-03 11:19:01 +02:00
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("LocalisationDolibarrParameters").'</td><td></td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n";
2017-04-12 17:44:01 +02:00
print '<tr class="oddeven"><td>'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
// Thousands
$thousand = $langs->transnoentitiesnoconv("SeparatorThousand");
2021-02-26 22:04:03 +01:00
if ($thousand == 'SeparatorThousand') {
$thousand = ' '; // ' ' does not work on trans method
}
if ($thousand == 'None') {
$thousand = '';
}
print '<tr class="oddeven"><td>'.$langs->trans("CurrentValueSeparatorThousand").'</td><td>'.($thousand == ' ' ? $langs->transnoentitiesnoconv("Space") : $thousand).'</td></tr>'."\n";
// Decimals
$dec = $langs->transnoentitiesnoconv("SeparatorDecimal");
2017-04-12 17:44:01 +02:00
print '<tr class="oddeven"><td>'.$langs->trans("CurrentValueSeparatorDecimal").'</td><td>'.$dec.'</td></tr>'."\n";
// Show results of functions to see if everything works
print '<tr class="oddeven"><td>&nbsp; => price2num(1233.56+1)</td><td>'.price2num(1233.56 + 1, 2).'</td></tr>'."\n";
print '<tr class="oddeven"><td>&nbsp; => price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56", 2)."</td></tr>\n";
2021-02-26 22:04:03 +01:00
if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) {
print '<tr class="oddeven"><td>&nbsp; => price2num('."'1 234.56')</td><td>".price2num("1 234.56", 2)."</td>";
print "</tr>\n";
}
2017-04-12 17:44:01 +02:00
print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n";
// Timezones
// Database timezone
2021-02-26 22:04:03 +01:00
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') {
print '<tr class="oddeven"><td>'.$langs->trans("MySQLTimeZone").' (database)</td><td>'; // Timezone server base
$sql = "SHOW VARIABLES where variable_name = 'system_time_zone'";
$resql = $db->query($sql);
2021-02-26 22:04:03 +01:00
if ($resql) {
$obj = $db->fetch_object($resql);
print $form->textwithtooltip($obj->Value, $langs->trans('TZHasNoEffect'), 2, 1, img_info(''));
}
print '</td></tr>'."\n";
}
$txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n";
2020-12-30 22:01:26 +01:00
$txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
2024-01-05 04:18:53 +01:00
$txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.getDolGlobalString('MAIN_SERVER_TZ', $langs->trans("NotDefined"));
print '<tr class="oddeven"><td>'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
$a = getServerTimeZoneInt('now');
$b = getServerTimeZoneInt('winter');
$c = getServerTimeZoneInt('summer');
2020-11-21 16:49:54 +01:00
$daylight = round($c - $b);
//print $a." ".$b." ".$c." ".$daylight;
$val = ($a >= 0 ? '+' : '').$a;
$val .= ' ('.($a == 'unknown' ? 'unknown' : ($a >= 0 ? '+' : '').($a * 3600)).')';
$val .= ' &nbsp; &nbsp; &nbsp; '.getServerTimeZoneString();
$val .= ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.((is_null($b) || is_null($c)) ? 'unknown' : ($a == $c ? yn((int) $daylight) : yn(0).($daylight ? ' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')' : '')));
print $form->textwithtooltip($val, $txt, 2, 1, img_info(''));
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver').'</td></tr>'."\n";
print '<tr class="oddeven"><td>&nbsp; => dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0, "dayhourtext").'</td>';
print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970, 1, false).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, false), 'dayhour').')</td>';
print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970, 1, true).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, true), 'dayhour').')</td>';
// Client
$tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
print '<tr class="oddeven"><td>'.$langs->trans("ClientTZ").'</td><td>'.($tz ? ($tz >= 0 ? '+' : '').$tz : '').' ('.($tz >= 0 ? '+' : '').($tz * 60 * 60).')';
2012-05-15 01:41:12 +02:00
print ' &nbsp; &nbsp; &nbsp; '.$_SESSION['dol_tz_string'];
print ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': ';
2021-02-26 22:04:03 +01:00
if ($_SESSION['dol_dst'] > 0) {
print yn(1);
} else {
print yn(0);
}
if (!empty($_SESSION['dol_dst_first'])) {
print ' &nbsp; &nbsp; ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']), 'dayhour', 'gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']), 'dayhour', 'gmt').')';
}
2011-11-01 04:57:45 +01:00
print '</td></tr>'."\n";
print '</td></tr>'."\n";
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now('gmt'), 'dayhour', 'tzuser').'</td></tr>'."\n";
2009-12-14 20:34:10 +01:00
$filesystemencoding = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
2017-11-15 13:15:08 +01:00
print '<tr class="oddeven"><td>'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n";
2009-12-14 20:34:10 +01:00
$tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
2021-02-26 22:04:03 +01:00
if (empty($tmp) && !empty($_SERVER["WINDIR"])) {
$tmp = 'iso-8859-1'; // By default for windows
}
if (empty($tmp)) {
$tmp = 'utf-8'; // By default for other
}
if (getDolGlobalString('MAIN_FILESYSTEM_ENCODING')) {
2024-01-05 04:18:53 +01:00
$tmp = getDolGlobalString('MAIN_FILESYSTEM_ENCODING');
2021-02-26 22:04:03 +01:00
}
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("File encoding").'</td><td>'.$tmp.'</td></tr>'."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
2009-12-14 20:34:10 +01:00
print '</table>';
2017-01-17 20:04:41 +01:00
print '</div>';
print '<br>';
2012-09-21 00:13:20 +02:00
// Parameters in conf.php file (when a parameter start with ?, it is shown only if defined)
$configfileparameters = array(
2021-07-05 18:16:52 +02:00
'dolibarr_main_prod' => 'Production mode (Hide all error messages)',
2021-07-05 18:19:02 +02:00
'dolibarr_main_instance_unique_id' => $langs->trans("InstanceUniqueID"),
2021-07-05 18:16:52 +02:00
'separator0' => '',
'dolibarr_main_url_root' => $langs->trans("URLRoot"),
'?dolibarr_main_url_root_alt' => $langs->trans("URLRoot").' (alt)',
'dolibarr_main_document_root' => $langs->trans("DocumentRootServer"),
2021-07-05 18:16:52 +02:00
'?dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)',
'dolibarr_main_data_root' => $langs->trans("DataRootServer"),
'separator1' => '',
'dolibarr_main_db_host' => $langs->trans("DatabaseServer"),
'dolibarr_main_db_port' => $langs->trans("DatabasePort"),
'dolibarr_main_db_name' => $langs->trans("DatabaseName"),
'dolibarr_main_db_type' => $langs->trans("DriverType"),
'dolibarr_main_db_user' => $langs->trans("DatabaseUser"),
'dolibarr_main_db_pass' => $langs->trans("DatabasePassword"),
'dolibarr_main_db_character_set' => $langs->trans("DBStoringCharset"),
'dolibarr_main_db_collation' => $langs->trans("DBSortingCollation"),
'?dolibarr_main_db_prefix' => $langs->trans("DatabasePrefix"),
'dolibarr_main_db_readonly' => $langs->trans("ReadOnlyMode"),
2021-07-05 18:16:52 +02:00
'separator2' => '',
'dolibarr_main_authentication' => $langs->trans("AuthenticationMode"),
'?multicompany_transverse_mode' => $langs->trans("MultiCompanyMode"),
'separator' => '',
2021-07-05 18:16:52 +02:00
'?dolibarr_main_auth_ldap_login_attribute' => 'dolibarr_main_auth_ldap_login_attribute',
'?dolibarr_main_auth_ldap_host' => 'dolibarr_main_auth_ldap_host',
'?dolibarr_main_auth_ldap_port' => 'dolibarr_main_auth_ldap_port',
'?dolibarr_main_auth_ldap_version' => 'dolibarr_main_auth_ldap_version',
'?dolibarr_main_auth_ldap_dn' => 'dolibarr_main_auth_ldap_dn',
'?dolibarr_main_auth_ldap_admin_login' => 'dolibarr_main_auth_ldap_admin_login',
'?dolibarr_main_auth_ldap_admin_pass' => 'dolibarr_main_auth_ldap_admin_pass',
'?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug',
'separator3' => '',
'?dolibarr_lib_FPDF_PATH' => 'dolibarr_lib_FPDF_PATH',
'?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH',
'?dolibarr_lib_TCPDI_PATH' => 'dolibarr_lib_TCPDI_PATH',
'?dolibarr_lib_NUSOAP_PATH' => 'dolibarr_lib_NUSOAP_PATH',
'?dolibarr_lib_GEOIP_PATH' => 'dolibarr_lib_GEOIP_PATH',
'?dolibarr_lib_ODTPHP_PATH' => 'dolibarr_lib_ODTPHP_PATH',
'?dolibarr_lib_ODTPHP_PATHTOPCLZIP' => 'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'?dolibarr_js_CKEDITOR' => 'dolibarr_js_CKEDITOR',
'?dolibarr_js_JQUERY' => 'dolibarr_js_JQUERY',
'?dolibarr_js_JQUERY_UI' => 'dolibarr_js_JQUERY_UI',
'?dolibarr_font_DOL_DEFAULT_TTF' => 'dolibarr_font_DOL_DEFAULT_TTF',
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator4' => '',
'dolibarr_main_restrict_os_commands' => 'Restrict CLI commands for backups',
'dolibarr_main_restrict_ip' => 'Restrict access to some IPs only',
'?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
'?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli',
2022-07-13 01:01:44 +02:00
'?dolibarr_mailing_limit_sendbyday' => 'Limit nb of email sent per day',
2021-07-05 18:16:52 +02:00
'?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_nocsrfcheck' => 'Disable CSRF security checks'
);
2017-01-17 20:04:41 +01:00
print '<div class="div-table-responsive-no-min">';
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">';
2012-09-21 00:13:20 +02:00
print '<tr class="liste_titre">';
2021-02-02 09:44:51 +01:00
print '<td class="titlefieldcreate">'.$langs->trans("Parameters").' ';
print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
print '</td>';
2024-09-03 11:19:01 +02:00
print '<td>'.$langs->trans("Name").'</td>';
print '<td></td>';
print '</tr>'."\n";
$lastkeyshown = null;
2021-02-26 22:04:03 +01:00
foreach ($configfileparameters as $key => $value) {
$ignore = 0;
2021-02-26 22:04:03 +01:00
if (empty($ignore)) {
$newkey = preg_replace('/^\?/', '', $key);
2021-02-26 22:04:03 +01:00
if (preg_match('/^\?/', $key) && empty(${$newkey})) {
2022-08-28 13:38:02 +02:00
if ($newkey != 'multicompany_transverse_mode' || !isModEnabled('multicompany')) {
continue; // We discard parameters starting with ?
2021-02-26 22:04:03 +01:00
}
}
if (strpos($newkey, 'separator') !== false && $lastkeyshown == 'separator') {
continue;
2017-02-15 18:30:27 +01:00
}
2017-04-12 17:44:01 +02:00
print '<tr class="oddeven">';
2021-02-26 22:04:03 +01:00
if (strpos($newkey, 'separator') !== false) {
print '<td colspan="3">&nbsp;</td>';
2020-05-21 09:35:30 +02:00
} else {
// Label
print "<td>".$value.'</td>';
// Key
print '<td>'.$newkey.'</td>';
// Value
print "<td>";
2020-10-04 19:09:25 +02:00
if (in_array($newkey, array('dolibarr_main_db_pass', 'dolibarr_main_auth_ldap_admin_pass'))) {
2020-09-20 21:17:27 +02:00
if (empty($dolibarr_main_prod)) {
print '<!-- '.${$newkey}.' -->';
2021-07-05 18:14:52 +02:00
print showValueWithClipboardCPButton(${$newkey}, 0, '********');
} else {
print '**********';
2020-09-20 21:17:27 +02:00
}
2021-02-26 22:04:03 +01:00
} elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/', ${$newkey})) {
print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
} elseif ($newkey == 'dolibarr_main_document_root_alt') {
$tmparray = explode(',', $dolibarr_main_document_root_alt);
$i = 0;
2021-02-26 22:04:03 +01:00
foreach ($tmparray as $value2) {
if ($i > 0) {
print ', ';
}
print $value2;
2021-02-26 22:04:03 +01:00
if (!is_readable($value2)) {
2014-08-13 15:07:22 +02:00
$langs->load("errors");
print ' '.img_warning($langs->trans("ErrorCantReadDir", $value2));
2014-08-13 15:07:22 +02:00
}
++$i;
}
} elseif ($newkey == 'dolibarr_main_instance_unique_id') {
//print $conf->file->instance_unique_id;
2021-07-05 18:14:52 +02:00
global $dolibarr_main_cookie_cryptkey, $dolibarr_main_instance_unique_id;
$valuetoshow = $dolibarr_main_instance_unique_id ? $dolibarr_main_instance_unique_id : $dolibarr_main_cookie_cryptkey; // Use $dolibarr_main_instance_unique_id first then $dolibarr_main_cookie_cryptkey
if (empty($dolibarr_main_prod)) {
print '<!-- '.$dolibarr_main_instance_unique_id.' (this will not be visible if $dolibarr_main_prod = 1 -->';
2021-07-05 18:14:52 +02:00
print showValueWithClipboardCPButton($valuetoshow, 0, '********');
print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("ThisValueCanBeReadBecauseInstanceIsNotInProductionMode").'</span>';
2021-07-05 18:14:52 +02:00
} else {
print '**********';
print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("SeeConfFile").'</span>';
2021-07-05 18:14:52 +02:00
}
if (empty($valuetoshow)) {
print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id');
}
print '</td></tr>';
print '<tr class="oddeven"><td></td><td>&nbsp; => '.$langs->trans("HashForPing").'</td><td>'.md5('dolibarr'.$valuetoshow).'</td></tr>'."\n";
} elseif ($newkey == 'dolibarr_main_prod') {
print ${$newkey};
$valuetoshow = ${$newkey};
if (empty($valuetoshow)) {
print img_warning($langs->trans('SwitchThisForABetterSecurity', 1));
}
} elseif ($newkey == 'dolibarr_nocsrfcheck') {
print ${$newkey};
$valuetoshow = ${$newkey};
if (!empty($valuetoshow)) {
print img_warning($langs->trans('SwitchThisForABetterSecurity', 0));
}
} elseif ($newkey == 'dolibarr_main_db_readonly') {
print ${$newkey};
$valuetoshow = ${$newkey};
if (!empty($valuetoshow)) {
print img_warning($langs->trans('ReadOnlyMode', 1));
}
2020-05-21 09:35:30 +02:00
} else {
2023-12-04 11:41:14 +01:00
print(empty(${$newkey}) ? '' : ${$newkey});
}
2021-02-26 22:04:03 +01:00
if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) {
print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
}
print "</td>";
}
print "</tr>\n";
$lastkeyshown = $newkey;
}
}
print '</table>';
2017-01-17 20:04:41 +01:00
print '</div>';
print '<br>';
// Parameters in database
2017-01-17 20:04:41 +01:00
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
2016-11-06 12:16:10 +01:00
print '<td class="titlefield">'.$langs->trans("Parameters").' '.$langs->trans("Database").'</td>';
2024-09-03 11:19:01 +02:00
print '<td></td>';
2022-08-28 13:38:02 +02:00
if (!isModEnabled('multicompany') || !$user->entity) {
2021-02-26 22:04:03 +01:00
print '<td class="center width="80px"">'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
}
print "</tr>\n";
$sql = "SELECT";
$sql .= " rowid";
$sql .= ", ".$db->decrypt('name')." as name";
$sql .= ", ".$db->decrypt('value')." as value";
$sql .= ", type";
$sql .= ", note";
$sql .= ", entity";
$sql .= " FROM ".MAIN_DB_PREFIX."const";
2022-08-28 13:38:02 +02:00
if (!isModEnabled('multicompany')) {
// If no multicompany mode, admins can see global and their constantes
$sql .= " WHERE entity IN (0,".$conf->entity.")";
2020-05-21 09:35:30 +02:00
} else {
// If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
2021-02-26 22:04:03 +01:00
if ($user->entity) {
2021-03-22 11:30:18 +01:00
$sql .= " WHERE entity IN (".$db->sanitize($user->entity.",".$conf->entity).")";
2021-02-26 22:04:03 +01:00
}
}
$sql .= " ORDER BY entity, name ASC";
$resql = $db->query($sql);
2021-02-26 22:04:03 +01:00
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
2021-02-26 22:04:03 +01:00
while ($i < $num) {
$obj = $db->fetch_object($resql);
2017-04-12 17:44:01 +02:00
print '<tr class="oddeven">';
2021-09-09 05:11:56 +02:00
print '<td class="tdoverflowmax600" title="'.dol_escape_htmltag($obj->name).'">'.dol_escape_htmltag($obj->name).'</td>'."\n";
2020-09-20 21:17:27 +02:00
print '<td class="tdoverflowmax300">';
if (isASecretKey($obj->name)) {
2020-09-20 21:17:27 +02:00
if (empty($dolibarr_main_prod)) {
print '<!-- '.$obj->value.' -->';
}
print '**********';
} else {
print dol_escape_htmltag($obj->value);
}
print '</td>'."\n";
2022-08-28 13:38:02 +02:00
if (!isModEnabled('multicompany') || !$user->entity) {
2021-02-26 22:04:03 +01:00
print '<td class="center" width="80px">'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
}
print "</tr>\n";
$i++;
}
}
print '</table>';
2017-01-17 20:04:41 +01:00
print '</div>';
2012-09-21 00:13:20 +02:00
2018-07-28 14:29:28 +02:00
// End of page
llxFooter();
$db->close();