diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2b35cc38c4c..16491ce4f88 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2101,8 +2101,6 @@ class ActionComm extends CommonObject dol_syslog(get_class($this)."::build_exportfile select events", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - // Note: Output of sql request is encoded in $conf->file->character_set_client - // This assignment in condition is not a bug. It allows walking the results. $diff = 0; while ($obj = $this->db->fetch_object($resql)) { $qualified = true; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 71c8b33c5a3..7a0070cbb0d 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -41,7 +41,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; header('Cache-Control: Public, must-revalidate'); -header("Content-type: text/html; charset=".$conf->file->character_set_client); if (GETPOST('dol_hide_topmenu')) { $conf->dol_hide_topmenu = 1; diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index f43a2c63d9e..6a54ee53e79 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -36,7 +36,6 @@ if ($size > 10000) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; header('Cache-Control: Public, must-revalidate'); -header("Content-type: text/html; charset=".$conf->file->character_set_client); if (GETPOST('dol_hide_topmenu')) { $conf->dol_hide_topmenu = 1; diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php index 3b1bed10338..96cde6cf032 100644 --- a/htdocs/core/tpl/passwordreset.tpl.php +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -38,7 +38,6 @@ if ($size > 10000) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; header('Cache-Control: Public, must-revalidate'); -header("Content-type: text/html; charset=".$conf->file->character_set_client); if (GETPOST('dol_hide_topmenu')) { $conf->dol_hide_topmenu = 1; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 1133f10182e..1f17374728b 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -41,8 +41,8 @@ if (!defined('DOL_DOCUMENT_ROOT')) { define('DOL_DOCUMENT_ROOT', '..'); } -require_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/conf.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -338,10 +338,6 @@ if ($islocked) { // Pages are locked // Force usage of log file for install and upgrades -if (!isset($conf->syslog) || !is_object($conf->syslog)) { - $conf->syslog = new stdClass(); -} -$conf->syslog->enabled = 1; $conf->modules['syslog'] = 'syslog'; $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); if (!defined('SYSLOG_HANDLERS')) { @@ -451,10 +447,6 @@ function conf($dolibarr_main_document_root) $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; // Force usage of log file for install and upgrades - if (!isset($conf->syslog) || !is_object($conf->syslog)) { - $conf->syslog = new stdClass(); - } - $conf->syslog->enabled = 1; $conf->modules['syslog'] = 'syslog'; $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); if (!defined('SYSLOG_HANDLERS')) { diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php index 567a4b91669..0133493dcef 100644 --- a/htdocs/paybox/lib/paybox.lib.php +++ b/htdocs/paybox/lib/paybox.lib.php @@ -176,12 +176,10 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) dol_syslog("PBX_HASH: $PBX_HASH", LOG_DEBUG); dol_syslog("PBX_TIME: $PBX_TIME", LOG_DEBUG); - header("Content-type: text/html; charset=".$conf->file->character_set_client); - header("X-Content-Type-Options: nosniff"); + top_httphead(); print ''."\n"; print ''."\n"; - print "\n"; print ''."\n"; print ''."\n"; print "\n"; diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index 1c8c4c5d7f8..257cda97af8 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -29,19 +29,13 @@ if (!defined('DOL_DOCUMENT_ROOT')) { define('DOL_DOCUMENT_ROOT', '..'); } +require_once DOL_DOCUMENT_ROOT.'/core/class/conf.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -// Avoid warnings with strict mode E_STRICT -$conf = new stdClass(); // instantiate $conf explicitely -$conf->global = new stdClass(); -$conf->file = new stdClass(); -$conf->db = new stdClass(); -if (!isset($conf->syslog) || !is_object($conf->syslog)) { - $conf->syslog = new stdClass(); -} +$conf = new Conf(); // Force $_REQUEST["logtohtml"] $_REQUEST["logtohtml"] = 1; @@ -61,11 +55,12 @@ $conffiletoshowshort = "conf.php"; $conffile = "../conf/conf.php"; $conffiletoshow = "htdocs/conf/conf.php"; // For debian/redhat like systems +/* if (!file_exists($conffile)) { $conffile = "/etc/dolibarr/conf.php"; $conffiletoshow = "/etc/dolibarr/conf.php"; } - +*/ // Load conf file if it is already defined if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) { // Test on filesize is to ensure that conf file is more that an empty template with just // Create conf object if (!empty($dolibarr_main_document_root)) { - $result = conf($dolibarr_main_document_root); + $result = loadconf($dolibarr_main_document_root); } // Load database driver if ($result) { @@ -189,7 +184,7 @@ $bc[true] = ' class="bg2"'; * @param string $dolibarr_main_document_root Root directory of Dolibarr bin files * @return int <0 if KO, >0 if OK */ -function conf($dolibarr_main_document_root) +function loadconf($dolibarr_main_document_root) { global $conf; global $dolibarr_main_db_type; @@ -200,7 +195,10 @@ function conf($dolibarr_main_document_root) global $dolibarr_main_db_pass; global $character_set_client; - $return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; + $return = 1; + if (!class_exists('Conf')) { + $return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; + } if (!$return) { return -1; } diff --git a/htdocs/support/index.php b/htdocs/support/index.php index e61fef41f23..7956389ef6a 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -29,6 +29,7 @@ // This is a standalone feature with no information from Dolibarr to show // and no database access to do. include_once 'inc.php'; + $uri = preg_replace('/^http(s?):\/\//i', '', $dolibarr_main_url_root); $pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine if ($pos == '/') { @@ -38,7 +39,7 @@ if (!defined('DOL_URL_ROOT')) { define('DOL_URL_ROOT', $pos); // URL racine relative } -$langs->loadLangs(array("other", $langs->load("help"))); +$langs->loadLangs(array("other", "help")); /* @@ -65,7 +66,10 @@ if (GETPOST('dol_no_mouse_hover')) { if (GETPOST('dol_use_jmobile')) { $homeurl .= (strpos($homeurl, '?') === false ? '?' : '&').'dol_use_jmobile=1'; } -print $langs->trans("ToGoBackToDolibarr", $homeurl); +// If a global var $dolibarr_main_url_root exists, install is done and complete, we can show the link to home page +if (!empty($dolibarr_main_url_root)) { + print $langs->trans("ToGoBackToDolibarr", $homeurl); +} print '

'; diff --git a/qodana.yaml b/qodana.yaml index ae284e98c34..a10e0ad5f2d 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -15,7 +15,7 @@ exclude: - htdocs/custom - htdocs/includes - htdocs/install/doctemplates - - htdocs/modulebuilder/template/test/functionnal + - htdocs/modulebuilder/template/test/phpunit/functionnal - name: PhpIssetCanBeReplacedWithCoalesceInspection - name: PhpRedundantOptionalArgumentInspection - name: PhpLanguageLevelInspection