From 8b2e466c00a6686ec0f7e1f8b43421d4bbf91bbb Mon Sep 17 00:00:00 2001 From: Daniel Hoffend Date: Tue, 16 Oct 2018 23:30:40 +0200 Subject: [PATCH] limit skins available/shown in the settings section --- config/defaults.inc.php | 3 +++ program/steps/settings/func.inc | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 653dfcfaa..734589dff 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -1056,6 +1056,9 @@ $config['default_charset'] = 'ISO-8859-1'; // skin name: folder from skins/ $config['skin'] = 'larry'; +// limit skins available/shown in the settings section +$config['skins_allowed'] = []; + // Enables using standard browser windows (that can be handled as tabs) // instead of popup windows $config['standard_windows'] = false; diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 00c9f71d1..65d243159 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -1301,9 +1301,12 @@ function rcmail_user_prefs($current = null) function rcmail_get_skins() { + global $RCMAIL; + $path = RCUBE_INSTALL_PATH . 'skins'; $skins = array(); $dir = opendir($path); + $limit = $RCMAIL->config->get('skins_allowed'); if (!$dir) { return false; @@ -1311,7 +1314,8 @@ function rcmail_get_skins() while (($file = readdir($dir)) !== false) { $filename = $path.'/'.$file; - if (!preg_match('/^\./', $file) && is_dir($filename) && is_readable($filename)) { + if (!preg_match('/^\./', $file) && is_dir($filename) && is_readable($filename) + && (!is_array($limit) || !count($limit) || in_array($file, $limit))) { $skins[] = $file; } }