/** * This function shows the board index. * It uses the BoardIndex template, and main sub template. * It may use the boardindex subtemplate for wireless support. * It updates the most online statistics. * It is accessed by ?action=boardindex. */ function BoardIndex() { global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl; // For wireless, we use the Wireless template... if (WIRELESS) { $context['sub_template'] = WIRELESS_PROTOCOL . '_boardindex'; } else { loadTemplate('BoardIndex'); } // Set a canonical URL for this page. $context['canonical_url'] = $scripturl; // Do not let search engines index anything if there is a random thing in $_GET. if (!empty($_GET)) { $context['robot_no_index'] = true; } // Retrieve the categories and boards. require_once $sourcedir . '/Subs-BoardIndex.php'; $boardIndexOptions = array('include_categories' => true, 'base_level' => 0, 'parent_id' => 0, 'set_latest_post' => true, 'countChildPosts' => !empty($modSettings['countChildPosts'])); $context['categories'] = getBoardIndex($boardIndexOptions); // Get the user online list. require_once $sourcedir . '/Subs-MembersOnline.php'; $membersOnlineOptions = array('show_hidden' => allowedTo('moderate_forum'), 'sort' => 'log_time', 'reverse_sort' => true); $context += getMembersOnlineStats($membersOnlineOptions); $context['show_buddies'] = !empty($user_info['buddies']); // Are we showing all membergroups on the board index? if (!empty($settings['show_group_key'])) { $context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array()); } // Track most online statistics? (Subs-MembersOnline.php) if (!empty($modSettings['trackStats'])) { trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']); } // Retrieve the latest posts if the theme settings require it. if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1) { $latestPostOptions = array('number_posts' => $settings['number_recent_posts']); $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions)); } $settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0; $settings['show_member_bar'] &= allowedTo('view_mlist'); $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']); $context['show_member_list'] = allowedTo('view_mlist'); $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']); // Load the calendar? if (!empty($modSettings['cal_enabled']) && allowedTo('calendar_view')) { // Retrieve the calendar data (events, birthdays, holidays). $eventOptions = array('include_holidays' => $modSettings['cal_showholidays'] > 1, 'include_birthdays' => $modSettings['cal_showbdays'] > 1, 'include_events' => $modSettings['cal_showevents'] > 1, 'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index']); $context += cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions)); // Whether one or multiple days are shown on the board index. $context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1; // This is used to show the "how-do-I-edit" help. $context['calendar_can_edit'] = allowedTo('calendar_edit_any'); } else { $context['show_calendar'] = false; } $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']); // Mark read button $context['mark_read_button'] = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id'])); // Allow mods to add additional buttons here call_integration_hook('integrate_mark_read_button'); }
/** * This function shows the board index. * * What it does: * - It uses the BoardIndex template, and main sub template. * - It updates the most online statistics. * - It is accessed by ?action=boardindex. */ public function action_boardindex() { global $txt, $user_info, $modSettings, $context, $settings, $scripturl; loadTemplate('BoardIndex'); // Set a canonical URL for this page. $context['canonical_url'] = $scripturl; Template_Layers::getInstance()->add('boardindex_outer'); // Do not let search engines index anything if there is a random thing in $_GET. if (!empty($_GET)) { $context['robot_no_index'] = true; } // Retrieve the categories and boards. require_once SUBSDIR . '/BoardsList.class.php'; $boardIndexOptions = array('include_categories' => true, 'base_level' => 0, 'parent_id' => 0, 'set_latest_post' => true, 'countChildPosts' => !empty($modSettings['countChildPosts'])); $boardlist = new Boards_List($boardIndexOptions); $context['categories'] = $boardlist->getBoards(); $context['latest_post'] = $boardlist->getLatestPost(); // Get the user online list. require_once SUBSDIR . '/MembersOnline.subs.php'; $membersOnlineOptions = array('show_hidden' => allowedTo('moderate_forum'), 'sort' => 'log_time', 'reverse_sort' => true); $context += getMembersOnlineStats($membersOnlineOptions); $context['show_buddies'] = !empty($user_info['buddies']); // Are we showing all membergroups on the board index? if (!empty($settings['show_group_key'])) { $context['membergroups'] = cache_quick_get('membergroup_list', 'subs/Membergroups.subs.php', 'cache_getMembergroupList', array()); } // Track most online statistics? (subs/Members.subs.phpOnline.php) if (!empty($modSettings['trackStats'])) { trackStatsUsersOnline($context['num_guests'] + $context['num_users_online']); } // Retrieve the latest posts if the theme settings require it. if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1) { $latestPostOptions = array('number_posts' => $settings['number_recent_posts']); $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'subs/Recent.subs.php', 'cache_getLastPosts', array($latestPostOptions)); } // Let the template know what the members can do if the theme enables these options $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']); $context['show_member_list'] = allowedTo('view_mlist'); $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']); // Load the calendar? if (!empty($modSettings['cal_enabled']) && allowedTo('calendar_view')) { // Retrieve the calendar data (events, birthdays, holidays). $eventOptions = array('include_holidays' => $modSettings['cal_showholidays'] > 1, 'include_birthdays' => $modSettings['cal_showbdays'] > 1, 'include_events' => $modSettings['cal_showevents'] > 1, 'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index']); $context += cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'subs/Calendar.subs.php', 'cache_getRecentEvents', array($eventOptions)); // Whether one or multiple days are shown on the board index. $context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1; // This is used to show the "how-do-I-edit" help. $context['calendar_can_edit'] = allowedTo('calendar_edit_any'); $show_calendar = true; } else { $show_calendar = false; } $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']); $context['sub_template'] = 'boards_list'; // Mark read button $context['mark_read_button'] = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'custom' => 'onclick="return markallreadButton(this);"', 'url' => $scripturl . '?action=markasread;sa=all;bi;' . $context['session_var'] . '=' . $context['session_id'])); $context['info_center_callbacks'] = array(); if (!empty($settings['number_recent_posts']) && (!empty($context['latest_posts']) || !empty($context['latest_post']))) { $context['info_center_callbacks'][] = 'recent_posts'; } if ($show_calendar) { $context['info_center_callbacks'][] = 'show_events'; } if (!empty($settings['show_stats_index'])) { $context['info_center_callbacks'][] = 'show_stats'; } $context['info_center_callbacks'][] = 'show_users'; // Allow mods to add additional buttons here call_integration_hook('integrate_mark_read_button'); }
function BoardIndex() { global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl; // For wireless, we use the Wireless template... if (WIRELESS) { $context['sub_template'] = WIRELESS_PROTOCOL . '_boardindex'; } else { loadTemplate('BoardIndex'); } // Set a canonical URL for this page. $context['canonical_url'] = $scripturl; // Do not let search engines index anything if there is a random thing in $_GET. if (!empty($_GET)) { $context['robot_no_index'] = true; } // Retrieve the categories and boards. require_once $sourcedir . '/Subs-BoardIndex.php'; $boardIndexOptions = array('include_categories' => true, 'base_level' => 0, 'parent_id' => 0, 'set_latest_post' => true, 'countChildPosts' => !empty($modSettings['countChildPosts'])); $context['categories'] = getBoardIndex($boardIndexOptions); //The latest member? if (!empty($modSettings['latestMember']) && !empty($modSettings['MemberColorLatestMember'])) { $context['MemberColor_ID_MEMBER'][$modSettings['latestMember']] = $modSettings['latestMember']; } // Know set the colors for the last post... if (!empty($context['MemberColor_ID_MEMBER'])) { $colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']); $cmemcolid = null; //So the BoardIndex need colored links if (!empty($modSettings['MemberColorBoardindex']) && !empty($context['MemberColor_board'])) { foreach ($context['MemberColor_board'] as $boardid_memcolor) { $cmemcolid = $context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['last_post']['member']['id']; if (!empty($colorDatas[$cmemcolid]['colored_link'])) { $context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['last_post']['member']['link'] = $colorDatas[$cmemcolid]['colored_link']; } } } //You are not know what you do ;P Colors allready loaded :D if (!empty($modSettings['MemberColorModeratorLinks']) && !empty($context['MemberColor_ModBoard'])) { //Okay now... do a heavy serach for moderators... only jokeing... but you know... it look so ugly ;) $onlineColor = load_mod_color(true); global $scripturl, $color_profile; foreach ($context['MemberColor_ModBoard'] as $boardid_memcolor) { //Reset it :D $context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['link_moderators'] = array(); foreach ($context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['moderators'] as $moderators) { $cmemcolid = $moderators['id']; //Replace "Profil of" with "Moderator" ;D $link = str_replace($txt['profile_of'], $txt['board_moderator'], $colorDatas[$cmemcolid]['colored_link']); if (empty($colorDatas[$cmemcolid]['online_color']) && !empty($onlineColor)) { $link = '<a href="' . $scripturl . '?action=profile;u=' . $color_profile[$cmemcolid]['id_member'] . '" title="' . $txt['board_moderator'] . ' ' . $color_profile[$cmemcolid]['real_name'] . '"' . (!empty($modSettings['MemberColorLinkOldSpanStyle']) ? '><span style="color:' . $onlineColor . ';">' : ' style="color:' . $onlineColor . ';">') . $color_profile[$cmemcolid]['real_name'] . (!empty($modSettings['MemberColorLinkOldSpanStyle']) ? '</span>' : '') . '</a>'; } $context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['moderators'][$cmemcolid]['link'] = $link; //Creat the new list... $context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['link_moderators'][] = $link; } } } } // Get the user online list. require_once $sourcedir . '/Subs-MembersOnline.php'; $membersOnlineOptions = array('show_hidden' => allowedTo('moderate_forum'), 'sort' => 'log_time', 'reverse_sort' => true); $context += getMembersOnlineStats($membersOnlineOptions); $context['show_buddies'] = !empty($user_info['buddies']); // Are we showing all membergroups on the board index? if (!empty($settings['show_group_key'])) { $context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array()); } // Track most online statistics? (Subs-MembersOnline.php) if (!empty($modSettings['trackStats'])) { trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']); } // Retrieve the latests posts if the theme settings require it. if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1) { $latestPostOptions = array('number_posts' => $settings['number_recent_posts']); $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions)); } $settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0; $settings['show_member_bar'] &= allowedTo('view_mlist'); $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']); $context['show_member_list'] = allowedTo('view_mlist'); $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']); // Load the calendar? if (!empty($modSettings['cal_enabled']) && allowedTo('calendar_view')) { // Retrieve the calendar data (events, birthdays, holidays). $eventOptions = array('include_holidays' => $modSettings['cal_showholidays'] > 1, 'include_birthdays' => $modSettings['cal_showbdays'] > 1, 'include_events' => $modSettings['cal_showevents'] > 1, 'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index']); $context += cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions)); // Whether one or multiple days are shown on the board index. $context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1; // This is used to show the "how-do-I-edit" help. $context['calendar_can_edit'] = allowedTo('calendar_edit_any'); } else { $context['show_calendar'] = false; } $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']); }
function BoardIndex() { global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl, $boardurl, $boarddir; EoS_Smarty::loadTemplate('boardindex'); $context['is_board_index'] = true; $context['sidebar_template'] = 'sidebars/sidebar_on_index.tpl'; $context['show_sidebar'] = true; $context['sidebar_class'] = 'index'; GetSidebarVisibility('index'); // Set a canonical URL for this page. $context['canonical_url'] = $scripturl; $context['share_url'] = $boardurl; // Do not let search engines index anything if there is a random thing in $_GET. if (!empty($_GET)) { $context['robot_no_index'] = true; } // Retrieve the categories and boards. require_once $sourcedir . '/lib/Subs-BoardIndex.php'; $boardIndexOptions = array('include_categories' => true, 'base_level' => 0, 'parent_id' => 0, 'set_latest_post' => true, 'countChildPosts' => !empty($modSettings['countChildPosts'])); $context['categories'] = getBoardIndex($boardIndexOptions); // Get the user online list. require_once $sourcedir . '/lib/Subs-MembersOnline.php'; $membersOnlineOptions = array('show_hidden' => allowedTo('moderate_forum'), 'sort' => 'log_time', 'reverse_sort' => true); $context += getMembersOnlineStats($membersOnlineOptions); $context['show_buddies'] = !empty($user_info['buddies']); // Are we showing all membergroups on the board index? if (!empty($settings['show_group_key'])) { $context['membergroups'] = cache_quick_get('membergroup_list', 'lib/Subs-Membergroups.php', 'cache_getMembergroupList', array()); } // Track most online statistics? (Subs-MembersOnline.php) if (!empty($modSettings['trackStats'])) { trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']); } // Retrieve the latest posts if the theme settings require it. if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1) { $latestPostOptions = array('number_posts' => $settings['number_recent_posts']); $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'lib/Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions)); } $settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0; $settings['show_member_bar'] &= allowedTo('view_mlist'); $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']); $context['show_member_list'] = allowedTo('view_mlist'); $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']); // Load the calendar? if (!empty($modSettings['cal_enabled']) && allowedTo('calendar_view')) { // Retrieve the calendar data (events, birthdays, holidays). $eventOptions = array('include_holidays' => $modSettings['cal_showholidays'] > 1, 'include_birthdays' => $modSettings['cal_showbdays'] > 1, 'include_events' => $modSettings['cal_showevents'] > 1, 'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index']); $context += cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'lib/Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions)); // Whether one or multiple days are shown on the board index. $context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1; // This is used to show the "how-do-I-edit" help. $context['calendar_can_edit'] = allowedTo('calendar_edit_any'); } else { $context['show_calendar'] = false; } $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']); $context['template_hooks']['boardindex'] = array('above_boardlisting' => '', 'below_boardlisting' => ''); if (isset($context['show_who'])) { $bracketList = array(); if ($context['show_buddies']) { $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); } if (!empty($context['num_spiders'])) { $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); } if (!empty($context['num_users_hidden'])) { $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . $txt['hidden']; } if (!empty($bracketList)) { $context['show_who_formatted'] = ' (' . implode(', ', $bracketList) . ')'; } } $context['mark_read_button'] = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id'])); HookAPI::callHook('boardindex', array()); fetchNewsItems(0, 0); }
function GetSidebarContent() { global $context, $user_info, $txt, $modSettings, $sourcedir, $scripturl, $settings; loadTemplate('index'); $context['sub_template'] = 'sidebar_content'; $context['template_layers'] = array(); $context['canonical_url'] = $scripturl; // Get the user online list. require_once $sourcedir . '/lib/Subs-MembersOnline.php'; $membersOnlineOptions = array('show_hidden' => allowedTo('moderate_forum'), 'sort' => 'log_time', 'reverse_sort' => true); $context += getMembersOnlineStats($membersOnlineOptions); $context['show_buddies'] = !empty($user_info['buddies']); // Are we showing all membergroups on the board index? if (!empty($settings['show_group_key'])) { $context['membergroups'] = cache_quick_get('membergroup_list', 'lib/Subs-Membergroups.php', 'cache_getMembergroupList', array()); } // Track most online statistics? (Subs-MembersOnline.php) if (!empty($modSettings['trackStats'])) { trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']); } // Retrieve the latest posts if the theme settings require it. if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1) { $latestPostOptions = array('number_posts' => $settings['number_recent_posts']); $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'lib/Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions)); } $settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0; $settings['show_member_bar'] &= allowedTo('view_mlist'); $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']); $context['show_member_list'] = allowedTo('view_mlist'); $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']); // Load the calendar? if (!empty($modSettings['cal_enabled']) && allowedTo('calendar_view')) { // Retrieve the calendar data (events, birthdays, holidays). $eventOptions = array('include_holidays' => $modSettings['cal_showholidays'] > 1, 'include_birthdays' => $modSettings['cal_showbdays'] > 1, 'include_events' => $modSettings['cal_showevents'] > 1, 'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index']); $context += cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'lib/Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions)); // Whether one or multiple days are shown on the board index. $context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1; // This is used to show the "how-do-I-edit" help. $context['calendar_can_edit'] = allowedTo('calendar_edit_any'); } else { $context['show_calendar'] = false; } $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']); }