123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <?php
- if (!defined('SMF'))
- die('No direct access...');
- function BoardIndex()
- {
- global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl;
-
- if (WIRELESS)
- $context['sub_template'] = WIRELESS_PROTOCOL . '_boardindex';
- else
- {
- loadTemplate('BoardIndex');
- $context['template_layers'][] = 'boardindex_outer';
- }
-
- $context['canonical_url'] = $scripturl;
-
- if (!empty($_GET))
- $context['robot_no_index'] = true;
-
- 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);
-
- $context['info_center'] = array();
-
- if (!empty($settings['number_recent_posts']))
- {
- if ($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));
- }
- if (!empty($context['latest_posts']) || !empty($context['latest_post']))
- $context['info_center'][] = 'recent';
- }
-
- if (!empty($modSettings['cal_enabled']) && allowedTo('calendar_view'))
- {
-
- $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));
-
- $context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1;
-
- $context['calendar_can_edit'] = allowedTo('calendar_edit_any');
- if ($context['show_calendar'])
- $context['info_center'][] = 'calendar';
- }
-
- $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']);
- if ($settings['show_stats_index'])
- $context['info_center'][] = 'stats';
-
- 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']);
- $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']);
- $context['info_center'][] = 'online';
-
- if (!empty($modSettings['trackStats']))
- trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']);
-
- if (!empty($settings['show_group_key']))
- $context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());
-
- $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']);
-
- $context['mark_read_button'] = array(
- 'markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_mark_read'] . '\');"', 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
- );
-
- call_integration_hook('integrate_mark_read_button');
- loadJavascriptFile('fader.js', array('default_theme' => true, 'defer' => false), 'smf_fader');
- }
- function CollapseCategory()
- {
- global $user_info, $sourcedir, $context;
-
- $context['robot_no_index'] = true;
- checkSession('request');
- if (!isset($_GET['sa']))
- fatal_lang_error('no_access', false);
-
- if (in_array($_REQUEST['sa'], array('expand', 'collapse', 'toggle')) && isset($_REQUEST['c']))
- {
-
- require_once($sourcedir . '/Subs-Categories.php');
- collapseCategories(array((int) $_REQUEST['c']), $_REQUEST['sa'], array($user_info['id']));
- }
-
- BoardIndex();
- }
- ?>
|