From 0728fad7d757a37e7b6ef7edbd1e7ff9ece626d4 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Fri, 2 Jun 2023 14:14:48 +0700 Subject: [PATCH] Minor improvements (#759) --- index.php | 4 ---- library/config.php | 1 + library/includes/page_header.php | 13 +++++-------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/index.php b/index.php index 73fec4f7e..a9a99310a 100644 --- a/index.php +++ b/index.php @@ -17,7 +17,6 @@ $page_cfg['load_tpl_vars'] = array( $show_last_topic = true; $last_topic_max_len = 28; -$show_online_users = true; $show_subforums = true; $datastore->enqueue(array( @@ -403,9 +402,6 @@ if (IS_AM) { } } -// Display page -define('SHOW_ONLINE', $show_online_users); - if (isset($_GET['map'])) { $template->assign_vars(array('PAGE_TITLE' => $lang['FORUM_MAP'])); } diff --git a/library/config.php b/library/config.php index 74891d477..037a90d98 100644 --- a/library/config.php +++ b/library/config.php @@ -520,6 +520,7 @@ $bb_cfg['allow_change'] = [ ]; $bb_cfg['show_jumpbox'] = true; +$bb_cfg['show_online_userlist_index'] = true; $bb_cfg['trash_forum_id'] = 0; // (int) 7 diff --git a/library/includes/page_header.php b/library/includes/page_header.php index af65da172..e153030f8 100644 --- a/library/includes/page_header.php +++ b/library/includes/page_header.php @@ -28,7 +28,7 @@ if ($logged_in) { } // Online userlist -if (defined('SHOW_ONLINE') && SHOW_ONLINE) { +if ($bb_cfg['show_online_userlist_index']) { $online_full = !empty($_REQUEST['online_full']); $online_list = $online_full ? 'online_' . $userdata['user_lang'] : 'online_short_' . $userdata['user_lang']; @@ -38,16 +38,13 @@ if (defined('SHOW_ONLINE') && SHOW_ONLINE) { 'cnt' => '', ); - if (defined('IS_GUEST') && !(IS_GUEST || IS_USER)) { - $template->assign_var('SHOW_ONLINE_LIST'); + if (!${$online_list} = CACHE('bb_cache')->get($online_list)) { + require INC_DIR . '/online_userlist.php'; - if (!${$online_list} = CACHE('bb_cache')->get($online_list)) { - require INC_DIR . '/online_userlist.php'; - - ${$online_list} = CACHE('bb_cache')->get($online_list); - } + ${$online_list} = CACHE('bb_cache')->get($online_list); } + $template->assign_var('SHOW_ONLINE_LIST'); $template->assign_vars(array( 'TOTAL_USERS_ONLINE' => ${$online_list}['stat'], 'LOGGED_IN_USER_LIST' => ${$online_list}['userlist'],