--- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_about.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_about.php @@ -27 +26,0 @@ -// Load Dolibarr environment @@ -35,5 +34,3 @@ -$action = GETPOST('action', 'aZ09'); - -if (!$user->admin) { - accessforbidden(); -} +$action = GETPOST('action', 'alpha'); + +if (!$user->admin) accessforbidden(); @@ -76,2 +73,2 @@ -print '
  • '.$langs->trans("SourcesRepository").': https://www.github.com/Dolibarr/dolibarr
  • '; -print '
  • '.$langs->trans("SeeWikiForAllTeam").': https://wiki.dolibarr.org/index.php/Dolibarr_Project
  • '; +print '
  • '.$langs->trans("SourcesRepository").': https://www.github.com/Dolibarr/dolibarr
  • '; +print '
  • '.$langs->trans("SeeWikiForAllTeam").': https://wiki.dolibarr.org/index.php/Dolibarr_Project
  • '; @@ -86 +83 @@ -print ''.$langs->trans("OfficialWebSite").''; +print ''.$langs->trans("OfficialWebSite").''; @@ -89 +85,0 @@ -/* @@ -93 +89 @@ - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("France")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("France")).''; @@ -99 +95 @@ - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Greece")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Greece")).''; @@ -105 +101 @@ - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Spain")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Spain")).''; @@ -111 +107 @@ - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Italy")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Italy")).''; @@ -117,5 +113,5 @@ - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).''; - print ''; -}*/ -print '
  • '; -print ''.$langs->trans("OfficialWiki").''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).''; + print '
  • '; +} +print '
  • '; +print ''.$langs->trans("OfficialWiki").''; @@ -128 +124 @@ -print ''.$langs->trans("OfficialDemo").''; +print ''.$langs->trans("OfficialDemo").''; @@ -135 +131 @@ -print ''.$langs->trans("OfficialMarketPlace").''; +print ''.$langs->trans("OfficialMarketPlace").''; @@ -147 +143 @@ -print ''.$langs->trans("HelpCenter").''; +print ''.$langs->trans("HelpCenter").''; @@ -156,7 +152,3 @@ -if (preg_match('/^fr_/i', $langs->getDefaultLang())) { - $url = 'https://wiki.dolibarr.org/index.php/Adh%C3%A9rer'; -} -if (preg_match('/^es_/i', $langs->getDefaultLang())) { - $url = 'https://wiki.dolibarr.org/index.php/Subscribirse'; -} -print '
  • '.$langs->trans("SubscribeToFoundation").'
  • '; +if (preg_match('/^fr_/i', $langs->getDefaultLang())) $url = 'https://wiki.dolibarr.org/index.php/Adh%C3%A9rer'; +if (preg_match('/^es_/i', $langs->getDefaultLang())) $url = 'https://wiki.dolibarr.org/index.php/Subscribirse'; +print '
  • '.$langs->trans("SubscribeToFoundation").'
  • '; @@ -169,2 +161,2 @@ -print '
  • FaceBook
  • '; -print '
  • Twitter
  • '; +print '
  • FaceBook
  • '; +print '
  • Twitter
  • '; @@ -179,8 +171,4 @@ -if (preg_match('/^fr_/i', $langs->getDefaultLang())) { - $url = 'https://wiki.dolibarr.org/index.php/Solutions_Cloud_pour_Dolibarr_ERP_CRM'; -} -if (preg_match('/^es_/i', $langs->getDefaultLang())) { - $url = 'https://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube'; -} -print '
  • '; -print ''.$title.''; +if (preg_match('/^fr_/i', $langs->getDefaultLang())) $url = 'https://wiki.dolibarr.org/index.php/Solutions_de_Cloud'; +if (preg_match('/^es_/i', $langs->getDefaultLang())) $url = 'https://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube'; +print '
  • '; +print ''.$title.''; @@ -190 +178 @@ -print ''.$title.''; +print ''.$title.''; @@ -201,18 +189,23 @@ -if ($showpromotemessage) { - $tmp = versiondolibarrarray(); - if (is_numeric($tmp[2])) { // Not alpha, beta or rc - print '
    '; - print '
    '; - - if ((empty($tmp[2]) && (strpos($tmp[1], '0') === 0)) || (strpos($tmp[2], '0') === 0)) { - print $langs->trans("TitleExampleForMajorRelease").':
    '; - print ''; - } else { - print $langs->trans("TitleExampleForMaintenanceRelease").':
    '; - print ''; - } - } +if ($showpromotemessage) +{ + $tmp = versiondolibarrarray(); + if (is_numeric($tmp[2])) // Not alpha, beta or rc + { + print '
    '; + print '
    '; + + if ((empty($tmp[2]) && (strpos($tmp[1], '0') === 0)) || (strpos($tmp[2], '0') === 0)) + { + print $langs->trans("TitleExampleForMajorRelease").':
    '; + print ''; + } + else + { + print $langs->trans("TitleExampleForMaintenanceRelease").':
    '; + print ''; + } + } --- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_constall.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_constall.php @@ -25 +24,0 @@ -// Load Dolibarr environment @@ -32,3 +31,2 @@ -if (!$user->admin) { - accessforbidden(); -} +if (!$user->admin) + accessforbidden(); @@ -75,0 +74 @@ + '?dolibarr_lib_ADODB_PATH', @@ -80,0 +80 @@ + '?dolibarr_lib_PHPEXCEL_PATH', @@ -86,0 +87 @@ + '?dolibarr_js_JQUERY_FLOT', @@ -92 +92,0 @@ - '?dolibarr_mailing_limit_sendbyday', @@ -123,0 +124 @@ + 'dolibarr_lib_ADODB_PATH', @@ -126,0 +128 @@ + 'dolibarr_lib_PHPEXCEL_PATH', @@ -132,0 +135 @@ + 'dolibarr_js_JQUERY_FLOT', @@ -146 +149,2 @@ -foreach ($configfileparameters as $key) { +foreach ($configfileparameters as $key) +{ @@ -149,8 +153,5 @@ - if ($key == 'dolibarr_main_url_root_alt' && empty(${$key})) { - $ignore = 1; - } - if ($key == 'dolibarr_main_document_root_alt' && empty(${$key})) { - $ignore = 1; - } - - if (empty($ignore)) { + if ($key == 'dolibarr_main_url_root_alt' && empty(${$key})) $ignore = 1; + if ($key == 'dolibarr_main_document_root_alt' && empty(${$key})) $ignore = 1; + + if (empty($ignore)) + { @@ -159 +160,2 @@ - if (preg_match('/^\?/', $key) && empty(${$newkey})) { + if (preg_match('/^\?/', $key) && empty(${$newkey})) + { @@ -164 +166,2 @@ - if ($newkey == 'separator' && $lastkeyshown == 'separator') { + if ($newkey == 'separator' && $lastkeyshown == 'separator') + { @@ -170 +173,2 @@ - if ($newkey == 'separator') { + if ($newkey == 'separator') + { @@ -172 +176,3 @@ - } else { + } + else + { @@ -179,10 +185,4 @@ - 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'); - } else { - print ${$newkey}; - } - if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) { - print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; - } + 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'); + else print ${$newkey}; + if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; @@ -207,3 +207 @@ -if (!isModEnabled('multicompany') || !$user->entity) { - print ''.$langs->trans("Entity").''; // If superadmin or multicompany disabled -} +if (empty($conf->multicompany->enabled) || !$user->entity) print ''.$langs->trans("Entity").''; // If superadmin or multicompany disabled @@ -220 +218,2 @@ -if (!isModEnabled('multicompany')) { +if (empty($conf->multicompany->enabled)) +{ @@ -223 +222,3 @@ -} else { +} +else +{ @@ -225,3 +226 @@ - if ($user->entity) { - $sql .= " WHERE entity IN (".$db->sanitize($user->entity.",".$conf->entity).")"; - } + if ($user->entity) $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; @@ -231 +230,2 @@ -if ($resql) { +if ($resql) +{ @@ -235 +235,2 @@ - while ($i < $num) { + while ($i < $num) + { @@ -241,3 +242 @@ - if (!isModEnabled('multicompany') || !$user->entity) { - print ''.$obj->entity.''."\n"; // If superadmin or multicompany disabled - } + if (empty($conf->multicompany->enabled) || !$user->entity) print ''.$obj->entity.''."\n"; // If superadmin or multicompany disabled --- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_database-tables.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_database-tables.php @@ -3 +3 @@ - * Copyright (C) 2004-2021 Laurent Destailleur + * Copyright (C) 2004-2005 Laurent Destailleur @@ -24 +24 @@ - * \brief Page with information on database tables. Add also some maintenance action to convert tables. + * \brief Page with information on database tables @@ -27,5 +26,0 @@ -if (! defined('CSRFCHECK_WITH_TOKEN')) { - define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -} - -// Load Dolibarr environment @@ -33,2 +27,0 @@ -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -38 +31 @@ -if (!$user->admin) { +if (!$user->admin) @@ -40,11 +33,7 @@ -} - -$action = GETPOST('action', 'aZ09'); - - -/* - * Actions - */ - -if ($action == 'convert') { - $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB"; + +$action = GETPOST('action', 'alpha'); + + +if ($action == 'convert') +{ + $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB"; @@ -53,7 +42,4 @@ -if ($action == 'convertutf8') { - $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci"; - $db->query($sql); -} -if ($action == 'convertdynamic') { - $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ROW_FORMAT=DYNAMIC;"; - $db->query($sql); +if ($action == 'convertutf8') +{ + $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + $db->query($sql); @@ -74 +60,2 @@ -if (preg_match('/mysql/i', $conf->db->type)) { +if (preg_match('/mysql/i', $conf->db->type)) +{ @@ -77 +64,3 @@ -} elseif ($conf->db->type == 'pgsql') { +} +elseif ($conf->db->type == 'pgsql') +{ @@ -80 +69,3 @@ -} elseif ($conf->db->type == 'mssql') { +} +elseif ($conf->db->type == 'mssql') +{ @@ -83 +74,3 @@ -} elseif ($conf->db->type == 'sqlite' || $conf->db->type == 'sqlite3') { +} +elseif ($conf->db->type == 'sqlite' || $conf->db->type == 'sqlite3') +{ @@ -89 +82,2 @@ -if (!$base) { +if (!$base) +{ @@ -91,4 +85,7 @@ -} else { - if ($base == 1) { - print '
    '; - print ''; +} +else +{ + if ($base == 1) + { + print '
    '; + print '
    '; @@ -96 +92,0 @@ - print ''; @@ -110,14 +105,0 @@ - $arrayoffilesrich = dol_dir_list(DOL_DOCUMENT_ROOT.'/install/mysql/tables/', 'files', 0, '\.sql$'); - $arrayoffiles = array(); - $arrayoftablesautocreated = array(); - foreach ($arrayoffilesrich as $value) { - //print $shortsqlfilename.' '; - $shortsqlfilename = preg_replace('/\-[a-z]+\./', '.', $value['name']); - $arrayoffiles[$value['name']] = $shortsqlfilename; - if ($value['name'] == $shortsqlfilename && ! preg_match('/\.key\.sql$/', $value['name'])) { - // This is a sql file automatically created - $arrayoftablesautocreated[$value['name']] = $shortsqlfilename; - } - } - - // Now loop on tables really found into database @@ -127 +109,2 @@ - if ($resql) { + if ($resql) + { @@ -130 +113,2 @@ - while ($i < $num) { + while ($i < $num) + { @@ -132 +115,0 @@ - @@ -135,16 +118 @@ - print ''; - print ''; + print ''; @@ -152,3 +120,6 @@ - if (isset($obj->Engine) && $obj->Engine == "MyISAM") { - print ''; - } else { + if (isset($obj->Engine) && $obj->Engine == "MyISAM") + { + print ''; + } + else + { @@ -157,6 +128 @@ - print ''; + print ''; @@ -171,2 +137,3 @@ - if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci")))) { - print '
    '.$langs->trans("Convert").' UTF8'; + if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci")))) + { + print '
    '.$langs->trans("Convert").' UTF8'; @@ -183,3 +150,4 @@ - if ($base == 2) { - print '
    '; - print '
    #'.($i+1).''.$obj->Name.''; - $tablename = preg_replace('/^'.MAIN_DB_PREFIX.'/', 'llx_', $obj->Name); - - if (in_array($tablename.'.sql', $arrayoffiles)) { - if (in_array($tablename.'.sql', $arrayoftablesautocreated)) { - $img = "info"; - } else { - $img = "info_black"; - print img_picto($langs->trans("NotAvailableByDefaultEnabledOnModuleActivation"), $img, 'class="small opacitymedium"'); - } - } else { - $img = "info_black"; - print img_picto($langs->trans("ExternalModule"), $img, 'class="small"'); - } - print ''.$obj->Name.''.$langs->trans("Convert").' InnoDb'.$langs->trans("Convert").' InnoDB'; - print $obj->Row_format; - if (isset($obj->Row_format) && (in_array($obj->Row_format, array("Compact")))) { - print '
    '.$langs->trans("Convert").' Dynamic'; - } - print '
    '.$obj->Row_format.'
    '; + if ($base == 2) + { + print '
    '; + print '
    '; @@ -187,2 +154,0 @@ - - print ''; @@ -201 +167,2 @@ - if ($resql) { + if ($resql) + { @@ -204 +171,2 @@ - while ($i < $num) { + while ($i < $num) + { @@ -207 +174,0 @@ - print ''; @@ -222 +189,2 @@ - if ($base == 4) { + if ($base == 4) + { @@ -224,2 +192,2 @@ - print '
    '; - print '
    #'.($i+1).'
    '; + print '
    '; + print '
    '; @@ -227 +194,0 @@ - print ''; @@ -235 +202,2 @@ - if ($resql) { + if ($resql) + { @@ -246 +213,0 @@ - print ''; --- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_database.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_database.php @@ -26 +25,0 @@ -// Load Dolibarr environment @@ -31,3 +30 @@ -if (!$user->admin) { - accessforbidden(); -} +if (!$user->admin) accessforbidden(); @@ -51,9 +48,9 @@ -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; @@ -68 +65 @@ -print ''."\n"; +print ''."\n"; @@ -76 +73,2 @@ -if (!count($listofvars) && !count($listofstatus)) { +if (!count($listofvars) && !count($listofstatus)) +{ @@ -78,2 +76,5 @@ -} else { - foreach ($arraylist as $listname) { +} +else +{ + foreach ($arraylist as $listname) + { @@ -81 +82 @@ - print '
    '; + print '
    '; @@ -90 +91,2 @@ - if (preg_match('/mysql/i', $db->type)) { + if (preg_match('/mysql/i', $db->type)) + { @@ -98,6 +100,2 @@ - if ($listname == 'listofvars') { - $listtouse = $listofvars; - } - if ($listname == 'listofstatus') { - $listtouse = $listofstatus; - } + if ($listname == 'listofvars') $listtouse = $listofvars; + if ($listname == 'listofstatus') $listtouse = $listofstatus; @@ -105 +103,2 @@ - foreach ($listtouse as $param => $paramval) { + foreach ($listtouse as $param => $paramval) + { @@ -110,9 +109,6 @@ - print '
    "; + print (isset($link[$row[0]][1]) ? $link[$row[0]][1] : '').""; @@ -123,2 +132 @@ - print ''; - print ''; + print ''; --- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_dolibarr.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_dolibarr.php @@ -2 +2 @@ -/* Copyright (C) 2005-2020 Laurent Destailleur +/* Copyright (C) 2005-2017 Laurent Destailleur @@ -22 +22 @@ - * \brief Page to show Dolibarr information + * \brief Page to show Dolibarr informations @@ -25 +24,0 @@ -// Load Dolibarr environment @@ -36,3 +35,3 @@ -$action = GETPOST('action', 'aZ09'); - -if (!$user->admin) { +$action = GETPOST('action', 'alpha'); + +if (!$user->admin) @@ -40 +38,0 @@ -} @@ -51,14 +49,5 @@ -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 - libxml_disable_entity_loader(true); - } - - $sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); - } else { - setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors'); - } +if ($action == 'getlastversion') +{ + $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss'); + //var_dump($result['content']); + $sfurl = simplexml_load_string($result['content']); @@ -74 +62,0 @@ -$help_url = ''; @@ -77 +65 @@ -llxHeader('', $title, $help_url); +llxHeader('', $title); @@ -84 +72 @@ -print ''."\n"; +print ''."\n"; @@ -87,11 +75,49 @@ -if (!getDolGlobalString('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)); - } -} +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)); +} + +if (function_exists('curl_init')) +{ + $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10; + print '     -     '; + if ($action == 'getlastversion') + { + if ($sfurl) + { + while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) + { + $title = $sfurl->channel[0]->item[$i]->title; + 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")).''; + } + else + { + print $langs->trans("LastStableVersion").' : '.$langs->trans("UpdateServerOffline").''; + } + } + else + { + print $langs->trans("LastStableVersion").' : '.$langs->trans("Check").''; + } +} + +// Now show link to the changelog +print '     -     '; @@ -100,51 +126,6 @@ -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 ''."\n"; -print ''."\n"; -print ''."\n"; +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 ''."\n"; +print ''."\n"; @@ -158,7 +139,6 @@ -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''; -print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; -print ''."\n"; +print ''; + print ''; @@ -208 +185,2 @@ - foreach ($shmoparray as $key => $val) { + foreach ($shmoparray as $key => $val) + { @@ -224 +202 @@ -print ''."\n"; +print ''."\n"; @@ -229,6 +207,2 @@ -if ($thousand == 'SeparatorThousand') { - $thousand = ' '; // ' ' does not work on trans method -} -if ($thousand == 'None') { - $thousand = ''; -} +if ($thousand == 'SeparatorThousand') $thousand = ' '; // ' ' does not work on trans method +if ($thousand == 'None') $thousand = ''; @@ -242 +216,2 @@ -if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) { +if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) +{ @@ -247,3 +222,20 @@ - -// 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 ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php +print ''."\n"; +print ''; +print ''; +print ''; @@ -251 +243,2 @@ -if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') { +if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') +{ @@ -255 +248,2 @@ - if ($resql) { + if ($resql) + { @@ -261,19 +254,0 @@ -$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") : $conf->global->MAIN_SERVER_TZ); -print ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php -print ''."\n"; -print ''; -print ''; -print ''; @@ -285,11 +260,6 @@ -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 ''."\n"; -print ''."\n"; -print ''."\n"; +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 ''."\n"; +print ''."\n"; +print ''."\n"; @@ -301,9 +271,3 @@ -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 = $conf->global->MAIN_FILESYSTEM_ENCODING; -} +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 (!empty($conf->global->MAIN_FILESYSTEM_ENCODING)) $tmp = $conf->global->MAIN_FILESYSTEM_ENCODING; @@ -320,53 +284,53 @@ - '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' + '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"), + '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"), + '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("Prefix"), + '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_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH', + '?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_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' => '', + 'dolibarr_main_prod' => 'Production mode (Hide all error messages)', + '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_strict_mode' => 'Strict mode is on/off', + '?dolibarr_nocsrfcheck' => 'Disable CSRF security checks' @@ -378 +342 @@ -print ''; + if (strpos($newkey, 'separator') !== false) + { + print ''; @@ -399,5 +369,2 @@ - - print ''; - if (strpos($newkey, 'separator') !== false) { - print ''; - } else { + else + { @@ -410,11 +377,5 @@ - 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); + 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') + { + $tmparray = explode(',', ${$newkey}); @@ -422,4 +383,3 @@ - foreach ($tmparray as $value2) { - if ($i > 0) { - print ', '; - } + foreach ($tmparray as $value2) + { + if ($i > 0) print ', '; @@ -427 +387,2 @@ - if (!is_readable($value2)) { + if (!is_readable($value2)) + { @@ -433,40 +393,0 @@ - } 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 ''; - 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}); @@ -474,2 +395,10 @@ - if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) { - print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; + 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).')'; @@ -476,0 +406,5 @@ + else + { + print ${$newkey}; + } + if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; @@ -495,3 +429 @@ -if (!isModEnabled('multicompany') || !$user->entity) { - print ''; // If superadmin or multicompany disabled -} +if (empty($conf->multicompany->enabled) || !$user->entity) print ''; // If superadmin or multicompany disabled @@ -508 +440,2 @@ -if (!isModEnabled('multicompany')) { +if (empty($conf->multicompany->enabled)) +{ @@ -511 +444,3 @@ -} else { +} +else +{ @@ -513,3 +448 @@ - if ($user->entity) { - $sql .= " WHERE entity IN (".$db->sanitize($user->entity.",".$conf->entity).")"; - } + if ($user->entity) $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; @@ -519 +452,2 @@ -if ($resql) { +if ($resql) +{ @@ -523 +457,2 @@ - while ($i < $num) { + while ($i < $num) + { @@ -527,14 +462,3 @@ - print ''."\n"; - print ''."\n"; - if (!isModEnabled('multicompany') || !$user->entity) { - print ''."\n"; // If superadmin or multicompany disabled - } + print ''."\n"; + print ''."\n"; + if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled --- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_filecheck.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_filecheck.php @@ -2 +2 @@ -/* Copyright (C) 2005-2020 Laurent Destailleur +/* Copyright (C) 2005-2016 Laurent Destailleur @@ -27 +26,0 @@ -// Load Dolibarr environment @@ -34,3 +33,2 @@ -if (!$user->admin) { - accessforbidden(); -} +if (!$user->admin) + accessforbidden(); @@ -57,2 +55,2 @@ -print ''."\n"; -print ''."\n"; +print ''."\n"; +print ''."\n"; @@ -61,5 +59,4 @@ -if (!getDolGlobalString('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)); - } +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)); @@ -67,4 +64,3 @@ - // 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)); @@ -82,7 +78,2 @@ -$xmlshortfile = dol_sanitizeFileName(GETPOST('xmlshortfile', 'alpha') ? GETPOST('xmlshortfile', 'alpha') : 'filelist-'.DOL_VERSION.(!getDolGlobalString('MAIN_FILECHECK_LOCAL_SUFFIX') ? '' : $conf->global->MAIN_FILECHECK_LOCAL_SUFFIX).'.xml'.(!getDolGlobalString('MAIN_FILECHECK_LOCAL_EXT') ? '' : $conf->global->MAIN_FILECHECK_LOCAL_EXT)); - -$xmlfile = DOL_DOCUMENT_ROOT.'/install/'.$xmlshortfile; -if (!preg_match('/\.zip$/i', $xmlfile) && dol_is_file($xmlfile.'.zip')) { - $xmlfile = $xmlfile.'.zip'; -} - +$xmlshortfile = GETPOST('xmlshortfile', 'alpha') ?GETPOST('xmlshortfile', 'alpha') : '/install/filelist-'.DOL_VERSION.(empty($conf->global->MAIN_FILECHECK_LOCAL_SUFFIX) ? '' : $conf->global->MAIN_FILECHECK_LOCAL_SUFFIX).'.xml'.(empty($conf->global->MAIN_FILECHECK_LOCAL_EXT) ? '' : $conf->global->MAIN_FILECHECK_LOCAL_EXT); +$xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile; @@ -90,4 +81,2 @@ -$xmlremote = GETPOST('xmlremote', 'alphanohtml'); -if (empty($xmlremote) && getDolGlobalString('MAIN_FILECHECK_URL')) { - $xmlremote = $conf->global->MAIN_FILECHECK_URL; -} +$xmlremote = GETPOST('xmlremote'); +if (empty($xmlremote) && !empty($conf->global->MAIN_FILECHECK_URL)) $xmlremote = $conf->global->MAIN_FILECHECK_URL; @@ -95,15 +84,3 @@ -if (empty($xmlremote) && getDolGlobalString($param)) { - $xmlremote = getDolGlobalString($param); -} -if (empty($xmlremote)) { - $xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml'; -} -if ($xmlremote && !preg_match('/^https?:\/\//', $xmlremote)) { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorURLMustStartWithHttp", $xmlremote), null, 'errors'); - $error++; -} elseif ($xmlremote && !preg_match('/\.xml$/', $xmlremote)) { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorURLMustEndWith", $xmlremote, '.xml'), null, 'errors'); - $error++; -} +if (empty($xmlremote) && !empty($conf->global->$param)) $xmlremote = $conf->global->$param; +if (empty($xmlremote)) $xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml'; + @@ -113,3 +90 @@ -if (preg_match('/beta|alpha|rc/i', DOL_VERSION) || getDolGlobalString('MAIN_ALLOW_INTEGRITY_CHECK_ON_UNSTABLE')) { - $enableremotecheck = false; -} +if (preg_match('/beta|alpha|rc/i', DOL_VERSION) || !empty($conf->global->MAIN_ALLOW_INTEGRITY_CHECK_ON_UNSTABLE)) $enableremotecheck = false; @@ -119 +93,0 @@ -print ''; @@ -122,9 +96,12 @@ -if (dol_is_file($xmlfile)) { - print ' = '; - print ''; - print '
    '; -} else { - print ''; - print '
    '; +if (dol_is_file($xmlfile)) +{ + print ' '.$langs->trans("LocalSignature").' = '; + print ''; + print '
    '; +} +else +{ + print ' '.$langs->trans("LocalSignature").' = '; + print ''; + print ' ('.$langs->trans("AvailableOnlyOnPackagedVersions").')'; + print '
    '; @@ -133,9 +110,10 @@ -if ($enableremotecheck) { - print ' = '; - print '
    '; -} else { - print ' '.$langs->trans("RemoteSignature").' = '.dol_escape_htmltag($xmlremote); - if (!GETPOST('xmlremote')) { - print ' ('.$langs->trans("FeatureAvailableOnlyOnStable").')'; - } - print '
    '; +if ($enableremotecheck) +{ + print ' '.$langs->trans("RemoteSignature").' = '; + print '
    '; +} +else +{ + print ' '.$langs->trans("RemoteSignature").' = '.$xmlremote; + if (!GETPOST('xmlremote')) print ' ('.$langs->trans("FeatureAvailableOnlyOnStable").')'; + print '
    '; @@ -148,54 +126,54 @@ -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); - if ($xml === false) { - print '
    '.$langs->trans('XmlCorrupted').': '.$xmlfile.''; - $error++; - } - } else { - print '
    '.$langs->trans('XmlNotFound').': '.$xmlfile.''; - $error++; - } -} -if (GETPOST('target') == 'remote') { - $xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only. Same is used into api_setup.class.php. - - // 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"; - if (LIBXML_VERSION < 20900) { - // Avoid load of external entities (security problem). - // Required only if LIBXML_VERSION < 20900 - libxml_disable_entity_loader(true); - } - - $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); - } else { - $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; - setEventMessages($errormsg, null, 'errors'); - $error++; - } -} - - -if (empty($error) && !empty($xml)) { - $checksumconcat = array(); - $file_list = array(); - $out = ''; - - // Forced constants - if (is_object($xml->dolibarr_constants[0])) { - $out .= load_fiche_titre($langs->trans("ForcedConstants")); +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 (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'] != '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")); @@ -204,63 +182,66 @@ - $out .= '
    #'.($i+1).'
    '.$langs->trans("Version").''.$db::LABEL.' '.$db->getVersion().'
    '.$langs->trans("DatabaseServer").''.$conf->db->host.'
    '.$langs->trans("DatabasePort").''.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'
    '.$langs->trans("DatabaseName").''.$conf->db->name.'
    '.$langs->trans("DriverType").''.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'
    '.$langs->trans("User").''.$conf->db->user.'
    '.$langs->trans("Password").''.preg_replace('/./i', '*', $dolibarr_main_db_pass).'
    '.$langs->trans("DBStoringCharset").''.$db->getDefaultCharacterSetDatabase().'
    '.$langs->trans("DBSortingCharset").''.$db->getDefaultCollationDatabase().'
    '.$langs->trans("Version").''.$db::LABEL.' '.$db->getVersion().'
    '.$langs->trans("DatabaseServer").''.$conf->db->host.'
    '.$langs->trans("DatabasePort").''.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'
    '.$langs->trans("DatabaseName").''.$conf->db->name.'
    '.$langs->trans("DriverType").''.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'
    '.$langs->trans("User").''.$conf->db->user.'
    '.$langs->trans("Password").''.preg_replace('/./i', '*', $dolibarr_main_db_pass).'
    '.$langs->trans("DBStoringCharset").''.$db->getDefaultCharacterSetDatabase().'
    '.$langs->trans("DBSortingCharset").''.$db->getDefaultCollationDatabase().'
    '.img_picto('', 'list', 'class="pictofixedwidth"').$langs->trans("List").'
    '.$langs->trans("List").'
    '; - $show = 0; - $text = ''; - foreach ($arraytest as $key => $val) { - if ($key != $param) { - continue; - } - $tmpvar = $val['var']; - $val2 = ${$tmpvar}; + print ''; + $show = 0; $text = ''; + foreach ($arraytest as $key => $val) + { + if ($key != $param) continue; + $val2 = ${$val['var']}; @@ -122,9 +118,3 @@ - if ($show == 0) { - print $paramval; - } - if ($show == 1) { - print $form->textwithpicto($paramval, $text); - } - if ($show == 2) { - print $form->textwithpicto($paramval, $text, 1, 'warning'); - } + if ($show == 0) print $paramval; + if ($show == 1) print $form->textwithpicto($paramval, $text); + if ($show == 2) print $form->textwithpicto($paramval, $text, 1, 'warning'); --- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_dbtable.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_dbtable.php @@ -27 +26,0 @@ -// Load Dolibarr environment @@ -32 +31 @@ -if (!$user->admin) { +if (!$user->admin) @@ -34 +32,0 @@ -} @@ -50 +48,2 @@ -if (preg_match('/mysql/i', $conf->db->type)) { +if (preg_match('/mysql/i', $conf->db->type)) +{ @@ -53 +52,3 @@ -} elseif ($conf->db->type == 'pgsql') { +} +elseif ($conf->db->type == 'pgsql') +{ @@ -58 +59,2 @@ -if (!$base) { +if (!$base) +{ @@ -60 +62,3 @@ -} else { +} +else +{ @@ -62 +66,2 @@ - if ($resql) { + if ($resql) + { @@ -65 +70,2 @@ - while ($i < $num) { + while ($i < $num) + { @@ -71 +77,2 @@ - if ($base == 1) { // mysql + if ($base == 1) // mysql + { @@ -74,2 +81,4 @@ - if (!empty($cons)) { - foreach ($cons as $cc) { + if (!empty($cons)) + { + foreach ($cons as $cc) + { @@ -104 +113,2 @@ - if ($resql) { + if ($resql) + { @@ -107 +117,2 @@ - while ($i < $num) { + while ($i < $num) + { @@ -109,2 +119,0 @@ - //var_dump($row); - @@ -121 +130 @@ - print(isset($link[$row[0]][1]) ? $link[$row[0]][1] : '')."
    '.$langs->trans("Version").''.$langs->trans("Value").'
    '.$langs->trans("Version").''.$langs->trans("Value").'
    '.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')'.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').'
    '.$langs->trans("VersionLastInstall").''.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'
    '.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
    '.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
    '.$langs->trans("Session").''.$langs->trans("Value").'
    '.$langs->trans("SessionSavePath").''.session_save_path().'
    '.$langs->trans("SessionName").''.session_name().'
    '.$langs->trans("SessionId").''.session_id().'
    '.$langs->trans("CurrentSessionTimeOut").' (session.gc_maxlifetime)'; -print ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds"); +print '
    '.$langs->trans("Session").''.$langs->trans("Value").'
    '.$langs->trans("SessionSavePath").''.session_save_path().'
    '.$langs->trans("SessionName").''.session_name().'
    '.$langs->trans("SessionId").''.session_id().'
    '.$langs->trans("CurrentSessionTimeOut").' (session.gc_maxlifetime)'.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds"); +print ''; @@ -170,2 +150,2 @@ -print '
    '.$langs->trans("CurrentTheme").''.$conf->theme.'
    '.$langs->trans("CurrentMenuHandler").''; +print '
    '.$langs->trans("CurrentTheme").''.$conf->theme.'
    '.$langs->trans("CurrentMenuHandler").''; @@ -174 +154 @@ -print '
    '.$langs->trans("Screen").''; +print '
    '.$langs->trans("Screen").''; @@ -177 +157 @@ -print '
    '.$langs->trans("Session").''; +print '
    '.$langs->trans("Session").''; @@ -179,9 +159,5 @@ -foreach ($_SESSION as $key => $val) { - if ($i > 0) { - print ', '; - } - if (is_array($val)) { - print $key.' => array(...)'; - } else { - print $key.' => '.dol_escape_htmltag($val); - } +foreach ($_SESSION as $key => $val) +{ + if ($i > 0) print ', '; + if (is_array($val)) print $key.' => array(...)'; + else print $key.' => '.dol_escape_htmltag($val); @@ -197 +173,2 @@ -if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { +if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) +{ @@ -200 +177 @@ - print '
    '; + print '
    '; @@ -203 +180 @@ - print '
    '.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").''.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'
    '.$langs->trans("LocalisationDolibarrParameters").''.$langs->trans("Value").'
    '.$langs->trans("LocalisationDolibarrParameters").''.$langs->trans("Value").'
    '.$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 '
      => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now(), '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("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($daylight) ? '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("ClientHour").''.dol_print_date(dol_now('gmt'), 'dayhour', 'tzuser').'
      => '.$langs->trans("ClientHour").''.dol_print_date(dol_now(), 'dayhour', 'tzuser').'
    '.$langs->trans("Parameters").' '; +print ''.$langs->trans("Parameters").' '; @@ -385 +349,2 @@ -foreach ($configfileparameters as $key => $value) { +foreach ($configfileparameters as $key => $value) +{ @@ -388 +353,2 @@ - if (empty($ignore)) { + if (empty($ignore)) + { @@ -391,4 +357,4 @@ - if (preg_match('/^\?/', $key) && empty(${$newkey})) { - if ($newkey != 'multicompany_transverse_mode' || !isModEnabled('multicompany')) { - continue; // We discard parameters starting with ? - } + if (preg_match('/^\?/', $key) && empty(${$newkey})) + { + if ($newkey != 'multicompany_transverse_mode' || empty($conf->multicompany->enabled)) + continue; // We discard parameters starting with ? @@ -396,2 +362,6 @@ - if (strpos($newkey, 'separator') !== false && $lastkeyshown == 'separator') { - continue; + if (strpos($newkey, 'separator') !== false && $lastkeyshown == 'separator') continue; + + print '
     
     
      => '.$langs->trans("HashForPing").''.md5('dolibarr'.$valuetoshow).'
    '.$langs->trans("Entity").''.$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.''.$obj->name.''.dol_escape_htmltag($obj->value).''.$obj->entity.'
    '.$langs->trans("VersionLastInstall").''.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'
    '.$langs->trans("VersionLastUpgrade").''.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').'
    '.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
    '.$langs->trans("VersionLastUpgrade").''.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
    '; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $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 && getDolGlobalString($constname) != '') { - $value = getDolGlobalString($constname); - } - $valueforchecksum = (empty($value) ? '0' : $value); - - $checksumconcat[] = $valueforchecksum; - - $i++; - $out .= ''; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= "\n"; - } - - if ($i == 0) { - $out .= ''; - } - $out .= '
    #'.$langs->trans("Constant").''.$langs->trans("ExpectedValue").''.$langs->trans("Value").'
    '.$i.''.dol_escape_htmltag($constname).''.dol_escape_htmltag($constvalue).''.dol_escape_htmltag($valueforchecksum).'
    '.$langs->trans("None").'
    '; - $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']); - - // Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.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|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; - $regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|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 .= ''; + $out .= ''; + $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 .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= "\n"; + } + + if ($i == 0) + { + $out .= ''; + } + $out .= '
    #'.$langs->trans("Constant").''.$langs->trans("ExpectedValue").''.$langs->trans("Value").'
    '.$i.''.$constname.''.$constvalue.''.$valueforchecksum.'
    '.$langs->trans("None").'
    '; + $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")); @@ -269,35 +250,37 @@ - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $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 .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= "\n"; - } - } else { - $out .= ''; - } - $out .= '
    #'.$langs->trans("Filename").''.$langs->trans("ExpectedSize").''.$langs->trans("ExpectedChecksum").'
    '.$i.''.dol_escape_htmltag($file['filename']).''; - if (!empty($file['expectedsize'])) { - $out .= dol_print_size($file['expectedsize']); - } - $out .= ''.dol_escape_htmltag($file['expectedmd5']).'
    '.$langs->trans("None").'
    '; - $out .= ''; - - $out .= '
    '; - - // Files modified - $out .= load_fiche_titre($langs->trans("FilesModified")); - - $totalsize = 0; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $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 .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= "\n"; + } + } + else + { + $out .= ''; + } + $out .= '
    #'.$langs->trans("Filename").''.$langs->trans("ExpectedSize").''.$langs->trans("ExpectedChecksum").'
    '.$i.''.$file['filename'].''; + if (!empty($file['expectedsize'])) $out .= dol_print_size($file['expectedsize']); + $out .= ''.$file['expectedmd5'].'
    '.$langs->trans("None").'
    '; + $out .= ''; + + $out .= '
    '; + + // Files modified + $out .= load_fiche_titre($langs->trans("FilesModified")); + + $totalsize = 0; @@ -305,52 +288,54 @@ - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $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 .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); - $totalsize += $size; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= "\n"; - } - $out .= ''; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= "\n"; - } else { - $out .= ''; - } - $out .= '
    #'.$langs->trans("Filename").''.$langs->trans("ExpectedChecksum").''.$langs->trans("CurrentChecksum").''.$langs->trans("ExpectedSize").''.$langs->trans("CurrentSize").''.$langs->trans("DateModification").'
    '.$i.''.dol_escape_htmltag($file['filename']).''.dol_escape_htmltag($file['expectedmd5']).''.dol_escape_htmltag($file['md5']).''; - if ($file['expectedsize']) { - $out .= dol_print_size($file['expectedsize']); - } - $out .= ''.dol_print_size($size).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').'
    '.$langs->trans("Total").''.dol_print_size($totalsize).'
    '.$langs->trans("None").'
    '; - $out .= ''; - - $out .= '
    '; - - // Files added - $out .= load_fiche_titre($langs->trans("FilesAdded")); - - $totalsize = 0; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $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 .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); + $totalsize += $size; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= "\n"; + } + $out .= ''; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= "\n"; + } + else + { + $out .= ''; + } + $out .= '
    #'.$langs->trans("Filename").''.$langs->trans("ExpectedChecksum").''.$langs->trans("CurrentChecksum").''.$langs->trans("ExpectedSize").''.$langs->trans("CurrentSize").''.$langs->trans("DateModification").'
    '.$i.''.$file['filename'].''.$file['expectedmd5'].''.$file['md5'].''; + if ($file['expectedsize']) $out .= dol_print_size($file['expectedsize']); + $out .= ''.dol_print_size($size).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').'
    '.$langs->trans("Total").''.dol_print_size($totalsize).'
    '.$langs->trans("None").'
    '; + $out .= ''; + + $out .= '
    '; + + // Files added + $out .= load_fiche_titre($langs->trans("FilesAdded")); + + $totalsize = 0; @@ -358,109 +343,117 @@ - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $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 .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); - $totalsize += $size; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= "\n"; - } - $out .= ''; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; - $out .= "\n"; - } else { - $out .= ''; - } - $out .= '
    #'.$langs->trans("Filename").''.$langs->trans("ExpectedChecksum").''.$langs->trans("CurrentChecksum").''.$langs->trans("Size").''.$langs->trans("DateModification").'
    '.$i.''.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 .= ''.dol_escape_htmltag($file['expectedmd5']).''.dol_escape_htmltag($file['md5']).''.dol_print_size($size).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').'
    '.$langs->trans("Total").''.dol_print_size($totalsize).'
    '.$langs->trans("None").'
    '; - $out .= ''; - } else { - print '
    '; - print 'Error: Failed to found dolibarr_htdocs_dir into content of XML file:
    '.dol_escape_htmltag(dol_trunc($xmlfile, 500)); - print '

    '; - $error++; - } - - - // Scan scripts - /* - if (is_object($xml->dolibarr_script_dir[0])) - { - $file_list = array(); - $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list - }*/ - - - 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 (is_array($file_list['added']) && 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; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $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 .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); + $totalsize += $size; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= "\n"; + } + $out .= ''; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; + $out .= "\n"; + } + else + { + $out .= ''; + } + $out .= '
    #'.$langs->trans("Filename").''.$langs->trans("ExpectedChecksum").''.$langs->trans("CurrentChecksum").''.$langs->trans("Size").''.$langs->trans("DateModification").'
    '.$i.''.$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 .= ''.$file['expectedmd5'].''.$file['md5'].''.dol_print_size($size).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').'
    '.$langs->trans("Total").''.dol_print_size($totalsize).'
    '.$langs->trans("None").'
    '; + $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(); + $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list + }*/ + + + 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);*/ + + $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; --- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_index.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_index.php @@ -0,0 +1,118 @@ + + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2010 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/index.php + * \brief Home page of system information + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("admin", "user", "install")); + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +// None + + +/* + * View + */ + +llxHeader(); + +print load_fiche_titre($langs->trans("SummarySystem"), '', 'title_setup'); + + +print ''; +print "\n"; +$dolversion = version_dolibarr(); +print "\n"; +print '
    Dolibarr
    ".$langs->trans("Version")."".$dolversion."
    '; + +print "
    \n"; + +print ''; +print "\n"; +$osversion = version_os(); +print "\n"; +print '
    ".$langs->trans("OS")."
    ".$langs->trans("Version")."".$osversion."
    '; + +print "
    \n"; + +// Serveur web +print ''; +print "\n"; +$apacheversion = version_webserver(); +print "\n"; +print '
    ".$langs->trans("WebServer")."
    ".$langs->trans("Version")."".$apacheversion."
    '; + +print "
    \n"; + +// Php +print ''; +print "\n"; +$phpversion = version_php(); +print "\n"; +print "\n"; +print '
    ".$langs->trans("PHP")."
    ".$langs->trans("Version")."".$phpversion."
    ".$langs->trans("PhpWebLink")."".php_sapi_name()."
    '; + +print "
    \n"; + +// Database +print ''; +print "\n"; +$dblabel = $db::LABEL; +$dbversion = $db->getVersion(); +print "\n"; +print '
    ".$langs->trans("Database")."
    ".$langs->trans("Version")."".$dblabel." ".$dbversion."
    '; +// Add checks on database options +if ($db->type == 'pgsql') +{ + // 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"); + // } +} +print '
    '; + +// Browser +print ''; +print "\n"; +print "\n"; +print "\n"; +print '
    ".$langs->trans("Browser")."
    ".$langs->trans("UserAgent")."".$_SERVER["HTTP_USER_AGENT"]."
    ".$langs->trans("Smartphone")."".(($conf->browser->layout != 'phone') ? $langs->trans("No") : $langs->trans("Yes"))."
    '; +print '
    '; + + +//print "
    \n"; +print info_admin($langs->trans("SystemInfoDesc")).'
    '; + +// End of page +llxFooter(); +$db->close(); --- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_modules.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_modules.php @@ -25 +24,0 @@ -// Load Dolibarr environment @@ -28,4 +26,0 @@ - -if (empty($user->admin)) { - accessforbidden(); -} @@ -36,34 +31,2 @@ -$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', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); - -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'); -$param = ''; +if (!$user->admin) + accessforbidden(); @@ -73 +36 @@ - * Actions + * View @@ -76,5 +39 @@ -$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(); @@ -82,4 +41 @@ -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'); @@ -86,0 +43,2 @@ +print ''.$langs->trans("ToActivateModule").'
    '; +print "
    \n"; @@ -88,2 +45,0 @@ -// Load list of modules -$moduleList = array(); @@ -90,0 +47 @@ +$modules_names = array(); @@ -94,2 +50,0 @@ -$rights_ids = array(); -$arrayofpermissions = array(); @@ -97 +52,4 @@ -foreach ($modulesdir as $dir) { +// Load list of modules +$i = 0; +foreach ($modulesdir as $dir) +{ @@ -99,3 +57,6 @@ - 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') + { @@ -104 +65,2 @@ - if ($modName) { + if ($modName) + { @@ -106 +68,2 @@ - if (in_array($file, $modules_files)) { + if (in_array($file, $modules_files)) + { @@ -109 +72,3 @@ - } else { + } + else + { @@ -112 +77,2 @@ - if (class_exists($modName)) { + if (class_exists($modName)) + { @@ -116,0 +83 @@ + $modules_names[$objMod->numero] = $objMod->name; @@ -119 +86,4 @@ - } catch (Exception $e) { + $picto[$objMod->numero] = (isset($objMod->picto) && $objMod->picto) ? $objMod->picto : 'generic'; + } + catch (Exception $e) + { @@ -122 +92,3 @@ - } else { + } + else + { @@ -133,19 +105,22 @@ -// 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->getModulePosition(); - - $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"'); - } - } else { - $newModule->picto = img_object($alt, 'generic', 'width="14px"'); +print '
    '; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +$var = false; +$sortorder = $modules_names; +ksort($sortorder); +$rights_ids = array(); +foreach ($sortorder as $numero=>$name) +{ + $idperms = ""; + // Module + print '"; + // Version + print ''; + // Id + print ''; + // Permissions + if ($modules[$numero]->rights) + { + foreach ($modules[$numero]->rights as $rights) + { + $idperms .= ($idperms ? ", " : "").$rights[0]; @@ -166,30 +147,2 @@ - - $newModule->permission = $permission; - - // pre-filter list - if (!empty($search_name) && !stristr($newModule->name, $search_name)) { - continue; - } - if (!empty($search_version) && !stristr($newModule->version, $search_version)) { - continue; - } - if (!empty($search_id) && !stristr($newModule->id, $search_id)) { - continue; - } - - if (!empty($search_permission)) { - $found = false; - - foreach ($newModule->permission as $permission) { - if (stristr($permission, $search_permission)) { - $found = true; - break; - } - } - - if (!$found) { - continue; - } - } - - $moduleList[] = $newModule; + print ''; + print "\n"; @@ -197,193 +149,0 @@ - - - -/* - * View - */ - -llxHeader(); - -print ''; -if ($optioncss != '') { - print ''; -} -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -print_barre_liste($langs->trans("AvailableModules"), empty($page) ? 0 : $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', -1, '', 'title_setup', 0, '', '', 0, 1, 1); - -print ''.$langs->trans("ToActivateModule").''; -print '
    '; -print '
    '; - -$mode = ''; -$arrayofmassactions = array(); - -$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields -$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); - -$moreforfilter = ''; - -print '
    '; -print '
    '.$langs->trans("Modules").''.$langs->trans("Version").''.$langs->trans("IdModule").''.$langs->trans("IdPermissions").'
    '; + $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"'); @@ -153,10 +128,16 @@ - - $permission = array(); - if ($module->rights) { - foreach ($module->rights as $rights) { - if (empty($rights[0])) { - continue; - } - $arrayofpermissions[$rights[0]] = array('label'=> 'user->rights->'.$module->rights_class.'->'.$rights[4].(empty($rights[5]) ? '' : '->'.$rights[5])); - $permission[] = $rights[0]; - + else + { + print img_object($alt, $picto[$numero], 'width="14px"'); + } + print ' '.$modules[$numero]->getName(); + print "'.$modules[$numero]->getVersion().''.$numero.''.($idperms ? $idperms : " ").'
    '."\n"; - -// Lines with input filters -print ''; -// Action column -if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; -} -if ($arrayfields['name']['checked']) { - print ''; -} -if ($arrayfields['version']['checked']) { - print ''; -} -if ($arrayfields['id']['checked']) { - print ''; -} -if ($arrayfields['permission']['checked']) { - print ''; -} -if ($arrayfields['module_position']['checked']) { - print ''; -} -// Action column -if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; -} -print ''; - -print ''; -// Action column -if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn'); -} -if ($arrayfields['name']['checked']) { - print_liste_field_titre($arrayfields['name']['label'], $_SERVER["PHP_SELF"], "name", "", "", "", $sortfield, $sortorder); -} -if ($arrayfields['version']['checked']) { - print_liste_field_titre($arrayfields['version']['label'], $_SERVER["PHP_SELF"], "version", "", "", "", $sortfield, $sortorder); -} -if ($arrayfields['id']['checked']) { - print_liste_field_titre($arrayfields['id']['label'], $_SERVER["PHP_SELF"], "id", "", "", "", $sortfield, $sortorder, 'nowraponall '); -} -if ($arrayfields['permission']['checked']) { - print_liste_field_titre($arrayfields['permission']['label'], $_SERVER["PHP_SELF"], "permission", "", "", "", $sortfield, $sortorder); -} -if ($arrayfields['module_position']['checked']) { - print_liste_field_titre($arrayfields['module_position']['label'], $_SERVER["PHP_SELF"], "module_position", "", "", "", $sortfield, $sortorder); -} - -// Fields from hook -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; -// Action column -if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); -} -print ''; - -// sort list -if ($sortfield == "name" && $sortorder == "asc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($a->name, $b->name); - }); -} elseif ($sortfield == "name" && $sortorder == "desc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($b->name, $a->name); - }); -} elseif ($sortfield == "version" && $sortorder == "asc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($a->version, $b->version); - }); -} elseif ($sortfield == "version" && $sortorder == "desc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($b->version, $a->version); - }); -} elseif ($sortfield == "id" && $sortorder == "asc") { - usort($moduleList, "compareIdAsc"); -} elseif ($sortfield == "id" && $sortorder == "desc") { - usort($moduleList, "compareIdDesc"); -} elseif ($sortfield == "permission" && $sortorder == "asc") { - usort($moduleList, "comparePermissionIdsAsc"); -} elseif ($sortfield == "permission" && $sortorder == "desc") { - usort($moduleList, "comparePermissionIdsDesc"); -} else { - $moduleList = dol_sort_array($moduleList, 'module_position'); -} - -foreach ($moduleList as $module) { - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - - if ($arrayfields['name']['checked']) { - print '"; - } - - if ($arrayfields['version']['checked']) { - print ''; - } - - if ($arrayfields['id']['checked']) { - print ''; - } - - if ($arrayfields['permission']['checked']) { - $idperms = ''; - - foreach ($module->permission as $permission) { - $translationKey = "Permission".$permission; - $labelpermission = $langs->trans($translationKey); - $labelpermission .= ' : '.$arrayofpermissions[$permission]['label']; - $idperms .= ($idperms ? ", " : "").''.$permission.''; - - if (getDolGlobalString('MAIN_SHOW_PERMISSION')) { - if (empty($langs->tab_translate[$translationKey])) { - $tooltip = 'Missing translation (key '.$translationkey.' not found in admin.lang)'; - $idperms .= ' Warning'; - } - } - } - - print ''; - } - - if ($arrayfields['module_position']['checked']) { - print ''; - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - print ''; -} - @@ -392 +151,0 @@ -print ''; @@ -394 +152,0 @@ - @@ -397,6 +155,3 @@ - -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."
    "; @@ -409,87 +163,0 @@ - - - /** - * 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 ((int) $a->id == (int) $b->id) { - return 0; - } - - return ((int) $a->id < (int) $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 ((int) $a->id == (int) $b->id) { - return 0; - } - - return ((int) $b->id < (int) $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 $b->permission[0] < $a->permission[0] ? -1 : 1; -} --- /tmp/dsg/dolibarr/htdocs/admin/system/github_19.0.3_perf.php +++ /tmp/dsg/dolibarr/htdocs/admin/system/client_perf.php @@ -23 +22,0 @@ -// Load Dolibarr environment @@ -31,3 +30,3 @@ -$langs->loadLangs(array("install", "other", "admin", "products")); - -if (!$user->admin) { +$langs->loadLangs(array("install", "other", "admin")); + +if (!$user->admin) @@ -35,3 +34,3 @@ -} - -if (GETPOST('action', 'aZ09') == 'donothing') { + +if (GETPOST('action', 'aZ09') == 'donothing') +{ @@ -53,9 +52 @@ -print ''.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').''; -print '     '; -print ''; -print img_picto($langs->trans("Reload"), 'refresh').' '; -print $langs->trans("Reload"); -print ''; -print '
    '; -print '
    '; -print '
    '; +print $langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' ('.$langs->trans("Reload").')
    '; @@ -74,3 +65,3 @@ -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 +{ @@ -85,9 +76,5 @@ -$test = !isModEnabled('syslog'); -if ($test) { - print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' '.$langs->trans("NotSlowedDownByThis").''; -} else { - if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) { - print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog")); - } else { - print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL')); - } +$test = empty($conf->syslog->enabled); +if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); +else +{ + print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("Syslog")); @@ -101,4 +88,4 @@ -$test = !isModEnabled('debugbar'); -if ($test) { - print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' '.$langs->trans("NotSlowedDownByThis").''; -} else { +$test = empty($conf->debugbar->enabled); +if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); +else +{ @@ -106 +93 @@ - //print ' '.$langs->trans("MoreInformation").' XDebug admin page'; + //print ' '.$langs->trans("MoreInformation").' XDebug admin page'; @@ -113,4 +100,6 @@ -$test = isModEnabled('memcached'); -if ($test) { - if (getDolGlobalString('MEMCACHED_SERVER')) { - print $langs->trans("MemcachedAvailableAndSetup"); +$test = !empty($conf->memcached->enabled); +if ($test) +{ + if (!empty($conf->global->MEMCACHED_SERVER)) + { + print img_picto('', 'tick.png').' '.$langs->trans("MemcachedAvailableAndSetup"); @@ -118,2 +107,4 @@ - } else { - print $langs->trans("MemcachedModuleAvailableButNotSetup"); + } + else + { + print img_picto('', 'warning').' '.$langs->trans("MemcachedModuleAvailableButNotSetup"); @@ -122,3 +113,2 @@ -} else { - print $langs->trans("MemcachedNotAvailable"); -} +} +else print img_picto('', 'warning').' '.$langs->trans("MemcachedNotAvailable"); @@ -132 +122,2 @@ -if (!$foundcache && $test) { +if (!$foundcache && $test) +{ @@ -138 +129,2 @@ -if (!$foundcache && $test) { +if (!$foundcache && $test) +{ @@ -143 +135,2 @@ -if (!$foundcache && $test) { +if (!$foundcache && $test) +{ @@ -150 +143,2 @@ -if (!$foundcache && $test) { +if (!$foundcache && $test) +{ @@ -152 +146,2 @@ - if (ini_get('apc.enabled')) { + if (ini_get('apc.enabled')) + { @@ -155 +150,3 @@ - } else { + } + else + { @@ -159,3 +156 @@ -if (!$foundcache) { - print $langs->trans("NoOPCodeCacheFound"); -} +if (!$foundcache) print $langs->trans("NoOPCodeCacheFound"); @@ -165 +160,2 @@ -if (ini_get('opcache.preload')) { +if (ini_get('opcache.preload')) +{ @@ -169 +165,3 @@ -} else { +} +else +{ @@ -177 +175 @@ -print '
    '; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print '
    '; - print $module->picto; - print ' '.$module->name; - print "'.$module->version.''.$module->id.''.($idperms ? $idperms : " ").''.$module->module_position.'