Skip to content

Commit

Permalink
Improve robustness against misconfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Oct 8, 2019
1 parent 876d54b commit 663bcc8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/midcom/admin/folder/management.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ public static function list_styles($up = 0, $prefix = '/', $spacer = '') : array
public static function list_theme_styles(array $styles) : array public static function list_theme_styles(array $styles) : array
{ {
$theme_styledir = OPENPSA2_THEME_ROOT . '/' . midcom::get()->config->get('theme') . '/style'; $theme_styledir = OPENPSA2_THEME_ROOT . '/' . midcom::get()->config->get('theme') . '/style';
if (is_dir($theme_styledir)) {
$finder = new Finder(); $finder = new Finder();
foreach ($finder->directories()->in($theme_styledir) as $dir) { foreach ($finder->directories()->in($theme_styledir) as $dir) {
$label = preg_replace('/.+?\//', '  ', $dir->getRelativePathname()); $label = preg_replace('/.+?\//', '  ', $dir->getRelativePathname());
$styles['theme:/' . $dir->getRelativePathname()] = $label; $styles['theme:/' . $dir->getRelativePathname()] = $label;
}
} }
return $styles; return $styles;
} }
Expand Down

0 comments on commit 663bcc8

Please sign in to comment.