Merge pull request #3140 from annando/issue-3116

Bugfix issue 3116: Only allowed themes are displayed
pull/2291/merge
Tobias Diekershoff 2017-01-31 07:36:25 +01:00 zatwierdzone przez GitHub
commit 44bd890645
1 zmienionych plików z 19 dodań i 0 usunięć

Wyświetl plik

@ -863,12 +863,22 @@ function admin_page_site(App $a) {
$theme_choices_mobile["---"] = t("No special theme for mobile devices"); $theme_choices_mobile["---"] = t("No special theme for mobile devices");
$files = glob('view/theme/*'); $files = glob('view/theme/*');
if($files) { if($files) {
$allowed_theme_list = Config::get('system', 'allowed_themes');
foreach($files as $file) { foreach($files as $file) {
if(intval(file_exists($file.'/unsupported'))) if(intval(file_exists($file.'/unsupported')))
continue; continue;
$f = basename($file); $f = basename($file);
// Only show allowed themes here
if (($allowed_theme_list != '') AND !strstr($allowed_theme_list, $f)) {
continue;
}
$theme_name = ((file_exists($file.'/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f); $theme_name = ((file_exists($file.'/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
if(file_exists($file.'/mobile')) { if(file_exists($file.'/mobile')) {
$theme_choices_mobile[$f] = $theme_name; $theme_choices_mobile[$f] = $theme_name;
} else { } else {
@ -1695,6 +1705,15 @@ function admin_page_themes(App $a) {
if($files) { if($files) {
foreach($files as $file) { foreach($files as $file) {
$f = basename($file); $f = basename($file);
// Is there a style file?
$theme_files = glob('view/theme/'.$f.'/style.*');
// If not then quit
if (count($theme_files) == 0) {
continue;
}
$is_experimental = intval(file_exists($file.'/experimental')); $is_experimental = intval(file_exists($file.'/experimental'));
$is_supported = 1-(intval(file_exists($file.'/unsupported'))); $is_supported = 1-(intval(file_exists($file.'/unsupported')));
$is_allowed = intval(in_array($f,$allowed_themes)); $is_allowed = intval(in_array($f,$allowed_themes));