diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-02-25 18:20:33 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-02-25 18:20:33 +0000 |
commit | 1aa274d1e737328f4462ad2ea6f8a6819a5db1d3 (patch) | |
tree | 7932e39b9130b84355aa1be4632d9aeace2334d1 /phpBB/viewforum.php | |
parent | 02bcd7e2e1b43ce77ade9308ade809a5a583589d (diff) | |
download | forums-1aa274d1e737328f4462ad2ea6f8a6819a5db1d3.tar forums-1aa274d1e737328f4462ad2ea6f8a6819a5db1d3.tar.gz forums-1aa274d1e737328f4462ad2ea6f8a6819a5db1d3.tar.bz2 forums-1aa274d1e737328f4462ad2ea6f8a6819a5db1d3.tar.xz forums-1aa274d1e737328f4462ad2ea6f8a6819a5db1d3.zip |
Updates of various types, sizes, colours and accessories ...
git-svn-id: file:///svn/phpbb/trunk@3531 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/viewforum.php')
-rw-r--r-- | phpBB/viewforum.php | 329 |
1 files changed, 158 insertions, 171 deletions
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 56e6fa2c6f..53ef269ddc 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -24,39 +24,45 @@ $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); + // Start initial var setup -$mark_read = (!empty($_GET['mark'])) ? $_GET['mark'] : ''; $forum_id = (!empty($_GET['f'])) ? intval($_GET['f']) : 0; $start = (isset($_GET['start'])) ? intval($_GET['start']) : 0; -$sort_key = (!empty($_POST['sort_key'])) ? $_POST['sort_key']{0} : 't'; -$sort_dir = (!empty($_POST['sort_dir'])) ? $_POST['sort_dir']{0} : 'd'; -// End initial var setup +$mark_read = (!empty($_GET['mark'])) ? $_GET['mark'] : ''; +$sort_days = (!empty($_REQUEST['sort_days'])) ? intval($_REQUEST['sort_days']) : 0; +$sort_key = (!empty($_REQUEST['sort_key'])) ? $_REQUEST['sort_key'] : 't'; +$sort_dir = (!empty($_REQUEST['sort_dir'])) ? $_REQUEST['sort_dir'] : 'd'; + // Start session //$user->fetch_data(array()); $user->start(); + // Check if the user has actually sent a forum ID with his/her request // If not give them a nice error page. if (!$forum_id) { - trigger_error('Forum_not_exist'); + trigger_error('NO_FORUM'); } + +// Grab appropriate forum data if ($user->data['user_id'] == ANONYMOUS) { - $sql = 'SELECT * FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $forum_id; + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_id; } else { switch (SQL_LAYER) { - //TODO case 'oracle': - break; + //TODO + break; default: - /* $sql = 'SELECT f.*, tw.topics_list, fw.notify_status FROM ' . FORUMS_TABLE . ' f @@ -64,28 +70,36 @@ else LEFT JOIN " . FORUMS_WATCH_TABLE . ' fw ON fw.user_id = ' . $user->data['user_id'] . ' AND f.forum_id = fw.forum_id WHERE f.forum_id = ' . $forum_id; */ - $sql = 'SELECT f.*, fw.notify_status, lr.lastread_time, lr.lastread_type - FROM ' . FORUMS_TABLE . ' f - LEFT JOIN '.LASTREAD_TABLE.' lr ON ( - lr.user_id = '.$user->data['user_id'].' - AND lr.forum_id = '.-$forum_id.') - LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON ( - fw.user_id = ' . $user->data['user_id'] . ' - AND f.forum_id = fw.forum_id) + $sql = 'SELECT f.*, fw.notify_status + FROM (' . FORUMS_TABLE . ' f + LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON fw.forum_id = f.forum_id + AND fw.user_id = ' . $user->data['user_id'] . ') WHERE f.forum_id = ' . $forum_id; + // UNION if necessary? +/* $sql = "SELECT * + FROM " . FORUMS_TABLE . " + WHERE forum_id = $forum_id + UNION + SELECT notify_status, NULL, NULL, ... + FROM " . FORUMS_WATCH_TABLE . " + WHERE forum_id = $forum_id + AND user_id = " . $user->data['user_id'];*/ } } $result = $db->sql_query($sql); if (!$forum_data = $db->sql_fetchrow($result)) { - trigger_error('Forum_not_exist'); + trigger_error('NO_FORUM'); } +$db->sql_freeresult($result); + // Configure style, language, etc. $user->setup(false, $forum_data['forum_style']); $auth->acl($user->data, $forum_id); -// Auth check + +// Permissions check if (!$auth->acl_gets('f_read', 'm_', 'a_', $forum_id)) { if ($user->data['user_id'] == ANONYMOUS) @@ -93,17 +107,17 @@ if (!$auth->acl_gets('f_read', 'm_', 'a_', $forum_id)) redirect("login.$phpEx$SID&redirect=viewforum.$phpEx&f=$forum_id" . ((isset($start)) ? "&start=$start" : '')); } - trigger_error('Sorry_auth_read'); + trigger_error('SORRY_AUTH_READ'); } -// End of auth check + // Build navigation links generate_forum_nav($forum_data); -// Moderators -$forum_moderators = array(); // Do we have subforums? +$moderators = array(); + if ($forum_data['left_id'] != $forum_data['right_id'] - 1) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); @@ -112,9 +126,10 @@ if ($forum_data['left_id'] != $forum_data['right_id'] - 1) else { $template->assign_var('S_HAS_SUBFORUM', FALSE); - get_moderators($forum_moderators, $forum_id); + get_moderators($moderators, $forum_id); } + // Output forum listing if it is postable if ($forum_data['forum_postable']) { @@ -130,12 +145,12 @@ if ($forum_data['forum_postable']) ); } - $message = $user->lang['Topics_marked_read'] . '<br /><br />' . sprintf($user->lang['Click_return_forum'], '<a href="' . "viewforum.$phpEx$SID&f=$forum_id" . '">', '</a> '); + $message = $user->lang['TOPICS_MARKED_READ'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . "viewforum.$phpEx$SID&f=$forum_id" . '">', '</a> '); trigger_error($message); } - // End handle marking posts - // Do the forum Prune + + // Do the forum Prune - cron type job ... if ($config['prune_enable'] && $auth->acl_get('a_')) { if ($forum_data['prune_next'] < time() && $forum_data['prune_enable']) @@ -144,36 +159,36 @@ if ($forum_data['forum_postable']) auto_prune($forum_id); } } - // End of forum prune + // Forum rules, subscription info and word censors - $s_watching_forum = ''; - $s_watching_forum_img = ''; + $s_watching_forum = $s_watching_forum_img = ''; $notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL; watch_topic_forum('forum', $s_watching_forum, $s_watching_forum_img, $user->data['user_id'], $forum_id, $notify_status); $s_forum_rules = ''; - get_forum_rules('forum', $s_forum_rules, $forum_id); + gen_forum_rules('forum', $forum_id); - // Grab censored words $censors = array(); obtain_word_list($censors); - - // Topic ordering options - $previous_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'], 364 => $user->lang['1_YEAR']); + $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'], 364 => $user->lang['1_YEAR']); + $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']); - $sort_by = array('a' => 'u.username', 't' => 't.topic_last_post_id', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); + $sort_by_sql = array('a' => 't.topic_last_poster_name', 't' => 't.topic_last_post_id', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); + + gen_sort_selects($limit_days, $sort_by_text, $s_limit_days, $s_sort_key, $s_sort_dir); - $sort_days = $topic_days = ''; - if (isset($_POST['sort'])) + + // Limit topics to certain time frame, obtain correct topic count + $topic_days = ''; + if (isset($_REQUEST['sort'])) { - if (!empty($_POST['sort_days'])) + if ($sort_days) { - $sort_days = intval($_POST['sort_days']); - $min_topic_time = time() - ( $sort_days * 86400 ); + $min_topic_time = time() - ($sort_days * 86400); // ref type on as rows as topics ... also not great $sql = "SELECT COUNT(topic_id) AS forum_topics @@ -197,43 +212,20 @@ if ($forum_data['forum_postable']) $limit_topics_time = ''; } - $sort_order = $sort_by[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); - - $select_sort_days = '<select name="sort_days">'; - foreach ($previous_days as $day => $text) - { - $selected = ($sort_days == $day) ? ' selected="selected"' : ''; - $select_sort_days .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>'; - } - $select_sort_days .= '</select>'; - - $select_sort = '<select name="sort_key">'; - foreach ($sort_by_text as $key => $text) - { - $selected = ($sort_key == $key) ? ' selected="selected"' : ''; - $select_sort .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>'; - } - $select_sort .= '</select>'; - - $select_sort_dir = '<select name="sort_dir">'; - $select_sort_dir .= ($sort_dir == 'a') ? '<option value="a" selected="selected">' . $user->lang['ASCENDING'] . '</option><option value="d">' . $user->lang['DESCENDING'] . '</option>' : '<option value="a">' . $user->lang['ASCENDING'] . '</option><option value="d" selected="selected">' . $user->lang['DESCENDING'] . '</option>'; - $select_sort_dir .= '</select>'; - - - - $post_alt = (intval($forum_data['forum_status']) == ITEM_LOCKED) ? 'Forum_locked' : 'Post_new_topic'; - + // Select the sort order + $sort_order_sql = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); // Basic pagewide vars + $post_alt = (intval($forum_data['forum_status']) == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'POST_NEW_TOPIC'; + $template->assign_vars(array( - 'S_IS_POSTABLE' => TRUE, - 'POST_IMG' => (intval($forum_data['forum_status']) == ITEM_LOCKED) ? $user->img('post_locked', $post_alt) : $user->img('post_new', $post_alt), - 'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&f=$forum_id&topicdays=$topic_days", $topics_count, $config['topics_per_page'], $start), - 'PAGE_NUMBER' => sprintf($user->lang['PAGE_OF'], (floor( $start / $config['topics_per_page'] ) + 1), ceil( $topics_count / $config['topics_per_page'] )), + 'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&f=$forum_id", $topics_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start), 'MOD_CP' => ($auth->acl_gets('m_', 'a_', $forum_id)) ? sprintf($user->lang['MCP'], '<a href="mcp.' . $phpEx . '?sid=' . $user->session_id . '&f=' . $forum_id . '">', '</a>') : '', - 'MODERATORS' => (!empty($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : $user->lang['NONE'], + 'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : $user->lang['NONE'], + 'POST_IMG' => (intval($forum_data['forum_status']) == ITEM_LOCKED) ? $user->img('post_locked', $post_alt) : $user->img('post_new', $post_alt), 'FOLDER_IMG' => $user->img('folder', 'NO_NEW_POSTS'), 'FOLDER_NEW_IMG' => $user->img('folder_new', 'NEW_POSTS'), 'FOLDER_HOT_IMG' => $user->img('folder_hot', 'NO_NEW_POSTS_HOT'), @@ -243,80 +235,68 @@ if ($forum_data['forum_postable']) 'FOLDER_STICKY_IMG' => $user->img('folder_sticky', 'POST_STICKY'), 'FOLDER_STICKY_NEW_IMG' => $user->img('folder_sticky_new', 'POST_STICKY'), 'FOLDER_ANNOUNCE_IMG' => $user->img('folder_announce', 'POST_ANNOUNCEMENT'), - 'FOLDER_ANNOUNCE_NEW_IMG' => $user->img('folder_announce_new', 'POST_ANNOUNCEMENT'), + 'FOLDER_ANNOUNCE_NEW_IMG'=> $user->img('folder_announce_new', 'POST_ANNOUNCEMENT'), - 'L_NO_TOPICS' => ( $forum_data['forum_status'] == ITEM_LOCKED ) ? $user->lang['Forum_locked'] : $user->lang['No_topics_post_one'], + 'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LOCKED'] : $user->lang['NO_TOPICS'], + 'S_IS_POSTABLE' => TRUE, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS'=> $s_limit_days, 'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false, - 'S_SELECT_SORT_DIR' => $select_sort_dir, - 'S_SELECT_SORT_KEY' => $select_sort, - 'S_SELECT_SORT_DAYS'=> $select_sort_days, - 'S_AUTH_LIST' => $s_forum_rules, 'S_WATCH_FORUM' => $s_watching_forum, 'S_FORUM_ACTION' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . "&start=$start", 'U_POST_NEW_TOPIC' => 'posting.' . $phpEx . $SID . '&mode=post&f=' . $forum_id, - 'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&mode=moderators&f=' . $forum_id, 'U_MARK_READ' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '&mark=topics') ); - // Grab icons $icons = array(); obtain_icons($icons); - - // Grab all the basic data. If we're not on page 1 we also grab any - // announcements that may exist. + // Grab all topic data $total_topics = 0; $topics_list = ''; - $topic_rowset = array(); - - if (empty($forum_data['topics_list'])) - { - $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, lr.lastread_time, lr.lastread_type - FROM " . TOPICS_TABLE . " t - LEFT JOIN " . LASTREAD_TABLE . " lr ON ( - lr.user_id = " . $user->data['user_id'] . " - AND t.topic_id=lr.topic_id) - , " . USERS_TABLE . " u, " . USERS_TABLE . " u2 - WHERE t.forum_id = $forum_id + $row_ary = array(); + +// if (empty($forum_data['topics_list'])) +// { + $sql = 'SELECT t.*, lr.lastread_time, lr.lastread_type + FROM (' . TOPICS_TABLE . ' t + LEFT JOIN ' . LASTREAD_TABLE . ' lr ON lr.topic_id = t.topic_id + AND lr.user_id = ' . $user->data['user_id'] . ") + WHERE t.forum_id = $forum_id AND t.topic_type = " . POST_ANNOUNCE . " - AND u.user_id = t.topic_poster - AND u2.user_id = t.topic_last_poster_id - ORDER BY $sort_order + ORDER BY $sort_order_sql LIMIT " . $config['topics_per_page']; $result = $db->sql_query($sql); - while( $row = $db->sql_fetchrow($result) ) + while($row = $db->sql_fetchrow($result)) { - $topics_list .= '.' . str_pad(base_convert($row['topic_id'], 10, 36), 5, '0', STR_PAD_LEFT); - $topic_rowset[] = $row; +// $topics_list .= '.' . str_pad(base_convert($row['topic_id'], 10, 36), 5, '0', STR_PAD_LEFT); + $row_ary[] = $row; $total_topics++; } $db->sql_freeresult($result); - $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, lr.lastread_time, lr.lastread_type - FROM " . TOPICS_TABLE . " t - LEFT JOIN " . LASTREAD_TABLE . " lr ON ( - lr.user_id = " . $user->data['user_id'] . " - AND t.topic_id=lr.topic_id) - , " . USERS_TABLE . " u, " . USERS_TABLE . " u2 - WHERE t.forum_id = $forum_id - AND t.topic_approved = 1 - AND u.user_id = t.topic_poster - AND u2.user_id = t.topic_last_poster_id + $sql = 'SELECT t.*, lr.lastread_time, lr.lastread_type + FROM (' . TOPICS_TABLE . ' t + LEFT JOIN ' . LASTREAD_TABLE . ' lr ON lr.topic_id = t.topic_id + AND lr.user_id = ' . $user->data['user_id'] . ") + WHERE t.forum_id = $forum_id + AND t.topic_approved = 1 $limit_topics_time - ORDER BY t.topic_type DESC, $sort_order + ORDER BY t.topic_type DESC, $sort_order_sql LIMIT $start, " . $config['topics_per_page']; - } +/* } else { -/* + $topic_ids = array(); - preg_match_all('/.{5,5}/', $forum_data['topics_list'], $m); + preg_match_all('/.{5,5}/', $forum_data['topics_list'], $m);// explode('.' ? foreach ($m[0] as $topic_id) { $topic_ids[] = base_convert($topic_id, 36, 10); @@ -328,45 +308,41 @@ if ($forum_data['forum_postable']) AND u.user_id = t.topic_poster AND u2.user_id = t.topic_last_poster_id ORDER BY $sort_order"; -*/ - } - + }*/ $result = $db->sql_query($sql); - while( $row = $db->sql_fetchrow($result) ) + + while($row = $db->sql_fetchrow($result)) { - $topics_list .= str_pad(base_convert($row['topic_id'], 10, 36), 5, '0', STR_PAD_LEFT); - $topic_rowset[] = $row; +// $topics_list .= str_pad(base_convert($row['topic_id'], 10, 36), 5, '0', STR_PAD_LEFT); + $row_ary[] = $row; $total_topics++; } $db->sql_freeresult($result); +/* if (empty($forum_data['topics_list']) && !empty($topics_list)) { -// $sql = 'INSERT INTO ' . TOPICS_PREFETCH_TABLE . " (forum_id, start, sort_key, sort_dir, topics_list) -// VALUES ($forum_id, $start, '$sort_key', '$sort_dir', '$topics_list')"; -// $db->sql_query($sql); + $sql = 'INSERT INTO ' . TOPICS_PREFETCH_TABLE . " (forum_id, start, sort_key, sort_dir, topics_list) + VALUES ($forum_id, $start, '$sort_key', '$sort_dir', '$topics_list')"; + $db->sql_query($sql); } - - +*/ // Okay, lets dump out the page ... if ($total_topics) { $i = 0; - foreach ($topic_rowset as $topic_row) + foreach ($row_ary as $row) { - $topic_id = $topic_row['topic_id']; - $replies = $topic_row['topic_replies']; - - $topic_title = (!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $topic_row['topic_title']) : $topic_row['topic_title']; + $topic_id = $row['topic_id']; // Type and folder $topic_type = ''; - if ($topic_row['topic_status'] == ITEM_MOVED) + if ($row['topic_status'] == ITEM_MOVED) { - $topic_type = $user->lang['Topic_Moved'] . ' '; - $topic_id = $topic_row['topic_moved_id']; + $topic_type = $user->lang['TOPIC_MOVED'] . ' '; + $topic_id = $row['topic_moved_id']; $folder_image = 'folder'; $folder_alt = 'Topic_Moved'; @@ -374,22 +350,25 @@ if ($forum_data['forum_postable']) } else { - switch ($topic_row['topic_type']) + switch ($row['topic_type']) { case POST_ANNOUNCE: - $topic_type = $user->lang['Topic_Announcement'] . ' '; + $topic_type = $user->lang['TOPIC_ANNOUNCEMENT'] . ' '; $folder = 'folder_announce'; $folder_new = 'folder_announce_new'; break; + case POST_STICKY: - $topic_type = $user->lang['Topic_Sticky'] . ' '; + $topic_type = $user->lang['TOPIC_STICKY'] . ' '; $folder = 'folder_sticky'; $folder_new = 'folder_sticky_new'; break; + case ITEM_LOCKED: $folder = 'folder_locked'; $folder_new = 'folder_locked_new'; break; + default: if ($replies >= intval($config['hot_threshold'])) { @@ -405,34 +384,38 @@ if ($forum_data['forum_postable']) } $unread_topic = true; - if ($user->data['user_id'] != ANONYMOUS - && - ( $topic_row['topic_last_post_time'] <= $topic_row['lastread_time'] - || $topic_row['topic_last_post_time'] < (time()-$config['lastread']) - || $topic_row['topic_last_post_time'] < $forum_row['lastread_time'] - ) - ) + if ($user->data['user_id'] != ANONYMOUS && + ($row['topic_last_post_time'] <= $row['lastread_time'] || + $row['topic_last_post_time'] < (time() - $config['lastread']) || + $row['topic_last_post_time'] < $forum_row['lastread_time']) + ) { $unread_topic = false; } - $newest_post_img = ($unread_topic) ? '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&view=newest#newest">' . $user->img('goto_post_newest', 'View_newest_post') . '</a> ' : ''; + + $newest_post_img = ($unread_topic) ? '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&view=newest">' . $user->img('goto_post_newest', 'VIEW_NEWEST_POST') . '</a> ' : ''; $folder_img = ($unread_topic) ? $folder_new : $folder; - $folder_alt = ($unread_topic) ? 'New_posts' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'Topic_locked' : 'No_new_posts'); + $folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS'); - if ($topic_row['lastread_type'] == LASTREAD_POSTED) + + if ($row['lastread_type'] == LASTREAD_POSTED) { $folder_img .= '_posted'; } } - if (intval($topic_row['poll_start'])) + + if (intval($row['poll_start'])) { $topic_type .= $user->lang['Topic_Poll'] . ' '; } - // Goto message - if (($replies + 1 ) > intval($config['posts_per_page'])) + + // Goto message generation + $replies = $row['topic_replies']; + + if (($replies + 1) > intval($config['posts_per_page'])) { $total_pages = ceil(($replies + 1) / intval($config['posts_per_page'])); $goto_page = ' [ ' . $user->img('goto_post', 'GOTO_PAGE') . $user->lang['GOTO_PAGE'] . ': '; @@ -460,43 +443,45 @@ if ($forum_data['forum_postable']) $goto_page = ''; } + // Generate all the URIs ... $view_topic_url = 'viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id; - $topic_author = ($topic_row['user_id'] != ANONYMOUS) ? '<a href="ucp.' . $phpEx . $SID . '&mode=viewprofile&u=' . $topic_row['user_id'] . '">' : ''; - $topic_author .= ($topic_row['user_id'] != ANONYMOUS) ? $topic_row['username'] : (($topic_row['topic_first_poster_name'] != '') ? $topic_row['topic_first_poster_name'] : $user->lang['GUEST']); + $last_post_img = '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('goto_post_latest', 'VIEW_LATEST_POST') . '</a>'; - $topic_author .= ($topic_row['user_id'] != ANONYMOUS) ? '</a>' : ''; + $topic_author = ($row['topic_poster'] != ANONYMOUS) ? '<a href="ucp.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['topic_poster'] . '">' : ''; + $topic_author .= ($row['topic_poster'] != ANONYMOUS) ? $row['topic_first_poster_name'] : (($row['topic_first_poster_name'] != '') ? $row['topic_first_poster_name'] : $user->lang['GUEST']); + $topic_author .= ($row['topic_poster'] != ANONYMOUS) ? '</a>' : ''; - $first_post_time = $user->format_date($topic_row['topic_time'], $config['board_timezone']); + $last_post_author = ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : '<a href="ucp.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['topic_last_poster_id'] . '">' . $row['topic_last_poster_name'] . '</a>'; - $last_post_time = $user->format_date($topic_row['topic_last_post_time']); + $first_post_time = $user->format_date($row['topic_time'], $config['board_timezone']); - $last_post_author = ($topic_row['id2'] == ANONYMOUS) ? (($topic_row['topic_last_poster_name'] != '') ? $topic_row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : '<a href="ucp.' . $phpEx . $SID . '&mode=viewprofile&u=' . $topic_row['topic_last_poster_id'] . '">' . $topic_row['user2'] . '</a>'; + $last_post_time = $user->format_date($row['topic_last_post_time']); - $last_post_url = '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&p=' . $topic_row['topic_last_post_id'] . '#' . $topic_row['topic_last_post_id'] . '">' . $user->img('goto_post_latest', 'VIEW_LATEST_POST') . '</a>'; // Send vars to template $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, - 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_AUTHOR' => $topic_author, - 'NEWEST_POST_IMG' => $newest_post_img, 'FIRST_POST_TIME' => $first_post_time, 'LAST_POST_TIME' => $last_post_time, 'LAST_POST_AUTHOR' => $last_post_author, - 'LAST_POST_IMG' => $last_post_url, - 'GOTO_PAGE' => $goto_page, - 'REPLIES' => $topic_row['topic_replies'], - 'VIEWS' => $topic_row['topic_views'], - 'TOPIC_TITLE' => $topic_title, + 'GOTO_PAGE' => $goto_page, + 'REPLIES' => $row['topic_replies'], + 'VIEWS' => $row['topic_views'], + 'TOPIC_TITLE' => (!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $row['topic_title']) : $row['topic_title'], 'TOPIC_TYPE' => $topic_type, - 'TOPIC_ICON' => (!empty($icons[$topic_row['icon_id']]) ) ? '<img src="' . $config['icons_path'] . '/' . $icons[$topic_row['icon_id']]['img'] . '" width="' . $icons[$topic_row['icon_id']]['width'] . '" height="' . $icons[$topic_row['icon_id']]['height'] . '" alt="" title="" />' : '', + + 'LAST_POST_IMG' => $last_post_img, + 'NEWEST_POST_IMG' => $newest_post_img, + 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), + 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '', 'S_ROW_COUNT' => $i, - 'S_TOPIC_TYPE' => $topic_type, - 'S_USER_POSTED' => ($topic_row['lastread_type'] == LASTREAD_POSTED) ? true : false, + 'S_TOPIC_TYPE' => $row['topic_type'], + 'S_USER_POSTED' => ($row['lastread_type'] == LASTREAD_POSTED) ? true : false, 'U_VIEW_TOPIC' => $view_topic_url) ); @@ -505,31 +490,33 @@ if ($forum_data['forum_postable']) } } + if ($user->data['user_id'] != ANONYMOUS) { // $mark_topics isn't set as of now //setcookie($config['cookie_name'] . '_t', serialize($mark_topics), 0, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']); } - - } + // Mozilla navigation links $nav_links['up'] = array( 'url' => 'index.' . $phpEx . $SID, - 'title' => sprintf($user->lang['Forum_Index'], $config['sitename']) + 'title' => sprintf($user->lang['FORUM_INDEX'], $config['sitename']) ); -// Dump out the page header and load viewforum template -$page_title = $user->lang['View_forum'] . ' - ' . $forum_data['forum_name']; +// Dump out the page header and load viewforum template +$page_title = $user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); + $template->set_filenames(array( 'body' => 'viewforum_body.html') ); make_jumpbox("viewforum.$phpEx$SID", $forum_id); + include($phpbb_root_path . 'includes/page_tail.'.$phpEx); ?>
\ No newline at end of file |