diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 3a53148b93..ad2ad79dbe 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -293,10 +293,9 @@ class ucp_register if ($config['enable_confirm']) { - $vc_response = $captcha->validate(); - if ($vc_response !== false) + if ($captcha->validate() !== true) { - $error[] = $vc_response; + $error[] = $captcha->get_error(); } if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts']) diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php index 395a48a9a5..6911adfaff 100644 --- a/phpBB/phpbb/auth/provider/db.php +++ b/phpBB/phpbb/auth/provider/db.php @@ -176,9 +176,8 @@ class db extends base // Every auth module is able to define what to do by itself... if ($show_captcha) { - $captcha->init(CONFIRM_LOGIN); - $vc_response = $captcha->validate(); - if ($vc_response) + $captcha->init(\phpbb\captcha\plugins\plugin_interface::CONFIRM_LOGIN); + if ($captcha->validate() !== true) { return array( 'status' => LOGIN_ERROR_ATTEMPTS, diff --git a/phpBB/phpbb/report/controller/report.php b/phpBB/phpbb/report/controller/report.php index b8e2b04583..7d41c1c47f 100644 --- a/phpBB/phpbb/report/controller/report.php +++ b/phpBB/phpbb/report/controller/report.php @@ -13,6 +13,7 @@ namespace phpbb\report\controller; +use phpbb\captcha\plugins\plugin_interface; use phpbb\exception\http_exception; use phpbb\report\report_handler_interface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -131,7 +132,7 @@ class report if ($this->config['enable_post_confirm'] && !$this->user->data['is_registered']) { $captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']); - $captcha->init(CONFIRM_REPORT); + $captcha->init(plugin_interface::CONFIRM_REPORT); } //Has the report been cancelled? @@ -140,7 +141,7 @@ class report return new RedirectResponse($redirect_url, 302); } - // Check CAPTCHA, if the form was submited + // Check CAPTCHA, if the form was submitted if (!empty($submit) && isset($captcha)) { $captcha_template_array = $this->check_captcha($captcha); @@ -298,18 +299,17 @@ class report /** * Check CAPTCHA * - * @param object $captcha A phpBB CAPTCHA object + * @param plugin_interface $captcha A phpBB CAPTCHA object * @return array template variables which ensures that CAPTCHA's work correctly */ - protected function check_captcha($captcha) + protected function check_captcha(plugin_interface $captcha) { $error = array(); $captcha_hidden_fields = ''; - $visual_confirmation_response = $captcha->validate(); - if ($visual_confirmation_response) + if ($captcha->validate() !== true) { - $error[] = $visual_confirmation_response; + $error[] = $captcha->get_error(); } if (count($error) === 0) diff --git a/phpBB/posting.php b/phpBB/posting.php index 988b7f03e2..fb54f05ff6 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1210,15 +1210,9 @@ if ($submit || $preview || $refresh) if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { - $captcha_data = array( - 'message' => $request->variable('message', '', true), - 'subject' => $request->variable('subject', '', true), - 'username' => $request->variable('username', '', true), - ); - $vc_response = $captcha->validate($captcha_data); - if ($vc_response) + if ($captcha->validate() !== true) { - $error[] = $vc_response; + $error[] = $captcha->get_error(); } }