1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

We have to use the documented API

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9672 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof
2009-06-25 08:26:51 +00:00
parent 9c795870f9
commit b4c17b3732
3 changed files with 18 additions and 13 deletions

View File

@@ -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;
}
}
?>

View File

@@ -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'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'),