From 3e23839c0491f2ff6303330245c28817f1d89d0f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 17 Apr 2024 19:55:06 +0200 Subject: [PATCH] [ticket/12960] Add warning messages when captcha is disabled or incomplete PHPBB3-12960 --- phpBB/adm/style/acp_main.html | 9 +++++++++ phpBB/includes/acp/acp_main.php | 26 ++++++++++++++++++++++++++ phpBB/language/en/acp/common.php | 3 +++ 3 files changed, 38 insertions(+) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 05ccd10605..2fe84656db 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -35,6 +35,15 @@

{UPGRADE_INSTRUCTIONS}

+ {% if S_CAPTCHA_UNSAFE %} +
+

{{ lang('CAPTCHA_UNSAFE_WARNING') }}

+
+ {% elseif S_CAPTCHA_INCOMPLETE %} +
+

{{ lang('CAPTCHA_INCOMPLETE_WARNING') }}

+
+ {% endif %}
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 8b34b5fea8..cdf5895def 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -641,6 +641,9 @@ class acp_main } } + // Warn if incomplete captcha is enabled + $this->check_captcha_type($config, $template); + if (!defined('PHPBB_DISABLE_CONFIG_CHECK')) { // World-Writable? (000x) @@ -673,4 +676,27 @@ class acp_main $this->tpl_name = 'acp_main'; $this->page_title = 'ACP_MAIN'; } + + /** + * Check CAPTCHA type and output warning if incomplete type or unsafe config is used + * + * @param \phpbb\config\config $config + * @param \phpbb\template\template $template + * @return void + */ + protected function check_captcha_type(\phpbb\config\config $config, \phpbb\template\template $template): void + { + $template_vars = []; + + if (!$config['enable_confirm']) + { + $template_vars['S_CAPTCHA_UNSAFE'] = true; + } + else if ($config['captcha_plugin'] == 'core.captcha.plugins.incomplete') + { + $template_vars['S_CAPTCHA_INCOMPLETE'] = true; + } + + $template->assign_vars($template_vars); + } } diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index ae2b54f62f..bcbbe5d931 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -235,6 +235,9 @@ $lang = array_merge($lang, array( 'BACK' => 'Back', + 'CAPTCHA_UNSAFE_WARNING' => 'Your board is currently vulnerable to spam submissions because the Spambot countermeasures are either disabled or not configured correctly.', + 'CAPTCHA_INCOMPLETE_WARNING' => '“Incomplete Captcha“ is currently enabled. This placeholder CAPTCHA will prevent all form submissions requiring CAPTCHA verification, e.g. user registration. Please configure a proper CAPTCHA solution like Q&A or reCaptcha to ensure intended functionality.', + 'CONTAINER_EXCEPTION' => 'phpBB encountered an error building the container due to an installed extension. For this reason, all extensions have been temporarily disabled. Please try purging your forum cache. All extensions will automatically be re-enabled once the container error is resolved. If this error continues, please visit phpBB.com for support.', 'EXCEPTION' => 'Exception',