1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/17414] Move captcha acp html to html files

PHPBB-17414
This commit is contained in:
Marc Alexander
2024-10-05 20:56:58 +02:00
parent c27c1fa7a3
commit 8de8878d5e
2 changed files with 30 additions and 19 deletions

View File

@@ -95,7 +95,7 @@ class acp_captcha
add_form_key($form_key);
$submit = $request->variable('main_submit', false);
$error = $cfg_array = array();
$errors = $cfg_array = array();
if ($submit)
{
@@ -103,13 +103,13 @@ class acp_captcha
{
$cfg_array[$config_var] = $request->variable($config_var, $options['default']);
}
validate_config_vars($config_vars, $cfg_array, $error);
validate_config_vars($config_vars, $cfg_array, $errors);
if (!check_form_key($form_key))
{
$error[] = $user->lang['FORM_INVALID'];
$errors[] = $user->lang['FORM_INVALID'];
}
if ($error)
if ($errors)
{
$submit = false;
}
@@ -143,17 +143,24 @@ class acp_captcha
}
else
{
$captcha_select = '';
$captcha_options = [];
foreach ($captchas['available'] as $value => $title)
{
$current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
$captcha_select .= '<option value="' . $value . '"' . $current . '>' . $user->lang($title) . '</option>';
$captcha_options[] = [
'value' => $value,
'label' => $user->lang($title),
'selected' => $selected !== false && $value == $selected,
];
}
foreach ($captchas['unavailable'] as $value => $title)
{
$current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
$captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option">' . $user->lang($title) . '</option>';
$captcha_options[] = [
'value' => $value,
'label' => $user->lang($title),
'selected' => $selected !== false && $value == $selected,
'class' => 'disabled-option',
];
}
$demo_captcha = $factory->get_instance($selected);
@@ -166,8 +173,12 @@ class acp_captcha
$template->assign_vars(array(
'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id),
'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(),
'CAPTCHA_SELECT' => $captcha_select,
'ERROR_MSG' => implode('<br />', $error),
'CAPTCHA_SELECT' => [
'tag' => 'select',
'name' => 'select_captcha',
'options' => $captcha_options,
],
'ERRORS' => $errors,
'U_ACTION' => $this->u_action,
));