|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
*
|
|
|
f2e824 |
* @package phpBB3
|
|
|
f2e824 |
* @version $Id: viewforum.php 9003 2008-10-11 18:23:12Z toonarmy $
|
|
|
f2e824 |
* @copyright (c) 2005 phpBB Group
|
|
|
f2e824 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
f2e824 |
*
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* @ignore
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
define('IN_PHPBB', true);
|
|
|
f2e824 |
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
|
|
|
f2e824 |
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
|
f2e824 |
include($phpbb_root_path . 'common.' . $phpEx);
|
|
|
f2e824 |
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Start session
|
|
|
f2e824 |
$user->session_begin();
|
|
|
f2e824 |
$auth->acl($user->data);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Start initial var setup
|
|
|
f2e824 |
$forum_id = request_var('f', 0);
|
|
|
f2e824 |
$mark_read = request_var('mark', '');
|
|
|
f2e824 |
$start = request_var('start', 0);
|
|
|
f2e824 |
|
|
|
f2e824 |
$default_sort_days = (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0;
|
|
|
f2e824 |
$default_sort_key = (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't';
|
|
|
f2e824 |
$default_sort_dir = (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd';
|
|
|
f2e824 |
|
|
|
f2e824 |
$sort_days = request_var('st', $default_sort_days);
|
|
|
f2e824 |
$sort_key = request_var('sk', $default_sort_key);
|
|
|
f2e824 |
$sort_dir = request_var('sd', $default_sort_dir);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Check if the user has actually sent a forum ID with his/her request
|
|
|
f2e824 |
// If not give them a nice error page.
|
|
|
f2e824 |
if (!$forum_id)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
trigger_error('NO_FORUM');
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$sql_from = FORUMS_TABLE . ' f';
|
|
|
f2e824 |
$lastread_select = '';
|
|
|
f2e824 |
|
|
|
f2e824 |
// Grab appropriate forum data
|
|
|
f2e824 |
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . '
|
|
|
f2e824 |
AND ft.forum_id = f.forum_id)';
|
|
|
f2e824 |
$lastread_select .= ', ft.mark_time';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($user->data['is_registered'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql_from .= ' LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON (fw.forum_id = f.forum_id AND fw.user_id = ' . $user->data['user_id'] . ')';
|
|
|
f2e824 |
$lastread_select .= ', fw.notify_status';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$sql = "SELECT f.* $lastread_select
|
|
|
f2e824 |
FROM $sql_from
|
|
|
f2e824 |
WHERE f.forum_id = $forum_id";
|
|
|
f2e824 |
$result = $db->sql_query($sql);
|
|
|
f2e824 |
$forum_data = $db->sql_fetchrow($result);
|
|
|
f2e824 |
$db->sql_freeresult($result);
|
|
|
f2e824 |
|
|
|
f2e824 |
if (!$forum_data)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
trigger_error('NO_FORUM');
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
// Configure style, language, etc.
|
|
|
f2e824 |
$user->setup('viewforum', $forum_data['forum_style']);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Redirect to login upon emailed notification links
|
|
|
f2e824 |
if (isset($_GET['e']) && !$user->data['is_registered'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
login_box('', $user->lang['LOGIN_NOTIFY_FORUM']);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Permissions check
|
|
|
f2e824 |
if (!$auth->acl_gets('f_list', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id)))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($user->data['user_id'] != ANONYMOUS)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
trigger_error('SORRY_AUTH_READ');
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
login_box('', $user->lang['LOGIN_VIEWFORUM']);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Forum is passworded ... check whether access has been granted to this
|
|
|
f2e824 |
// user this session, if not show login box
|
|
|
f2e824 |
if ($forum_data['forum_password'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
login_forum_box($forum_data);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Is this forum a link? ... User got here either because the
|
|
|
f2e824 |
// number of clicks is being tracked or they guessed the id
|
|
|
f2e824 |
if ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Does it have click tracking enabled?
|
|
|
f2e824 |
if ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql = 'UPDATE ' . FORUMS_TABLE . '
|
|
|
f2e824 |
SET forum_posts = forum_posts + 1
|
|
|
f2e824 |
WHERE forum_id = ' . $forum_id;
|
|
|
f2e824 |
$db->sql_query($sql);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// We redirect to the url. The third parameter indicates that external redirects are allowed.
|
|
|
f2e824 |
redirect($forum_data['forum_link'], false, true);
|
|
|
f2e824 |
return;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Build navigation links
|
|
|
f2e824 |
generate_forum_nav($forum_data);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Forum Rules
|
|
|
f2e824 |
if ($auth->acl_get('f_read', $forum_id))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
generate_forum_rules($forum_data);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Do we have subforums?
|
|
|
f2e824 |
$active_forum_ary = $moderators = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($forum_data['left_id'] != $forum_data['right_id'] - 1)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
list($active_forum_ary, $moderators) = display_forums($forum_data, $config['load_moderators'], $config['load_moderators']);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$template->assign_var('S_HAS_SUBFORUM', false);
|
|
|
f2e824 |
get_moderators($moderators, $forum_id);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Dump out the page header and load viewforum template
|
|
|
f2e824 |
page_header($user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name']);
|
|
|
f2e824 |
|
|
|
f2e824 |
$template->set_filenames(array(
|
|
|
f2e824 |
'body' => 'viewforum_body.html')
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_id);
|
|
|
f2e824 |
|
|
|
f2e824 |
$template->assign_vars(array(
|
|
|
f2e824 |
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&start=$start"),
|
|
|
f2e824 |
));
|
|
|
f2e824 |
|
|
|
f2e824 |
// Not postable forum or showing active topics?
|
|
|
f2e824 |
if (!($forum_data['forum_type'] == FORUM_POST || (($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) && $forum_data['forum_type'] == FORUM_CAT)))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
page_footer();
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Ok, if someone has only list-access, we only display the forum list.
|
|
|
f2e824 |
// We also make this circumstance available to the template in case we want to display a notice. ;)
|
|
|
f2e824 |
if (!$auth->acl_get('f_read', $forum_id))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$template->assign_vars(array(
|
|
|
f2e824 |
'S_NO_READ_ACCESS' => true,
|
|
|
f2e824 |
'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false,
|
|
|
f2e824 |
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') . '&redirect=' . urlencode(str_replace('&', '&', build_url())),
|
|
|
f2e824 |
));
|
|
|
f2e824 |
|
|
|
f2e824 |
page_footer();
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Handle marking posts
|
|
|
f2e824 |
if ($mark_read == 'topics')
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$token = request_var('hash', '');
|
|
|
f2e824 |
if (check_link_hash($token, 'global'))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
markread('topics', $forum_id);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
|
|
|
f2e824 |
meta_refresh(3, $redirect_url);
|
|
|
f2e824 |
|
|
|
f2e824 |
trigger_error($user->lang['TOPICS_MARKED'] . '
' . sprintf($user->lang['RETURN_FORUM'], '', ''));
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Is a forum specific topic count required?
|
|
|
f2e824 |
if ($forum_data['forum_topics_per_page'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$config['topics_per_page'] = $forum_data['forum_topics_per_page'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Do the forum Prune thang - cron type job ...
|
|
|
f2e824 |
if ($forum_data['prune_next'] < time() && $forum_data['enable_prune'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$template->assign_var('RUN_CRON_TASK', '');
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Forum rules and subscription info
|
|
|
f2e824 |
$s_watching_forum = array(
|
|
|
f2e824 |
'link' => '',
|
|
|
f2e824 |
'title' => '',
|
|
|
f2e824 |
'is_watching' => false,
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
if (($config['email_enable'] || $config['jab_enable']) && $config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && $auth->acl_get('f_subscribe', $forum_id))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL;
|
|
|
f2e824 |
watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$s_forum_rules = '';
|
|
|
f2e824 |
gen_forum_auth_level('forum', $forum_id, $forum_data['forum_status']);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Topic ordering options
|
|
|
f2e824 |
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
|
|
|
f2e824 |
|
|
|
f2e824 |
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
|
|
|
f2e824 |
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
|
|
|
f2e824 |
|
|
|
f2e824 |
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
|
|
|
f2e824 |
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Limit topics to certain time frame, obtain correct topic count
|
|
|
f2e824 |
// global announcements must not be counted, normal announcements have to
|
|
|
f2e824 |
// be counted, as forum_topics(_real) includes them
|
|
|
f2e824 |
if ($sort_days)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$min_post_time = time() - ($sort_days * 86400);
|
|
|
f2e824 |
|
|
|
f2e824 |
$sql = 'SELECT COUNT(topic_id) AS num_topics
|
|
|
f2e824 |
FROM ' . TOPICS_TABLE . "
|
|
|
f2e824 |
WHERE forum_id = $forum_id
|
|
|
f2e824 |
AND ((topic_type <> " . POST_GLOBAL . " AND topic_last_post_time >= $min_post_time)
|
|
|
f2e824 |
OR topic_type = " . POST_ANNOUNCE . ")
|
|
|
f2e824 |
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND topic_approved = 1');
|
|
|
f2e824 |
$result = $db->sql_query($sql);
|
|
|
f2e824 |
$topics_count = (int) $db->sql_fetchfield('num_topics');
|
|
|
f2e824 |
$db->sql_freeresult($result);
|
|
|
f2e824 |
|
|
|
f2e824 |
if (isset($_POST['sort']))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$start = 0;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$sql_limit_time = "AND t.topic_last_post_time >= $min_post_time";
|
|
|
f2e824 |
|
|
|
f2e824 |
// Make sure we have information about day selection ready
|
|
|
f2e824 |
$template->assign_var('S_SORT_DAYS', true);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topics_count = ($auth->acl_get('m_approve', $forum_id)) ? $forum_data['forum_topics_real'] : $forum_data['forum_topics'];
|
|
|
f2e824 |
$sql_limit_time = '';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Make sure $start is set to the last page if it exceeds the amount
|
|
|
f2e824 |
if ($start < 0 || $start > $topics_count)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$start = ($start < 0) ? 0 : floor(($topics_count - 1) / $config['topics_per_page']) * $config['topics_per_page'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Basic pagewide vars
|
|
|
f2e824 |
$post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LOCKED'] : $user->lang['POST_NEW_TOPIC'];
|
|
|
f2e824 |
|
|
|
f2e824 |
// Display active topics?
|
|
|
f2e824 |
$s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false;
|
|
|
f2e824 |
|
|
|
f2e824 |
$template->assign_vars(array(
|
|
|
f2e824 |
'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : '',
|
|
|
f2e824 |
|
|
|
f2e824 |
'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', $post_alt) : $user->img('button_topic_new', $post_alt),
|
|
|
f2e824 |
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
|
|
|
f2e824 |
'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
|
|
|
f2e824 |
'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'),
|
|
|
f2e824 |
'FOLDER_NEW_IMG' => $user->img('topic_unread', 'NEW_POSTS'),
|
|
|
f2e824 |
'FOLDER_HOT_IMG' => $user->img('topic_read_hot', 'NO_NEW_POSTS_HOT'),
|
|
|
f2e824 |
'FOLDER_HOT_NEW_IMG' => $user->img('topic_unread_hot', 'NEW_POSTS_HOT'),
|
|
|
f2e824 |
'FOLDER_LOCKED_IMG' => $user->img('topic_read_locked', 'NO_NEW_POSTS_LOCKED'),
|
|
|
f2e824 |
'FOLDER_LOCKED_NEW_IMG' => $user->img('topic_unread_locked', 'NEW_POSTS_LOCKED'),
|
|
|
f2e824 |
'FOLDER_STICKY_IMG' => $user->img('sticky_read', 'POST_STICKY'),
|
|
|
f2e824 |
'FOLDER_STICKY_NEW_IMG' => $user->img('sticky_unread', 'POST_STICKY'),
|
|
|
f2e824 |
'FOLDER_ANNOUNCE_IMG' => $user->img('announce_read', 'POST_ANNOUNCEMENT'),
|
|
|
f2e824 |
'FOLDER_ANNOUNCE_NEW_IMG' => $user->img('announce_unread', 'POST_ANNOUNCEMENT'),
|
|
|
f2e824 |
'FOLDER_MOVED_IMG' => $user->img('topic_moved', 'TOPIC_MOVED'),
|
|
|
f2e824 |
'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'),
|
|
|
f2e824 |
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'),
|
|
|
f2e824 |
'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'),
|
|
|
f2e824 |
|
|
|
f2e824 |
'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'],
|
|
|
f2e824 |
|
|
|
f2e824 |
'S_DISPLAY_POST_INFO' => ($forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
|
|
|
f2e824 |
|
|
|
f2e824 |
'S_IS_POSTABLE' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
|
|
|
f2e824 |
'S_USER_CAN_POST' => ($auth->acl_get('f_post', $forum_id)) ? true : false,
|
|
|
f2e824 |
'S_DISPLAY_ACTIVE' => $s_display_active,
|
|
|
f2e824 |
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
|
|
f2e824 |
'S_SELECT_SORT_KEY' => $s_sort_key,
|
|
|
f2e824 |
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
|
|
f2e824 |
'S_TOPIC_ICONS' => ($s_display_active && sizeof($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false),
|
|
|
f2e824 |
'S_WATCH_FORUM_LINK' => $s_watching_forum['link'],
|
|
|
f2e824 |
'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'],
|
|
|
f2e824 |
'S_WATCHING_FORUM' => $s_watching_forum['is_watching'],
|
|
|
f2e824 |
'S_FORUM_ACTION' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&start=$start"),
|
|
|
f2e824 |
'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false,
|
|
|
f2e824 |
'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'fid[]=' . $forum_id),
|
|
|
f2e824 |
'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true,
|
|
|
f2e824 |
'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false,
|
|
|
f2e824 |
'S_VIEWFORUM' => true,
|
|
|
f2e824 |
|
|
|
f2e824 |
'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", true, $user->session_id) : '',
|
|
|
f2e824 |
'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=post&f=' . $forum_id) : '',
|
|
|
f2e824 |
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . "&start=$start"),
|
|
|
f2e824 |
'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics") : '',
|
|
|
f2e824 |
));
|
|
|
f2e824 |
|
|
|
f2e824 |
// Grab icons
|
|
|
f2e824 |
$icons = $cache->obtain_icons();
|
|
|
f2e824 |
|
|
|
f2e824 |
// Grab all topic data
|
|
|
f2e824 |
$rowset = $announcement_list = $topic_list = $global_announce_list = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
$sql_array = array(
|
|
|
f2e824 |
'SELECT' => 't.*',
|
|
|
f2e824 |
'FROM' => array(
|
|
|
f2e824 |
TOPICS_TABLE => 't'
|
|
|
f2e824 |
),
|
|
|
f2e824 |
'LEFT_JOIN' => array(),
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
$sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1';
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($user->data['is_registered'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($config['load_db_track'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id']);
|
|
|
f2e824 |
$sql_array['SELECT'] .= ', tp.topic_posted';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($config['load_db_lastread'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']);
|
|
|
f2e824 |
$sql_array['SELECT'] .= ', tt.mark_time';
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($s_display_active && sizeof($active_forum_ary))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']);
|
|
|
f2e824 |
$sql_array['SELECT'] .= ', ft.mark_time AS forum_mark_time';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($forum_data['forum_type'] == FORUM_POST)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Obtain announcements ... removed sort ordering, sort by time in all cases
|
|
|
f2e824 |
$sql = $db->sql_build_query('SELECT', array(
|
|
|
f2e824 |
'SELECT' => $sql_array['SELECT'],
|
|
|
f2e824 |
'FROM' => $sql_array['FROM'],
|
|
|
f2e824 |
'LEFT_JOIN' => $sql_array['LEFT_JOIN'],
|
|
|
f2e824 |
|
|
|
f2e824 |
'WHERE' => 't.forum_id IN (' . $forum_id . ', 0)
|
|
|
f2e824 |
AND t.topic_type IN (' . POST_ANNOUNCE . ', ' . POST_GLOBAL . ')',
|
|
|
f2e824 |
|
|
|
f2e824 |
'ORDER_BY' => 't.topic_time DESC',
|
|
|
f2e824 |
));
|
|
|
f2e824 |
$result = $db->sql_query($sql);
|
|
|
f2e824 |
|
|
|
f2e824 |
while ($row = $db->sql_fetchrow($result))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$rowset[$row['topic_id']] = $row;
|
|
|
f2e824 |
$announcement_list[] = $row['topic_id'];
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($row['topic_type'] == POST_GLOBAL)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$global_announce_list[$row['topic_id']] = true;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topics_count--;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$db->sql_freeresult($result);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// If the user is trying to reach late pages, start searching from the end
|
|
|
f2e824 |
$store_reverse = false;
|
|
|
f2e824 |
$sql_limit = $config['topics_per_page'];
|
|
|
f2e824 |
if ($start > $topics_count / 2)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$store_reverse = true;
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($start + $config['topics_per_page'] > $topics_count)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql_limit = min($config['topics_per_page'], max(1, $topics_count - $start));
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Select the sort order
|
|
|
f2e824 |
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC');
|
|
|
f2e824 |
$sql_start = max(0, $topics_count - $sql_limit - $start);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Select the sort order
|
|
|
f2e824 |
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
|
|
f2e824 |
$sql_start = $start;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($forum_data['forum_type'] == FORUM_POST || !sizeof($active_forum_ary))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql_where = 't.forum_id = ' . $forum_id;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else if (empty($active_forum_ary['exclude_forum_id']))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql_where = $db->sql_in_set('t.forum_id', $active_forum_ary['forum_id']);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']);
|
|
|
f2e824 |
$sql_where = (sizeof($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Grab just the sorted topic ids
|
|
|
f2e824 |
$sql = 'SELECT t.topic_id
|
|
|
f2e824 |
FROM ' . TOPICS_TABLE . " t
|
|
|
f2e824 |
WHERE $sql_where
|
|
|
f2e824 |
AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ")
|
|
|
f2e824 |
$sql_approved
|
|
|
f2e824 |
$sql_limit_time
|
|
|
f2e824 |
ORDER BY t.topic_type " . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order;
|
|
|
f2e824 |
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
|
|
f2e824 |
|
|
|
f2e824 |
while ($row = $db->sql_fetchrow($result))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topic_list[] = (int) $row['topic_id'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$db->sql_freeresult($result);
|
|
|
f2e824 |
|
|
|
f2e824 |
// For storing shadow topics
|
|
|
f2e824 |
$shadow_topic_list = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
if (sizeof($topic_list))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// SQL array for obtaining topics/stickies
|
|
|
f2e824 |
$sql_array = array(
|
|
|
f2e824 |
'SELECT' => $sql_array['SELECT'],
|
|
|
f2e824 |
'FROM' => $sql_array['FROM'],
|
|
|
f2e824 |
'LEFT_JOIN' => $sql_array['LEFT_JOIN'],
|
|
|
f2e824 |
|
|
|
f2e824 |
'WHERE' => $db->sql_in_set('t.topic_id', $topic_list),
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
// If store_reverse, then first obtain topics, then stickies, else the other way around...
|
|
|
f2e824 |
// Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because
|
|
|
f2e824 |
// the number of stickies are not known
|
|
|
f2e824 |
$sql = $db->sql_build_query('SELECT', $sql_array);
|
|
|
f2e824 |
$result = $db->sql_query($sql);
|
|
|
f2e824 |
|
|
|
f2e824 |
while ($row = $db->sql_fetchrow($result))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($row['topic_status'] == ITEM_MOVED)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$shadow_topic_list[$row['topic_moved_id']] = $row['topic_id'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$rowset[$row['topic_id']] = $row;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$db->sql_freeresult($result);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// If we have some shadow topics, update the rowset to reflect their topic information
|
|
|
f2e824 |
if (sizeof($shadow_topic_list))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$sql = 'SELECT *
|
|
|
f2e824 |
FROM ' . TOPICS_TABLE . '
|
|
|
f2e824 |
WHERE ' . $db->sql_in_set('topic_id', array_keys($shadow_topic_list));
|
|
|
f2e824 |
$result = $db->sql_query($sql);
|
|
|
f2e824 |
|
|
|
f2e824 |
while ($row = $db->sql_fetchrow($result))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$orig_topic_id = $shadow_topic_list[$row['topic_id']];
|
|
|
f2e824 |
|
|
|
f2e824 |
// If the shadow topic is already listed within the rowset (happens for active topics for example), then do not include it...
|
|
|
f2e824 |
if (isset($rowset[$row['topic_id']]))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// We need to remove any trace regarding this topic. :)
|
|
|
f2e824 |
unset($rowset[$orig_topic_id]);
|
|
|
f2e824 |
unset($topic_list[array_search($orig_topic_id, $topic_list)]);
|
|
|
f2e824 |
$topics_count--;
|
|
|
f2e824 |
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Do not include those topics the user has no permission to access
|
|
|
f2e824 |
if (!$auth->acl_get('f_read', $row['forum_id']))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// We need to remove any trace regarding this topic. :)
|
|
|
f2e824 |
unset($rowset[$orig_topic_id]);
|
|
|
f2e824 |
unset($topic_list[array_search($orig_topic_id, $topic_list)]);
|
|
|
f2e824 |
$topics_count--;
|
|
|
f2e824 |
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// We want to retain some values
|
|
|
f2e824 |
$row = array_merge($row, array(
|
|
|
f2e824 |
'topic_moved_id' => $rowset[$orig_topic_id]['topic_moved_id'],
|
|
|
f2e824 |
'topic_status' => $rowset[$orig_topic_id]['topic_status'],
|
|
|
f2e824 |
'topic_type' => $rowset[$orig_topic_id]['topic_type'],
|
|
|
f2e824 |
));
|
|
|
f2e824 |
|
|
|
f2e824 |
// Shadow topics are never reported
|
|
|
f2e824 |
$row['topic_reported'] = 0;
|
|
|
f2e824 |
|
|
|
f2e824 |
$rowset[$orig_topic_id] = $row;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$db->sql_freeresult($result);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
unset($shadow_topic_list);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Ok, adjust topics count for active topics list
|
|
|
f2e824 |
if ($s_display_active)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topics_count = 1;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$template->assign_vars(array(
|
|
|
f2e824 |
'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')), $topics_count, $config['topics_per_page'], $start),
|
|
|
f2e824 |
'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start),
|
|
|
f2e824 |
'TOTAL_TOPICS' => ($s_display_active) ? false : (($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count)))
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
$topic_list = ($store_reverse) ? array_merge($announcement_list, array_reverse($topic_list)) : array_merge($announcement_list, $topic_list);
|
|
|
f2e824 |
$topic_tracking_info = $tracking_topics = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
// Okay, lets dump out the page ...
|
|
|
f2e824 |
if (sizeof($topic_list))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$mark_forum_read = true;
|
|
|
f2e824 |
$mark_time_forum = 0;
|
|
|
f2e824 |
|
|
|
f2e824 |
// Active topics?
|
|
|
f2e824 |
if ($s_display_active && sizeof($active_forum_ary))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Generate topic forum list...
|
|
|
f2e824 |
$topic_forum_list = array();
|
|
|
f2e824 |
foreach ($rowset as $t_id => $row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread'] && $user->data['is_registered'] && isset($row['forum_mark_time'])) ? $row['forum_mark_time'] : 0;
|
|
|
f2e824 |
$topic_forum_list[$row['forum_id']]['topics'][] = $t_id;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
foreach ($topic_forum_list as $f_id => $topic_row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']), false);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
foreach ($topic_forum_list as $f_id => $topic_row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics'], false);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
unset($topic_forum_list);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $rowset, array($forum_id => $forum_data['mark_time']), $global_announce_list);
|
|
|
f2e824 |
$mark_time_forum = (!empty($forum_data['mark_time'])) ? $forum_data['mark_time'] : $user->data['user_lastmark'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, $global_announce_list);
|
|
|
f2e824 |
|
|
|
f2e824 |
if (!$user->data['is_registered'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$mark_time_forum = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$s_type_switch = 0;
|
|
|
f2e824 |
foreach ($topic_list as $topic_id)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$row = &$rowset[$topic_id];
|
|
|
f2e824 |
|
|
|
f2e824 |
// This will allow the style designer to output a different header
|
|
|
f2e824 |
// or even separate the list of announcements from sticky and normal topics
|
|
|
f2e824 |
$s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
|
|
|
f2e824 |
|
|
|
f2e824 |
// Replies
|
|
|
f2e824 |
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($row['topic_status'] == ITEM_MOVED)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$topic_id = $row['topic_moved_id'];
|
|
|
f2e824 |
$unread_topic = false;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Get folder img, topic status/type related information
|
|
|
f2e824 |
$folder_img = $folder_alt = $topic_type = '';
|
|
|
f2e824 |
topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Generate all the URIs ...
|
|
|
f2e824 |
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
|
|
f2e824 |
|
|
|
f2e824 |
$topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
|
|
|
f2e824 |
$posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
|
|
|
f2e824 |
$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, $user->session_id) : '';
|
|
|
f2e824 |
|
|
|
f2e824 |
// Send vars to template
|
|
|
f2e824 |
$template->assign_block_vars('topicrow', array(
|
|
|
f2e824 |
'FORUM_ID' => $forum_id,
|
|
|
f2e824 |
'TOPIC_ID' => $topic_id,
|
|
|
f2e824 |
'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
|
|
|
f2e824 |
'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
|
|
|
f2e824 |
'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
|
|
|
f2e824 |
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
|
|
|
f2e824 |
'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']),
|
|
|
f2e824 |
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
|
|
|
f2e824 |
'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']),
|
|
|
f2e824 |
'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
|
|
|
f2e824 |
'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
|
|
|
f2e824 |
'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
|
|
|
f2e824 |
|
|
|
f2e824 |
'PAGINATION' => topic_generate_pagination($replies, $view_topic_url),
|
|
|
f2e824 |
'REPLIES' => $replies,
|
|
|
f2e824 |
'VIEWS' => $row['topic_views'],
|
|
|
f2e824 |
'TOPIC_TITLE' => censor_text($row['topic_title']),
|
|
|
f2e824 |
'TOPIC_TYPE' => $topic_type,
|
|
|
f2e824 |
|
|
|
f2e824 |
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
|
|
f2e824 |
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
|
|
|
f2e824 |
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],
|
|
|
f2e824 |
'TOPIC_FOLDER_IMG_WIDTH'=> $user->img($folder_img, '', false, '', 'width'),
|
|
|
f2e824 |
'TOPIC_FOLDER_IMG_HEIGHT' => $user->img($folder_img, '', false, '', 'height'),
|
|
|
f2e824 |
|
|
|
f2e824 |
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
|
|
|
f2e824 |
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
|
|
|
f2e824 |
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
|
|
|
f2e824 |
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
|
|
|
f2e824 |
'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
|
|
|
f2e824 |
|
|
|
f2e824 |
'S_TOPIC_TYPE' => $row['topic_type'],
|
|
|
f2e824 |
'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
|
|
|
f2e824 |
'S_UNREAD_TOPIC' => $unread_topic,
|
|
|
f2e824 |
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false,
|
|
|
f2e824 |
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
|
|
|
f2e824 |
'S_POSTS_UNAPPROVED' => $posts_unapproved,
|
|
|
f2e824 |
'S_HAS_POLL' => ($row['poll_start']) ? true : false,
|
|
|
f2e824 |
'S_POST_ANNOUNCE' => ($row['topic_type'] == POST_ANNOUNCE) ? true : false,
|
|
|
f2e824 |
'S_POST_GLOBAL' => ($row['topic_type'] == POST_GLOBAL) ? true : false,
|
|
|
f2e824 |
'S_POST_STICKY' => ($row['topic_type'] == POST_STICKY) ? true : false,
|
|
|
f2e824 |
'S_TOPIC_LOCKED' => ($row['topic_status'] == ITEM_LOCKED) ? true : false,
|
|
|
f2e824 |
'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false,
|
|
|
f2e824 |
|
|
|
f2e824 |
'U_NEWEST_POST' => $view_topic_url . '&view=unread#unread',
|
|
|
f2e824 |
'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
|
|
|
f2e824 |
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
|
|
|
f2e824 |
'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
|
|
|
f2e824 |
'U_VIEW_TOPIC' => $view_topic_url,
|
|
|
f2e824 |
'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, $user->session_id),
|
|
|
f2e824 |
'U_MCP_QUEUE' => $u_mcp_queue,
|
|
|
f2e824 |
|
|
|
f2e824 |
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test)
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
$s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($unread_topic)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$mark_forum_read = false;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
unset($rowset[$topic_id]);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// This is rather a fudge but it's the best I can think of without requiring information
|
|
|
f2e824 |
// on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find
|
|
|
f2e824 |
// any it updates the forum last read cookie. This requires that the user visit the forum
|
|
|
f2e824 |
// after reading a topic
|
|
|
f2e824 |
if ($forum_data['forum_type'] == FORUM_POST && sizeof($topic_list) && $mark_forum_read)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
page_footer();
|
|
|
f2e824 |
|
|
|
f2e824 |
?>
|