From da2bb8af6da6d8fcf6c1f5c27bf64e7ffe81d353 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 23 May 2020 09:44:00 +0200 Subject: [PATCH] Fix error when user-configured skin does not exist anymore (#7271) We fallback to the system skin not the default one. --- CHANGELOG | 1 + program/include/rcmail_output_html.php | 4 +++- program/lib/Roundcube/rcube_config.php | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7da0f8720..d91801ff6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -31,6 +31,7 @@ CHANGELOG Roundcube Webmail - Mailvelope: Use sender's address to find pubkeys to check signatures (#7348) - Mailvelope: Fix Encrypt button hidden in Elastic (#7353) - Fix PHP warning: count(): Parameter must be an array or an object... in ID command handler (#7392) +- Fix error when user-configured skin does not exist anymore (#7271) RELEASE 1.4.4 ------------- diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 4c995dc6f..e9c67c0cb 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -275,7 +275,9 @@ EOF; public function set_skin($skin) { if (!$this->check_skin($skin)) { - $skin = rcube_config::DEFAULT_SKIN; + // If the skin does not exist (could be removed or invalid), + // fallback to the skin set in the system configuration (#7271) + $skin = $this->config->system_skin; } $skin_path = 'skins/' . $skin; diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index 814ff88dc..3d3628368 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -27,6 +27,8 @@ class rcube_config { const DEFAULT_SKIN = 'elastic'; + public $system_skin = 'elastic'; + private $env = ''; private $paths = array(); private $prop = array(); @@ -231,6 +233,8 @@ class rcube_config $this->prop['skin'] = self::DEFAULT_SKIN; } + $this->system_skin = $this->prop['skin']; + // fix paths foreach (array('log_dir' => 'logs', 'temp_dir' => 'temp') as $key => $dir) { foreach (array($this->prop[$key], '../' . $this->prop[$key], RCUBE_INSTALL_PATH . $dir) as $path) { @@ -454,7 +458,7 @@ class rcube_config } if ($prefs['skin'] == 'default') { - $prefs['skin'] = self::DEFAULT_SKIN; + $prefs['skin'] = $this->system_skin; } $skins_allowed = $this->get('skins_allowed');