Beispiel #1
0
/**
 * 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');
}
Beispiel #2
0
/**
 * cache callback function used to retrieve the upcoming birthdays, holidays, and events
 * within the given period, taking into account the users time offset.
 *
 * - Called from the BoardIndex to display the current day's events on the board index
 * - used by the board index and SSI to show the upcoming events.
 *
 * @package Calendar
 * @param mixed[] $eventOptions
 * @return array
 */
function cache_getRecentEvents($eventOptions)
{
    // With the 'static' cached data we can calculate the user-specific data.
    $cached_data = cache_quick_get('calendar_index', 'subs/Calendar.subs.php', 'cache_getOffsetIndependentEvents', array($eventOptions['num_days_shown']));
    // Get the information about today (from user perspective).
    $today = getTodayInfo();
    $return_data = array('calendar_holidays' => array(), 'calendar_birthdays' => array(), 'calendar_events' => array());
    // Set the event span to be shown in seconds.
    $days_for_index = $eventOptions['num_days_shown'] * 86400;
    // Get the current member time/date.
    $now = forum_time();
    // Holidays between now and now + days.
    for ($i = $now; $i < $now + $days_for_index; $i += 86400) {
        if (isset($cached_data['holidays'][strftime('%Y-%m-%d', $i)])) {
            $return_data['calendar_holidays'] = array_merge($return_data['calendar_holidays'], $cached_data['holidays'][strftime('%Y-%m-%d', $i)]);
        }
    }
    // Happy Birthday, guys and gals!
    for ($i = $now; $i < $now + $days_for_index; $i += 86400) {
        $loop_date = strftime('%Y-%m-%d', $i);
        if (isset($cached_data['birthdays'][$loop_date])) {
            foreach ($cached_data['birthdays'][$loop_date] as $index => $dummy) {
                $cached_data['birthdays'][strftime('%Y-%m-%d', $i)][$index]['is_today'] = $loop_date === $today['date'];
            }
            $return_data['calendar_birthdays'] = array_merge($return_data['calendar_birthdays'], $cached_data['birthdays'][$loop_date]);
        }
    }
    $duplicates = array();
    for ($i = $now; $i < $now + $days_for_index; $i += 86400) {
        // Determine the date of the current loop step.
        $loop_date = strftime('%Y-%m-%d', $i);
        // No events today? Check the next day.
        if (empty($cached_data['events'][$loop_date])) {
            continue;
        }
        // Loop through all events to add a few last-minute values.
        foreach ($cached_data['events'][$loop_date] as $ev => $event) {
            // Create a shortcut variable for easier access.
            $this_event =& $cached_data['events'][$loop_date][$ev];
            // Skip duplicates.
            if (isset($duplicates[$this_event['topic'] . $this_event['title']])) {
                unset($cached_data['events'][$loop_date][$ev]);
                continue;
            } else {
                $duplicates[$this_event['topic'] . $this_event['title']] = true;
            }
            // Might be set to true afterwards, depending on the permissions.
            $this_event['can_edit'] = false;
            $this_event['is_today'] = $loop_date === $today['date'];
            $this_event['date'] = $loop_date;
        }
        if (!empty($cached_data['events'][$loop_date])) {
            $return_data['calendar_events'] = array_merge($return_data['calendar_events'], $cached_data['events'][$loop_date]);
        }
    }
    // Mark the last item so that a list separator can be used in the template.
    for ($i = 0, $n = count($return_data['calendar_birthdays']); $i < $n; $i++) {
        $return_data['calendar_birthdays'][$i]['is_last'] = !isset($return_data['calendar_birthdays'][$i + 1]);
    }
    for ($i = 0, $n = count($return_data['calendar_events']); $i < $n; $i++) {
        $return_data['calendar_events'][$i]['is_last'] = !isset($return_data['calendar_events'][$i + 1]);
    }
    return array('data' => $return_data, 'expires' => time() + 3600, 'refresh_eval' => 'return \'' . strftime('%Y%m%d', forum_time(false)) . '\' != strftime(\'%Y%m%d\', forum_time(false)) || (!empty($modSettings[\'calendar_updated\']) && ' . time() . ' < $modSettings[\'calendar_updated\']);', 'post_retri_eval' => '
			global $context, $scripturl, $user_info;

			foreach ($cache_block[\'data\'][\'calendar_events\'] as $k => $event)
			{
				// Remove events that the user may not see or wants to ignore.
				if ((count(array_intersect($user_info[\'groups\'], $event[\'allowed_groups\'])) === 0 && !allowedTo(\'admin_forum\') && !empty($event[\'id_board\'])) || in_array($event[\'id_board\'], $user_info[\'ignoreboards\']))
					unset($cache_block[\'data\'][\'calendar_events\'][$k]);
				else
				{
					// Whether the event can be edited depends on the permissions.
					$cache_block[\'data\'][\'calendar_events\'][$k][\'can_edit\'] = allowedTo(\'calendar_edit_any\') || ($event[\'poster\'] == $user_info[\'id\'] && allowedTo(\'calendar_edit_own\'));

					// The added session code makes this URL not cachable.
					$cache_block[\'data\'][\'calendar_events\'][$k][\'modify_href\'] = $scripturl . \'?action=\' . ($event[\'topic\'] == 0 ? \'calendar;sa=post;\' : \'post;msg=\' . $event[\'msg\'] . \';topic=\' . $event[\'topic\'] . \'.0;calendar;\') . \'eventid=\' . $event[\'id\'] . \';\' . $context[\'session_var\'] . \'=\' . $context[\'session_id\'];
				}
			}

			if (empty($params[0][\'include_holidays\']))
				$cache_block[\'data\'][\'calendar_holidays\'] = array();
			if (empty($params[0][\'include_birthdays\']))
				$cache_block[\'data\'][\'calendar_birthdays\'] = array();
			if (empty($params[0][\'include_events\']))
				$cache_block[\'data\'][\'calendar_events\'] = array();

			$cache_block[\'data\'][\'show_calendar\'] = !empty($cache_block[\'data\'][\'calendar_holidays\']) || !empty($cache_block[\'data\'][\'calendar_birthdays\']) || !empty($cache_block[\'data\'][\'calendar_events\']);');
}
Beispiel #3
0
/**
 * Show all calendar entires for today. (birthdays, holidays, and events.)
 *
 * @param string $output_method = 'echo'
 */
function ssi_todaysCalendar($output_method = 'echo')
{
    global $modSettings, $txt, $scripturl, $user_info;
    if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
        return;
    }
    $eventOptions = array('include_birthdays' => allowedTo('profile_view_any'), 'include_holidays' => true, 'include_events' => true, 'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index']);
    $return = cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'subs/Calendar.subs.php', 'cache_getRecentEvents', array($eventOptions));
    if ($output_method != 'echo') {
        return $return;
    }
    if (!empty($return['calendar_holidays'])) {
        echo '
			<span class="holiday">' . $txt['calendar_prompt'] . ' ' . implode(', ', $return['calendar_holidays']) . '<br /></span>';
    }
    if (!empty($return['calendar_birthdays'])) {
        echo '
			<span class="birthday">' . $txt['birthdays_upcoming'] . '</span> ';
        foreach ($return['calendar_birthdays'] as $member) {
            echo '
			<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', !$member['is_last'] ? ', ' : '';
        }
        echo '
			<br />';
    }
    if (!empty($return['calendar_events'])) {
        echo '
			<span class="event">' . $txt['events_upcoming'] . '</span> ';
        foreach ($return['calendar_events'] as $event) {
            if ($event['can_edit']) {
                echo '
			<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
            }
            echo '
			' . $event['link'] . (!$event['is_last'] ? ', ' : '');
        }
    }
}
 /**
  * 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');
 }
Beispiel #5
0
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);
}
Beispiel #6
0
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']);
}
Beispiel #7
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']);
}