diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-10-06 23:43:27 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-10-06 23:43:27 +0200 |
commit | 4b90357d79de68fa9e91dd178a56baa4c1effba0 (patch) | |
tree | f10d40fd54f198b379fda0626ace3f497da09fcc /phpBB/includes/acp | |
parent | 38ac0bcc8ea1a9fbaf81993a87d6230264de8d33 (diff) | |
parent | 0061a305d8b440995d11ec48c5ae81fc6023ad7e (diff) | |
download | forums-4b90357d79de68fa9e91dd178a56baa4c1effba0.tar forums-4b90357d79de68fa9e91dd178a56baa4c1effba0.tar.gz forums-4b90357d79de68fa9e91dd178a56baa4c1effba0.tar.bz2 forums-4b90357d79de68fa9e91dd178a56baa4c1effba0.tar.xz forums-4b90357d79de68fa9e91dd178a56baa4c1effba0.zip |
Merge pull request #2307 from PayBas/ticket/12408
[ticket/12408] Add quick setting for "default guest style" to ACP
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 9c9e32b57c..f4f7512f0c 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -65,13 +65,16 @@ class acp_board 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true), - 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false), + + '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), 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'legend2' => 'WARNINGS', + 'legend3' => 'WARNINGS', 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), - 'legend3' => 'ACP_SUBMIT_CHANGES', + 'legend4' => 'ACP_SUBMIT_CHANGES', ) ); break; @@ -509,6 +512,14 @@ class acp_board continue; } + if ($config_name == 'guest_style') + { + if (isset($cfg_array[$config_name])) { + $this->guest_style_set($cfg_array[$config_name]); + } + continue; + } + $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; if ($config_name == 'email_function_name') @@ -912,6 +923,39 @@ class acp_board } /** + * Get guest style + */ + public function guest_style_get() + { + global $db; + + $sql = 'SELECT user_style + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . ANONYMOUS; + $result = $db->sql_query($sql); + + $style = (int) $db->sql_fetchfield('user_style'); + $db->sql_freeresult($result); + + return $style; + } + + /** + * Set guest style + * + * @param int $style_id The style ID + */ + public function guest_style_set($style_id) + { + global $db; + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $style_id . ' + WHERE user_id = ' . ANONYMOUS; + $db->sql_query($sql); + } + + /** * Select default dateformat */ function dateformat_select($value, $key) |