't.forum_id, t.id, t.last_post', 'FROM' => 'topics AS t', 'JOINS' => array( array( 'INNER JOIN' => 'forums AS f', 'ON' => 'f.id=t.forum_id' ), array( 'LEFT JOIN' => 'forum_perms AS fp', 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')' ) ), 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$forum_user['last_visit'].' AND t.moved_to IS NULL' ); ($hook = get_hook('in_qr_get_new_topics')) ? eval($hook) : null; $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); $new_topics = array(); while ($cur_topic = $forum_db->fetch_assoc($result)) $new_topics[$cur_topic['forum_id']][$cur_topic['id']] = $cur_topic['last_post']; $tracked_topics = get_tracked_topics(); } // Setup main heading $forum_page['main_title'] = forum_htmlencode($forum_config['o_board_title']); ($hook = get_hook('in_pre_header_load')) ? eval($hook) : null; define('FORUM_ALLOW_INDEX', 1); define('FORUM_PAGE', 'index'); require FORUM_ROOT.'header.php'; // START SUBST - ob_start(); ($hook = get_hook('in_main_output_start')) ? eval($hook) : null; // Print the categories and forums $query = array( 'SELECT' => 'c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster', 'FROM' => 'categories AS c', 'JOINS' => array( array( 'INNER JOIN' => 'forums AS f', 'ON' => 'c.id=f.cat_id' ), array( 'LEFT JOIN' => 'forum_perms AS fp', 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')' ) ), 'WHERE' => 'fp.read_forum IS NULL OR fp.read_forum=1', 'ORDER BY' => 'c.disp_position, c.id, f.disp_position' ); ($hook = get_hook('in_qr_get_cats_and_forums')) ? eval($hook) : null; $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); $forum_page['cur_category'] = $forum_page['cat_count'] = $forum_page['item_count'] = 0; while ($cur_forum = $forum_db->fetch_assoc($result)) { ($hook = get_hook('in_forum_loop_start')) ? eval($hook) : null; ++$forum_page['item_count']; if ($cur_forum['cid'] != $forum_page['cur_category']) // A new category since last iteration? { if ($forum_page['cur_category'] != 0) echo "\t".''."\n"; ++$forum_page['cat_count']; $forum_page['item_count'] = 1; $forum_page['item_header'] = array(); $forum_page['item_header']['subject']['title'] = ''.$lang_index['Forums'].''; $forum_page['item_header']['info']['topics'] = ''.$lang_index['topics'].''; $forum_page['item_header']['info']['post'] = ''.$lang_index['posts'].''; $forum_page['item_header']['info']['lastpost'] = ''.$lang_index['last post'].''; ($hook = get_hook('in_forum_pre_cat_head')) ? eval($hook) : null; $forum_page['cur_category'] = $cur_forum['cid']; ?>

'.forum_htmlencode($cur_forum['forum_name']).''; $forum_page['item_status']['redirect'] = 'redirect'; if ($cur_forum['forum_desc'] != '') $forum_page['item_subject']['desc'] = $cur_forum['forum_desc']; $forum_page['item_subject']['redirect'] = ''.$lang_index['External forum'].''; ($hook = get_hook('in_redirect_row_pre_item_subject_merge')) ? eval($hook) : null; if (!empty($forum_page['item_subject'])) $forum_page['item_body']['subject']['desc'] = '

'.implode(' ', $forum_page['item_subject']).'

'; // Forum topic and post count $forum_page['item_body']['info']['topics'] = '
  • '.$lang_index['No topic info'].'
  • '; $forum_page['item_body']['info']['posts'] = '
  • '.$lang_index['No post info'].'
  • '; $forum_page['item_body']['info']['lastpost'] = '
  • '.$lang_index['No lastpost info'].'
  • '; ($hook = get_hook('in_redirect_row_pre_display')) ? eval($hook) : null; } else { // Setup the title and link to the forum $forum_page['item_title']['title'] = ''.forum_htmlencode($cur_forum['forum_name']).''; // Are there new posts since our last visit? if (!$forum_user['is_guest'] && $cur_forum['last_post'] > $forum_user['last_visit'] && (empty($tracked_topics['forums'][$cur_forum['fid']]) || $cur_forum['last_post'] > $tracked_topics['forums'][$cur_forum['fid']])) { // There are new posts in this forum, but have we read all of them already? foreach ($new_topics[$cur_forum['fid']] as $check_topic_id => $check_last_post) { if ((empty($tracked_topics['topics'][$check_topic_id]) || $tracked_topics['topics'][$check_topic_id] < $check_last_post) && (empty($tracked_topics['forums'][$cur_forum['fid']]) || $tracked_topics['forums'][$cur_forum['fid']] < $check_last_post)) { $forum_page['item_status']['new'] = 'new'; $forum_page['item_title']['status'] = ''.sprintf($lang_index['Forum has new'], ''.$lang_index['Forum new posts'].'').''; break; } } } ($hook = get_hook('in_normal_row_pre_item_title_merge')) ? eval($hook) : null; $forum_page['item_body']['subject']['title'] = '

    '.implode(' ', $forum_page['item_title']).'

    '; // Setup the forum description and mod list if ($cur_forum['forum_desc'] != '') $forum_page['item_subject']['desc'] = $cur_forum['forum_desc']; if ($forum_config['o_show_moderators'] == '1' && $cur_forum['moderators'] != '') { $forum_page['mods_array'] = unserialize($cur_forum['moderators']); $forum_page['item_mods'] = array(); foreach ($forum_page['mods_array'] as $mod_username => $mod_id) $forum_page['item_mods'][] = ($forum_user['g_view_users'] == '1') ? ''.forum_htmlencode($mod_username).'' : forum_htmlencode($mod_username); ($hook = get_hook('in_row_modify_modlist')) ? eval($hook) : null; $forum_page['item_subject']['modlist'] = ''.sprintf($lang_index['Moderated by'], implode(', ', $forum_page['item_mods'])).''; } ($hook = get_hook('in_normal_row_pre_item_subject_merge')) ? eval($hook) : null; if (!empty($forum_page['item_subject'])) $forum_page['item_body']['subject']['desc'] = '

    '.implode(' ', $forum_page['item_subject']).'

    '; // Setup forum topics, post count and last post $forum_page['item_body']['info']['topics'] = '
  • '.forum_number_format($cur_forum['num_topics']).' '.(($cur_forum['num_topics'] == 1) ? $lang_index['topic'] : $lang_index['topics']).'
  • '; $forum_page['item_body']['info']['posts'] = '
  • '.forum_number_format($cur_forum['num_posts']).' '.(($cur_forum['num_posts'] == 1) ? $lang_index['post'] : $lang_index['posts']).'
  • '; if ($cur_forum['last_post'] != '') $forum_page['item_body']['info']['lastpost'] = '
  • '.$lang_index['Last post'].' '.format_time($cur_forum['last_post']).' '.sprintf($lang_index['Last poster'], forum_htmlencode($cur_forum['last_poster'])).'
  • '; else $forum_page['item_body']['info']['lastpost'] = '
  • '.$lang_common['Never'].'
  • '; ($hook = get_hook('in_normal_row_pre_display')) ? eval($hook) : null; } // Generate classes for this forum depending on its status $forum_page['item_style'] = (($forum_page['item_count'] % 2 != 0) ? ' odd' : ' even').(($forum_page['item_count'] == 1) ? ' main-first-item' : '').((!empty($forum_page['item_status'])) ? ' '.implode(' ', $forum_page['item_status']) : ''); ($hook = get_hook('in_row_pre_display')) ? eval($hook) : null; ?>
    0) { ?>

    ', $tpl_temp, $tpl_main); ob_end_clean(); // END SUBST - // START SUBST - ob_start(); ($hook = get_hook('in_info_output_start')) ? eval($hook) : null; if (file_exists(FORUM_CACHE_DIR.'cache_stats.php')) include FORUM_CACHE_DIR.'cache_stats.php'; // Regenerate cache only if the cache is more than 30 minutes old if (!defined('FORUM_STATS_LOADED') || $forum_stats['cached'] < (time() - 1800)) { if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) require FORUM_ROOT.'include/cache.php'; generate_stats_cache(); require FORUM_CACHE_DIR.'cache_stats.php'; } $stats_list['no_of_users'] = '
  • '.sprintf($lang_index['No of users'], ''.forum_number_format($forum_stats['total_users']).'').'
  • '; $stats_list['newest_user'] = '
  • '.sprintf($lang_index['Newest user'], ''.($forum_user['g_view_users'] == '1' ? ''.forum_htmlencode($forum_stats['last_user']['username']).'' : forum_htmlencode($forum_stats['last_user']['username'])).'').'
  • '; $stats_list['no_of_topics'] = '
  • '.sprintf($lang_index['No of topics'], ''.forum_number_format($forum_stats['total_topics']).'').'
  • '; $stats_list['no_of_posts'] = '
  • '.sprintf($lang_index['No of posts'], ''.forum_number_format($forum_stats['total_posts']).'').'
  • '; ($hook = get_hook('in_stats_pre_info_output')) ? eval($hook) : null; ?>

    'o.user_id, o.ident', 'FROM' => 'online AS o', 'WHERE' => 'o.idle=0', 'ORDER BY' => 'o.ident' ); ($hook = get_hook('in_users_online_qr_get_online_info')) ? eval($hook) : null; $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); $forum_page['num_guests'] = $forum_page['num_users'] = 0; $users = array(); while ($forum_user_online = $forum_db->fetch_assoc($result)) { ($hook = get_hook('in_users_online_add_online_user_loop')) ? eval($hook) : null; if ($forum_user_online['user_id'] > 1) { $users[] = ($forum_user['g_view_users'] == '1') ? ''.forum_htmlencode($forum_user_online['ident']).'' : forum_htmlencode($forum_user_online['ident']); ++$forum_page['num_users']; } else ++$forum_page['num_guests']; } $forum_page['online_info'] = array(); $forum_page['online_info']['guests'] = ($forum_page['num_guests'] == 0) ? $lang_index['Guests none'] : sprintf((($forum_page['num_guests'] == 1) ? $lang_index['Guests single'] : $lang_index['Guests plural']), forum_number_format($forum_page['num_guests'])); $forum_page['online_info']['users'] = ($forum_page['num_users'] == 0) ? $lang_index['Users none'] : sprintf((($forum_page['num_users'] == 1) ? $lang_index['Users single'] : $lang_index['Users plural']), forum_number_format($forum_page['num_users'])); ($hook = get_hook('in_users_online_pre_online_info_output')) ? eval($hook) : null; ?>

    ', $tpl_temp, $tpl_main); ob_end_clean(); // END SUBST - require FORUM_ROOT.'footer.php';