mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00: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:
parent
9c795870f9
commit
b4c17b3732
3 changed files with 18 additions and 13 deletions
|
@ -30,7 +30,7 @@ class phpbb_default_captcha
|
||||||
var $seed;
|
var $seed;
|
||||||
var $attempts = 0;
|
var $attempts = 0;
|
||||||
var $type;
|
var $type;
|
||||||
var $solved = false;
|
var $solved = 0;
|
||||||
var $captcha_vars = false;
|
var $captcha_vars = false;
|
||||||
|
|
||||||
function init($type)
|
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->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
|
||||||
$this->confirm_id = md5(unique_id($user->ip));
|
$this->confirm_id = md5(unique_id($user->ip));
|
||||||
$this->seed = hexdec(substr(unique_id(), 4, 10));
|
$this->seed = hexdec(substr(unique_id(), 4, 10));
|
||||||
$this->solved = false;
|
$this->solved = 0;
|
||||||
// compute $seed % 0x7fffffff
|
// compute $seed % 0x7fffffff
|
||||||
$this->seed -= 0x7fffffff * floor($this->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->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
|
||||||
$this->seed = hexdec(substr(unique_id(), 4, 10));
|
$this->seed = hexdec(substr(unique_id(), 4, 10));
|
||||||
$this->solved = false;
|
$this->solved = 0;
|
||||||
// compute $seed % 0x7fffffff
|
// compute $seed % 0x7fffffff
|
||||||
$this->seed -= 0x7fffffff * floor($this->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->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
|
||||||
$this->seed = hexdec(substr(unique_id(), 4, 10));
|
$this->seed = hexdec(substr(unique_id(), 4, 10));
|
||||||
$this->solved = false;
|
$this->solved = 0;
|
||||||
// compute $seed % 0x7fffffff
|
// compute $seed % 0x7fffffff
|
||||||
$this->seed -= 0x7fffffff * floor($this->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
|
// we leave the class usable by generating a new question
|
||||||
$this->generate_code();
|
$this->generate_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_solved()
|
||||||
|
{
|
||||||
|
if ($this->solved === 0)
|
||||||
|
{
|
||||||
|
$this->validate();
|
||||||
|
}
|
||||||
|
return (bool) $this->solved;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -230,7 +230,7 @@ class ucp_register
|
||||||
|
|
||||||
if ($config['enable_confirm'])
|
if ($config['enable_confirm'])
|
||||||
{
|
{
|
||||||
if (!$captcha->solved)
|
if (!$captcha->is_solved())
|
||||||
{
|
{
|
||||||
$error[] = $vc_response;
|
$error[] = $vc_response;
|
||||||
}
|
}
|
||||||
|
@ -453,7 +453,7 @@ class ucp_register
|
||||||
$confirm_image = '';
|
$confirm_image = '';
|
||||||
|
|
||||||
// Visual Confirmation - Show images
|
// Visual Confirmation - Show images
|
||||||
if ($config['enable_confirm'] && !$captcha->solved)
|
if ($config['enable_confirm'] && !$captcha->is_solved())
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'),
|
'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'),
|
||||||
|
|
|
@ -592,7 +592,6 @@ if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_
|
||||||
load_drafts($topic_id, $forum_id);
|
load_drafts($topic_id, $forum_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$solved_captcha = false;
|
|
||||||
|
|
||||||
if ($submit || $preview || $refresh)
|
if ($submit || $preview || $refresh)
|
||||||
{
|
{
|
||||||
|
@ -778,10 +777,6 @@ if ($submit || $preview || $refresh)
|
||||||
{
|
{
|
||||||
$error[] = $vc_response;
|
$error[] = $vc_response;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$solved_captcha = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check form
|
// check form
|
||||||
|
@ -1247,7 +1242,7 @@ generate_forum_nav($post_data);
|
||||||
// Build Forum Rules
|
// Build Forum Rules
|
||||||
generate_forum_rules($post_data);
|
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();
|
$captcha->reset();
|
||||||
|
|
||||||
|
@ -1262,7 +1257,7 @@ $s_hidden_fields .= '<input type="hidden" name="lastclick" value="' . $current_t
|
||||||
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . request_var('draft_loaded', $draft_id) . '" />' : '';
|
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . request_var('draft_loaded', $draft_id) . '" />' : '';
|
||||||
|
|
||||||
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
|
// 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());
|
$s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue