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
1495ec0f
Commit
1495ec0f
authored
13 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
show server configuration errors on seperate page
parent
b5f913a3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
index.php
+7
-3
7 additions, 3 deletions
index.php
lib/base.php
+23
-13
23 additions, 13 deletions
lib/base.php
templates/error.php
+15
-0
15 additions, 0 deletions
templates/error.php
with
45 additions
and
16 deletions
index.php
+
7
−
3
View file @
1495ec0f
...
...
@@ -24,7 +24,12 @@
require_once
(
'lib/base.php'
);
require_once
(
'appconfig.php'
);
require_once
(
'template.php'
);
if
(
OC_USER
::
isLoggedIn
()){
// check if the server is correctly configured for ownCloud
$errors
=
OC_UTIL
::
checkServer
();
if
(
count
(
$errors
)
>
0
){
OC_TEMPLATE
::
printGuestPage
(
""
,
"error"
,
array
(
"errors"
=>
$errors
));
}
elseif
(
OC_USER
::
isLoggedIn
()){
if
(
$_GET
[
"logout"
]
){
OC_USER
::
logout
();
header
(
"Location:
$WEBROOT
"
);
...
...
@@ -34,8 +39,7 @@ if( OC_USER::isLoggedIn()){
header
(
"Location: "
.
OC_APPCONFIG
::
getValue
(
"core"
,
"defaultpage"
,
"files/index.php"
));
exit
();
}
}
else
{
}
else
{
if
(
OC_USER
::
login
(
$_POST
[
"user"
],
$_POST
[
"password"
]
)){
header
(
"Location: "
.
OC_APPCONFIG
::
getValue
(
"core"
,
"defaultpage"
,
"files/index.php"
));
exit
();
...
...
This diff is collapsed.
Click to expand it.
lib/base.php
+
23
−
13
View file @
1495ec0f
...
...
@@ -89,13 +89,17 @@ require_once('connect.php');
require_once
(
'remotestorage.php'
);
require_once
(
'plugin.php'
);
OC_PLUGIN
::
loadPlugins
(
""
);
$error
=
(
count
(
OC_UTIL
::
checkServer
())
>
0
);
if
(
!
$error
){
OC_PLUGIN
::
loadPlugins
(
""
);
}
OC_USER
::
setBackend
(
OC_CONFIG
::
getValue
(
"userbackend"
,
"database"
));
OC_GROUP
::
setBackend
(
OC_CONFIG
::
getValue
(
"groupbackend"
,
"database"
));
// Set up file system unless forbidden
if
(
!
$RUNTIME_NOSETUPFS
){
if
(
!
$error
and
!
$RUNTIME_NOSETUPFS
){
OC_UTIL
::
setupFS
();
}
...
...
@@ -108,12 +112,10 @@ OC_UTIL::addStyle( "jquery-ui-1.8.10.custom" );
OC_UTIL
::
addStyle
(
"styles"
);
// Load Apps
if
(
!
$RUNTIME_NOAPPS
){
if
(
!
$error
and
!
$RUNTIME_NOAPPS
){
OC_APP
::
loadApps
();
}
// check if the server is correctly configured for ownCloud
OC_UTIL
::
checkserver
();
/**
* Class for utility functions
*
...
...
@@ -221,7 +223,7 @@ class OC_UTIL {
/**
* check if the current server configuration is suitable for ownCloud
*
*
@return array with error messages
*/
public
static
function
checkServer
(){
global
$SERVERROOT
;
...
...
@@ -230,12 +232,16 @@ class OC_UTIL {
$CONFIG_DATADIRECTORY_ROOT
=
OC_CONFIG
::
getValue
(
"datadirectory"
,
"
$SERVERROOT
/data"
);;
$CONFIG_BACKUPDIRECTORY
=
OC_CONFIG
::
getValue
(
"backupdirectory"
,
"
$SERVERROOT
/backup"
);
$CONFIG_INSTALLED
=
OC_CONFIG
::
getValue
(
"installed"
,
false
);
$error
=
''
;
$errors
=
array
();
//check for database drivers
if
(
!
is_callable
(
'sqlite_open'
)
and
!
is_callable
(
'mysql_connect'
)){
$error
.
=
'No database drivers (sqlite or mysql) installed.<br/>'
;
$error
s
[]
=
'No database drivers (sqlite or mysql) installed.<br/>'
;
}
$CONFIG_DBTYPE
=
OC_CONFIG
::
getValue
(
"dbtype"
,
"sqlite"
);
$CONFIG_DBNAME
=
OC_CONFIG
::
getValue
(
"dbname"
,
"owncloud"
);
//check for correct file permissions
if
(
!
stristr
(
PHP_OS
,
'WIN'
)){
if
(
$CONFIG_DBTYPE
==
'sqlite'
){
$file
=
$SERVERROOT
.
'/'
.
$CONFIG_DBNAME
;
...
...
@@ -246,7 +252,7 @@ class OC_UTIL {
clearstatcache
();
$prems
=
substr
(
decoct
(
fileperms
(
$file
)),
-
3
);
if
(
substr
(
$prems
,
2
,
1
)
!=
'0'
){
$error
.
=
'SQLite database file ('
.
$file
.
') is readable from the web<br/>'
;
$error
s
[]
=
'SQLite database file ('
.
$file
.
') is readable from the web<br/>'
;
}
}
}
...
...
@@ -257,7 +263,7 @@ class OC_UTIL {
clearstatcache
();
$prems
=
substr
(
decoct
(
fileperms
(
$CONFIG_DATADIRECTORY_ROOT
)),
-
3
);
if
(
substr
(
$prems
,
2
,
1
)
!=
'0'
){
$error
.
=
'Data directory ('
.
$CONFIG_DATADIRECTORY_ROOT
.
') is readable from the web<br/>'
;
$error
s
[]
=
'Data directory ('
.
$CONFIG_DATADIRECTORY_ROOT
.
') is readable from the web<br/>'
;
}
}
if
(
OC_CONFIG
::
getValue
(
"enablebackup"
,
false
)){
...
...
@@ -267,16 +273,20 @@ class OC_UTIL {
clearstatcache
();
$prems
=
substr
(
decoct
(
fileperms
(
$CONFIG_BACKUPDIRECTORY
)),
-
3
);
if
(
substr
(
$prems
,
2
,
1
)
!=
'0'
){
$error
.
=
'Data directory ('
.
$CONFIG_BACKUPDIRECTORY
.
') is readable from the web<br/>'
;
$error
s
[]
=
'Data directory ('
.
$CONFIG_BACKUPDIRECTORY
.
') is readable from the web<br/>'
;
}
}
}
}
else
{
//TODO: premisions checks for windows hosts
}
if
(
$error
){
die
(
$error
)
;
if
(
!
is_writable
(
$CONFIG_DATADIRECTORY_ROOT
)
){
$errors
[]
=
'Data directory ('
.
$CONFIG_BACKUPDIRECTORY
.
') not writable by ownCloud<br/>'
;
}
//TODO: check for php modules
return
$errors
;
}
}
...
...
This diff is collapsed.
Click to expand it.
templates/error.php
0 → 100644
+
15
−
0
View file @
1495ec0f
<?php
/*
* Template for error page
*/
?>
<div
id=
"login"
>
<img
src=
"
<?php
echo
image_path
(
""
,
"owncloud-logo-medium-white.png"
);
?>
"
alt=
"ownCloud"
/>
<br/><br/><br/><br/>
<ul>
<?php
foreach
(
$_
[
"errors"
]
as
$error
)
:
?>
<li>
<?php
echo
$error
?>
</li>
<?php
endforeach
?>
</ul>
</div>
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