From 5e9d268c21ab96e382a9634dcb1e66cb5b6637ff Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Tue, 28 Feb 2012 16:14:12 +0100 Subject: [PATCH] never try to load an non existing template,css,img. do propper checking, error reporting and motivate the developerto fix it ;-) --- lib/helper.php | 5 ++++- lib/template.php | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/helper.php b/lib/helper.php index fc0b886770..5b1efd749a 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -98,8 +98,11 @@ class OC_Helper { return OC::$WEBROOT."/$app/img/$image"; }elseif( file_exists( OC::$SERVERROOT."/themes/$theme/core/img/$image" )){ return OC::$WEBROOT."/themes/$theme/core/img/$image"; - }else{ + }elseif( file_exists( OC::$SERVERROOT."/core/img/$image" )){ return OC::$WEBROOT."/core/img/$image"; + }else{ + echo('image not found: image:'.$image.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); + die(); } } diff --git a/lib/template.php b/lib/template.php index b79faa9e75..eea2925975 100644 --- a/lib/template.php +++ b/lib/template.php @@ -197,9 +197,12 @@ class OC_Template{ }elseif( file_exists( OC::$SERVERROOT."/$app/templates/"."$name$fext.php" )){ $template = OC::$SERVERROOT."/$app/templates/"."$name$fext.php"; $path = OC::$SERVERROOT."/$app/templates/"; - }else{ + }elseif( file_exists( OC::$SERVERROOT."/$app/templates/"."$name.php" )){ $template = OC::$SERVERROOT."/$app/templates/"."$name.php"; $path = OC::$SERVERROOT."/$app/templates/"; + }else{ + echo('template not found: template:'.$name.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); + die(); } } @@ -383,9 +386,13 @@ class OC_Template{ // Is it in core? }elseif(is_file(OC::$SERVERROOT."/core/$script$fext.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/core/$script$fext.js" ); - }else{ + }elseif(is_file(OC::$SERVERROOT."/core/$script.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/core/$script.js" ); + }else{ + echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); + die(); + } } // Add the css files @@ -406,8 +413,12 @@ class OC_Template{ // or in core ? }elseif(is_file(OC::$SERVERROOT."/core/$style$fext.css" )){ $page->append( "cssfiles", OC::$WEBROOT."/core/$style$fext.css" ); - }else{ + }elseif(is_file(OC::$SERVERROOT."/core/$style.css" )){ $page->append( "cssfiles", OC::$WEBROOT."/core/$style.css" ); + + }else{ + echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); + die(); } } // Add the theme css files. you can override the default values here