]> 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 11:45:40 +0000 (13:45 +0200)
lib/helper.php
lib/template.php
lib/templatelayout.php
lib/util.php

index 73484ad913f2ba4addfce838a99cac0da1449eb6..2ba70294f4b28e452817e2018d49f1fb026594b6 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 69bebac050397c66d0e7c33ddcb7d1aaae56bf9d..3c496f56e41769f9c14ccaf4f70c99520d4ddd83 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();
@@ -162,7 +162,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 38453c1ce9242ddb34b5b369ae5e0ecf44f5294a..987a5782779a434ed598785d70b8b5d23eae7e67 100755 (executable)
@@ -795,4 +795,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;
+       }
+
+
 }