Minor captcha API change - disable display of plugin by returning false in get_template.

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9869 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof 2009-07-27 11:39:28 +00:00
parent 4066849b72
commit a0acfb6a3f
9 changed files with 56 additions and 37 deletions

View file

@ -87,21 +87,28 @@ class phpbb_default_captcha
{ {
global $config, $user, $template, $phpEx, $phpbb_root_path; global $config, $user, $template, $phpEx, $phpbb_root_path;
$link = append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?mode=confirm&confirm_id=' . $this->confirm_id . '&type=' . $this->type); if ($this->is_solved())
$explain = ($this->type != CONFIRM_POST) ? sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>') : $user->lang['POST_CONFIRM_EXPLAIN']; {
return false;
$template->assign_vars(array( }
'CONFIRM_IMAGE_LINK' => $link, else
'CONFIRM_IMAGE' => '<img src="'. $link . '" />', {
'CONFIRM_IMG' => '<img src="'. $link . '" />', $link = append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?mode=confirm&amp;confirm_id=' . $this->confirm_id . '&amp;type=' . $this->type);
'CONFIRM_ID' => $this->confirm_id, $explain = ($this->type != CONFIRM_POST) ? sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>') : $user->lang['POST_CONFIRM_EXPLAIN'];
'S_CONFIRM_CODE' => true,
'S_TYPE' => $this->type, $template->assign_vars(array(
'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh'] && $this->type == CONFIRM_REG) ? true : false, 'CONFIRM_IMAGE_LINK' => $link,
'L_CONFIRM_EXPLAIN' => $explain, 'CONFIRM_IMAGE' => '<img src="'. $link . '" />',
)); 'CONFIRM_IMG' => '<img src="'. $link . '" />',
'CONFIRM_ID' => $this->confirm_id,
'S_CONFIRM_CODE' => true,
'S_TYPE' => $this->type,
'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh'] && $this->type == CONFIRM_REG) ? true : false,
'L_CONFIRM_EXPLAIN' => $explain,
));
return 'captcha_default.html'; return 'captcha_default.html';
}
} }
function get_demo_template($id) function get_demo_template($id)

View file

@ -171,14 +171,21 @@ class phpbb_captcha_qa
{ {
global $template; global $template;
$template->assign_vars(array( if ($this->is_solved())
'QA_CONFIRM_QUESTION' => $this->question_text, {
'QA_CONFIRM_ID' => $this->confirm_id, return false;
'S_CONFIRM_CODE' => true, }
'S_TYPE' => $this->type, else
)); {
$template->assign_vars(array(
'QA_CONFIRM_QUESTION' => $this->question_text,
'QA_CONFIRM_ID' => $this->confirm_id,
'S_CONFIRM_CODE' => true,
'S_TYPE' => $this->type,
));
return 'captcha_qa.html'; return 'captcha_qa.html';
}
} }
/** /**

View file

@ -128,16 +128,23 @@ class phpbb_recaptcha extends phpbb_default_captcha
{ {
global $config, $user, $template; global $config, $user, $template;
$template->assign_vars(array( if ($this->is_solved())
'RECAPTCHA_SERVER' => $this->recaptcha_server, {
'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', return false;
'RECAPTCHA_ERRORGET' => '', }
'S_RECAPTCHA_AVAILABLE' => $this->is_available(), else
'S_CONFIRM_CODE' => true, {
'S_TYPE' => $this->type, $template->assign_vars(array(
)); 'RECAPTCHA_SERVER' => $this->recaptcha_server,
'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '',
'RECAPTCHA_ERRORGET' => '',
'S_RECAPTCHA_AVAILABLE' => $this->is_available(),
'S_CONFIRM_CODE' => true,
'S_TYPE' => $this->type,
));
return 'captcha_recaptcha.html'; return 'captcha_recaptcha.html';
}
} }
function get_demo_template($id) function get_demo_template($id)

View file

@ -2752,7 +2752,6 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
$captcha->reset(); $captcha->reset();
$template->assign_vars(array( $template->assign_vars(array(
'S_CONFIRM_CODE' => true,
'CAPTCHA_TEMPLATE' => $captcha->get_template(), 'CAPTCHA_TEMPLATE' => $captcha->get_template(),
)); ));

View file

@ -446,10 +446,9 @@ class ucp_register
$confirm_image = ''; $confirm_image = '';
// Visual Confirmation - Show images // Visual Confirmation - Show images
if ($config['enable_confirm'] && !$captcha->is_solved()) if ($config['enable_confirm'])
{ {
$template->assign_vars(array( $template->assign_vars(array(
'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'),
'CAPTCHA_TEMPLATE' => $captcha->get_template(), 'CAPTCHA_TEMPLATE' => $captcha->get_template(),
)); ));
} }

View file

@ -21,7 +21,7 @@
<!-- IF U_RESEND_ACTIVATION --><dd><a href="{U_RESEND_ACTIVATION}">{L_RESEND_ACTIVATION}</a></dd><!-- ENDIF --> <!-- IF U_RESEND_ACTIVATION --><dd><a href="{U_RESEND_ACTIVATION}">{L_RESEND_ACTIVATION}</a></dd><!-- ENDIF -->
<!-- ENDIF --> <!-- ENDIF -->
</dl> </dl>
<!-- IF CAPTCHA_TEMPLATE --> <!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
<!-- INCLUDE {CAPTCHA_TEMPLATE} --> <!-- INCLUDE {CAPTCHA_TEMPLATE} -->
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF S_DISPLAY_FULL_LOGIN --> <!-- IF S_DISPLAY_FULL_LOGIN -->

View file

@ -99,7 +99,7 @@
<dt><label for="subject">{L_SUBJECT}:</label></dt> <dt><label for="subject">{L_SUBJECT}:</label></dt>
<dd><input type="text" name="subject" id="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->" tabindex="2" value="{SUBJECT}{DRAFT_SUBJECT}" class="inputbox autowidth" /></dd> <dd><input type="text" name="subject" id="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->" tabindex="2" value="{SUBJECT}{DRAFT_SUBJECT}" class="inputbox autowidth" /></dd>
</dl> </dl>
<!-- IF S_CONFIRM_CODE --> <!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
<!-- INCLUDE {CAPTCHA_TEMPLATE} --> <!-- INCLUDE {CAPTCHA_TEMPLATE} -->
<!-- ENDIF --> <!-- ENDIF -->
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -65,7 +65,7 @@
</td> </td>
</tr> </tr>
<!-- IF S_CONFIRM_CODE --> <!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
</table> </table>
<table class="tablebg" width="100%" cellspacing="1"> <table class="tablebg" width="100%" cellspacing="1">

View file

@ -332,7 +332,7 @@
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF S_CONFIRM_CODE --> <!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
<!-- INCLUDE {CAPTCHA_TEMPLATE} --> <!-- INCLUDE {CAPTCHA_TEMPLATE} -->
<!-- ENDIF --> <!-- ENDIF -->