<?php require './bb-load.php'; bb_repermalink(); $bb_db_override = false; do_action('bb_index.php_pre_db'); if (isset($_GET['new']) && '1' == $_GET['new']) { $forums = false; } elseif (!$bb_db_override) { $forums = bb_get_forums(); // Comment to hide forums if ($topics = get_latest_topics(false, $page)) { bb_cache_last_posts($topics); } if ($super_stickies = get_sticky_topics()) { bb_cache_last_posts($super_stickies); } } bb_load_template('front-page.php', array('bb_db_override', 'super_stickies'));
<?php require_once './bb-load.php'; $forum_id = 0; bb_repermalink(); if (!$forum) { bb_die(__('Forum not found.')); } $bb_db_override = false; do_action('bb_forum.php_pre_db', $forum_id); if (!$bb_db_override) { if ($topics = get_latest_topics($forum_id, $page)) { bb_cache_last_posts($topics); } if ($stickies = get_sticky_topics($forum_id, $page)) { bb_cache_last_posts($stickies); } } bb_load_template('forum.php', array('bb_db_override', 'stickies'), $forum_id);
<?php require_once './bb-load.php'; bb_repermalink(); // Temporary, refactor this! if (!$tag && $tag_name) { bb_die(__('Tag not found')); } if ($tag_name && $tag) { if ($topics = get_tagged_topics($tag->tag_id, $page)) { bb_cache_last_posts($topics); } bb_load_template('tag-single.php', array('tag', 'tag_name', 'topics'), $tag->tag_id); } else { bb_load_template('tags.php'); }
function best_answer_views($view) { global $bbdb, $topics, $view_count, $page; if ($view == 'best-answer' || $view == 'no-best-answer') { $limit = bb_get_option('page_topics'); $offset = ($page - 1) * $limit; $where = apply_filters('get_latest_topics_where', "WHERE topic_status=0 "); if ($view == 'best-answer') { if (defined('BACKPRESS_PATH')) { $query = " FROM {$bbdb->topics} AS t1 \r\n\t\t\tLEFT JOIN {$bbdb->meta} as t2 ON t1.topic_id=t2.object_id \r\n\t\t\t{$where} AND object_type='bb_topic' AND meta_key='best_answer' "; } else { $query = " FROM {$bbdb->topics} AS t1 \r\n\t\t\tLEFT JOIN {$bbdb->topicmeta} as t2 ON t1.topic_id=t2.topic_id \r\n\t\t\t{$where} AND meta_key='best_answer' "; } } else { if (defined('BACKPRESS_PATH')) { $query = " FROM {$bbdb->topics} {$where} AND topic_id NOT IN \r\n\t\t\t(SELECT object_id as topic_id FROM {$bbdb->meta} WHERE object_type='bb_topic' AND meta_key='best_answer') "; } else { $query = " FROM {$bbdb->topics} {$where} AND topic_id NOT IN \t\r\n\t\t\t(SELECT topic_id FROM {$bbdb->topicmeta} WHERE meta_key='best_answer') "; } } $restrict = " ORDER BY topic_time DESC LIMIT {$limit} OFFSET {$offset}"; $view_count = $bbdb->get_var("SELECT count(*) " . $query); $topics = $bbdb->get_results("SELECT * " . $query . $restrict); $topics = bb_append_meta($topics, 'topic'); bb_cache_last_posts(); } }