From 7f8c4d877a9d9d5837e1b3612b2678d024ca087b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 29 Oct 2014 17:44:42 +0100 Subject: [PATCH 1/3] [ticket/10744] Prevent installing styles with reserved names PHPBB3-10744 --- phpBB/includes/acp/acp_styles.php | 7 +++++++ phpBB/language/en/acp/styles.php | 1 + 2 files changed, 8 insertions(+) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index af3fd7937c..330da0ff73 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -29,6 +29,7 @@ class acp_styles protected $styles_path; protected $styles_path_absolute = 'styles'; protected $default_style = 0; + protected $reserved_style_names = array('adm', 'admin', 'all'); protected $db; protected $user; @@ -164,6 +165,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) { 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', From 7c683608ab0714dd78eed66b49725d6b3efed6f9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 29 Oct 2014 17:47:43 +0100 Subject: [PATCH 2/3] [ticket/10744] Type hint objects for IDE usages PHPBB3-10744 --- phpBB/includes/acp/acp_styles.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 330da0ff73..78cab57446 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -31,13 +31,28 @@ class acp_styles protected $default_style = 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) From c174862b7ed668b6f898b0b07ff9cae7a69357d0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 29 Oct 2014 17:52:38 +0100 Subject: [PATCH 3/3] [ticket/10744] Fix some doc blocks PHPBB3-10744 --- phpBB/includes/acp/acp_styles.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 78cab57446..6bd27a8bca 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -29,6 +29,7 @@ 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 */ @@ -831,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) @@ -1113,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)