From 282bcf780d64bfc9c67ec8fd8c1c5976c97514ed Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Tue, 3 Nov 2020 01:33:00 +0100 Subject: [PATCH] fix getAppValue default value in theming app Signed-off-by: Julien Veyssier --- apps/theming/lib/Capabilities.php | 6 +++--- apps/theming/lib/ImageManager.php | 4 ++-- apps/theming/lib/ThemingDefaults.php | 8 ++++---- apps/theming/lib/Util.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php index d10002c9deae8..f0c4d2663622c 100644 --- a/apps/theming/lib/Capabilities.php +++ b/apps/theming/lib/Capabilities.php @@ -69,7 +69,7 @@ public function __construct(ThemingDefaults $theming, Util $util, IURLGenerator * @return array */ public function getCapabilities() { - $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false); + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', ''); $color = $this->theming->getColorPrimary(); return [ 'theming' => [ @@ -82,10 +82,10 @@ public function getCapabilities() { 'color-element-bright' => $this->util->elementColor($color), 'color-element-dark' => $this->util->elementColor($color, false), 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), - 'background' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === false && $this->theming->getColorPrimary() !== '#0082c9') ? + 'background' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === '' && $this->theming->getColorPrimary() !== '#0082c9') ? $this->theming->getColorPrimary() : $this->url->getAbsoluteURL($this->theming->getBackground()), - 'background-plain' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === false && $this->theming->getColorPrimary() !== '#0082c9'), + 'background-plain' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === '' && $this->theming->getColorPrimary() !== '#0082c9'), 'background-default' => !$this->util->isBackgroundThemed(), 'logoheader' => $this->url->getAbsoluteURL($this->theming->getLogo()), 'favicon' => $this->url->getAbsoluteURL($this->theming->getLogo()), diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php index 263a242f7f026..6ba7df3ffa942 100644 --- a/apps/theming/lib/ImageManager.php +++ b/apps/theming/lib/ImageManager.php @@ -104,9 +104,9 @@ public function getImageUrlAbsolute(string $key, bool $useSvg = true): string { */ public function getImage(string $key, bool $useSvg = true): ISimpleFile { $pngFile = null; - $logo = $this->config->getAppValue('theming', $key . 'Mime', false); + $logo = $this->config->getAppValue('theming', $key . 'Mime', ''); $folder = $this->appData->getFolder('images'); - if ($logo === false || !$folder->fileExists($key)) { + if ($logo === '' || !$folder->fileExists($key)) { throw new NotFoundException(); } if (!$useSvg && $this->shouldReplaceIcons()) { diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 174491beb2213..66a961ccb3cbd 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -223,7 +223,7 @@ public function getColorPrimary() { * @return string */ public function getLogo($useSvg = true): string { - $logo = $this->config->getAppValue('theming', 'logoMime', false); + $logo = $this->config->getAppValue('theming', 'logoMime', ''); $logoExists = true; try { @@ -307,17 +307,17 @@ public function getScssVariables() { $variables['image-login-plain'] = 'false'; $variables['image-dashboard-plain'] = 'false'; - if ($this->config->getAppValue('theming', 'color', null) !== null) { + if ($this->config->getAppValue('theming', 'color', '') !== '') { $variables['color-primary'] = $this->getColorPrimary(); $variables['color-primary-text'] = $this->getTextColorPrimary(); $variables['color-primary-element'] = $this->util->elementColor($this->getColorPrimary()); } - if ($this->config->getAppValue('theming', 'backgroundMime', null) === 'backgroundColor') { + if ($this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor') { $variables['image-login-plain'] = 'true'; } - if ($this->config->getAppValue('theming', 'dashboardBackgroundMime', null) === 'backgroundColor') { + if ($this->config->getAppValue('theming', 'dashboardBackgroundMime', '') === 'backgroundColor') { $variables['image-dashboard-plain'] = 'true'; } diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php index 3addda9142200..e757d100a1b15 100644 --- a/apps/theming/lib/Util.php +++ b/apps/theming/lib/Util.php @@ -249,7 +249,7 @@ public function isAlreadyThemed() { } public function isBackgroundThemed() { - $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false); + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', ''); $backgroundExists = true; try {