diff --git a/phpBB/adm/style/acp_bots.html b/phpBB/adm/style/acp_bots.html index b4f8ea5072..8332df7e2b 100644 --- a/phpBB/adm/style/acp_bots.html +++ b/phpBB/adm/style/acp_bots.html @@ -27,7 +27,9 @@

{L_BOT_STYLE_EXPLAIN}
-
+
+ {{ FormsSelect(S_STYLE_OPTIONS) }} +

{L_BOT_LANG_EXPLAIN}
@@ -37,7 +39,9 @@
-
+
+ {{ FormsSelect(S_ACTIVE_OPTIONS) }} +

{L_BOT_AGENT_EXPLAIN}
diff --git a/phpBB/adm/style/acp_users_prefs.html b/phpBB/adm/style/acp_users_prefs.html index 68420389b4..d485d1e113 100644 --- a/phpBB/adm/style/acp_users_prefs.html +++ b/phpBB/adm/style/acp_users_prefs.html @@ -48,7 +48,9 @@
-
+
+ {{ FormsSelect(S_STYLE_OPTIONS) }} +
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 1f8f632788..1e82c0e6d5 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -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 */ diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index 323dd1baee..982a8967b7 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -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 .= ''; + $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; diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7a5036f931..32be512d81 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -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', diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 0bdb36eb79..68e4e75dda 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -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; } /** diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index d2fc72621d..103f647ab0 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -205,14 +205,18 @@ 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', 'options' => $timezone_select, ], - 'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false, - 'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false) + 'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false, + 'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false) ); break;