check if there is a default/ folder in the theme directory if no theme exists

This commit is contained in:
Bernhard Posselt 2013-04-24 13:45:40 +02:00
parent b1c9b296e8
commit b98b56e4a8
4 changed files with 25 additions and 4 deletions

View File

@ -159,7 +159,7 @@ class OC_Helper {
*/ */
public static function imagePath( $app, $image ) { public static function imagePath( $app, $image ) {
// Read the selected theme from the config file // 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 // Check if the app is in the app folder
if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )) { if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )) {

View File

@ -272,7 +272,7 @@ class OC_Template{
protected function findTemplate($name) protected function findTemplate($name)
{ {
// Read the selected theme from the config file // 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. // Read the detected formfactor and use the right file name.
$fext = self::getFormFactorExtension(); $fext = self::getFormFactorExtension();

View File

@ -103,7 +103,7 @@ class OC_TemplateLayout extends OC_Template {
static public function findStylesheetFiles($styles) { static public function findStylesheetFiles($styles) {
// Read the selected theme from the config file // 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. // Read the detected formfactor and use the right file name.
$fext = self::getFormFactorExtension(); $fext = self::getFormFactorExtension();
@ -162,7 +162,7 @@ class OC_TemplateLayout extends OC_Template {
static public function findJavascriptFiles($scripts) { static public function findJavascriptFiles($scripts) {
// Read the selected theme from the config file // 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. // Read the detected formfactor and use the right file name.
$fext = self::getFormFactorExtension(); $fext = self::getFormFactorExtension();

View File

@ -795,4 +795,25 @@ class OC_Util {
return (substr(PHP_OS, 0, 3) === "WIN"); 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;
}
} }