From fc7f279d90d26c5bac92d32919d2fb75e614c0a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 12 Feb 2015 11:20:38 +0100 Subject: [PATCH] catch any whitespaces which might get written to the output buffer while loading a theme --- lib/private/defaults.php | 15 +++++++++------ lib/private/util.php | 9 ++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/private/defaults.php b/lib/private/defaults.php index c16ebdbe24..dfcd97aedd 100644 --- a/lib/private/defaults.php +++ b/lib/private/defaults.php @@ -1,9 +1,5 @@ defaultLogoClaim = ''; $this->defaultMailHeaderColor = '#1d2d44'; /* header color of mail notifications */ - if (class_exists('OC_Theme')) { - $this->theme = new OC_Theme(); + $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php'; + if (file_exists($themePath)) { + // prevent defaults.php from printing output + ob_start(); + require_once $themePath; + ob_end_clean(); + if (class_exists('OC_Theme')) { + $this->theme = new OC_Theme(); + } } } diff --git a/lib/private/util.php b/lib/private/util.php index d6c76e0960..2be7e8eb29 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -504,11 +504,6 @@ class OC_Util { $webServerRestart = true; } - //common hint for all file permissions error messages - $permissionsHint = $l->t('Permissions can usually be fixed by ' - . '%sgiving the webserver write access to the root directory%s.', - array('', '')); - // Check if config folder is writable. if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { $errors[] = array( @@ -549,6 +544,10 @@ class OC_Util { ); } } else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { + //common hint for all file permissions error messages + $permissionsHint = $l->t('Permissions can usually be fixed by ' + . '%sgiving the webserver write access to the root directory%s.', + array('', '')); $errors[] = array( 'error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud', 'hint' => $permissionsHint