diff --git a/lib/base.php b/lib/base.php index e9451c45b6..520c12d4df 100644 --- a/lib/base.php +++ b/lib/base.php @@ -125,7 +125,17 @@ if( OC_Config::getValue( "forcessl", false )){ } } -$error=(count(OC_Util::checkServer())>0); +$errors=OC_Util::checkServer(); +$error=(count($errors)>0); + +if($error) { + $tmpl = new OC_Template( '', 'error', 'guest' ); + $tmpl->assign('errors',$errors); + $tmpl->printPage(); + exit; +} + + // User and Groups if( !OC_Config::getValue( "installed", false )){ diff --git a/lib/util.php b/lib/util.php index d9c749521e..e07400fc1f 100644 --- a/lib/util.php +++ b/lib/util.php @@ -25,7 +25,13 @@ class OC_Util { // Create root dir if(!is_dir($CONFIG_DATADIRECTORY_ROOT)){ - @mkdir($CONFIG_DATADIRECTORY_ROOT) or die("Can't create data directory ($CONFIG_DATADIRECTORY_ROOT), you can usually fix this by setting the owner of '$SERVERROOT' to the user that the web server uses (www-data for debian/ubuntu)"); + $success=@mkdir($CONFIG_DATADIRECTORY_ROOT); + if(!$success) { + $tmpl = new OC_Template( '', 'error', 'guest' ); + $tmpl->assign('errors',array(1=>array('error'=>"Can't create data directory ($CONFIG_DATADIRECTORY_ROOT)",'hint'=>"You can usually fix this by setting the owner of '$SERVERROOT' to the user that the web server uses (www-data for debian/ubuntu)"))); + $tmpl->printPage(); + exit; + } } // If we are not forced to load a specific user we load the one that is logged in @@ -210,21 +216,21 @@ class OC_Util { //check for correct file permissions if(!stristr(PHP_OS, 'WIN')){ - $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); + $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); if(substr($prems,-1)!='0'){ OC_Helper::chmodr($CONFIG_DATADIRECTORY_ROOT,0770); clearstatcache(); - $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); + $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); if(substr($prems,2,1)!='0'){ $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web
','hint'=>$permissionsHint); } } if( OC_Config::getValue( "enablebackup", false )){ - $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); + $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3); if(substr($prems,-1)!='0'){ OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY,0770); clearstatcache(); - $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); + $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3); if(substr($prems,2,1)!='0'){ $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web
','hint'=>$permissionsHint); }