From d9acf328610e8023b516fa25317b3b1076c58017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 17 Sep 2015 19:26:52 +0200 Subject: [PATCH] Fix Do not always append htdocs to include path Serving the htdocs directly is a best practice. The old code generates a bogus include path in that case. This code mitigates the issue by setting an include path only when needed. --- htdocs/main.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7c682756edd..62f0271ebd0 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -164,7 +164,10 @@ if (! defined('NOSCANPOSTFORINJECTION')) } // This is to make Dolibarr working with Plesk -if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) !== 'htdocs') { + set_include_path($_SERVER['DOCUMENT_ROOT'] . '/htdocs'); + } +} // Include the conf.php and functions.lib.php require_once 'filefunc.inc.php';