diff --git a/phpBB/language/email/topic_notify_english.tpl b/phpBB/language/email/topic_notify_english.tpl index 687a819565..1280ab15d4 100644 --- a/phpBB/language/email/topic_notify_english.tpl +++ b/phpBB/language/email/topic_notify_english.tpl @@ -4,4 +4,8 @@ You are receiving this email because you are watching the topic, "{TOPIC_TITLE}" {TOPIC_URL} +If you no longer wish to watch this topic you can either click the "Stop watching this topic link" found at the bottom of the topic above, or by clicking the following link: + +{UN_WATCH_URL} + {EMAIL_SIG} \ No newline at end of file diff --git a/phpBB/posting.php b/phpBB/posting.php index 1749196fb5..243cc6d547 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -97,7 +97,30 @@ 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['user_notify']; +if($mode == "reply" && !empty($topic_id) ) +{ + if( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['preview']) ) + { + $notify = ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0; + } + else + { + $sql = "SELECT * + 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); + } + + $notify = ( $db->sql_numrows($result)) ? TRUE : 0; + } +} +else +{ + $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; @@ -541,18 +564,21 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED { if($email_set[$i]['user_email'] != "") { - $email_headers = "From: " . $board_config['board_email_from'] . "\r\n"; + $email_headers = "From: " . $board_config['board_email_from'] . "\nReturn-Path: " . $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); + $path = (dirname($HTTP_SERVER_VARS['REQUEST_URI']) == "/") ? "" : dirname($HTTP_SERVER_VARS['REQUEST_URI']); + $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", + "TOPIC_URL" => "http://" . $HTTP_SERVER_VARS['SERVER_NAME'] . $path . "/viewtopic.$phpEx?" . POST_POST_URL . "=$new_post_id#$new_post_id", + "UN_WATCH_URL" => "http://" . $HTTP_SERVER_VARS['SERVER_NAME'] . $path . "/viewtopic.$phpEx?" . POST_TOPIC_URL . "=$new_topic_id&unwatch=topic", "EMAIL_SIG" => $board_config['board_email']) ); @@ -582,11 +608,11 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED // Handle notification request ... not complete // only fully functional for new posts // - if( !empty($notify) ) + if( isset($notify) ) { if($mode == "reply") { - $sql = "SELECT notify_status + $sql = "SELECT * FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = $new_topic_id AND user_id = " . $userdata['user_id']; @@ -599,11 +625,23 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED { if( !$notify ) { - + $sql = "DELETE 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 delete topic watch information", "", __LINE__, __FILE__, $sql); + } } } 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); + } } } else if( $notify ) @@ -1378,14 +1416,6 @@ if( $user_sig != "" ) $template->assign_block_vars("signature_checkbox", array()); } -// -// Notify selection -// -if($mode == "newtopic" || $preview || ( $mode == "editpost" && $notify_show ) ) -{ - $template->assign_block_vars("notify_checkbox", array()); -} - // // Delete selection // diff --git a/phpBB/templates/PSO/posting_body.tpl b/phpBB/templates/PSO/posting_body.tpl index 79e4e6f15d..8a62866890 100644 --- a/phpBB/templates/PSO/posting_body.tpl +++ b/phpBB/templates/PSO/posting_body.tpl @@ -31,11 +31,11 @@ function insertCode(formObj, selectObj) - {L_MESSAGE_BODY}

{L_HTML_IS} {HTML_STATUS}
{L_BBCODE_IS} {BBCODE_STATUS}
{L_SMILIES_ARE} {SMILIES_STATUS}
+ {L_MESSAGE_BODY}

{L_HTML_IS} {HTML_STATUS}
{L_BBCODE_IS} {BBCODE_STATUS}
{L_SMILIES_ARE} {SMILIES_STATUS}
- - + +
 BBcodes:

 Smiley codes:
 BBcodes:

 Smiley codes:
@@ -66,12 +66,10 @@ function insertCode(formObj, selectObj) {L_ATTACH_SIGNATURE} - {L_NOTIFY_ON_REPLY} - diff --git a/phpBB/templates/PSO/posting_preview.tpl b/phpBB/templates/PSO/posting_preview.tpl index 7c4d64a108..4965b6dd2c 100644 --- a/phpBB/templates/PSO/posting_preview.tpl +++ b/phpBB/templates/PSO/posting_preview.tpl @@ -11,7 +11,7 @@  {L_MESSAGE}  - +
Post image icon{L_POSTED}: {POST_DATE}     Post Subject: {POST_SUBJECT}