mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 02:58:23 +01:00
Fix: more compatible with alternative path
Fix: problem with dol_include_once and dol_require_once (blank page)
This commit is contained in:
@@ -69,6 +69,7 @@ function GETPOST($paramname,$check='',$method=0)
|
|||||||
*/
|
*/
|
||||||
function dol_include_once($relpath)
|
function dol_include_once($relpath)
|
||||||
{
|
{
|
||||||
|
$res=false;
|
||||||
$res=@include_once(DOL_DOCUMENT_ROOT.$relpath);
|
$res=@include_once(DOL_DOCUMENT_ROOT.$relpath);
|
||||||
if (! $res && defined('DOL_DOCUMENT_ROOT_ALT')) $res=@include_once(DOL_DOCUMENT_ROOT_ALT.$relpath);
|
if (! $res && defined('DOL_DOCUMENT_ROOT_ALT')) $res=@include_once(DOL_DOCUMENT_ROOT_ALT.$relpath);
|
||||||
return $res;
|
return $res;
|
||||||
@@ -81,8 +82,13 @@ function dol_include_once($relpath)
|
|||||||
*/
|
*/
|
||||||
function dol_require_once($relpath)
|
function dol_require_once($relpath)
|
||||||
{
|
{
|
||||||
$res=@require_once(DOL_DOCUMENT_ROOT.$relpath);
|
$res=false;
|
||||||
if (! $res && defined('DOL_DOCUMENT_ROOT_ALT')) $res=@require_once(DOL_DOCUMENT_ROOT_ALT.$relpath);
|
|
||||||
|
// 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;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,14 +99,13 @@ function dol_require_once($relpath)
|
|||||||
*/
|
*/
|
||||||
function dol_file_exists($path,$absolute=0)
|
function dol_file_exists($path,$absolute=0)
|
||||||
{
|
{
|
||||||
$res='';
|
$res=false;
|
||||||
|
|
||||||
if ($absolute)
|
if ($absolute)
|
||||||
{
|
{
|
||||||
preg_match('/^([^<]+\.php)/i',$path,$regs);
|
preg_match('/^([^<]+\.php)/i',$path,$regs);
|
||||||
$path = (! empty($regs[1]) ? $regs[1] : $path);
|
|
||||||
$res=DOL_URL_ROOT.$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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user