aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-11-22 00:00:22 +0100
committerMarc Alexander <admin@m-a-styles.de>2014-11-22 00:00:22 +0100
commit70692dd52260f91094fb200708603b6abf9cd895 (patch)
tree52578740bd4331885301699ff78bc872067dbbcd
parent2e2ab7b485f76ab4000b5d8c47c846ff44c10a33 (diff)
parentc174862b7ed668b6f898b0b07ff9cae7a69357d0 (diff)
downloadforums-70692dd52260f91094fb200708603b6abf9cd895.tar
forums-70692dd52260f91094fb200708603b6abf9cd895.tar.gz
forums-70692dd52260f91094fb200708603b6abf9cd895.tar.bz2
forums-70692dd52260f91094fb200708603b6abf9cd895.tar.xz
forums-70692dd52260f91094fb200708603b6abf9cd895.zip
Merge pull request #3094 from nickvergessen/ticket/10744
Ticket/10744 Prevent installing styles with reserved names
-rw-r--r--phpBB/includes/acp/acp_styles.php27
-rw-r--r--phpBB/language/en/acp/styles.php1
2 files changed, 26 insertions, 2 deletions
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index af3fd7937c..6bd27a8bca 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -29,14 +29,31 @@ class acp_styles
protected $styles_path;
protected $styles_path_absolute = 'styles';
protected $default_style = 0;
+ protected $styles_list_cols = 0;
+ protected $reserved_style_names = array('adm', 'admin', 'all');
+ /** @var \phpbb\db\driver\driver_interface */
protected $db;
+
+ /** @var \phpbb\user */
protected $user;
+
+ /** @var \phpbb\template\template */
protected $template;
+
+ /** @var \phpbb\request\request_interface */
protected $request;
+
+ /** @var \phpbb\cache\driver\driver_interface */
protected $cache;
+
+ /** @var \phpbb\auth\auth */
protected $auth;
+
+ /** @var string */
protected $phpbb_root_path;
+
+ /** @var string */
protected $php_ext;
public function main($id, $mode)
@@ -164,6 +181,12 @@ class acp_styles
$last_installed = false;
foreach ($dirs as $dir)
{
+ if (in_array($dir, $this->reserved_style_names))
+ {
+ $messages[] = $this->user->lang('STYLE_NAME_RESERVED', htmlspecialchars($dir));
+ continue;
+ }
+
$found = false;
foreach ($styles as &$style)
{
@@ -809,7 +832,7 @@ class acp_styles
* Update styles tree
*
* @param array $styles Styles list, passed as reference
- * @param array $style Current style, false if root
+ * @param array|false $style Current style, false if root
* @return bool True if something was updated, false if not
*/
protected function update_styles_tree(&$styles, $style = false)
@@ -1091,7 +1114,7 @@ class acp_styles
/**
* Install style
*
- * @param $style style data
+ * @param array $style style data
* @return int Style id
*/
protected function install_style($style)
diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php
index 506d569d56..e6b05c8282 100644
--- a/phpBB/language/en/acp/styles.php
+++ b/phpBB/language/en/acp/styles.php
@@ -74,6 +74,7 @@ $lang = array_merge($lang, array(
'STYLE_INSTALLED_RETURN_INSTALLED_STYLES' => 'Return to installed styles list',
'STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES' => 'Install more styles',
'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_PATH' => 'Style path',
'STYLE_UNINSTALL' => 'Uninstall',