Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
56dfcce9
Commit
56dfcce9
authored
14 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
improved detection of WEBROOT
parent
e4a5ef55
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inc/lib_base.php
+21
-2
21 additions, 2 deletions
inc/lib_base.php
with
21 additions
and
2 deletions
inc/lib_base.php
+
21
−
2
View file @
56dfcce9
...
...
@@ -35,8 +35,27 @@ session_start();
$SERVERROOT
=
substr
(
__FILE__
,
0
,
-
17
);
$DOCUMENTROOT
=
$_SERVER
[
'DOCUMENT_ROOT'
];
$SERVERROOT
=
str_replace
(
"
\\
"
,
'/'
,
$SERVERROOT
);
$count
=
strlen
(
$DOCUMENTROOT
);
$WEBROOT
=
substr
(
$SERVERROOT
,
$count
);
if
(
strpos
(
$SERVERROOT
,
$DOCUMENTROOT
)
===
0
){
//if the serverroot is a subdir of the documentroot we can use this
$count
=
strlen
(
$DOCUMENTROOT
);
$WEBROOT
=
substr
(
$SERVERROOT
,
$count
);
}
else
{
//try some common patterns
$WEBROOT
=
''
;
if
(
strpos
(
$_SERVER
[
'REQUEST_URI'
],
'/~'
)
!==
false
){
//owncloud is probable installed in a users home folder, extract the username from the uri and use it as base for the webroot
$part
=
substr
(
$_SERVER
[
'REQUEST_URI'
],
strpos
(
$_SERVER
[
'REQUEST_URI'
],
'/~'
)
+
1
);
$part
=
substr
(
$part
,
0
,
strpos
(
$part
,
'/'
));
$WEBROOT
.
=
'/'
.
$part
;
}
if
(
strpos
(
$SERVERROOT
,
'public_html'
)
!==
false
){
//a common used folder name for websevers to store their sites
if
(
$WEBROOT
{
strlen
(
$WEBROOT
)
-
1
}
!==
'/'
){
$WEBROOT
.
=
'/'
;
}
$WEBROOT
.
=
substr
(
$SERVERROOT
,
strpos
(
$SERVERROOT
,
'public_html'
)
+
strlen
(
'public_html'
));
}
}
if
(
$WEBROOT
{
0
}
!==
'/'
and
$WEBROOT
!=
''
){
$WEBROOT
=
'/'
.
$WEBROOT
;
}
...
...
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