Topic icons and the "self post star" are displayed now.

This commit is contained in:
Kevin
2008-08-16 15:45:27 +00:00
parent 26c7c3202f
commit 9d9e5684c7
3 changed files with 67 additions and 44 deletions

View File

@@ -143,37 +143,32 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
$pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_announcements, $portal_config['portal_number_of_announcements'], $start, 'announcements'); $pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_announcements, $portal_config['portal_number_of_announcements'], $start, 'announcements');
} }
// Determining topic icons code borrowed from nickvergessens NV_recent_topics - http://www.flying-bits.org
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
$folder_img = $folder_alt = $topic_type = $folder = $folder_new = ''; $replies = ($auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
switch ($fetch_news[$i]['topic_type']) $folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
{ switch ($fetch_news[$i]['topic_type'])
case POST_GLOBAL: {
$topic_type = $user->lang['VIEW_TOPIC_GLOBAL']; case POST_GLOBAL:
$folder = 'global_read'; $folder = 'global_read';
$folder_new = 'global_unread'; $folder_new = 'global_unread';
break; break;
case POST_ANNOUNCE: case POST_ANNOUNCE:
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT']; $folder = 'announce_read';
$folder = 'announce_read'; $folder_new = 'announce_unread';
$folder_new = 'announce_unread'; break;
break; default:
default: $folder = 'topic_read';
$topic_type = ''; $folder_new = 'topic_unread';
$folder = 'topic_read'; if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $fetch_news[$i]['topic_status'] != ITEM_LOCKED)
$folder_new = 'topic_unread'; {
if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $fetch_news[$i]['topic_status'] != ITEM_LOCKED) $folder .= '_hot';
{ $folder_new .= '_hot';
$folder .= '_hot'; }
$folder_new .= '_hot'; break;
} }
break;
}
if ($fetch_news[$i]['topic_status'] == ITEM_LOCKED) if ($fetch_news[$i]['topic_status'] == ITEM_LOCKED)
{ {
$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
$folder .= '_locked'; $folder .= '_locked';
$folder_new .= '_locked'; $folder_new .= '_locked';
} }
@@ -181,9 +176,19 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
{ {
$global_announce_list[$fetch_news[$i]['topic_id']] = true; $global_announce_list[$fetch_news[$i]['topic_id']] = true;
} }
if ($fetch_news[$i]['topic_posted'])
{
$folder .= '_mine';
$folder_new .= '_mine';
}
$folder_img = ($unread_topic) ? $folder_new : $folder; $folder_img = ($unread_topic) ? $folder_new : $folder;
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($fetch_news[$i]['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS'); $folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($fetch_news[$i]['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
// Grab icons
$icons = $cache->obtain_icons();
$forum_data = $db->sql_fetchrow($result);
$s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false;
$template->assign_block_vars('announcements_row', array( $template->assign_block_vars('announcements_row', array(
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'FORUM_NAME' => ( $forum_id ) ? $fetch_news[$i]['forum_name'] : '', 'FORUM_NAME' => ( $forum_id ) ? $fetch_news[$i]['forum_name'] : '',
@@ -202,6 +207,9 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],
'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'), 'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'),
'TOPIC_ICON_IMG' => (!empty($icons[$fetch_news[$i]['icon_id']])) ? $icons[$fetch_news[$i]['icon_id']]['img'] : '',
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$fetch_news[$i]['icon_id']])) ? $icons[$fetch_news[$i]['icon_id']]['width'] : '',
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$fetch_news[$i]['icon_id']])) ? $icons[$fetch_news[$i]['icon_id']]['height'] : '',
'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']), 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']),
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']), 'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id), 'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id),

View File

@@ -135,24 +135,19 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
$pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_news, $portal_config['portal_number_of_news'], $start, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news'); $pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_news, $portal_config['portal_number_of_news'], $start, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
} }
// Determining topic icons code borrowed from nickvergessens NV_recent_topics - http://www.flying-bits.org $replies = ($auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies']; $folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
$folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
switch ($fetch_news[$i]['topic_type']) switch ($fetch_news[$i]['topic_type'])
{ {
case POST_STICKY: case POST_STICKY:
$topic_type = $user->lang['VIEW_TOPIC_STICKY'];
$folder = 'sticky_read'; $folder = 'sticky_read';
$folder_new = 'sticky_unread'; $folder_new = 'sticky_unread';
break; break;
case POST_ANNOUNCE: case POST_ANNOUNCE:
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
$folder = 'announce_read'; $folder = 'announce_read';
$folder_new = 'announce_unread'; $folder_new = 'announce_unread';
break; break;
default: default:
$topic_type = '';
$folder = 'topic_read'; $folder = 'topic_read';
$folder_new = 'topic_unread'; $folder_new = 'topic_unread';
if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $fetch_news[$i]['topic_status'] != ITEM_LOCKED) if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $fetch_news[$i]['topic_status'] != ITEM_LOCKED)
@@ -163,15 +158,25 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
break; break;
} }
if ($fetch_news[$i]['topic_status'] == ITEM_LOCKED) if ($fetch_news[$i]['topic_status'] == ITEM_LOCKED)
{ {
$topic_type = $user->lang['VIEW_TOPIC_LOCKED']; $folder .= '_locked';
$folder .= '_locked'; $folder_new .= '_locked';
$folder_new .= '_locked'; }
} if ($fetch_news[$i]['topic_posted'])
{
$folder .= '_mine';
$folder_new .= '_mine';
}
$folder_img = ($unread_topic) ? $folder_new : $folder;
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($fetch_news[$i]['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
// Grab icons
$icons = $cache->obtain_icons();
$forum_data = $db->sql_fetchrow($result);
$s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false;
$folder_img = ($unread_topic) ? $folder_new : $folder;
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($fetch_news[$i]['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
$template->assign_block_vars('news_row', array( $template->assign_block_vars('news_row', array(
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
@@ -190,6 +195,9 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],
'TOPIC_ICON_IMG' => (!empty($icons[$fetch_news[$i]['icon_id']])) ? $icons[$fetch_news[$i]['icon_id']]['img'] : '',
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$fetch_news[$i]['icon_id']])) ? $icons[$fetch_news[$i]['icon_id']]['width'] : '',
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$fetch_news[$i]['icon_id']])) ? $icons[$fetch_news[$i]['icon_id']]['height'] : '',
'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'), 'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'),
'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']), 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']),
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']), 'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
@@ -200,6 +208,7 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
'L_READ_FULL' => $read_full, 'L_READ_FULL' => $read_full,
'OPEN' => $open_bracket, 'OPEN' => $open_bracket,
'CLOSE' => $close_bracket, 'CLOSE' => $close_bracket,
'S_TOPIC_ICONS' => ($s_display_active && sizeof($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false),
'S_NOT_LAST' => ($i < sizeof($fetch_news) - 1) ? true : false, 'S_NOT_LAST' => ($i < sizeof($fetch_news) - 1) ? true : false,
'S_POLL' => $fetch_news[$i]['poll'], 'S_POLL' => $fetch_news[$i]['poll'],
'S_UNREAD_INFO' => $unread_topic, 'S_UNREAD_INFO' => $unread_topic,

View File

@@ -193,6 +193,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
t.topic_last_poster_name, t.topic_last_poster_name,
t.topic_last_poster_id, t.topic_last_poster_id,
t.topic_last_poster_colour, t.topic_last_poster_colour,
t.icon_id,
u.username, u.username,
u.user_id, u.user_id,
u.user_type, u.user_type,
@@ -239,6 +240,9 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
'ORDER_BY' => $topic_order, 'ORDER_BY' => $topic_order,
); );
$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']);
$sql_array['SELECT'] .= ', tp.topic_posted';
$sql = $db->sql_build_query('SELECT', $sql_array); $sql = $db->sql_build_query('SELECT', $sql_array);
if ($number_of_posts <> 0) if ($number_of_posts <> 0)
@@ -315,6 +319,8 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
'topic_id' => $row['topic_id'], 'topic_id' => $row['topic_id'],
'topic_last_post_id' => $row['post_id'], 'topic_last_post_id' => $row['post_id'],
'topic_type' => $row['topic_type'], 'topic_type' => $row['topic_type'],
'topic_posted' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
'icon_id' => $row['icon_id'],
'topic_status' => $row['topic_status'], 'topic_status' => $row['topic_status'],
'forum_id' => $row['forum_id'], 'forum_id' => $row['forum_id'],
'topic_replies' => $row['topic_replies'], 'topic_replies' => $row['topic_replies'],