From bebc9ec1be02439cce13e850e60e07a4cac00bd8 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 06cbb828c..883a9c943 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,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 0552b89c2..06ae4f69b 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 ec7628efd..eeeef6db3 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) { @@ -452,7 +456,7 @@ class rcube_config } if ($prefs['skin'] == 'default') { - $prefs['skin'] = self::DEFAULT_SKIN; + $prefs['skin'] = $this->system_skin; } $skins_allowed = $this->get('skins_allowed');