[ticket/10744] Prevent installing styles with reserved names

PHPBB3-10744
This commit is contained in:
Joas Schilling 2014-10-29 17:44:42 +01:00
parent 2e2ab7b485
commit 7f8c4d877a
2 changed files with 8 additions and 0 deletions

View file

@ -29,6 +29,7 @@ class acp_styles
protected $styles_path; protected $styles_path;
protected $styles_path_absolute = 'styles'; protected $styles_path_absolute = 'styles';
protected $default_style = 0; protected $default_style = 0;
protected $reserved_style_names = array('adm', 'admin', 'all');
protected $db; protected $db;
protected $user; protected $user;
@ -164,6 +165,12 @@ class acp_styles
$last_installed = false; $last_installed = false;
foreach ($dirs as $dir) foreach ($dirs as $dir)
{ {
if (in_array($dir, $this->reserved_style_names))
{
$messages[] = $this->user->lang('STYLE_NAME_RESERVED', htmlspecialchars($dir));
continue;
}
$found = false; $found = false;
foreach ($styles as &$style) foreach ($styles as &$style)
{ {

View file

@ -74,6 +74,7 @@ $lang = array_merge($lang, array(
'STYLE_INSTALLED_RETURN_INSTALLED_STYLES' => 'Return to installed styles list', 'STYLE_INSTALLED_RETURN_INSTALLED_STYLES' => 'Return to installed styles list',
'STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES' => 'Install more styles', 'STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES' => 'Install more styles',
'STYLE_NAME' => 'Style name', 'STYLE_NAME' => 'Style name',
'STYLE_NAME_RESERVED' => 'Style "%s" can not be installed, because the name is reserved.',
'STYLE_NOT_INSTALLED' => 'Style "%s" was not installed.', 'STYLE_NOT_INSTALLED' => 'Style "%s" was not installed.',
'STYLE_PATH' => 'Style path', 'STYLE_PATH' => 'Style path',
'STYLE_UNINSTALL' => 'Uninstall', 'STYLE_UNINSTALL' => 'Uninstall',