diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index c123263852d..acce17baf87 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -69,6 +69,7 @@ function GETPOST($paramname,$check='',$method=0) */ function dol_include_once($relpath) { + $res=false; $res=@include_once(DOL_DOCUMENT_ROOT.$relpath); if (! $res && defined('DOL_DOCUMENT_ROOT_ALT')) $res=@include_once(DOL_DOCUMENT_ROOT_ALT.$relpath); return $res; @@ -81,8 +82,13 @@ function dol_include_once($relpath) */ function dol_require_once($relpath) { - $res=@require_once(DOL_DOCUMENT_ROOT.$relpath); - if (! $res && defined('DOL_DOCUMENT_ROOT_ALT')) $res=@require_once(DOL_DOCUMENT_ROOT_ALT.$relpath); + $res=false; + + // Forced to use file_exists otherwise there is a blank page + //$res=@require_once(DOL_DOCUMENT_ROOT.$relpath); + //if (! $res && defined('DOL_DOCUMENT_ROOT_ALT')) $res=@require_once(DOL_DOCUMENT_ROOT_ALT.$relpath); + $res=@require_once(dol_file_exists($relpath)); + return $res; } @@ -93,14 +99,13 @@ function dol_require_once($relpath) */ function dol_file_exists($path,$absolute=0) { - $res=''; + $res=false; if ($absolute) { preg_match('/^([^<]+\.php)/i',$path,$regs); - $path = (! empty($regs[1]) ? $regs[1] : $path); $res=DOL_URL_ROOT.$path; - if (defined('DOL_URL_ROOT_ALT') && ! file_exists(DOL_DOCUMENT_ROOT.$path)) $url=DOL_URL_ROOT_ALT.$path; + if (defined('DOL_URL_ROOT_ALT') && ! file_exists(DOL_DOCUMENT_ROOT.$regs[1])) $res=DOL_URL_ROOT_ALT.$path; } else {