diff --git a/lib/helper.php b/lib/helper.php
index 525a096947d0f5eb9581a2dfba323084e9bf7b1a..1ea0a55f469dc7d1c7a2dda91c290e0ff46f1095 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -83,24 +83,24 @@ class OC_Helper {
 	 * Returns the path to the image.
 	 */
         public static function imagePath( $app, $image ){
-                // Read the selected theme from the config file
-                $theme=OC_Config::getValue( "theme" );
+		// Read the selected theme from the config file
+		$theme=OC_Config::getValue( "theme" );
 
-                // Check if the app is in the app folder
-                if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )){
-                        return OC::$WEBROOT."/themes/$theme/apps/$app/img/$image";
-                }elseif( file_exists( OC::$APPSROOT."/apps/$app/img/$image" )){
-                        return OC::$APPSWEBROOT."/apps/$app/img/$image";
-                }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/themes/$theme/$app/img/$image" )){
-                        return OC::$WEBROOT."/themes/$theme/$app/img/$image";
-                }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/$app/img/$image" )){
-                        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{
-                        return OC::$WEBROOT."/core/img/$image";
-                }
-        }
+		// Check if the app is in the app folder
+		if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )){
+			return OC::$WEBROOT."/themes/$theme/apps/$app/img/$image";
+		}elseif( file_exists( OC::$APPSROOT."/apps/$app/img/$image" )){
+			return OC::$APPSWEBROOT."/apps/$app/img/$image";
+		}elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/themes/$theme/$app/img/$image" )){
+			return OC::$WEBROOT."/themes/$theme/$app/img/$image";
+		}elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/$app/img/$image" )){
+			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{
+			return OC::$WEBROOT."/core/img/$image";
+		}
+	}
 
 	/**
 	 * @brief get path to icon of file type
diff --git a/lib/template.php b/lib/template.php
index 148e400d4e821bdeb86ec5c43a3c0b3360d5bc26..b79faa9e755c6a6e6a48710df70d9df0d56c2e0f 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -170,39 +170,39 @@ class OC_Template{
 
 		// Check if it is a app template or not.
 		if( $app != "" ){
-	                        // Check if the app is in the app folder or in the root
-                        if( file_exists( OC::$APPSROOT."/apps/$app/templates/" )){
-                                // Check if the template is overwritten by the selected theme
-                                if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/templates/"."$name$fext.php" )){
-                                        $template = OC::$SERVERROOT."/themes/$theme/apps/$app/templates/"."$name$fext.php";
-                                        $path = OC::$SERVERROOT."/themes/$theme/apps/$app/templates/";
-                                }elseif( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/templates/"."$name.php" )){
-                                        $template = OC::$SERVERROOT."/themes/$theme/apps/$app/templates/"."$name.php";
-                                        $path = OC::$SERVERROOT."/themes/$theme/apps/$app/templates/";
-                                }elseif( OC::$APPSROOT."/apps/$app/templates/"."$name$fext.php" ){
-                                        $template = OC::$APPSROOT."/apps/$app/templates/"."$name$fext.php";
-                                        $path = OC::$APPSROOT."/apps/$app/templates/";
-                                }else{
-                                        $template = OC::$APPSROOT."/apps/$app/templates/"."$name.php";
-                                        $path = OC::$APPSROOT."/apps/$app/templates/";
-                                }
-                        }else{
-                                // Check if the template is overwritten by the selected theme
-                                if( file_exists( OC::$SERVERROOT."/themes/$theme/$app/templates/"."$name$fext.php" )){
-                                        $template = OC::$SERVERROOT."/themes/$theme/$app/templates/"."$name$fext.php";
-                                        $path = OC::$SERVERROOT."/themes/$theme/$app/templates/";
-                                }elseif( file_exists( OC::$SERVERROOT."/themes/$theme/$app/templates/"."$name.php" )){
-                                        $template = OC::$SERVERROOT."/themes/$theme/$app/templates/"."$name.php";
-                                        $path = OC::$SERVERROOT."/themes/$theme/$app/templates/";
-                                }elseif( file_exists( OC::$SERVERROOT."/$app/templates/"."$name$fext.php" )){
-                                        $template = OC::$SERVERROOT."/$app/templates/"."$name$fext.php";
-                                        $path = OC::$SERVERROOT."/$app/templates/";
-                                }else{
-                                        $template = OC::$SERVERROOT."/$app/templates/"."$name.php";
-                                        $path = OC::$SERVERROOT."/$app/templates/";
-                                }
-
-                        }	
+			// Check if the app is in the app folder or in the root
+			if( file_exists( OC::$APPSROOT."/apps/$app/templates/" )){
+				// Check if the template is overwritten by the selected theme
+				if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/templates/"."$name$fext.php" )){
+					$template = OC::$SERVERROOT."/themes/$theme/apps/$app/templates/"."$name$fext.php";
+					$path = OC::$SERVERROOT."/themes/$theme/apps/$app/templates/";
+				}elseif( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/templates/"."$name.php" )){
+					$template = OC::$SERVERROOT."/themes/$theme/apps/$app/templates/"."$name.php";
+					$path = OC::$SERVERROOT."/themes/$theme/apps/$app/templates/";
+				}elseif( OC::$APPSROOT."/apps/$app/templates/"."$name$fext.php" ){
+					$template = OC::$APPSROOT."/apps/$app/templates/"."$name$fext.php";
+					$path = OC::$APPSROOT."/apps/$app/templates/";
+				}else{
+					$template = OC::$APPSROOT."/apps/$app/templates/"."$name.php";
+					$path = OC::$APPSROOT."/apps/$app/templates/";
+				}
+			}else{
+				// Check if the template is overwritten by the selected theme
+				if( file_exists( OC::$SERVERROOT."/themes/$theme/$app/templates/"."$name$fext.php" )){
+					$template = OC::$SERVERROOT."/themes/$theme/$app/templates/"."$name$fext.php";
+					$path = OC::$SERVERROOT."/themes/$theme/$app/templates/";
+				}elseif( file_exists( OC::$SERVERROOT."/themes/$theme/$app/templates/"."$name.php" )){
+					$template = OC::$SERVERROOT."/themes/$theme/$app/templates/"."$name.php";
+					$path = OC::$SERVERROOT."/themes/$theme/$app/templates/";
+				}elseif( file_exists( OC::$SERVERROOT."/$app/templates/"."$name$fext.php" )){
+					$template = OC::$SERVERROOT."/$app/templates/"."$name$fext.php";
+					$path = OC::$SERVERROOT."/$app/templates/";
+				}else{
+					$template = OC::$SERVERROOT."/$app/templates/"."$name.php";
+					$path = OC::$SERVERROOT."/$app/templates/";
+				}
+
+			}	
 		}else{
 			// Check if the template is overwritten by the selected theme
 			if( file_exists( OC::$SERVERROOT."/themes/$theme/core/templates/"."$name$fext.php" )){