]> source.dussan.org Git - nextcloud-server.git/commitdiff
check if there is a default/ folder in the theme directory if no theme exists
authorBernhard Posselt <nukeawhale@gmail.com>
Wed, 24 Apr 2013 11:45:40 +0000 (13:45 +0200)
committerBernhard Posselt <nukeawhale@gmail.com>
Wed, 24 Apr 2013 14:12:10 +0000 (16:12 +0200)
lib/helper.php
lib/template.php
lib/templatelayout.php
lib/util.php

index 41985ca57a71478889bfaef774858578746b725d..195722057eb003b2184367775b75ab91c5fdf6d5 100644 (file)
@@ -159,7 +159,7 @@ class OC_Helper {
         */
        public static function imagePath( $app, $image ) {
                // Read the selected theme from the config file
-               $theme=OC_Config::getValue( "theme" );
+               $theme = OC_Util::getTheme();
 
                // Check if the app is in the app folder
                if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )) {
index 434c1e9e9901b7dc729773956e6f7bc7a7c8e46b..f007618ff19e9f1b694b583816b6446fb48d6516 100644 (file)
@@ -272,7 +272,7 @@ class OC_Template{
        protected function findTemplate($name)
        {
                // Read the selected theme from the config file
-               $theme=OC_Config::getValue( "theme" );
+               $theme = OC_Util::getTheme();
 
                // Read the detected formfactor and use the right file name.
                $fext = self::getFormFactorExtension();
index eef867c8b1cf9898acfac6d74760c199c1f63d90..981e67f628ea98cb1091b75209b49110deeefedf 100644 (file)
@@ -103,7 +103,7 @@ class OC_TemplateLayout extends OC_Template {
 
        static public function findStylesheetFiles($styles) {
                // Read the selected theme from the config file
-               $theme=OC_Config::getValue( 'theme' );
+               $theme = OC_Util::getTheme();
 
                // Read the detected formfactor and use the right file name.
                $fext = self::getFormFactorExtension();
@@ -161,7 +161,7 @@ class OC_TemplateLayout extends OC_Template {
 
        static public function findJavascriptFiles($scripts) {
                // Read the selected theme from the config file
-               $theme=OC_Config::getValue( 'theme' );
+               $theme = OC_Util::getTheme();
 
                // Read the detected formfactor and use the right file name.
                $fext = self::getFormFactorExtension();
index 3ad400df2735e1129b306c8bbbd18f10a50bd92a..258f40e6bca95cc81bcf85a530eee0ecfe9bbc1e 100755 (executable)
@@ -799,4 +799,25 @@ class OC_Util {
                return (substr(PHP_OS, 0, 3) === "WIN");
        }
 
+
+       /**
+        * Handles the case that there may not be a theme, then check if a "default"
+        * theme exists and take that one
+        * @return string the theme
+        */
+       public static function getTheme() {
+               $theme = OC_Config::getValue("theme");
+
+               if(is_null($theme)) {
+                       
+                       if(is_dir(__DIR__ . '/../themes/default')) {
+                               $theme = 'default';
+                       }
+
+               }
+
+               return $theme;
+       }
+
+
 }