From 1dc3cb67fa2420703c1e07125d01dddc4dce0356 Mon Sep 17 00:00:00 2001
From: Frank Karlitschek <karlitschek@kde.org>
Date: Sat, 6 Aug 2011 23:31:38 +0200
Subject: [PATCH] more improved error reporting

---
 core/templates/layout.guest.php |  4 ++--
 lib/base.php                    | 19 +++++++++++--------
 lib/helper.php                  |  2 +-
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php
index 5655a64d8d..0b6189ef1c 100644
--- a/core/templates/layout.guest.php
+++ b/core/templates/layout.guest.php
@@ -4,13 +4,13 @@
 		<title>ownCloud</title>
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 		<link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" />
-		<?php foreach($_['cssfiles'] as $cssfile): ?>
+		<?php if(isset($_['cssfiles'])) foreach($_['cssfiles'] as $cssfile): ?>
 			<link rel="stylesheet" href="<?php echo $cssfile; ?>" type="text/css" media="screen" />
 		<?php endforeach; ?>
 		<script type="text/javascript">
 			var oc_webroot = '<?php global $WEBROOT; echo $WEBROOT; ?>';
 		// </script>
-		<?php foreach($_['jsfiles'] as $jsfile): ?>
+		<?php if(isset($_['jsfiles'])) foreach($_['jsfiles'] as $jsfile): ?>
 			<script type="text/javascript" src="<?php echo $jsfile; ?>"></script>
 		<?php endforeach; ?>
 	
diff --git a/lib/base.php b/lib/base.php
index d02f63a276..270e8c20c7 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -128,14 +128,6 @@ if( OC_Config::getValue( "forcessl", false )){
 $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 )){
@@ -173,6 +165,17 @@ OC_HOOK::connect('OC_User', 'post_createUser', 'OC_Connector_Sabre_Principal', '
 OC_HOOK::connect('OC_User', 'post_deleteUser', 'OC_Connector_Sabre_Principal', 'deletePrincipal');
 
 
+
+if($error) {
+	$tmpl = new OC_Template( '', 'error', 'guest' );
+	$tmpl->assign('errors',$errors);
+	$tmpl->printPage();
+	exit;
+}
+
+
+
+
 // FROM Connect.php
 function OC_CONNECT_TEST($path,$user,$password){
 	echo 'connecting...';
diff --git a/lib/helper.php b/lib/helper.php
index 5dc3dd44a1..fa5163ac26 100755
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -204,7 +204,7 @@ class OC_Helper {
 			}
 		}
 		closedir($dh);
-		if(chmod($path, $filemode))
+		if(@chmod($path, $filemode))
 			return TRUE;
 		else
 			return FALSE;
-- 
GitLab