';
print ''.$langs->trans("Parameters").' | ';
@@ -104,7 +106,7 @@
print '';
print $param;
print ' | ';
- print '';
+ print ' | ';
$show = 0; $text = '';
foreach ($arraytest as $key => $val)
{
--- /tmp/dsg/dolibarr/htdocs/admin/system/github_dbtable.php
+++ /tmp/dsg/dolibarr/htdocs/admin/system/client_dbtable.php
@@ -49,7 +49,8 @@
{
$sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'";
$base = 1;
-} elseif ($conf->db->type == 'pgsql')
+}
+elseif ($conf->db->type == 'pgsql')
{
$sql = "SELECT conname,contype FROM pg_constraint";
$base = 2;
@@ -58,7 +59,9 @@
if (!$base)
{
print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver");
-} else {
+}
+else
+{
$resql = $db->query($sql);
if ($resql)
{
--- /tmp/dsg/dolibarr/htdocs/admin/system/github_dolibarr.php
+++ /tmp/dsg/dolibarr/htdocs/admin/system/client_dolibarr.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2005-2017 Laurent Destailleur
* Copyright (C) 2007 Rodolphe Quiedeville
* Copyright (C) 2007-2012 Regis Houssin
*
@@ -19,7 +19,7 @@
/**
* \file htdocs/admin/system/dolibarr.php
- * \brief Page to show Dolibarr information
+ * \brief Page to show Dolibarr informations
*/
require '../../main.inc.php';
@@ -32,7 +32,7 @@
// Load translation files required by the page
$langs->loadLangs(array("install", "other", "admin"));
-$action = GETPOST('action', 'aZ09');
+$action = GETPOST('action', 'alpha');
if (!$user->admin)
accessforbidden();
@@ -48,13 +48,9 @@
if ($action == 'getlastversion')
{
- $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
- //var_dump($result['content']);
- if (function_exists('simplexml_load_string')) {
- $sfurl = simplexml_load_string($result['content']);
- } else {
- setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors');
- }
+ $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
+ //var_dump($result['content']);
+ $sfurl = simplexml_load_string($result['content']);
}
@@ -73,34 +69,33 @@
// Version
print '';
print ' ';
-print ''.$langs->trans("Version").' | '.$langs->trans("Value").' | '."\n";
+print ''.$langs->trans("Version").' | '.$langs->trans("Value").' | '."\n";
print ''.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").') | '.DOL_VERSION;
// If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
{
- // Compare version with last install database version (upgrades never occured)
- if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->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, $conf->global->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 = '';
+ // Compare version with last install database version (upgrades never occured)
+ if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->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, $conf->global->MAIN_VERSION_LAST_UPGRADE));
+}
+
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) {
+ if ($action == 'getlastversion')
+ {
+ if ($sfurl)
+ {
+ 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)) {
+ if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
+ {
$newversion = $reg[1];
$newversionarray = explode('.', $newversion);
$versionarray = explode('.', $version);
@@ -110,25 +105,27 @@
$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").'';
- }
+ // Show version
+ print $langs->trans("LastStableVersion").' : '.(($version != '0.0') ? $version : $langs->trans("Unknown")).'';
+ }
+ else
+ {
+ print $langs->trans("LastStableVersion").' : '.$langs->trans("UpdateServerOffline").'';
+ }
+ }
+ else
+ {
+ print $langs->trans("LastStableVersion").' : '.$langs->trans("Check").'';
+ }
}
// Now show link to the changelog
-//print ' - ';
+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("SeeChangeLog").'';
print ' | '."\n";
print ''.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").') | '.$conf->global->MAIN_VERSION_LAST_UPGRADE.' | '."\n";
print ''.$langs->trans("VersionLastInstall").' | '.$conf->global->MAIN_VERSION_LAST_INSTALL.' | '."\n";
@@ -139,7 +136,7 @@
// Session
print '';
print ' ';
-print ''.$langs->trans("Session").' | '.$langs->trans("Value").' | '."\n";
+print ''.$langs->trans("Session").' | '.$langs->trans("Value").' | '."\n";
print ''.$langs->trans("SessionSavePath").' | '.session_save_path().' | '."\n";
print ''.$langs->trans("SessionName").' | '.session_name().' | '."\n";
print ''.$langs->trans("SessionId").' | '.session_id().' | '."\n";
@@ -177,10 +174,10 @@
{
$shmoparray = dol_listshmop();
- print '';
+ print ' ';
print ' ';
print '';
- print ''.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").' | ';
+ print ''.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").' | ';
print ''.$langs->trans("NbOfEntries").' | ';
print ''.$langs->trans("Address").' | ';
print ' '."\n";
@@ -202,7 +199,7 @@
// Localisation
print '';
print ' ';
-print ''.$langs->trans("LocalisationDolibarrParameters").' | '.$langs->trans("Value").' | '."\n";
+print ''.$langs->trans("LocalisationDolibarrParameters").' | '.$langs->trans("Value").' | '."\n";
print ''.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").' | '.$_SERVER["HTTP_ACCEPT_LANGUAGE"].' | '."\n";
print ''.$langs->trans("CurrentUserLanguage").' | '.$langs->getDefaultLang().' | '."\n";
// Thousands
@@ -222,9 +219,26 @@
print "\n";
}
print ' => price(1234.56) | '.price(1234.56).' | '."\n";
-
-// Timezones
-
+// Timezone
+$txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).' '."\n";
+$txt .= $langs->trans("PHPTZ").' (php.ini date.timezone): '.(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").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ);
+print ''.$langs->trans("CurrentTimeZone").' | '; // Timezone server PHP
+$a = getServerTimeZoneInt('now');
+$b = getServerTimeZoneInt('winter');
+$c = getServerTimeZoneInt('summer');
+$daylight = (is_numeric($c) && is_numeric($b)) ?round($c - $b) : 'unknown';
+//print $a." ".$b." ".$c." ".$daylight;
+$val = ($a >= 0 ? '+' : '').$a;
+$val .= ' ('.($a == 'unknown' ? 'unknown' : ($a >= 0 ? '+' : '').($a * 3600)).')';
+$val .= ' '.getServerTimeZoneString();
+$val .= ' '.$langs->trans("DaylingSavingTime").': '.($daylight === 'unknown' ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? ' ('.$langs->trans('YesInSummer').')' : '')));
+print $form->textwithtooltip($val, $txt, 2, 1, img_info(''));
+print ' | '."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
+print ' => '.$langs->trans("CurrentHour").' | '.dol_print_date(dol_now(), 'dayhour', 'tzserver').' | '."\n";
+print ' => dol_print_date(0,"dayhourtext") | '.dol_print_date(0, "dayhourtext").' | ';
+print ' => 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').') | ';
+print ' => 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').') | ';
// Database timezone
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
{
@@ -238,25 +252,6 @@
}
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").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ);
-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").': '.($daylight === 'unknown' ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? ' ('.$langs->trans('YesInSummer').')' : '')));
-print $form->textwithtooltip($val, $txt, 2, 1, img_info(''));
-print ' | '."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
-print ' => '.$langs->trans("CurrentHour").' | '.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver').' | '."\n";
-print ' => dol_print_date(0,"dayhourtext") | '.dol_print_date(0, "dayhourtext").' | ';
-print ' => 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').') | ';
-print ' => 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').') | ';
// Client
$tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
print ' '.$langs->trans("ClientTZ").' | '.($tz ? ($tz >= 0 ? '+' : '').$tz : '').' ('.($tz >= 0 ? '+' : '').($tz * 60 * 60).')';
@@ -267,7 +262,7 @@
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 ' | '."\n";
print ''."\n";
-print ' => '.$langs->trans("ClientHour").' | '.dol_print_date(dol_now('gmt'), 'dayhour', 'tzuser').' | '."\n";
+print ' => '.$langs->trans("ClientHour").' | '.dol_print_date(dol_now(), 'dayhour', 'tzuser').' | '."\n";
$filesystemencoding = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
print ''.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding) | '.$filesystemencoding.' | '."\n";
@@ -291,8 +286,8 @@
'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"),
'?dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)',
'dolibarr_main_data_root' => $langs->trans("DataRootServer"),
- 'dolibarr_main_instance_unique_id' => $langs->trans("InstanceUniqueID"),
- 'separator1' => '',
+ 'dolibarr_main_instance_unique_id' => $langs->trans("InstanceUniqueID"),
+ 'separator1' => '',
'dolibarr_main_db_host' => $langs->trans("DatabaseServer"),
'dolibarr_main_db_port' => $langs->trans("DatabasePort"),
'dolibarr_main_db_name' => $langs->trans("DatabaseName"),
@@ -304,7 +299,7 @@
'?dolibarr_main_db_prefix' => $langs->trans("Prefix"),
'separator2' => '',
'dolibarr_main_authentication' => $langs->trans("AuthenticationMode"),
- '?multicompany_transverse_mode'=> $langs->trans("MultiCompanyMode"),
+ '?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',
@@ -321,12 +316,14 @@
'?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_PHPEXCEL_PATH' => 'dolibarr_lib_PHPEXCEL_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_js_JQUERY_FLOT' => 'dolibarr_js_JQUERY_FLOT',
'?dolibarr_font_DOL_DEFAULT_TTF' => 'dolibarr_font_DOL_DEFAULT_TTF',
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator4' => '',
@@ -342,7 +339,7 @@
print '';
print ' ';
print '';
-print ''.$langs->trans("Parameters").' ';
+print ' | '.$langs->trans("Parameters").' ';
print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
print ' | ';
print ''.$langs->trans("Parameter").' | ';
@@ -359,8 +356,8 @@
if (preg_match('/^\?/', $key) && empty(${$newkey}))
{
- if ($newkey != 'multicompany_transverse_mode' || empty($conf->multicompany->enabled))
- continue; // We discard parameters starting with ?
+ if ($newkey != 'multicompany_transverse_mode' || empty($conf->multicompany->enabled))
+ continue; // We discard parameters starting with ?
}
if (strpos($newkey, 'separator') !== false && $lastkeyshown == 'separator') continue;
@@ -368,21 +365,19 @@
if (strpos($newkey, 'separator') !== false)
{
print ' | ';
- } else {
+ }
+ else
+ {
// Label
print "".$value.' | ';
// Key
print ''.$newkey.' | ';
// Value
print "";
- if (in_array($newkey, array('dolibarr_main_db_pass', 'dolibarr_main_auth_ldap_admin_pass'))) {
- if (empty($dolibarr_main_prod)) {
- print '';
- }
- print '**********';
- }
+ if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i', '*', ${$newkey});
elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/', ${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
- elseif ($newkey == 'dolibarr_main_document_root_alt') {
+ elseif ($newkey == 'dolibarr_main_document_root_alt')
+ {
$tmparray = explode(',', ${$newkey});
$i = 0;
foreach ($tmparray as $value2)
@@ -396,31 +391,21 @@
}
++$i;
}
- } elseif ($newkey == 'dolibarr_main_instance_unique_id') {
- //print $conf->file->instance_unique_id;
- global $dolibarr_main_cookie_cryptkey;
- $valuetoshow = ${$newkey} ? ${$newkey} : $dolibarr_main_cookie_cryptkey; // Use $dolibarr_main_instance_unique_id first then $dolibarr_main_cookie_cryptkey
- print $valuetoshow;
- if (empty($valuetoshow)) {
- print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id');
- }
- print ' ('.$langs->trans("HashForPing").'='.md5('dolibarr'.$valuetoshow).')';
- } 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));
- }
- } else {
- print ${$newkey};
+ }
+ elseif ($newkey == 'dolibarr_main_instance_unique_id')
+ {
+ //print $conf->file->instance_unique_id;
+ global $dolibarr_main_cookie_cryptkey;
+ $valuetoshow = ${$newkey} ? ${$newkey} : $dolibarr_main_cookie_cryptkey; // Use $dolibarr_main_instance_unique_id first then $dolibarr_main_cookie_cryptkey
+ print $valuetoshow;
+ if (empty($valuetoshow)) {
+ print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id');
+ }
+ print ' ('.$langs->trans("HashForPing").'='.md5('dolibarr'.$valuetoshow).')';
+ }
+ else
+ {
+ print ${$newkey};
}
if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
print " | ";
@@ -456,7 +441,9 @@
{
// If no multicompany mode, admins can see global and their constantes
$sql .= " WHERE entity IN (0,".$conf->entity.")";
-} else {
+}
+else
+{
// If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
if ($user->entity) $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
}
@@ -473,16 +460,7 @@
print ' ';
print ''.$obj->name.' | '."\n";
- print '';
- if (isASecretKey($obj->name)) {
- if (empty($dolibarr_main_prod)) {
- print '';
- }
- print '**********';
- } else {
- print dol_escape_htmltag($obj->value);
- }
- print ' | '."\n";
+ print ''.dol_escape_htmltag($obj->value).' | '."\n";
if (empty($conf->multicompany->enabled) || !$user->entity) print ''.$obj->entity.' | '."\n"; // If superadmin or multicompany disabled
print " \n";
--- /tmp/dsg/dolibarr/htdocs/admin/system/github_filecheck.php
+++ /tmp/dsg/dolibarr/htdocs/admin/system/client_filecheck.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2005-2016 Laurent Destailleur
* Copyright (C) 2007 Rodolphe Quiedeville
* Copyright (C) 2007-2012 Regis Houssin
* Copyright (C) 2015-2019 Frederic France
@@ -31,7 +31,7 @@
$langs->load("admin");
if (!$user->admin)
- accessforbidden();
+ accessforbidden();
$error = 0;
@@ -57,13 +57,13 @@
print ''.$langs->trans("VersionProgram").' | '.DOL_VERSION;
// If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) {
- // Compare version with last install database version (upgrades never occured)
- if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL)
- print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_INSTALL));
+ // Compare version with last install database version (upgrades never occured)
+ if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL)
+ print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->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, $conf->global->MAIN_VERSION_LAST_UPGRADE));
+ // Compare version with last upgrade database version
+ if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE)
+ print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_UPGRADE));
}
print ' | '."\n";
print ' ';
@@ -91,29 +91,32 @@
$enableremotecheck = true;
print ' ';
@@ -122,266 +125,289 @@
if (GETPOST('target') == 'local')
{
- if (dol_is_file($xmlfile))
- {
- // If file is a zip file (.../filelist-x.y.z.xml.zip), we uncompress it before
- if (preg_match('/\.zip$/i', $xmlfile)) {
- dol_mkdir($conf->admin->dir_temp);
- $xmlfilenew = preg_replace('/\.zip$/i', '', $xmlfile);
- $result = dol_uncompress($xmlfile, $conf->admin->dir_temp);
- if (empty($result['error'])) {
- $xmlfile = $conf->admin->dir_temp.'/'.basename($xmlfilenew);
- } else {
- print $langs->trans('FailedToUncompressFile').': '.$xmlfile;
- $error++;
- }
- }
- $xml = simplexml_load_file($xmlfile);
- } else {
- print $langs->trans('XmlNotFound').': '.$xmlfile;
- $error++;
- }
+ if (dol_is_file($xmlfile))
+ {
+ // If file is a zip file (.../filelist-x.y.z.xml.zip), we uncompress it before
+ if (preg_match('/\.zip$/i', $xmlfile)) {
+ dol_mkdir($conf->admin->dir_temp);
+ $xmlfilenew = preg_replace('/\.zip$/i', '', $xmlfile);
+ $result = dol_uncompress($xmlfile, $conf->admin->dir_temp);
+ if (empty($result['error'])) {
+ $xmlfile = $conf->admin->dir_temp.'/'.basename($xmlfilenew);
+ } else {
+ print $langs->trans('FailedToUncompressFile').': '.$xmlfile;
+ $error++;
+ }
+ }
+ $xml = simplexml_load_file($xmlfile);
+ }
+ else
+ {
+ print $langs->trans('XmlNotFound').': '.$xmlfile;
+ $error++;
+ }
}
if (GETPOST('target') == 'remote')
{
- $xmlarray = getURLContent($xmlremote);
-
- // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
- if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404')
- {
- $xmlfile = $xmlarray['content'];
- //print "xmlfilestart".$xmlfile."xmlfileend";
- $xml = simplexml_load_string($xmlfile);
- } else {
- $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
- setEventMessages($errormsg, null, 'errors');
- $error++;
- }
+ $xmlarray = getURLContent($xmlremote);
+
+ // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
+ if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404')
+ {
+ $xmlfile = $xmlarray['content'];
+ //print "xmlfilestart".$xmlfile."xmlfileend";
+ $xml = simplexml_load_string($xmlfile);
+ }
+ else
+ {
+ $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
+ setEventMessages($errormsg, null, 'errors');
+ $error++;
+ }
}
if (!$error && $xml)
{
- $checksumconcat = array();
- $file_list = array();
- $out = '';
-
- // Forced constants
- if (is_object($xml->dolibarr_constants[0]))
- {
- $out .= load_fiche_titre($langs->trans("ForcedConstants"));
+ $checksumconcat = array();
+ $file_list = array();
+ $out = '';
+
+ // Forced constants
+ if (is_object($xml->dolibarr_constants[0]))
+ {
+ $out .= load_fiche_titre($langs->trans("ForcedConstants"));
$out .= ' ';
- $out .= ' ';
- $out .= '';
- $out .= '# | ';
- $out .= ''.$langs->trans("Constant").' | ';
- $out .= ''.$langs->trans("ExpectedValue").' | ';
- $out .= ''.$langs->trans("Value").' | ';
- $out .= ' '."\n";
-
- $i = 0;
- foreach ($xml->dolibarr_constants[0]->constant as $constant) // $constant is a simpleXMLElement
- {
- $constname = $constant['name'];
- $constvalue = (string) $constant;
- $constvalue = (empty($constvalue) ? '0' : $constvalue);
- // Value found
- $value = '';
- if ($constname && $conf->global->$constname != '') $value = $conf->global->$constname;
- $valueforchecksum = (empty($value) ? '0' : $value);
-
- $checksumconcat[] = $valueforchecksum;
-
- $i++;
- $out .= '';
- $out .= ''.$i.' | '."\n";
- $out .= ''.dol_escape_htmltag($constname).' | '."\n";
- $out .= ''.dol_escape_htmltag($constvalue).' | '."\n";
- $out .= ''.dol_escape_htmltag($valueforchecksum).' | '."\n";
- $out .= " \n";
- }
-
- if ($i == 0)
- {
- $out .= ''.$langs->trans("None").' | ';
- }
- $out .= ' ';
- $out .= ' ';
-
- $out .= ' ';
- }
-
- // Scan htdocs
- if (is_object($xml->dolibarr_htdocs_dir[0]))
- {
- //var_dump($xml->dolibarr_htdocs_dir[0]['includecustom']);exit;
- $includecustom = (empty($xml->dolibarr_htdocs_dir[0]['includecustom']) ? 0 : $xml->dolibarr_htdocs_dir[0]['includecustom']);
-
- // Defined qualified files (must be same than into generate_filelist_xml.php)
- $regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
- $regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
- $scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
-
- // Fill file_list with files in signature, new files, modified files
- $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
- // Complete with list of new files
- foreach ($scanfiles as $keyfile => $valfile)
- {
- $tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']);
- if (!in_array($tmprelativefilename, $file_list['insignature']))
- {
- $md5newfile = @md5_file($valfile['fullname']); // Can fails if we don't have permission to open/read file
- $file_list['added'][] = array('filename'=>$tmprelativefilename, 'md5'=>$md5newfile);
- }
- }
-
- // Files missings
- $out .= load_fiche_titre($langs->trans("FilesMissing"));
+ $out .= ' ';
+ $out .= '';
+ $out .= '# | ';
+ $out .= ''.$langs->trans("Constant").' | ';
+ $out .= ''.$langs->trans("ExpectedValue").' | ';
+ $out .= ''.$langs->trans("Value").' | ';
+ $out .= ' '."\n";
+
+ $i = 0;
+ foreach ($xml->dolibarr_constants[0]->constant as $constant) // $constant is a simpleXMLElement
+ {
+ $constname = $constant['name'];
+ $constvalue = (string) $constant;
+ $constvalue = (empty($constvalue) ? '0' : $constvalue);
+ // Value found
+ $value = '';
+ if ($constname && $conf->global->$constname != '') $value = $conf->global->$constname;
+ $valueforchecksum = (empty($value) ? '0' : $value);
+
+ $checksumconcat[] = $valueforchecksum;
+
+ $i++;
+ $out .= '';
+ $out .= ''.$i.' | '."\n";
+ $out .= ''.$constname.' | '."\n";
+ $out .= ''.$constvalue.' | '."\n";
+ $out .= ''.$valueforchecksum.' | '."\n";
+ $out .= " \n";
+ }
+
+ if ($i == 0)
+ {
+ $out .= ''.$langs->trans("None").' | ';
+ }
+ $out .= ' ';
+ $out .= ' ';
+
+ $out .= ' ';
+ }
+
+ // Scan htdocs
+ if (is_object($xml->dolibarr_htdocs_dir[0]))
+ {
+ //var_dump($xml->dolibarr_htdocs_dir[0]['includecustom']);exit;
+ $includecustom = (empty($xml->dolibarr_htdocs_dir[0]['includecustom']) ? 0 : $xml->dolibarr_htdocs_dir[0]['includecustom']);
+
+ // Defined qualified files (must be same than into generate_filelist_xml.php)
+ $regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
+ $regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
+ $scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
+
+ // Fill file_list with files in signature, new files, modified files
+ $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
+ // Complete with list of new files
+ foreach ($scanfiles as $keyfile => $valfile)
+ {
+ $tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']);
+ if (!in_array($tmprelativefilename, $file_list['insignature']))
+ {
+ $md5newfile = @md5_file($valfile['fullname']); // Can fails if we don't have permission to open/read file
+ $file_list['added'][] = array('filename'=>$tmprelativefilename, 'md5'=>$md5newfile);
+ }
+ }
+
+ // Files missings
+ $out .= load_fiche_titre($langs->trans("FilesMissing"));
$out .= '';
- $out .= ' ';
- $out .= '';
- $out .= '# | ';
- $out .= ''.$langs->trans("Filename").' | ';
- $out .= ''.$langs->trans("ExpectedSize").' | ';
- $out .= ''.$langs->trans("ExpectedChecksum").' | ';
- $out .= ' '."\n";
- $tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
- if (is_array($tmpfilelist) && count($tmpfilelist))
- {
- $i = 0;
- foreach ($tmpfilelist as $file)
- {
- $i++;
- $out .= '';
- $out .= ''.$i.' | '."\n";
- $out .= ''.dol_escape_htmltag($file['filename']).' | '."\n";
- $out .= '';
- if (!empty($file['expectedsize'])) $out .= dol_print_size($file['expectedsize']);
- $out .= ' | '."\n";
- $out .= ''.dol_escape_htmltag($file['expectedmd5']).' | '."\n";
- $out .= " \n";
- }
- } else {
- $out .= ''.$langs->trans("None").' | ';
- }
- $out .= ' ';
- $out .= ' ';
-
- $out .= ' ';
-
- // Files modified
- $out .= load_fiche_titre($langs->trans("FilesModified"));
-
- $totalsize = 0;
+ $out .= '';
+ $out .= '';
+ $out .= '# | ';
+ $out .= ''.$langs->trans("Filename").' | ';
+ $out .= ''.$langs->trans("ExpectedSize").' | ';
+ $out .= ''.$langs->trans("ExpectedChecksum").' | ';
+ $out .= ' '."\n";
+ $tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
+ if (is_array($tmpfilelist) && count($tmpfilelist))
+ {
+ $i = 0;
+ foreach ($tmpfilelist as $file)
+ {
+ $i++;
+ $out .= '';
+ $out .= ''.$i.' | '."\n";
+ $out .= ''.$file['filename'].' | '."\n";
+ $out .= '';
+ if (!empty($file['expectedsize'])) $out .= dol_print_size($file['expectedsize']);
+ $out .= ' | '."\n";
+ $out .= ''.$file['expectedmd5'].' | '."\n";
+ $out .= " \n";
+ }
+ }
+ else
+ {
+ $out .= ''.$langs->trans("None").' | ';
+ }
+ $out .= ' ';
+ $out .= '';
+
+ $out .= ' ';
+
+ // Files modified
+ $out .= load_fiche_titre($langs->trans("FilesModified"));
+
+ $totalsize = 0;
$out .= '';
- $out .= ' ';
- $out .= '';
- $out .= '# | ';
- $out .= ''.$langs->trans("Filename").' | ';
- $out .= ''.$langs->trans("ExpectedChecksum").' | ';
- $out .= ''.$langs->trans("CurrentChecksum").' | ';
- $out .= ''.$langs->trans("ExpectedSize").' | ';
- $out .= ''.$langs->trans("CurrentSize").' | ';
- $out .= ''.$langs->trans("DateModification").' | ';
- $out .= ' '."\n";
- $tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename');
- if (is_array($tmpfilelist2) && count($tmpfilelist2))
- {
- $i = 0;
- foreach ($tmpfilelist2 as $file)
- {
- $i++;
- $out .= '';
- $out .= ''.$i.' | '."\n";
- $out .= ''.dol_escape_htmltag($file['filename']).' | '."\n";
- $out .= ''.dol_escape_htmltag($file['expectedmd5']).' | '."\n";
- $out .= ''.dol_escape_htmltag($file['md5']).' | '."\n";
- $out .= '';
- if ($file['expectedsize']) $out .= dol_print_size($file['expectedsize']);
- $out .= ' | '."\n";
- $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
- $totalsize += $size;
- $out .= ''.dol_print_size($size).' | '."\n";
- $out .= ''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').' | '."\n";
- $out .= " \n";
- }
- $out .= '';
- $out .= ' | '."\n";
- $out .= ''.$langs->trans("Total").' | '."\n";
- $out .= ' | '."\n";
- $out .= ' | '."\n";
- $out .= ' | '."\n";
- $out .= ''.dol_print_size($totalsize).' | '."\n";
- $out .= ' | '."\n";
- $out .= " \n";
- } else {
- $out .= ''.$langs->trans("None").' | ';
- }
- $out .= ' ';
- $out .= ' ';
-
- $out .= ' ';
-
- // Files added
- $out .= load_fiche_titre($langs->trans("FilesAdded"));
-
- $totalsize = 0;
+ $out .= '';
+ $out .= '';
+ $out .= '# | ';
+ $out .= ''.$langs->trans("Filename").' | ';
+ $out .= ''.$langs->trans("ExpectedChecksum").' | ';
+ $out .= ''.$langs->trans("CurrentChecksum").' | ';
+ $out .= ''.$langs->trans("ExpectedSize").' | ';
+ $out .= ''.$langs->trans("CurrentSize").' | ';
+ $out .= ''.$langs->trans("DateModification").' | ';
+ $out .= ' '."\n";
+ $tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename');
+ if (is_array($tmpfilelist2) && count($tmpfilelist2))
+ {
+ $i = 0;
+ foreach ($tmpfilelist2 as $file)
+ {
+ $i++;
+ $out .= '';
+ $out .= ''.$i.' | '."\n";
+ $out .= ''.$file['filename'].' | '."\n";
+ $out .= ''.$file['expectedmd5'].' | '."\n";
+ $out .= ''.$file['md5'].' | '."\n";
+ $out .= '';
+ if ($file['expectedsize']) $out .= dol_print_size($file['expectedsize']);
+ $out .= ' | '."\n";
+ $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
+ $totalsize += $size;
+ $out .= ''.dol_print_size($size).' | '."\n";
+ $out .= ''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').' | '."\n";
+ $out .= " \n";
+ }
+ $out .= '';
+ $out .= ' | '."\n";
+ $out .= ''.$langs->trans("Total").' | '."\n";
+ $out .= ' | '."\n";
+ $out .= ' | '."\n";
+ $out .= ' | '."\n";
+ $out .= ''.dol_print_size($totalsize).' | '."\n";
+ $out .= ' | '."\n";
+ $out .= " \n";
+ }
+ else
+ {
+ $out .= ''.$langs->trans("None").' | ';
+ }
+ $out .= ' ';
+ $out .= '';
+
+ $out .= ' ';
+
+ // Files added
+ $out .= load_fiche_titre($langs->trans("FilesAdded"));
+
+ $totalsize = 0;
$out .= '';
- $out .= ' ';
- $out .= '';
- $out .= '# | ';
- $out .= ''.$langs->trans("Filename").' | ';
- $out .= ''.$langs->trans("ExpectedChecksum").' | ';
- $out .= ''.$langs->trans("CurrentChecksum").' | ';
- $out .= ''.$langs->trans("Size").' | ';
- $out .= ''.$langs->trans("DateModification").' | ';
- $out .= ' '."\n";
- $tmpfilelist3 = dol_sort_array($file_list['added'], 'filename');
- if (is_array($tmpfilelist3) && count($tmpfilelist3))
- {
- $i = 0;
- foreach ($tmpfilelist3 as $file)
- {
- $i++;
- $out .= '';
- $out .= ''.$i.' | '."\n";
- $out .= ''.dol_escape_htmltag($file['filename']);
- if (!preg_match('/^win/i', PHP_OS)) {
- $htmltext = $langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.$file['filename']); // The slash is included int file['filename']
- $out .= ' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i);
- }
- $out .= ' | '."\n";
- $out .= ''.dol_escape_htmltag($file['expectedmd5']).' | '."\n";
- $out .= ''.dol_escape_htmltag($file['md5']).' | '."\n";
- $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
- $totalsize += $size;
- $out .= ''.dol_print_size($size).' | '."\n";
- $out .= ''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').' | '."\n";
- $out .= " \n";
- }
- $out .= '';
- $out .= ' | '."\n";
- $out .= ''.$langs->trans("Total").' | '."\n";
- $out .= ' | '."\n";
- $out .= ' | '."\n";
- $out .= ''.dol_print_size($totalsize).' | '."\n";
- $out .= ' | '."\n";
- $out .= " \n";
- } else {
- $out .= ''.$langs->trans("None").' | ';
- }
- $out .= ' ';
- $out .= ' ';
- } else {
- print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile;
- $error++;
- }
-
-
- // Scan scripts
- /*
+ $out .= '';
+ $out .= '';
+ $out .= '# | ';
+ $out .= ''.$langs->trans("Filename").' | ';
+ $out .= ''.$langs->trans("ExpectedChecksum").' | ';
+ $out .= ''.$langs->trans("CurrentChecksum").' | ';
+ $out .= ''.$langs->trans("Size").' | ';
+ $out .= ''.$langs->trans("DateModification").' | ';
+ $out .= ' '."\n";
+ $tmpfilelist3 = dol_sort_array($file_list['added'], 'filename');
+ if (is_array($tmpfilelist3) && count($tmpfilelist3))
+ {
+ $i = 0;
+ foreach ($tmpfilelist3 as $file)
+ {
+ $i++;
+ $out .= '';
+ $out .= ''.$i.' | '."\n";
+ $out .= ''.$file['filename'];
+ if (!preg_match('/^win/i', PHP_OS)) {
+ $htmltext = $langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.$file['filename']); // The slash is included int file['filename']
+ $out .= ' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i);
+ }
+ $out .= ' | '."\n";
+ $out .= ''.$file['expectedmd5'].' | '."\n";
+ $out .= ''.$file['md5'].' | '."\n";
+ $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
+ $totalsize += $size;
+ $out .= ''.dol_print_size($size).' | '."\n";
+ $out .= ''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').' | '."\n";
+ $out .= " \n";
+ }
+ $out .= '';
+ $out .= ' | '."\n";
+ $out .= ''.$langs->trans("Total").' | '."\n";
+ $out .= ' | '."\n";
+ $out .= ' | '."\n";
+ $out .= ''.dol_print_size($totalsize).' | '."\n";
+ $out .= ' | '."\n";
+ $out .= " \n";
+ }
+ else
+ {
+ $out .= ''.$langs->trans("None").' | ';
+ }
+ $out .= ' ';
+ $out .= '';
+
+
+ // Show warning
+ if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
+ {
+ setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings');
+ }
+ }
+ else
+ {
+ print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile;
+ $error++;
+ }
+
+
+ // Scan scripts
+ /*
if (is_object($xml->dolibarr_script_dir[0]))
{
$file_list = array();
@@ -389,57 +415,48 @@
}*/
- asort($checksumconcat); // Sort list of checksum
- //var_dump($checksumconcat);
- $checksumget = md5(join(',', $checksumconcat));
- $checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum);
-
- /*var_dump(count($file_list['added']));
+ asort($checksumconcat); // Sort list of checksum
+ //var_dump($checksumconcat);
+ $checksumget = md5(join(',', $checksumconcat));
+ $checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum);
+
+ /*var_dump(count($file_list['added']));
var_dump($checksumget);
var_dump($checksumtoget);
var_dump($checksumget == $checksumtoget);*/
- $resultcomment = '';
-
- $outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown"));
- if ($checksumget == $checksumtoget)
- {
- if (count($file_list['added']))
- {
- $resultcode = 'warning';
- $resultcomment = 'FileIntegrityIsOkButFilesWereAdded';
- $outcurrentchecksum = $checksumget.' - '.$langs->trans($resultcomment).'';
- } else {
- $resultcode = 'ok';
- $resultcomment = 'Success';
- $outcurrentchecksum = ''.$checksumget.'';
- }
- } else {
- $resultcode = 'error';
- $resultcomment = 'Error';
- $outcurrentchecksum = ''.$checksumget.'';
- }
-
- // Show warning
- if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3) && $resultcode == 'ok') {
- setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
- } else {
- if ($resultcode == 'warning') {
- setEventMessages($langs->trans($resultcomment), null, 'warnings');
- } else {
- setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'errors');
- }
- }
-
- print load_fiche_titre($langs->trans("GlobalChecksum"));
- print $langs->trans("ExpectedChecksum").' = '.$outexpectedchecksum.' ';
- print $langs->trans("CurrentChecksum").' = '.$outcurrentchecksum;
-
- print ' ';
- print ' ';
-
- // Output detail
- print $out;
+ $outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown"));
+ if ($checksumget == $checksumtoget)
+ {
+ if (count($file_list['added']))
+ {
+ $resultcode = 'warning';
+ $resultcomment = 'FileIntegrityIsOkButFilesWereAdded';
+ $outcurrentchecksum = $checksumget.' - '.$langs->trans("FileIntegrityIsOkButFilesWereAdded").'';
+ }
+ else
+ {
+ $resultcode = 'ok';
+ $resultcomment = 'Success';
+ $outcurrentchecksum = ''.$checksumget.'';
+ }
+ }
+ else
+ {
+ $resultcode = 'error';
+ $resultcomment = 'Error';
+ $outcurrentchecksum = ''.$checksumget.'';
+ }
+
+ print load_fiche_titre($langs->trans("GlobalChecksum")).' ';
+ print $langs->trans("ExpectedChecksum").' = '.$outexpectedchecksum.' ';
+ print $langs->trans("CurrentChecksum").' = '.$outcurrentchecksum;
+
+ print ' ';
+ print ' ';
+
+ // Output detail
+ print $out;
}
// End of page
--- /tmp/dsg/dolibarr/htdocs/admin/system/github_index.php
+++ /tmp/dsg/dolibarr/htdocs/admin/system/client_index.php
@@ -94,10 +94,10 @@
{
// Check option standard_conforming_strings is on
$paramarray = $db->getServerParametersValues('standard_conforming_strings');
- // if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1)
- // {
- // $langs->load("errors");
- // }
+ // if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1)
+ // {
+ // $langs->load("errors");
+ // }
}
print ' ';
--- /tmp/dsg/dolibarr/htdocs/admin/system/github_modules.php
+++ /tmp/dsg/dolibarr/htdocs/admin/system/client_modules.php
@@ -25,95 +25,73 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
-if (!$user->admin) {
- accessforbidden();
-}
-
// Load translation files required by the page
$langs->loadLangs(array("install", "other", "admin"));
-$optioncss = GETPOST('optioncss', 'alpha');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'moduleoverview';
-
-$search_name = GETPOST("search_name", 'alpha');
-$search_id = GETPOST("search_id", 'alpha');
-$search_version = GETPOST("search_version", 'alpha');
-$search_permission = GETPOST("search_permission", 'alpha');
-
-$sortfield = GETPOST("sortfield", 'alpha');
-$sortorder = GETPOST("sortorder", 'alpha');
-
-if (!$sortfield) $sortfield = "id";
-if (!$sortorder) $sortorder = "asc";
-
-// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
-$hookmanager->initHooks(array('moduleoverview'));
-$form = new Form($db);
-$object = new stdClass();
-
-// Definition of fields for lists
-$arrayfields = array(
- 'name'=>array('label'=>$langs->trans("Modules"), 'checked'=>1, 'position'=>10),
- 'version'=>array('label'=>$langs->trans("Version"), 'checked'=>1, 'position'=>20),
- 'id'=>array('label'=>$langs->trans("IdModule"), 'checked'=>1, 'position'=>30),
- 'module_position'=>array('label'=>$langs->trans("Position"), 'checked'=>1, 'position'=>35),
- 'permission'=>array('label'=>$langs->trans("IdPermissions"), 'checked'=>1, 'position'=>40)
-);
-
-$arrayfields = dol_sort_array($arrayfields, 'position');
+if (!$user->admin)
+ accessforbidden();
/*
- * Actions
+ * View
*/
-$parameters = array();
-$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+llxHeader();
-if (empty($reshook)) {
- // Selection of new fields
- include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
-}
+print load_fiche_titre($langs->trans("AvailableModules"), '', 'title_setup');
+print ''.$langs->trans("ToActivateModule").' ';
+print " \n";
-// Load list of modules
-$moduleList = array();
$modules = array();
+$modules_names = array();
$modules_files = array();
$modules_fullpath = array();
$modulesdir = dolGetModulesDirs();
-$rights_ids = array();
-foreach ($modulesdir as $dir) {
+// Load list of modules
+$i = 0;
+foreach ($modulesdir as $dir)
+{
$handle = @opendir(dol_osencode($dir));
- if (is_resource($handle)) {
- while (($file = readdir($handle)) !== false) {
- if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
+ if (is_resource($handle))
+ {
+ while (($file = readdir($handle)) !== false)
+ {
+ if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
+ {
$modName = substr($file, 0, dol_strlen($file) - 10);
- if ($modName) {
+ if ($modName)
+ {
//print 'xx'.$dir.$file.' ';
- if (in_array($file, $modules_files)) {
+ if (in_array($file, $modules_files))
+ {
// File duplicate
print "Warning duplicate file found : ".$file." (Found ".$dir.$file.", already found ".$modules_fullpath[$file].") ";
}
- else {
+ else
+ {
// File to load
$res = include_once $dir.$file;
- if (class_exists($modName)) {
+ if (class_exists($modName))
+ {
try {
$objMod = new $modName($db);
$modules[$objMod->numero] = $objMod;
+ $modules_names[$objMod->numero] = $objMod->name;
$modules_files[$objMod->numero] = $file;
$modules_fullpath[$file] = $dir.$file;
+ $picto[$objMod->numero] = (isset($objMod->picto) && $objMod->picto) ? $objMod->picto : 'generic';
}
- catch (Exception $e) {
+ catch (Exception $e)
+ {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
}
}
- else {
+ else
+ {
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file) ";
}
}
@@ -124,294 +102,62 @@
}
}
-// create pre-filtered list for modules
-foreach ($modules as $key=>$module) {
- $newModule = new stdClass();
-
- $newModule->name = $module->getName();
- $newModule->version = $module->getVersion();
- $newModule->id = $key;
- $newModule->module_position = $module->module_position;
-
- $alt = $module->name.' - '.$modules_files[$key];
-
- if (!empty($module->picto)) {
- if (preg_match('/^\//', $module->picto)) $newModule->picto = img_picto($alt, $module->picto, 'width="14px"', 1);
- else $newModule->picto = img_object($alt, $module->picto, 'width="14px"');
+print '';
+print ' ';
+print '';
+print ''.$langs->trans("Modules").' | ';
+print ''.$langs->trans("Version").' | ';
+print ''.$langs->trans("IdModule").' | ';
+print ''.$langs->trans("IdPermissions").' | ';
+print ' ';
+$var = false;
+$sortorder = $modules_names;
+ksort($sortorder);
+$rights_ids = array();
+foreach ($sortorder as $numero=>$name)
+{
+ $idperms = "";
+ // Module
+ print '';
+ $alt = $name.' - '.$modules_files[$numero];
+ if (!empty($picto[$numero]))
+ {
+ if (preg_match('/^\//', $picto[$numero])) print img_picto($alt, $picto[$numero], 'width="14px"', 1);
+ else print img_object($alt, $picto[$numero], 'width="14px"');
}
- else {
- $newModule->picto = img_object($alt, 'generic', 'width="14px"');
+ else
+ {
+ print img_object($alt, $picto[$numero], 'width="14px"');
}
-
- $permission = array();
- if ($module->rights) {
- foreach ($module->rights as $rights) {
- if (empty($rights[0])) {
- continue;
- }
-
- $permission[] = $rights[0];
-
+ print ' '.$modules[$numero]->getName();
+ print " | ";
+ // Version
+ print ''.$modules[$numero]->getVersion().' | ';
+ // Id
+ print ''.$numero.' | ';
+ // Permissions
+ if ($modules[$numero]->rights)
+ {
+ foreach ($modules[$numero]->rights as $rights)
+ {
+ $idperms .= ($idperms ? ", " : "").$rights[0];
array_push($rights_ids, $rights[0]);
}
}
-
- $newModule->permission = $permission;
-
- // pre-filter list
- if ($search_name && !stristr($newModule->name, $search_name)) continue;
- if ($search_version && !stristr($newModule->version, $search_version)) continue;
- if ($search_id && !stristr($newModule->id, $search_id)) continue;
-
- if ($search_permission) {
- $found = false;
-
- foreach ($newModule->permission as $permission) {
- if (stristr($permission, $search_permission)) {
- $found = true;
- break;
- }
- }
-
- if (!$found) continue;
- }
-
- $moduleList[] = $newModule;
+ print ''.($idperms ? $idperms : " ").' | ';
+ print " \n";
}
-
-
-
-/*
- * View
- */
-
-llxHeader();
-
-print '';
print ' ';
-
sort($rights_ids);
$old = '';
-
-foreach ($rights_ids as $right_id) {
- if ($old == $right_id) {
- print "Warning duplicate id on permission : ".$right_id." ";
- }
-
+foreach ($rights_ids as $right_id)
+{
+ if ($old == $right_id) print "Warning duplicate id on permission : ".$right_id." ";
$old = $right_id;
}
// End of page
llxFooter();
$db->close();
-
-
- /**
- * Compare two modules by their ID for a ascending order
- *
- * @param stdClass $a First module
- * @param stdClass $b Second module
- * @return int Compare result (-1, 0, 1)
- */
-function compareIdAsc(stdClass $a, stdClass $b)
-{
- if ($a->id == $b->id) return 0;
-
- return $a->id > $b->id ? -1 : 1;
-}
-
- /**
- * Compare two modules by their ID for a descending order
- *
- * @param stdClass $a First module
- * @param stdClass $b Second module
- * @return int Compare result (-1, 0, 1)
- */
-function compareIdDesc(stdClass $a, stdClass $b)
-{
- if ($a->id == $b->id) return 0;
-
- return $b->id > $a->id ? -1 : 1;
-}
-
- /**
- * Compare two modules by their ID for a ascending order
- *
- * @param stdClass $a First module
- * @param stdClass $b Second module
- * @return int Compare result (-1, 0, 1)
- */
-function comparePermissionIdsAsc(stdClass $a, stdClass $b)
-{
- if (empty($a->permission) && empty($b->permission)) return compareIdAsc($a, $b);
-
- if (empty($a->permission)) return 1;
- if (empty($b->permission)) return -1;
-
- if ($a->permission[0] == $b->permission[0]) return 0;
-
- return $a->permission[0] > $b->permission[0] ? -1 : 1;
-}
-
- /**
- * Compare two modules by their permissions for a descending order
- *
- * @param stdClass $a First module
- * @param stdClass $b Second module
- * @return int Compare result (-1, 0, 1)
- */
-function comparePermissionIdsDesc(stdClass $a, stdClass $b)
-{
- if (empty($a->permission) && empty($b->permission)) return compareIdDesc($a, $b);
-
- if (empty($a->permission)) return -1;
- if (empty($b->permission)) return 1;
-
- if ($a->permission[0] == $b->permission[0]) return 0;
-
- return $a->permission[0] > $b->permission[0] ? 1 : -1;
-}
--- /tmp/dsg/dolibarr/htdocs/admin/system/github_perf.php
+++ /tmp/dsg/dolibarr/htdocs/admin/system/client_perf.php
@@ -49,7 +49,7 @@
print load_fiche_titre($langs->trans("PerfDolibarr"), '', 'title_setup');
-print ''.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' ('.$langs->trans("Reload").') ';
+print $langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' ('.$langs->trans("Reload").') ';
// Recupere la version de PHP
$phpversion = version_php();
@@ -62,8 +62,9 @@
print ' ';
print ''.$langs->trans("XDebug").': ';
$test = !function_exists('xdebug_is_enabled');
-if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis");
-else {
+if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
+else
+{
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug"));
print ' - '.$langs->trans("MoreInformation").' XDebug admin page';
}
@@ -73,8 +74,9 @@
print ' ';
print ''.$langs->trans("Syslog").': ';
$test = empty($conf->syslog->enabled);
-if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis");
-else {
+if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
+else
+{
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("Syslog"));
//print ' '.$langs->trans("MoreInformation").' XDebug admin page';
}
@@ -84,10 +86,11 @@
print ' ';
print ''.$langs->trans("DebugBar").': ';
$test = empty($conf->debugbar->enabled);
-if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis");
-else {
+if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
+else
+{
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("DebugBar"));
- //print ' '.$langs->trans("MoreInformation").' XDebug admin page';
+ //print ' '.$langs->trans("MoreInformation").' XDebug admin page';
}
print ' ';
@@ -101,11 +104,14 @@
{
print img_picto('', 'tick.png').' '.$langs->trans("MemcachedAvailableAndSetup");
print ' '.$langs->trans("MoreInformation").' Memcached module admin page';
- } else {
+ }
+ else
+ {
print img_picto('', 'warning').' '.$langs->trans("MemcachedModuleAvailableButNotSetup");
print ' Memcached module admin page';
}
-} else print img_picto('', 'warning').' '.$langs->trans("MemcachedNotAvailable");
+}
+else print img_picto('', 'warning').' '.$langs->trans("MemcachedNotAvailable");
print '';
// OPCode cache
@@ -141,7 +147,9 @@
{
$foundcache++;
print img_picto('', 'tick.png').' '.$langs->trans("APCInstalled");
- } else {
+ }
+ else
+ {
print img_picto('', 'warning').' '.$langs->trans("APCCacheInstalledButDisabled");
}
}
@@ -154,7 +162,9 @@
print ' ';
print ''.$langs->trans("PreloadOPCode").': ';
print ini_get('opcache.preload');
-} else {
+}
+else
+{
print ' ';
print ''.$langs->trans("PreloadOPCode").': ';
print $langs->trans("No");
@@ -431,6 +441,7 @@
print '';
print $form->textwithpicto($langs->trans("CompressionOfResources"), $langs->trans("CompressionOfResourcesDesc"));
print ': ';
+//$tmp=getURLContent(DOL_URL_ROOT.'/index.php','GET');var_dump($tmp);
print ' ';
// on PHP
print ''.img_picto('', 'tick.png').' '.$langs->trans("FilesOfTypeCompressed", 'php (.php)').' ';
@@ -457,7 +468,9 @@
if ($test)
{
print img_picto('', 'tick.png').' '.$langs->trans("YouUseBestDriver", $conf->db->type);
- } else {
+ }
+ else
+ {
print img_picto('', 'warning.png').' '.$langs->trans("YouDoNotUseBestDriver", $conf->db->type, 'mysqli');
}
print ' ';
@@ -473,7 +486,7 @@
$resql = $db->query($sql);
if ($resql)
{
- $limitforoptim = 100000;
+ $limitforoptim = 10000;
$num = $db->num_rows($resql);
$obj = $db->fetch_object($resql);
$nb = $obj->nb;
@@ -482,10 +495,14 @@
if (empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
{
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"), 'PRODUCT_DONOTSEARCH_ANYWHERE');
- } else {
+ }
+ else
+ {
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"));
}
- } else {
+ }
+ else
+ {
print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"));
}
print ' ';
@@ -508,10 +525,14 @@
if (empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE))
{
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'COMPANY_DONOTSEARCH_ANYWHERE');
- } else {
+ }
+ else
+ {
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ThirdParties"));
}
- } else {
+ }
+ else
+ {
print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ThirdParties"));
}
print ' ';
@@ -524,7 +545,9 @@
if (!in_array($conf->browser->name, array('chrome', 'opera', 'safari', 'firefox')))
{
print img_picto('', 'warning.png').' '.$langs->trans("BrowserIsKO", $conf->browser->name);
-} else {
+}
+else
+{
print img_picto('', 'tick.png').' '.$langs->trans("BrowserIsOK", $conf->browser->name);
}
print ' ';
--- /tmp/dsg/dolibarr/htdocs/admin/system/github_phpinfo.php
+++ /tmp/dsg/dolibarr/htdocs/admin/system/client_phpinfo.php
@@ -28,7 +28,9 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
-$langs->loadLangs(array("admin", "install", "errors"));
+$langs->load("admin");
+$langs->load("install");
+$langs->load("errors");
if (!$user->admin)
accessforbidden();
@@ -69,13 +71,13 @@
print '';
-print ''.$langs->trans("Parameter").' | '.$langs->trans("Value").' | ';
+print ''.$langs->trans("Parameter").' | '.$langs->trans("Value").' | ';
$ErrorPicturePath = "../../theme/eldy/img/error.png";
$WarningPicturePath = "../../theme/eldy/img/warning.png";
$OkayPicturePath = "../../theme/eldy/img/tick.png";
-print ''.$langs->trans("Version").' | ';
+print ' | '.$langs->trans("Version").' | ';
$arrayphpminversionerror = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 6, 0);
@@ -83,112 +85,115 @@
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0)
{
print ' '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
-} elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0)
+}
+elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0)
{
print ' '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning));
-} else {
+}
+else
+{
print ' '.versiontostring(versionphparray());
}
print ' | ';
print 'GET and POST support | ';
-if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["mainmenu"])) // We must keep $_GET and $_POST here
+if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["mainmenu"]))
{
print ' '.$langs->trans("PHPSupportPOSTGETKo");
print ' ('.$langs->trans("Recheck").')';
-} else {
+}
+else
+{
print ' '.$langs->trans("PHPSupportPOSTGETOk");
}
print ' | ';
print 'Sessions support | ';
+
if (!function_exists("session_id"))
{
print ' '.$langs->trans("ErrorPHPDoesNotSupportSessions");
-} else {
+}
+else
+{
print ' '.$langs->trans("PHPSupportSessions");
}
+
print ' | ';
-
print 'UTF-8 support | ';
+
if (!function_exists("utf8_encode"))
{
- print ' '.$langs->trans("ErrorPHPDoesNotSupport", "UTF8");
-} else {
- print ' '.$langs->trans("PHPSupport", "UTF8");
-}
+ print ' '.$langs->trans("ErrorPHPDoesNotSupportUTF8");
+}
+else
+{
+ print ' '.$langs->trans("PHPSupportUTF8");
+}
+
print ' | ';
-
print ' ';
print ' ';
-$activatedExtensions = array();
+$activatedExtensions = array_map('strtolower', getActivatedExtensions());
$loadedExtensions = array_map('strtolower', get_loaded_extensions(false));
print '';
print '';
-print ''.$langs->trans("Extension").' | ';
-print ''.$langs->trans("Test").' | ';
+print ''.$langs->trans("Extension").' | ';
+//print ''.$langs->trans("EnabledInSetup").' | ';
+print ''.$langs->trans("Loaded").' | ';
+print ''.$langs->trans("FunctionTest").' | ';
+print ''.$langs->trans("Result").' | ';
print ' ';
-$functions = ["mb_check_encoding"];
-$name = "MBString";
+$functions = ["imagecreate"];
+$name = "GD";
print "";
print "".$name." | ";
+//print getTableColumn($name, $activatedExtensions);
+print getTableColumn($name, $loadedExtensions);
+print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
-$functions = ["json_decode"];
-$name = "JSON";
+$functions = ["curl_init"];
+$name = "Curl";
print "";
print "".$name." | ";
+//print getTableColumn($name, $activatedExtensions);
+print getTableColumn($name, $loadedExtensions);
+print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
-$functions = ["imagecreate"];
-$name = "GD";
+if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost')
+{
+ $functions = ["locale_get_primary_language", "locale_get_region"];
+ $name = "Intl";
+
+ print "";
+ print "".$name." | ";
+ //print getTableColumn($name, $activatedExtensions);
+ print getTableColumn($name, $loadedExtensions);
+ print getTableColumnFunction($functions);
+ print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
+
+ print " ";
+}
+
+$functions = array();
+$name = "xDebug";
print "";
print "".$name." | ";
-print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
-print " ";
-
-$functions = ["curl_init"];
-$name = "Curl";
-
-print "";
-print "".$name." | ";
-print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
-print " ";
-
-if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost')
-{
- $functions = ["locale_get_primary_language", "locale_get_region"];
- $name = "Intl";
-
- print "";
- print "".$name." | ";
- print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
- print " ";
-}
-
-$functions = ["imap_open"];
-$name = "IMAP";
-
-print "";
-print "".$name." | ";
-print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
-print " ";
-
-$functions = array();
-$name = "xDebug";
-
-print "";
-print "".$name." | ";
+//print getTableColumn($name, $activatedExtensions);
+print getTableColumn($name, $loadedExtensions);
+print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
@@ -203,7 +208,7 @@
print '';
print ' ';
print '';
- print ''.$key.' | ';
+ print ''.$key.' | ';
print ''.$langs->trans("Value").' | ';
print " \n";
@@ -216,16 +221,18 @@
print ''.$keyparam.' | ';
$valtoshow = $keyvalue;
if ($keyparam == 'X-ChromePhp-Data') $valtoshow = dol_trunc($keyvalue, 80);
- print '';
+ print ' | ';
if ($keyparam == 'Path') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == 'PATH') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == '_SERVER["PATH"]') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
print $valtoshow;
print ' | ';
print '';
- } else {
+ }
+ else
+ {
print '';
- print ''.$keyparam.' | ';
+ print ''.$keyparam.' | ';
$i = 0;
foreach ($keyvalue as $keyparam2 => $keyvalue2)
{
@@ -249,14 +256,154 @@
llxFooter();
$db->close();
+/**
+ * Return all list with all activated, but possible not loaded PHP extensions
+ *
+ * @return array
+ */
+function getActivatedExtensions()
+{
+ $file = getConfigFilePath();
+ $handle = fopen(GetConfigFilePath(), "r");
+ $content = fread($handle, filesize($file));
+
+ fclose($handle);
+
+ $configLines = explode("\r", $content);
+
+ $extensions = array();
+ $lastLine = "";
+
+ foreach ($configLines as $line)
+ {
+ $line = trim($line);
+
+ // ignore comment lines
+ if (substr($line, 0, 1) === ";")
+ {
+ continue;
+ }
+
+ // extension
+ if (substr($line, 0, 9) === "extension" && substr($line, 0, 10) !== "extension_")
+ {
+ $value = trim(end(explode("=", $line)));
+
+ $extensions[] = $value === "gd2" ? "gd" : $value;
+ }
+
+ // zend_extension
+ if (substr($line, 0, 14) === "zend_extension")
+ {
+ $extensions[] = str_replace("[", "", str_replace("]", "", $lastLine));
+ }
+
+ $lastLine = $line;
+ }
+
+ return array_unique($extensions);
+}
+
+/**
+ * Return the path to the current used php config file
+ *
+ * @return string
+ */
+function getConfigFilePath()
+{
+ $phparray = phpinfo_array();
+
+ foreach ($phparray as $value)
+ {
+ foreach ($value as $keyparam => $keyvalue)
+ {
+ if (strtolower($keyparam) !== "loaded configuration file")
+ {
+ continue;
+ }
+
+ return $keyvalue;
+ }
+ }
+
+ return "";
+}
+
+/**
+ * Return a table column with a indicator (okay or warning), based on the given name and list
+ *
+ * @param string $name The name to check inside the given list
+ * @param array $list A list that should contains the given name
+ *
+ * @return string
+ */
+function getTableColumn($name, array $list)
+{
+ global $langs;
+
+ $name = strtolower($name);
+ $html = "";
+
+ if (in_array($name, $list))
+ {
+ if ($name == 'xdebug') $html .= ' ';
+ else $html .= ' ';
+ }
+ else
+ {
+ if ($name == 'xdebug') $html .= yn(0);
+ else $html .= ' ';
+ }
+
+ $html .= " | ";
+
+ return $html;
+}
+
+/**
+ * Return a table column with a indicator (okay or warning), based on the given functions to check
+ *
+ * @param array $functions A list with functions to check
+ *
+ * @return string
+ */
+function getTableColumnFunction(array $functions)
+{
+ if (count($functions) < 1)
+ {
+ return "- | ";
+ }
+
+ $result = true;
+ $html = "";
+
+ foreach ($functions as $function)
+ {
+ $result = $result && function_exists($function);
+ }
+
+ if ($result)
+ {
+ $html .= ' ';
+ }
+ else
+ {
+ $html .= ' ';
+ }
+
+ $html .= " | ";
+
+ return $html;
+}
/**
* Return a result column with a translated result text
*
* @param string $name The name of the PHP extension
- * @param array $activated A list with all activated PHP extensions. Deprecated.
+ * @param array $activated A list with all activated PHP extensions
* @param array $loaded A list with all loaded PHP extensions
* @param array $functions A list with all PHP functions to check
+ *
* @return string
*/
function getResultColumn($name, array $activated, array $loaded, array $functions)
@@ -264,7 +411,6 @@
global $langs;
$result = true;
-
//$result = $result && in_array(strtolower($name), $activated);
$result = $result && in_array(strtolower($name), $loaded);
@@ -274,30 +420,8 @@
}
$html = "";
- if ($result) {
- if (strtolower($name) == 'xdebug') $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
- else $html .= img_picto($langs->trans("Ok"), 'tick');
- if (in_array(strtolower($name), $loaded)) {
- $html .= ' '.$langs->trans("Loaded").' - ';
- } else {
- //$html .= ' '.$langs->trans("NotLoaded").' - ';
- }
- if (strtolower($name) == 'xdebug') {
- $html .= ' '.$langs->trans("ModuleActivated", "xdebug");
- } else {
- $html .= ' '.$langs->trans("PHPSupport", $name);
- }
- } else {
- if (strtolower($name) == 'xdebug') $html .= yn(0).' - ';
- else $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
- if (in_array(strtolower($name), $loaded)) {
- $html .= ' '.$langs->trans("Loaded").' - ';
- } else {
- //$html .= ' '.$langs->trans("NotLoaded").' - ';
- }
- $html .= ' '.$langs->trans("ErrorPHPDoesNotSupport", $name);
- }
+ $html .= $result ? $langs->trans("PHPSupport".$name) : $langs->trans("ErrorPHPDoesNotSupport".$name);
$html .= " | ";
- return $html;
-}
+ return $html;
+}
--- /tmp/dsg/dolibarr/htdocs/admin/system/github_xdebug.php
+++ /tmp/dsg/dolibarr/htdocs/admin/system/client_xdebug.php
@@ -108,13 +108,17 @@
XDebug with same port than in php.ini
Allow Remote debug=yes or prompt '."\n";
print " \n";
- } else {
+ }
+ else
+ {
print socket_strerror(socket_last_error());
echo "Failed to connect to address=".$address." port=".$port." \n";
echo "There is no Remote debug server at this address.\n";
}
socket_close($socket);
-} else {
+}
+else
+{
print "Can't test if PHPDebug is OK as PHP socket functions are not enabled.";
}
|