viewtopic.php
-----8<------
~110 line
if (!$cookie['is_guest'])
$result = $db->query('SELECT t.subject, t.closed, t.sticky, t.num_replies, t.last_post_id, t.last_post, f.id, f.forum_name, f.moderators, f.closed AS forum_closed, f.admmod_only, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON t.forum_id=f.id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (s.topic_id=t.id AND s.user_id='.$cur_user['id'].') WHERE t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
$result = $db->query('SELECT t.subject, t.closed, t.sticky, t.num_replies, t.last_post_id, t.last_post, f.id, f.forum_name, f.moderators, f.closed AS forum_closed, f.admmod_only, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON t.forum_id=f.id WHERE t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
~118 line
list($subject, $closed, $sticky, $num_replies, $last_post_id, $last_post, $forum_id, $forum_name, $moderators, $forum_closed, $admmod_only, $is_subscribed) = $db->fetch_row($result);
+++ before $footer_style =.... add
// Create/Update topic view session
if($cur_user['last_visit'] < $last_post)
setcookie('puntopic_'.$last_post_id, time(), (time()+$pun_config['o_timeout_visit']), $cookie_path, $cookie_domain, $cookie_secure);
------------->8--------
viewforum.php
~165? line
---if (!$cookie['is_guest'] && $cur_topic['last_post'] > $cur_user['last_visit'] && $cur_topic['moved_to'] == null)
+++if (!$cookie['is_guest'] && new_topic($cur_topic['last_post_id'], $cur_topic['last_post']) && $cur_topic['moved_to'] == null)
index.php
~88? line
---if (!$cookie['is_guest'] && $cur_forum['last_post'] > $cur_user['last_visit'])
+++if (!$cookie['is_guest'] && new_topic($cur_forum['last_post_id'], $cur_forum['last_post']))
include/functions.php
+++
function new_topic($id, $last_post)
{
global $cur_user;
if(isset($_COOKIE['puntopic_'.$id]))
{
if($_COOKIE['puntopic_'.$id] < $last_post)
return true;
}else
{
if($cur_user['last_visit'] < $last_post)
return true;
}
return false;
}