* Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2007-2012 Regis Houssin * * 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 * along with this program. If not, see . */ /** * \file htdocs/admin/system/dolibarr.php * \brief Page to show Dolibarr information */ // 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'; 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'; // Load translation files required by the page $langs->loadLangs(array("install", "other", "admin")); $action = GETPOST('action', 'aZ09'); if (!$user->admin) { accessforbidden(); } $sfurl = ''; $version = '0.0'; /* * Actions */ if ($action == 'getlastversion') { $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss'); //var_dump($result['content']); 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); } else { setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors'); } } /* * View */ $form = new Form($db); $help_url = ''; $title = $langs->trans("InfoDolibarr"); llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-admin page-system_dolibarr'); print load_fiche_titre($title, '', 'title_setup'); // Version print '
'; print ''; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print '
'.$langs->trans("Version").'
'.$langs->trans("CurrentVersion").'
('.$langs->trans("Programs").')
'.DOL_VERSION; // If current version differs from last upgrade if (!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')) { // Compare version with last install database version (upgrades never occurred) if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) { print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_INSTALL'))); } } else { // Compare version with last upgrade database version if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) { print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_UPGRADE'))); } } $version = DOL_VERSION; 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. } print '   '.$langs->trans("SeeChangeLog").''; $newversion = ''; if (function_exists('curl_init')) { $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10; print '     -     '; 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").' : '.(($version != '0.0') ? $version : $langs->trans("Unknown")).''; if ($version != '0.0') { print '   '.$langs->trans("SeeChangeLog").''; } } else { print $langs->trans("LastStableVersion").' : '.$langs->trans("UpdateServerOffline").''; } } else { print $langs->trans("LastStableVersion").' : '.$langs->trans("Check").''; } } // Now show link to the changelog //print '     -     '; $version = DOL_VERSION; 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. } print '
'.$langs->trans("VersionLastUpgrade").'
('.$langs->trans("Database").')
'.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').'
'.$langs->trans("VersionLastInstall").'
('.$langs->trans("Database").')
'.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'
'; print '
'; print '
'; // Session print '
'; print ''; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''; print '\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print '
'.$langs->trans("Session").'
'.$langs->trans("SessionSavePath").''.session_save_path().'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'; print $langs->trans("CurrentSessionTimeOut"); print ''; print ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds"); print ''."\n"; print ''."\n"; print ''."\n"; print $form->textwithpicto('', $langs->trans("Parameter").' php.ini: session.gc_maxlifetime
'.$langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor"))); print "
'.$langs->trans("CurrentTheme").''.$conf->theme.'
'.$langs->trans("CurrentMenuHandler").''; print $conf->standard_menu; print '
'.$langs->trans("Screen").''; print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; print '
'.$langs->trans("Session").''; $i = 0; 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 '
'; print '
'; print '
'; // Shmop if (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) { $shmoparray = dol_listshmop(); print '
'; print ''; print ''; print ''; print ''; print ''; print ''."\n"; foreach ($shmoparray as $key => $val) { print ''; print ''; print ''; print ''."\n"; } print '
'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").''.$langs->trans("NbOfEntries").''.$langs->trans("Address").'
'.$key.''.count($val).''.dol_getshmopaddress($key).'
'; print '
'; print '
'; } // Localisation print '
'; print ''; print ''."\n"; print ''."\n"; print ''."\n"; // Thousands $thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); if ($thousand == 'SeparatorThousand') { $thousand = ' '; // ' ' does not work on trans method } if ($thousand == 'None') { $thousand = ''; } print ''."\n"; // Decimals $dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); print ''."\n"; // Show results of functions to see if everything works print ''."\n"; print '\n"; if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) { print '"; print "\n"; } print ''."\n"; // Timezones // Database timezone if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') { print ''."\n"; } $txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'
'."\n"; $txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."
\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.getDolGlobalString('MAIN_SERVER_TZ', $langs->trans("NotDefined")); print ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php print ''."\n"; print ''; print ''; print ''; // Client $tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; print ''."\n"; print ''."\n"; print ''."\n"; $filesystemencoding = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 print ''."\n"; $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 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')) { $tmp = getDolGlobalString('MAIN_FILESYSTEM_ENCODING'); } print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php print '
'.$langs->trans("LocalisationDolibarrParameters").'
'.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").''.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'
'.$langs->trans("CurrentUserLanguage").''.$langs->getDefaultLang().'
'.$langs->trans("CurrentValueSeparatorThousand").''.($thousand == ' ' ? $langs->transnoentitiesnoconv("Space") : $thousand).'
'.$langs->trans("CurrentValueSeparatorDecimal").''.$dec.'
  => price2num(1233.56+1)'.price2num(1233.56 + 1, '2').'
  => price2num('."'1".$thousand."234".$dec."56')".price2num("1".$thousand."234".$dec."56", '2')."
  => price2num('."'1 234.56')".price2num("1 234.56", '2')."
  => price(1234.56)'.price(1234.56).'
'.$langs->trans("MySQLTimeZone").' (database)'; // Timezone server base $sql = "SHOW VARIABLES where variable_name = 'system_time_zone'"; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); print $form->textwithtooltip($obj->Value, $langs->trans('TZHasNoEffect'), 2, 1, img_info('')); } print '
'.$langs->trans("CurrentTimeZone").''; // Timezone server PHP $a = getServerTimeZoneInt('now'); $b = getServerTimeZoneInt('winter'); $c = getServerTimeZoneInt('summer'); $daylight = round($c - $b); //print $a." ".$b." ".$c." ".$daylight; $val = ($a >= 0 ? '+' : '').$a; $val .= ' ('.($a == 'unknown' ? 'unknown' : ($a >= 0 ? '+' : '').($a * 3600)).')'; $val .= '       '.getServerTimeZoneString(); $val .= '       '.$langs->trans("DaylingSavingTime").': '.((is_null($b) || is_null($c)) ? 'unknown' : ($a == $c ? yn($daylight) : yn(0).($daylight ? '     ('.$langs->trans('YesInSummer').')' : ''))); print $form->textwithtooltip($val, $txt, 2, 1, img_info('')); print '
  => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver').'
  => dol_print_date(0,"dayhourtext")'.dol_print_date(0, "dayhourtext").'
  => dol_get_first_day(1970,1,false)'.dol_get_first_day(1970, 1, false).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, false), 'dayhour').')
  => dol_get_first_day(1970,1,true)'.dol_get_first_day(1970, 1, true).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, true), 'dayhour').')
'.$langs->trans("ClientTZ").''.($tz ? ($tz >= 0 ? '+' : '').$tz : '').' ('.($tz >= 0 ? '+' : '').($tz * 60 * 60).')'; print '       '.$_SESSION['dol_tz_string']; print '       '.$langs->trans("DaylingSavingTime").': '; if ($_SESSION['dol_dst'] > 0) { print yn(1); } else { print yn(0); } if (!empty($_SESSION['dol_dst_first'])) { print '     ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']), 'dayhour', 'gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']), 'dayhour', 'gmt').')'; } print '
  => '.$langs->trans("ClientHour").''.dol_print_date(dol_now('gmt'), 'dayhour', 'tzuser').'
'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)'.$filesystemencoding.'
  => '.$langs->trans("File encoding").''.$tmp.'
'; print '
'; print '
'; // Parameters in conf.php file (when a parameter start with ?, it is shown only if defined) $configfileparameters = array( 'dolibarr_main_prod' => 'Production mode (Hide all error messages)', 'dolibarr_main_instance_unique_id' => $langs->trans("InstanceUniqueID"), 'separator0' => '', 'dolibarr_main_url_root' => $langs->trans("URLRoot"), '?dolibarr_main_url_root_alt' => $langs->trans("URLRoot").' (alt)', 'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"), '?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"), 'separator2' => '', 'dolibarr_main_authentication' => $langs->trans("AuthenticationMode"), '?multicompany_transverse_mode'=> $langs->trans("MultiCompanyMode"), 'separator'=> '', '?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', '?dolibarr_mailing_limit_sendbyday' => 'Limit nb of email sent per day', '?dolibarr_strict_mode' => 'Strict mode is on/off', '?dolibarr_nocsrfcheck' => 'Disable CSRF security checks' ); print '
'; print ''; print ''; print ''; print ''; print ''; print ''."\n"; foreach ($configfileparameters as $key => $value) { $ignore = 0; if (empty($ignore)) { $newkey = preg_replace('/^\?/', '', $key); if (preg_match('/^\?/', $key) && empty(${$newkey})) { if ($newkey != 'multicompany_transverse_mode' || !isModEnabled('multicompany')) { continue; // We discard parameters starting with ? } } if (strpos($newkey, 'separator') !== false && $lastkeyshown == 'separator') { continue; } print ''; if (strpos($newkey, 'separator') !== false) { print ''; } else { // Label print "'; // Key print ''; // Value print "'; print ''."\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)); } } else { print(empty(${$newkey}) ? '' : ${$newkey}); } if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) { print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; } print ""; } print "\n"; $lastkeyshown = $newkey; } } print '
'.$langs->trans("Parameters").' '; print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')'; print ''.$langs->trans("Name").'
 ".$value.''.$newkey.'"; if (in_array($newkey, array('dolibarr_main_db_pass', 'dolibarr_main_auth_ldap_admin_pass'))) { if (empty($dolibarr_main_prod)) { print ''; print showValueWithClipboardCPButton(${$newkey}, 0, '********'); } else { print '**********'; } } 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; foreach ($tmparray as $value2) { if ($i > 0) { print ', '; } print $value2; if (!is_readable($value2)) { $langs->load("errors"); print ' '.img_warning($langs->trans("ErrorCantReadDir", $value2)); } ++$i; } } elseif ($newkey == 'dolibarr_main_instance_unique_id') { //print $conf->file->instance_unique_id; 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 ''; print showValueWithClipboardCPButton($valuetoshow, 0, '********'); print '     '.$langs->trans("ThisValueCanBeReadBecauseInstanceIsNotInProductionMode").''; } else { print '**********'; print '     '.$langs->trans("SeeConfFile").''; } if (empty($valuetoshow)) { print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id'); } print '
  => '.$langs->trans("HashForPing").''.md5('dolibarr'.$valuetoshow).'
'; print '
'; print '
'; // Parameters in database print '
'; print ''; print ''; print ''; print ''; if (!isModEnabled('multicompany') || !$user->entity) { print ''; // If superadmin or multicompany disabled } print "\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"; if (!isModEnabled('multicompany')) { // If no multicompany mode, admins can see global and their constantes $sql .= " WHERE entity IN (0,".$conf->entity.")"; } else { // If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities. if ($user->entity) { $sql .= " WHERE entity IN (".$db->sanitize($user->entity.",".$conf->entity).")"; } } $sql .= " ORDER BY entity, name ASC"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); print ''; print ''."\n"; print ''."\n"; if (!isModEnabled('multicompany') || !$user->entity) { print ''."\n"; // If superadmin or multicompany disabled } print "\n"; $i++; } } print '
'.$langs->trans("Parameters").' '.$langs->trans("Database").''.$langs->trans("Entity").'
'.dol_escape_htmltag($obj->name).''; if (isASecretKey($obj->name)) { if (empty($dolibarr_main_prod)) { print ''; } print '**********'; } else { print dol_escape_htmltag($obj->value); } print ''.$obj->entity.'
'; print '
'; // End of page llxFooter(); $db->close();