Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
a9436e52
Commit
a9436e52
authored
Dec 19, 2010
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Fix: more compatible with alternative path
Fix: problem with dol_include_once and dol_require_once (blank page)
parent
81342b12
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/lib/functions.lib.php
+10
-5
10 additions, 5 deletions
htdocs/lib/functions.lib.php
with
10 additions
and
5 deletions
htdocs/lib/functions.lib.php
+
10
−
5
View file @
a9436e52
...
@@ -69,6 +69,7 @@ function GETPOST($paramname,$check='',$method=0)
...
@@ -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)
...
@@ -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)
...
@@ -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
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment