diff --git a/Sources/Subs-BoardIndex.php b/Sources/Subs-BoardIndex.php index 87f6db2..19e1bc7 100644 --- a/Sources/Subs-BoardIndex.php +++ b/Sources/Subs-BoardIndex.php @@ -30,7 +30,15 @@ if (!defined('SMF')) function getBoardIndex($boardIndexOptions) { global $smcFunc, $scripturl, $user_info, $modSettings, $txt; - global $settings, $context; + global $settings, $context, $show_archived; + + //xxx show archived boards + if($boardIndexOptions['include_categories']){ + if(isset($_GET['show_archived'])) + $_SESSION['show_archived'] = $_GET['show_archived'] == 0 ? 0 : 1; + $show_archived = !empty($user_info['possibly_robot']) || (isset($_SESSION['show_archived']) && $_SESSION['show_archived'] == 1); + } + //xxx end show archived boards // For performance, track the latest post while going through the boards. if (!empty($boardIndexOptions['set_latest_post'])) @@ -63,7 +71,9 @@ function getBoardIndex($boardIndexOptions) LEFT JOIN {db_prefix}members AS mods_mem ON (mods_mem.id_member = mods.id_member) WHERE {query_see_board}' . (empty($boardIndexOptions['countChildPosts']) ? (empty($boardIndexOptions['base_level']) ? '' : ' AND b.child_level >= {int:child_level}') : ' - AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + 1)), + AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + 1)) . + //xxx show archived boards + (isset($show_archived) && !$show_archived ? ' AND c.forumid = 1' : ''), array( 'current_member' => $user_info['id'], 'child_level' => $boardIndexOptions['base_level'], diff --git a/Sources/Subs.php b/Sources/Subs.php index 833a740..57b651b 100644 --- a/Sources/Subs.php +++ b/Sources/Subs.php @@ -3944,7 +3944,7 @@ function loadClassFile($filename) function setupMenuContext() { - global $context, $modSettings, $user_info, $txt, $scripturl; + global $context, $modSettings, $user_info, $txt, $scripturl, $show_archived; // Set up the menu privileges. $context['allow_search'] = allowedTo('search_posts'); @@ -3969,6 +3969,12 @@ function setupMenuContext() ), 'is_last' => $context['right_to_left'], ), + //xxx show archived boards + 'show_archived' => array( + 'title' => ($show_archived ? 'Hide' : 'Show').' Archived Boards', + 'href' => $scripturl . '?show_archived='.($show_archived ? 0 : 1), + 'show' => isset($show_archived), + ), 'help' => array( 'title' => $txt['help'], 'href' => $scripturl . '?action=help',