Skip to content

Commit

Permalink
limit skins available/shown in the settings section
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoffend committed Oct 16, 2018
1 parent 0551b0f commit 8b2e466
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config/defaults.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,9 @@
// 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;
Expand Down
6 changes: 5 additions & 1 deletion program/steps/settings/func.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1301,17 +1301,21 @@ 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;
}

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;
}
}
Expand Down

0 comments on commit 8b2e466

Please sign in to comment.