summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2013-04-24 07:08:57 -0700
committerFrank Karlitschek <frank@owncloud.org>2013-04-24 07:08:57 -0700
commit18debcf6a3fe732eee6f8e516e865568532bbe57 (patch)
tree1c58992b7e76d7261380d0892b3628844d973a1c
parentb1c9b296e809f1a1ebc1283013138f4f5cfc0141 (diff)
parenta8075943c3f425f3871faca9953bed3503573ef5 (diff)
downloadnextcloud-server-18debcf6a3fe732eee6f8e516e865568532bbe57.tar.gz
nextcloud-server-18debcf6a3fe732eee6f8e516e865568532bbe57.zip
Merge pull request #3103 from owncloud/default-theme
check if there is a default/ folder in the theme directory if no theme e...
-rw-r--r--lib/helper.php2
-rw-r--r--lib/template.php2
-rw-r--r--lib/templatelayout.php4
-rwxr-xr-xlib/util.php21
4 files changed, 25 insertions, 4 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 73484ad913f..2ba70294f4b 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -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" )) {
diff --git a/lib/template.php b/lib/template.php
index 434c1e9e990..f007618ff19 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -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();
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index 69bebac0503..3c496f56e41 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -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();
diff --git a/lib/util.php b/lib/util.php
index 38453c1ce92..810593358a5 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -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(OC::$SERVERROOT . '/themes/default')) {
+ $theme = 'default';
+ }
+
+ }
+
+ return $theme;
+ }
+
+
}