Topic notification ... initial stuff

git-svn-id: file:///svn/phpbb/trunk@862 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-08-14 00:29:39 +00:00
parent 538b793e65
commit a34d5d2abb
9 changed files with 283 additions and 20 deletions

View file

@ -423,6 +423,20 @@ CREATE TABLE phpbb_topics (
);
# --------------------------------------------------------
#
# Table structure for table 'phpbb_topics_watch'
#
DROP TABLE IF EXISTS phpbb_topics_watch;
CREATE TABLE phpbb_topics_watch (
topic_id int(11),
user_id int(11),
notify_status tinyint(1) NOT NULL default '0',
PRIMARY KEY (topic_id),
KEY user_id (user_id)
);
# --------------------------------------------------------
#
# Table structure for table 'phpbb_users'

View file

@ -418,6 +418,20 @@ CREATE INDEX _phpbb_topics_index ON phpbb_topics (forum_id, topic_id);
CREATE INDEX forum_id_phpbb_topics_index ON phpbb_topics (forum_id);
/* --------------------------------------------------------
Table structure for table phpbb_topics_watch
-------------------------------------------------------- */
CREATE TABLE phpbb_topics_watch (
topic_id int4,
user_id int4,
notify_status int2 NOT NULL default '0',
CONSTRAINT phpbb_topics_watch_pkey PRIMARY KEY (topic_id),
KEY user_id (user_id)
);
CREATE INDEX _phpbb_topics_watch_index ON phpbb_topics_watch (topic_id, user_id);
CREATE INDEX forum_id_phpbb_topics_index ON phpbb_topics (forum_id);
/* --------------------------------------------------------
Table structure for table phpbb_user_group
-------------------------------------------------------- */

View file

@ -0,0 +1,7 @@
Hello {USERNAME},
You are receiving this email because you are watching the topic, "{TOPIC_TITLE}" at {SITENAME}. This topic has received a reply since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic.
{TOPIC_URL}
{EMAIL_SIG}

View file

@ -233,6 +233,9 @@ $lang['Move_topic'] = "Move this topic";
$lang['Delete_topic'] = "Delete this topic";
$lang['Split_topic'] = "Split this topic";
$lang['Stop_watching_topic'] = "Stop watching this topic";
$lang['Start_watching_topic'] = "Watch this topic for replies";
//
// Posting/Replying (Not private messaging!)
@ -287,6 +290,8 @@ $lang['to_return_forum'] = "to return to the forum";
$lang['to_view_message'] = "to view your message";
$lang['to_return_topic'] = "to return to the topic";
$lang['Topic_reply_notification'] = "Topic Reply Notification";
//
// Private Messaging
//
@ -378,6 +383,9 @@ $lang['Always_smile'] = "Always enable Smilies";
$lang['Always_html'] = "Always allow HTML";
$lang['Always_bbcode'] = "Always allow BBCode";
$lang['Always_add_sig'] = "Always attach my signature";
$lang['Always_notify'] = "Always notify me of replies";
$lang['Always_notify_explain'] = "Sends an email when someone replies to a topic you have posted in. This can be changed whenever you post";
$lang['Board_template'] = "Board Template";
$lang['Board_theme'] = "Board Theme";
$lang['Board_lang'] = "Board Language";
@ -785,7 +793,6 @@ $lang['User_admin_explain'] = "Here you can change your user's information. Do n
$lang['User_delete'] = "Delete this user";
$lang['User_delete_explain'] = "Click here to delete this user. This cannot be undone.";
$lang['User_deleted'] = "User was successfully deleted.";
//
// End
// -------------------------------------------------

View file

@ -97,7 +97,7 @@ else
$attach_sig = ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['preview']) ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : $userdata['user_attachsig'];
$notify = ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['preview']) ) ? ( ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0 ) : $userdata['always_notify'];
$notify = ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['preview']) ) ? ( ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0 ) : $userdata['user_notify'];
$preview = (isset($HTTP_POST_VARS['preview'])) ? TRUE : 0;
@ -518,6 +518,105 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
if($db->sql_query($sql, END_TRANSACTION))
{
setcookie('phpbb2_' . $forum_id . '_' . $new_topic_id, '', time() - 1, $cookiepath, $cookiedomain, $cookiesecure);
//
// Email users who are watching this topic
//
if($mode == "reply")
{
$sql = "SELECT u.user_id, u.username, u.user_email, t.topic_title
FROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
WHERE tw.topic_id = $new_topic_id
AND tw.user_id <> " . $userdata['user_id'] . "
AND tw.user_id <> " . ANONYMOUS . "
AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
AND t.topic_id = tw.topic_id
AND u.user_id = tw.user_id";
if( $result = $db->sql_query($sql) )
{
$email_set = $db->sql_fetchrowset($result);
$update_watched_sql = "";
for($i = 0; $i < count($email_set); $i++)
{
if($email_set[$i]['user_email'] != "")
{
$email_headers = "From: " . $board_config['board_email_from'] . "\r\n";
$emailer->use_template("topic_notify");
$emailer->email_address($email_set[$i]['user_email']);
$emailer->set_subject($lang['Topic_reply_notification']);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
"USERNAME" => $email_set[$i]['username'],
"SITENAME" => $board_config['sitename'],
"TOPIC_TITLE" => $email_set[$i]['topic_title'],
"TOPIC_URL" => "http://" . $SERVER_NAME . "/viewtopic.$phpEx?" . POST_TOPIC_URL . "=$new_topic_id",
"EMAIL_SIG" => $board_config['board_email'])
);
$emailer->send();
$emailer->reset();
if($update_watched_sql != "")
{
$update_watched_sql .= " OR ";
}
$update_watched_sql .= "user_id = " . $email_set[$i]['user_id'];
}
}
if($update_watched_sql != "")
{
$sql = "UPDATE " . TOPICS_WATCH_TABLE . "
SET notify_status = " . TOPIC_WATCH_NOTIFIED . "
WHERE topic_id = $new_topic_id
AND $update_watched_sql";
$db->sql_query($sql);
}
}
}
//
// Handle notification request ... not complete
// only fully functional for new posts
//
if( !empty($notify) )
{
if($mode == "reply")
{
$sql = "SELECT notify_status
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $new_topic_id
AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain topic watch information", "", __LINE__, __FILE__, $sql);
}
if( $db->sql_numrows($result))
{
if( !$notify )
{
}
}
else if( $notify )
{
}
}
else if( $notify )
{
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
VALUES (" . $userdata['user_id'] . ", $new_topic_id, 0)";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert topic watch information", "", __LINE__, __FILE__, $sql);
}
}
}
//
// If we get here the post has been inserted successfully.
//
@ -555,6 +654,12 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
{
if(SQL_LAYER == "mysql")
{
$sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id = $new_post_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Error inserting data into posts text table and could not rollback", "", __LINE__, __FILE__, $sql);
}
}
// Rollback ?
message_die(GENERAL_ERROR, "Error inserting data into posts text table", "", __LINE__, __FILE__, $sql);
@ -562,9 +667,6 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
}
else
{
if(SQL_LAYER == "mysql")
{
}
// Rollback ?
message_die(GENERAL_ERROR, "Error inserting data into posts table", "", __LINE__, __FILE__, $sql);
}
@ -1165,8 +1267,6 @@ if($preview && !$error)
"preview" => "posting_preview.tpl")
);
$template->assign_vars(array(
"ROW_COLOR" => "#" . $theme['td_color1'],
"ROW_CLASS" => $theme['td_class1'],
"TOPIC_TITLE" => stripslashes($subject),
"POST_SUBJECT" => stripslashes($subject),
"POSTER_NAME" => stripslashes($username),
@ -1432,7 +1532,7 @@ $template->assign_vars(array(
"S_BBCODE_CHECKED" => (!$bbcode_on) ? "checked=\"checked\"" : "",
"S_SMILIES_CHECKED" => (!$smilies_on) ? "checked=\"checked\"" : "",
"S_SIGNATURE_CHECKED" => ($attach_sig) ? "checked=\"checked\"" : "",
"S_NOTIFY_CHECKED" => ($attach_sig) ? "checked=\"checked\"" : "",
"S_NOTIFY_CHECKED" => ($notify) ? "checked=\"checked\"" : "",
"S_TYPE_TOGGLE" => $topic_type_toggle,
"S_TOPIC_ID" => $topic_id,

View file

@ -274,6 +274,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
$viewemail = (isset($HTTP_POST_VARS['viewemail'])) ? $HTTP_POST_VARS['viewemail'] : 0;
$allowviewonline = (isset($HTTP_POST_VARS['hideonline'])) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : 1 ) : 1;
$notifyreply = (isset($HTTP_POST_VARS['notifyreply'])) ? $HTTP_POST_VARS['notifyreply'] : 0;
$notifypm = (isset($HTTP_POST_VARS['notifypm'])) ? $HTTP_POST_VARS['notifypm'] : 1;
$attachsig = (isset($HTTP_POST_VARS['attachsig'])) ? $HTTP_POST_VARS['attachsig'] : 0;
@ -668,7 +669,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
}
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '$email', user_icq = '$icq', user_website = '$website', user_occ = '$occupation', user_from = '$location', user_interests = '$interests', user_sig = '$signature', user_viewemail = $viewemail, user_aim = '$aim', user_yim = '$yim', user_msnm = '$msn', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify_pm = $notifypm, user_timezone = $user_timezone, user_dateformat = '$user_dateformat', user_lang = '$user_lang', user_template = '$user_template', user_active = $user_active, user_actkey = '$user_actkey', user_theme = $user_theme" . $avatar_sql . "
SET " . $username_sql . $passwd_sql . "user_email = '$email', user_icq = '$icq', user_website = '$website', user_occ = '$occupation', user_from = '$location', user_interests = '$interests', user_sig = '$signature', user_viewemail = $viewemail, user_aim = '$aim', user_yim = '$yim', user_msnm = '$msn', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_timezone = $user_timezone, user_dateformat = '$user_dateformat', user_lang = '$user_lang', user_template = '$user_template', user_active = $user_active, user_actkey = '$user_actkey', user_theme = $user_theme" . $avatar_sql . "
WHERE user_id = $user_id";
if($result = $db->sql_query($sql))
@ -716,8 +717,8 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
$user_id_value = "";
}
$sql = "INSERT INTO " . USERS_TABLE . " (" . $user_id_sql . "username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify_pm, user_timezone, user_dateformat, user_lang, user_template, user_theme, user_level, user_allow_pm, user_active, user_actkey)
VALUES (" . $user_id_value . "'$username', $regdate, '$password', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', '$user_template', $user_theme, 0, 1, ";
$sql = "INSERT INTO " . USERS_TABLE . " (" . $user_id_sql . "username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_template, user_theme, user_level, user_allow_pm, user_active, user_actkey)
VALUES (" . $user_id_value . "'$username', $regdate, '$password', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', '$user_template', $user_theme, 0, 1, ";
if($board_config['require_activation'] || $coppa == 1)
{
@ -766,11 +767,13 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
$emailer->set_subject($lang['Welcome_subject']);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array("WELCOME_MSG" => $lang['Welcome_subject'],
"USERNAME" => $username,
"PASSWORD" => $password_confirm,
"ACTIVATE_URL" => "http://".$SERVER_NAME.$PHP_SELF."?mode=activate&act_key=$act_key",
"EMAIL_SIG" => $board_config['board_email']));
$emailer->assign_vars(array(
"WELCOME_MSG" => $lang['Welcome_subject'],
"USERNAME" => $username,
"PASSWORD" => $password_confirm,
"ACTIVATE_URL" => "http://".$SERVER_NAME.$PHP_SELF."?mode=activate&act_key=$act_key",
"EMAIL_SIG" => $board_config['board_email'])
);
$emailer->send();
$emailer->reset();
}
@ -826,6 +829,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
$viewemail = $userdata['user_viewemail'];
$notifypm = $userdata['user_notify_pm'];
$notifyreply = $userdata['user_notify'];
$attachsig = $userdata['user_attachsig'];
$allowhtml = $userdata['user_allowhtml'];
$allowbbcode = $userdata['user_allowbbcode'];
@ -898,6 +902,8 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
"NOTIFY_PM_NO" => (!$notifypm) ? "checked=\"checked\"" : "",
"ALWAYS_ADD_SIGNATURE_YES" => ($attachsig) ? "checked=\"checked\"" : "",
"ALWAYS_ADD_SIGNATURE_NO" => (!$attachsig) ? "checked=\"checked\"" : "",
"NOTIFY_REPLY_YES" => ($notify_reply) ? "checked=\"checked\"" : "",
"NOTIFY_REPLY_NO" => (!$notify_reply) ? "checked=\"checked\"" : "",
"ALWAYS_ALLOW_BBCODE_YES" => ($allowbbcode) ? "checked=\"checked\"" : "",
"ALWAYS_ALLOW_BBCODE_NO" => (!$allowbbcode) ? "checked=\"checked\"" : "",
"ALWAYS_ALLOW_HTML_YES" => ($allowhtml) ? "checked=\"checked\"" : "",
@ -956,6 +962,8 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
"L_SIGNATURE" => $lang['Signature'],
"L_SIGNATURE_EXPLAIN" => $lang['Signature_explain'],
"L_NOTIFY_ON_REPLY" => $lang['Always_notify'],
"L_NOTIFY_ON_REPLY_EXPLAIN" => $lang['Always_notify_explain'],
"L_NOTIFY_ON_PRIVMSG" => $lang['Notify_on_privmsg'],
"L_PREFERENCES" => $lang['Preferences'],
"L_PUBLIC_VIEW_EMAIL" => $lang['Public_view_email'],

View file

@ -77,6 +77,10 @@
<td class="row1"><span class="gen">{L_HIDE_USER}:</span></td>
<td class="row2"><input type="radio" name="hideonline" value="1" {HIDE_USER_YES} /> <span class="gen">{L_YES}</span>&nbsp;&nbsp;<input type="radio" name="hideonline" value="0" {HIDE_USER_NO} /> <span class="gen">{L_NO}</span></td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_NOTIFY_ON_REPLY}:</span><br /><span class="gensmall">{L_NOTIFY_ON_REPLY_EXPLAIN}</span></td>
<td class="row2"><input type="radio" name="notifyreply" value="1" {NOTIFY_REPLY_YES} /> <span class="gen">{L_YES}</span>&nbsp;&nbsp;<input type="radio" name="notifyreply" value="0" {NOTIFY_REPLY_NO} /> <span class="gen">{L_NO}</span></td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_NOTIFY_ON_PRIVMSG}:</span></td>
<td class="row2"><input type="radio" name="notifypm" value="1" {NOTIFY_PM_YES} /> <span class="gen">{L_YES}</span>&nbsp;&nbsp;<input type="radio" name="notifypm" value="0" {NOTIFY_PM_NO} /> <span class="gen">{L_NO}</span></td>

View file

@ -76,7 +76,7 @@
<table width="98%" cellspacing="2" border="0" align="center">
<tr>
<td width="40%" valign="top" nowrap="nowrap"><form method="post" action="{S_POST_DAYS_ACTION}"><span class="gensmall">{L_DISPLAY_POSTS}:&nbsp;{S_SELECT_POST_DAYS}&nbsp;{S_SELECT_POST_ORDER}&nbsp;<input type="submit" value="{L_GO}" /></span></form><span class="gensmall"><b>{S_TIMEZONE}</b></span><br /><br />{S_TOPIC_ADMIN}</td>
<td align="right" valign="top" nowrap="nowrap">{JUMPBOX}<span class="gensmall">{S_AUTH_LIST}</span></td>
<td width="40%" valign="top" nowrap="nowrap"><form method="post" action="{S_POST_DAYS_ACTION}"><span class="gensmall">{L_DISPLAY_POSTS}:&nbsp;{S_SELECT_POST_DAYS}&nbsp;{S_SELECT_POST_ORDER}&nbsp;<input type="submit" value="{L_GO}" /></span></form><span class="gensmall"><b>{S_TIMEZONE}</b><br /><br />{S_WATCH_TOPIC}</span></td>
<td align="right" valign="top" nowrap="nowrap">{JUMPBOX}<span class="gensmall">{S_AUTH_LIST}</span><br />{S_TOPIC_ADMIN}</td>
</tr>
</table>

View file

@ -160,6 +160,92 @@ if(!$is_auth['auth_view'] || !$is_auth['auth_read'])
// End auth check
//
//
// Is user watching this thread? This could potentially
// be combined into the above query but the LEFT JOIN causes
// a number of problems which will probably end up in this
// solution being practically as fast and certainly simpler!
//
if($userdata['user_id'] != ANONYMOUS)
{
$can_watch_topic = TRUE;
$sql = "SELECT notify_status
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain topic watch information", "", __LINE__, __FILE__, $sql);
}
else if( $db->sql_numrows($result) )
{
if( isset($HTTP_GET_VARS['watch']) )
{
if( !$HTTP_GET_VARS['watch'] )
{
$is_watching_topic = 0;
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
$sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete topic watch information", "", __LINE__, __FILE__, $sql);
}
}
}
else
{
$is_watching_topic = TRUE;
$watch_data = $db->sql_fetchrow($result);
if( $watch_data['notify_status'] )
{
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
$sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . "
SET notify_status = 0
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update topic watch information", "", __LINE__, __FILE__, $sql);
}
}
}
}
else
{
if( isset($HTTP_GET_VARS['watch']) )
{
if( $HTTP_GET_VARS['watch'] )
{
$is_watching_topic = TRUE;
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
$sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert topic watch information", "", __LINE__, __FILE__, $sql);
}
}
}
else
{
$is_watching_topic = 0;
}
}
}
else
{
$can_watch_topic = 0;
$is_watching_topic = 0;
}
//
// Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed
// then get it's value, find the number of topics with dates newer than it (to properly
@ -264,7 +350,7 @@ $ranksrow = $db->sql_fetchrowset($ranksresult);
//
// Dump out the page header and load viewtopic body template
//
setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), time() + 6000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
$page_title = $lang['View_topic'] ." - $topic_title";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
@ -606,6 +692,27 @@ if( $is_auth['auth_mod'] )
$topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=split") . "\"><img src=\"" . $images['topic_mod_split'] . "\" alt = \"" . $lang['Split_topic'] . "\" border=\"0\" /></a>&nbsp;";
}
//
// Topic watch information
//
if($can_watch_topic)
{
if($is_watching_topic)
{
$s_watching_topic = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=0\">" . $lang['Stop_watching_topic'] . "</a>";
$s_watching_topic_img = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=0\"><img src=\"" . $images['Topic_un_watch'] . "\" alt=\"" . $lang['Stop_watching_topic'] . "\" border=\"0\"></a>";
}
else
{
$s_watching_topic = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=1\">" . $lang['Start_watching_topic'] . "</a>";
$s_watching_topic_img = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=1\"><img src=\"" . $images['Topic_watch'] . "\" alt=\"" . $lang['Start_watching_topic'] . "\" border=\"0\"></a>";
}
}
else
{
$s_watching_topic = "";
}
$template->assign_vars(array(
"PAGINATION" => generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start),
"ON_PAGE" => ( floor( $start / $board_config['posts_per_page'] ) + 1 ),
@ -617,7 +724,9 @@ $template->assign_vars(array(
"S_AUTH_REPLY_IMG" => $s_auth_reply_img,
"S_AUTH_EDIT_IMG" => $s_auth_edit_img,
"S_AUTH_MOD_IMG" => $s_auth_mod_img,
"S_TOPIC_ADMIN" => $topic_mod,
"S_TOPIC_ADMIN" => $topic_mod,
"S_WATCH_TOPIC" => $s_watching_topic,
"S_WATCH_TOPIC_IMG" => $s_watching_topic_img,
"L_OF" => $lang['of'],
"L_PAGE" => $lang['Page'],