diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php
index 6962100945..e23cfd0de0 100644
--- a/phpBB/includes/captcha/plugins/captcha_abstract.php
+++ b/phpBB/includes/captcha/plugins/captcha_abstract.php
@@ -30,7 +30,7 @@ class phpbb_default_captcha
var $seed;
var $attempts = 0;
var $type;
- var $solved = false;
+ var $solved = 0;
var $captcha_vars = false;
function init($type)
@@ -223,7 +223,7 @@ class phpbb_default_captcha
$this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
$this->confirm_id = md5(unique_id($user->ip));
$this->seed = hexdec(substr(unique_id(), 4, 10));
- $this->solved = false;
+ $this->solved = 0;
// compute $seed % 0x7fffffff
$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);
@@ -246,7 +246,7 @@ class phpbb_default_captcha
$this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
$this->seed = hexdec(substr(unique_id(), 4, 10));
- $this->solved = false;
+ $this->solved = 0;
// compute $seed % 0x7fffffff
$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);
@@ -268,7 +268,7 @@ class phpbb_default_captcha
$this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
$this->seed = hexdec(substr(unique_id(), 4, 10));
- $this->solved = false;
+ $this->solved = 0;
// compute $seed % 0x7fffffff
$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);
@@ -342,6 +342,16 @@ class phpbb_default_captcha
// we leave the class usable by generating a new question
$this->generate_code();
}
+
+ function is_solved()
+ {
+ if ($this->solved === 0)
+ {
+ $this->validate();
+ }
+ return (bool) $this->solved;
+ }
+
}
?>
\ No newline at end of file
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index aa3e00685e..8192f5489b 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -230,7 +230,7 @@ class ucp_register
if ($config['enable_confirm'])
{
- if (!$captcha->solved)
+ if (!$captcha->is_solved())
{
$error[] = $vc_response;
}
@@ -453,7 +453,7 @@ class ucp_register
$confirm_image = '';
// Visual Confirmation - Show images
- if ($config['enable_confirm'] && !$captcha->solved)
+ if ($config['enable_confirm'] && !$captcha->is_solved())
{
$template->assign_vars(array(
'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''),
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 9f63e43345..66daf7128f 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -592,7 +592,6 @@ if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_
load_drafts($topic_id, $forum_id);
}
-$solved_captcha = false;
if ($submit || $preview || $refresh)
{
@@ -778,10 +777,6 @@ if ($submit || $preview || $refresh)
{
$error[] = $vc_response;
}
- else
- {
- $solved_captcha = true;
- }
}
// check form
@@ -1247,7 +1242,7 @@ generate_forum_nav($post_data);
// Build Forum Rules
generate_forum_rules($post_data);
-if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote'))
+if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $captcha->is_solved() === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote'))
{
$captcha->reset();
@@ -1262,7 +1257,7 @@ $s_hidden_fields .= '' : '';
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
-if ($solved_captcha !== false)
+if ($captcha->is_solved() !== false)
{
$s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields());
}