[ticket/17151] Fix registration test error

PHPBB3-17151
This commit is contained in:
rxu 2023-09-19 13:16:57 +07:00
parent 9350e82d71
commit 52517a5efd
No known key found for this signature in database
GPG key ID: 955F0567380E586A
7 changed files with 54 additions and 22 deletions

View file

@ -27,7 +27,9 @@
</dl>
<dl>
<dt><label for="bot_style">{L_BOT_STYLE}{L_COLON}</label><br /><span>{L_BOT_STYLE_EXPLAIN}</span></dt>
<dd><select id="bot_style" name="bot_style">{S_STYLE_OPTIONS}</select></dd>
<dd>
{{ FormsSelect(S_STYLE_OPTIONS) }}
</dd>
</dl>
<dl>
<dt><label for="{{ LANG_OPTIONS.id }}">{L_BOT_LANG}{L_COLON}</label><br /><span>{L_BOT_LANG_EXPLAIN}</span></dt>
@ -37,7 +39,9 @@
</dl>
<dl>
<dt><label for="bot_active">{L_BOT_ACTIVE}{L_COLON}</label></dt>
<dd><select id="bot_active" name="bot_active">{S_ACTIVE_OPTIONS}</select></dd>
<dd>
{{ FormsSelect(S_ACTIVE_OPTIONS) }}
</dd>
</dl>
<dl>
<dt><label for="bot_agent">{L_BOT_AGENT}{L_COLON}</label><br /><span>{L_BOT_AGENT_EXPLAIN}</span></dt>

View file

@ -48,7 +48,9 @@
</dl>
<dl>
<dt><label for="style">{L_BOARD_STYLE}{L_COLON}</label></dt>
<dd><select id="style" name="style">{S_STYLE_OPTIONS}</select></dd>
<dd>
{{ FormsSelect(S_STYLE_OPTIONS) }}
</dd>
</dl>
<!-- INCLUDE timezone_option.html -->
<dl>

View file

@ -86,8 +86,8 @@ class acp_board
'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true),
'legend2' => 'BOARD_STYLE',
'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true),
'guest_style' => array('lang' => 'GUEST_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true),
'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'method' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true),
'guest_style' => array('lang' => 'GUEST_STYLE', 'validate' => 'int', 'type' => 'select', 'method' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true),
'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'legend3' => 'WARNINGS',
@ -1127,6 +1127,18 @@ class acp_board
return phpbb_language_select($db, $default, $langdata);
}
/**
* Wrapper function for style_select()
*
* @return array
*/
public function style_select(): array
{
global $db;
return ['options' => style_select()];
}
/**
* Board disable option and message
*/

View file

@ -321,12 +321,15 @@ class acp_bots
unset($bot_row['user_lang'], $bot_row['user_style']);
}
$s_active_options = '';
$s_active_options = [];
$_options = array('0' => 'NO', '1' => 'YES');
foreach ($_options as $value => $lang)
{
$selected = ($bot_row['bot_active'] == $value) ? ' selected="selected"' : '';
$s_active_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
$s_active_options[] = [
'value' => $value,
'selected' => $bot_row['bot_active'] == $value,
'label' => $user->lang($lang),
];
}
$style_select = style_select($bot_row['bot_style'], true);
@ -345,14 +348,22 @@ class acp_bots
'BOT_AGENT' => $bot_row['bot_agent'],
'S_EDIT_BOT' => true,
'S_ACTIVE_OPTIONS' => $s_active_options,
'S_STYLE_OPTIONS' => $style_select,
'S_ACTIVE_OPTIONS' => [
'id' => 'bot_active',
'name' => 'bot_active',
'options' => $s_active_options,
],
'S_STYLE_OPTIONS' => [
'id' => 'bot_style',
'name' => 'bot_style',
'options' => $style_select,
],
'LANG_OPTIONS' => [
'id' => 'bot_lang',
'name' => 'bot_lang',
'options' => $lang_options,
],
'S_ERROR' => (count($error)) ? true : false,
'S_ERROR' => (bool) count($error),
));
return;

View file

@ -1838,7 +1838,11 @@ class acp_users
'name' => 'lang',
'options' => $lang_options,
],
'S_STYLE_OPTIONS' => style_select($data['style']),
'S_STYLE_OPTIONS' => [
'id' => 'style',
'name' => 'style',
'options' => style_select($data['style'])
],
'TIMEZONE_OPTIONS' => [
'tag' => 'select',
'name' => 'tz',

View file

@ -291,9 +291,7 @@ function phpbb_language_select(\phpbb\db\driver\driver_interface $db, string $de
];
}
return [
'options' => $lang_options
];
return $lang_options;
}
/**
@ -325,16 +323,13 @@ function style_select($default = '', $all = false, array $styledata = [])
foreach ($styledata as $row)
{
$style_options[] = [
'tag' => 'select',
'value' => $row['style_id'],
'selected' => $row['style_id'] == $default,
'label' => $row['style_name'],
];
}
return [
'options' => $style_options,
];
return $style_options;
}
/**

View file

@ -205,7 +205,11 @@ class ucp_prefs
'name' => 'lang',
'options' => $lang_options,
],
'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['user_style'], false, $styles_row),
'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : [
'id' => 'user_style',
'name' => 'user_style',
'options' => style_select($data['user_style'], false, $styles_row)
],
'TIMEZONE_OPTIONS' => [
'tag' => 'select',
'name' => 'tz',