From ebd958c728b6bfe2992e7399c286d05d876454f8 Mon Sep 17 00:00:00 2001 From: 3D-I Date: Sun, 11 Aug 2019 23:19:06 +0200 Subject: [ticket/16080] Provide a back-trace for deleted installed style That's a very edge case, I am using the same approach done in user.php PHPBB3-16080 --- phpBB/includes/functions.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c9f589c174..1af919b8a6 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2734,6 +2734,11 @@ function build_hidden_fields($field_ary, $specialchar = false, $stripslashes = f */ function parse_cfg_file($filename, $lines = false) { + if (!file_exists($filename)) + { + trigger_error('NO_STYLE_DATA', E_USER_ERROR); + } + $parsed_items = array(); if ($lines === false) -- cgit v1.2.1 From 1de4a65e581b43a69c7d40ad705dbf752782fcff Mon Sep 17 00:00:00 2001 From: 3D-I Date: Mon, 12 Aug 2019 00:48:04 +0200 Subject: [ticket/16080] Change location as it should have been. PHPBB3-16080 --- phpBB/includes/acp/acp_styles.php | 6 ++++++ phpBB/includes/functions.php | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 1bf5a3c6a8..b5507005b0 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1123,7 +1123,13 @@ class acp_styles */ protected function read_style_cfg($dir) { + if (!file_exists($this->styles_path . $dir . '/style.cfg')) + { + trigger_error('NO_STYLE_DATA', E_USER_ERROR); + } + static $required = array('name', 'phpbb_version', 'copyright'); + $cfg = parse_cfg_file($this->styles_path . $dir . '/style.cfg'); // Check if it is a valid file diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 1af919b8a6..c9f589c174 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2734,11 +2734,6 @@ function build_hidden_fields($field_ary, $specialchar = false, $stripslashes = f */ function parse_cfg_file($filename, $lines = false) { - if (!file_exists($filename)) - { - trigger_error('NO_STYLE_DATA', E_USER_ERROR); - } - $parsed_items = array(); if ($lines === false) -- cgit v1.2.1 From 964c212f031ef7fcbd2e95d28218007830b5d184 Mon Sep 17 00:00:00 2001 From: 3D-I Date: Mon, 12 Aug 2019 01:19:30 +0200 Subject: [ticket/16080] Provide a meaningful error message for deleted installed style PHPBB3-16080 --- phpBB/includes/acp/acp_styles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index b5507005b0..04cb1f15ef 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1125,7 +1125,7 @@ class acp_styles { if (!file_exists($this->styles_path . $dir . '/style.cfg')) { - trigger_error('NO_STYLE_DATA', E_USER_ERROR); + trigger_error($this->user->lang['NO_STYLE_CFG'] . $dir, E_USER_WARNING); } static $required = array('name', 'phpbb_version', 'copyright'); -- cgit v1.2.1 From 37de0f96d1c2f52fe8702aa3638cc0f02f577a78 Mon Sep 17 00:00:00 2001 From: 3D-I Date: Mon, 12 Aug 2019 21:14:58 +0200 Subject: [ticket/16080] Use placeholder PHPBB3-16080 --- phpBB/includes/acp/acp_styles.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 04cb1f15ef..123c8f0ad4 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1123,9 +1123,10 @@ class acp_styles */ protected function read_style_cfg($dir) { + // This should never happen, we give them a red warning because of its relevance. if (!file_exists($this->styles_path . $dir . '/style.cfg')) { - trigger_error($this->user->lang['NO_STYLE_CFG'] . $dir, E_USER_WARNING); + trigger_error(sprintf($this->user->lang['NO_STYLE_CFG'], $dir), E_USER_WARNING); } static $required = array('name', 'phpbb_version', 'copyright'); -- cgit v1.2.1 From 78f0ec8ea75504f53192612ba4f904bc00fd32d2 Mon Sep 17 00:00:00 2001 From: 3D-I Date: Tue, 13 Aug 2019 20:54:49 +0200 Subject: [ticket/16080] Remove sprintf() PHPBB3-16080 --- phpBB/includes/acp/acp_styles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 123c8f0ad4..5029510839 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1126,7 +1126,7 @@ class acp_styles // This should never happen, we give them a red warning because of its relevance. if (!file_exists($this->styles_path . $dir . '/style.cfg')) { - trigger_error(sprintf($this->user->lang['NO_STYLE_CFG'], $dir), E_USER_WARNING); + trigger_error($this->user->lang('NO_STYLE_CFG', $dir), E_USER_WARNING); } static $required = array('name', 'phpbb_version', 'copyright'); -- cgit v1.2.1