mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge branch '3.1.x'
Conflicts: phpBB/includes/acp/acp_captcha.php
This commit is contained in:
commit
fbb9f8859a
2 changed files with 60 additions and 12 deletions
|
@ -8,6 +8,13 @@
|
||||||
|
|
||||||
<p>{L_ACP_VC_EXT_GET_MORE}</p>
|
<p>{L_ACP_VC_EXT_GET_MORE}</p>
|
||||||
|
|
||||||
|
<!-- IF ERROR_MSG -->
|
||||||
|
<div class="errorbox">
|
||||||
|
<h3>{L_WARNING}</h3>
|
||||||
|
<p>{ERROR_MSG}</p>
|
||||||
|
</div>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<form id="acp_captcha" method="post" action="{U_ACTION}">
|
<form id="acp_captcha" method="post" action="{U_ACTION}">
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_captcha
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $phpbb_log, $request;
|
global $user, $auth, $template, $phpbb_log, $request;
|
||||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
|
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
|
||||||
|
|
||||||
$user->add_lang('acp/board');
|
$user->add_lang('acp/board');
|
||||||
|
@ -53,11 +53,36 @@ class acp_captcha
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$config_vars = array(
|
$config_vars = array(
|
||||||
'enable_confirm' => array('tpl' => 'REG_ENABLE', 'default' => false),
|
'enable_confirm' => array(
|
||||||
'enable_post_confirm' => array('tpl' => 'POST_ENABLE', 'default' => false),
|
'tpl' => 'REG_ENABLE',
|
||||||
'confirm_refresh' => array('tpl' => 'CONFIRM_REFRESH', 'default' => false),
|
'default' => false,
|
||||||
'max_reg_attempts' => array('tpl' => 'REG_LIMIT', 'default' => 0),
|
'validate' => 'bool',
|
||||||
'max_login_attempts' => array('tpl' => 'MAX_LOGIN_ATTEMPTS', 'default' => 0),
|
'lang' => 'VISUAL_CONFIRM_REG',
|
||||||
|
),
|
||||||
|
'enable_post_confirm' => array(
|
||||||
|
'tpl' => 'POST_ENABLE',
|
||||||
|
'default' => false,
|
||||||
|
'validate' => 'bool',
|
||||||
|
'lang' => 'VISUAL_CONFIRM_POST',
|
||||||
|
),
|
||||||
|
'confirm_refresh' => array(
|
||||||
|
'tpl' => 'CONFIRM_REFRESH',
|
||||||
|
'default' => false,
|
||||||
|
'validate' => 'bool',
|
||||||
|
'lang' => 'VISUAL_CONFIRM_REFRESH',
|
||||||
|
),
|
||||||
|
'max_reg_attempts' => array(
|
||||||
|
'tpl' => 'REG_LIMIT',
|
||||||
|
'default' => 0,
|
||||||
|
'validate' => 'int:0:99999',
|
||||||
|
'lang' => 'REG_LIMIT',
|
||||||
|
),
|
||||||
|
'max_login_attempts' => array(
|
||||||
|
'tpl' => 'MAX_LOGIN_ATTEMPTS',
|
||||||
|
'default' => 0,
|
||||||
|
'validate' => 'int:0:99999',
|
||||||
|
'lang' => 'MAX_LOGIN_ATTEMPTS',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->tpl_name = 'acp_captcha';
|
$this->tpl_name = 'acp_captcha';
|
||||||
|
@ -66,12 +91,31 @@ class acp_captcha
|
||||||
add_form_key($form_key);
|
add_form_key($form_key);
|
||||||
|
|
||||||
$submit = $request->variable('main_submit', false);
|
$submit = $request->variable('main_submit', false);
|
||||||
|
$error = $cfg_array = array();
|
||||||
|
|
||||||
if ($submit && check_form_key($form_key))
|
if ($submit)
|
||||||
{
|
{
|
||||||
foreach ($config_vars as $config_var => $options)
|
foreach ($config_vars as $config_var => $options)
|
||||||
{
|
{
|
||||||
$config->set($config_var, $request->variable($config_var, $options['default']));
|
$cfg_array[$config_var] = $request->variable($config_var, $options['default']);
|
||||||
|
}
|
||||||
|
validate_config_vars($config_vars, $cfg_array, $error);
|
||||||
|
|
||||||
|
if (!check_form_key($form_key))
|
||||||
|
{
|
||||||
|
$error[] = $user->lang['FORM_INVALID'];
|
||||||
|
}
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
$submit = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($submit)
|
||||||
|
{
|
||||||
|
foreach ($cfg_array as $key => $value)
|
||||||
|
{
|
||||||
|
$config->set($key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($selected !== $config['captcha_plugin'])
|
if ($selected !== $config['captcha_plugin'])
|
||||||
|
@ -95,10 +139,6 @@ class acp_captcha
|
||||||
}
|
}
|
||||||
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
else if ($submit)
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$captcha_select = '';
|
$captcha_select = '';
|
||||||
|
@ -125,6 +165,7 @@ class acp_captcha
|
||||||
'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id),
|
'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id),
|
||||||
'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(),
|
'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(),
|
||||||
'CAPTCHA_SELECT' => $captcha_select,
|
'CAPTCHA_SELECT' => $captcha_select,
|
||||||
|
'ERROR_MSG' => implode('<br />', $error),
|
||||||
|
|
||||||
'U_ACTION' => $this->u_action,
|
'U_ACTION' => $this->u_action,
|
||||||
));
|
));
|
||||||
|
|
Loading…
Add table
Reference in a new issue