<div class="postright"> <div class="postmsg"> <p><?php echo $message; ?> </p> </div> </div> <div class="clearer"></div> </div> </div> </div> <?php } else { // Does this topic have new posts ? $has_new_post = !$pun_user['is_guest'] && topic_is_new($search_set[$i]['tid'], $search_set[$i]['forum_id'], $search_set[$i]['last_post']); $icon = '<div class="icon"><div class="nosize">' . $lang_common['Normal icon'] . '</div></div>' . "\n"; $icon_text = $lang_common['Normal icon']; $item_status = ''; $icon_type = 'icon'; if ($search_set[$i]['question'] == "" || $search_set[$i]['question'] == 0) { $subject = '<a href="viewtopic.php?id=' . $search_set[$i]['tid'] . '"' . $rel . '>' . pun_htmlspecialchars($search_set[$i]['subject']) . '</a>'; $by_user = '******' . $lang_common['by'] . ' ' . pun_htmlspecialchars($search_set[$i]['poster']) . '</span>'; } else { $subject = $lang_polls['Poll'] . ': <a href="viewtopic.php?id=' . $search_set[$i]['tid'] . '"' . $rel . '>' . pun_htmlspecialchars($search_set[$i]['subject']) . '</a>'; $by_user = '******' . $lang_common['by'] . ' ' . pun_htmlspecialchars($search_set[$i]['poster']) . '</span> [ ' . pun_htmlspecialchars($search_set[$i]['question']) . ' ]'; } if ($search_set[$i]['closed'] != '0') { $icon_text = $lang_common['Closed icon']; $item_status = 'iclosed'; }
function mark_topic_read($topic_id, $forum_id, $last_post) { global $db, $pun_user; if (topic_is_new($topic_id, $forum_id, $last_post)) { $pun_user['read_topics']['t'][$topic_id] = $last_post; $db->query('UPDATE ' . $db->prefix . 'users SET read_topics=\'' . $db->escape(serialize($pun_user['read_topics'])) . '\' WHERE id=' . $pun_user['id']) or error('Unable to update read-topic data', __FILE__, __LINE__, $db->error()); } }
} if ($pun_config['o_censoring'] == '1') { $cur_topic['subject'] = censor_words($cur_topic['subject']); } if ($cur_topic['moved_to'] != 0) { $subject = $lang_forum['Moved'] . ': <a href="viewtopic.php?id=' . $cur_topic['moved_to'] . '">' . pun_htmlspecialchars($cur_topic['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . pun_htmlspecialchars($cur_topic['poster']) . '</span>'; } else { if ($cur_topic['closed'] == '0') { $subject = '<a href="viewtopic.php?id=' . $cur_topic['id'] . '">' . pun_htmlspecialchars($cur_topic['subject']) . '</a> <span>' . $lang_common['by'] . ' ' . pun_htmlspecialchars($cur_topic['poster']) . '</span>'; } else { $subject = '<a href="viewtopic.php?id=' . $cur_topic['id'] . '">' . pun_htmlspecialchars($cur_topic['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . pun_htmlspecialchars($cur_topic['poster']) . '</span>'; $icon_text = $lang_common['Closed icon']; $item_status = 'iclosed'; } } if (topic_is_new($cur_topic['id'], $fid, $cur_topic['last_post']) && !$ghost_topic) { $icon_text .= ' ' . $lang_common['New icon']; $item_status .= ' inew'; $icon_type = 'icon inew'; $subject = '<strong>' . $subject . '</strong>'; $subject_new_posts = '<span class="newtext">[ <a href="viewtopic.php?id=' . $cur_topic['id'] . '&action=new" title="' . $lang_common['New posts info'] . '">' . $lang_common['New posts'] . '</a> ]</span>'; } else { $subject_new_posts = null; } // We won't display "the dot", but we add the spaces anyway if ($pun_config['o_show_dot'] == '1') { $subject = ' ' . $subject; } if ($cur_topic['sticky'] == '1') { $subject = '<span class="stickytext">' . $lang_forum['Sticky'] . ': </span>' . $subject; $item_status .= ' isticky';
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.question FROM ' . $db->prefix . 'topics AS t LEFT JOIN ' . $db->prefix . 'posts AS p ON t.id=p.topic_id AND p.poster_id=' . $pun_user['id'] . ' WHERE t.id IN(SELECT id FROM ' . $db->prefix . 'topics WHERE forum_id=' . $id . ' ORDER BY sticky DESC, ' . ($cur_forum['sort_by'] == '1' ? 'posted' : 'last_post') . ' DESC LIMIT ' . $start_from . ', ' . $pun_user['disp_topics'] . ') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC'; break; default: $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.sticky, t.moved_to, t.question FROM ' . $db->prefix . 'topics AS t LEFT JOIN ' . $db->prefix . 'posts AS p ON t.id=p.topic_id AND p.poster_id=' . $pun_user['id'] . ' WHERE t.forum_id=' . $id . ' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.sticky, t.moved_to, t.question, p.poster_id ORDER BY sticky DESC, ' . ($cur_forum['sort_by'] == '1' ? 'posted' : 'last_post') . ' DESC LIMIT ' . $start_from . ', ' . $pun_user['disp_topics']; break; } } $result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); // If there are topics in this forum. if ($db->num_rows($result)) { while ($cur_topic = $db->fetch_assoc($result)) { $icon_text = $lang_common['Normal icon']; $item_status = ''; $icon_type = 'icon'; // Does this topic have new posts ? $has_new_post = !$pun_user['is_guest'] && topic_is_new($cur_topic['id'], $id, $cur_topic['last_post']) && $cur_topic['moved_to'] == null; // Forum 'comments' if ($is_comment_forum && !isset($_GET['forum'])) { $doc_param = get_doc_param($cur_topic['subject']); $topic_url = $doc_param[2]; $last_post_url = $topic_url; $doc = '&doc=' . $doc_param[4]; } else { $topic_url = 'viewtopic.php?id=' . $cur_topic['id'] . $show_link_to_forum; $last_post_url = 'viewtopic.php?pid=' . $cur_topic['last_post_id'] . $show_link_to_forum; $doc = ''; } if ($cur_topic['moved_to'] == null) { $last_post = '<a href="' . $last_post_url . '#p' . $cur_topic['last_post_id'] . '" rel="nofollow">' . format_time($cur_topic['last_post']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . pun_htmlspecialchars($cur_topic['last_poster']) . '</span>'; } else { $last_post = ' ';