Notify on reply now supposedly fully functional

git-svn-id: file:///svn/phpbb/trunk@865 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-08-14 13:37:28 +00:00
parent 22471c9e1e
commit 07028bc04f
4 changed files with 52 additions and 20 deletions

View file

@ -4,4 +4,8 @@ You are receiving this email because you are watching the topic, "{TOPIC_TITLE}"
{TOPIC_URL} {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} {EMAIL_SIG}

View file

@ -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']; $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; $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'] != "") 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->use_template("topic_notify");
$emailer->email_address($email_set[$i]['user_email']); $emailer->email_address($email_set[$i]['user_email']);
$emailer->set_subject($lang['Topic_reply_notification']); $emailer->set_subject($lang['Topic_reply_notification']);
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$path = (dirname($HTTP_SERVER_VARS['REQUEST_URI']) == "/") ? "" : dirname($HTTP_SERVER_VARS['REQUEST_URI']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
"USERNAME" => $email_set[$i]['username'], "USERNAME" => $email_set[$i]['username'],
"SITENAME" => $board_config['sitename'], "SITENAME" => $board_config['sitename'],
"TOPIC_TITLE" => $email_set[$i]['topic_title'], "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']) "EMAIL_SIG" => $board_config['board_email'])
); );
@ -582,11 +608,11 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
// Handle notification request ... not complete // Handle notification request ... not complete
// only fully functional for new posts // only fully functional for new posts
// //
if( !empty($notify) ) if( isset($notify) )
{ {
if($mode == "reply") if($mode == "reply")
{ {
$sql = "SELECT notify_status $sql = "SELECT *
FROM " . TOPICS_WATCH_TABLE . " FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $new_topic_id WHERE topic_id = $new_topic_id
AND user_id = " . $userdata['user_id']; AND user_id = " . $userdata['user_id'];
@ -599,11 +625,23 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
{ {
if( !$notify ) 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 ) 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 ) else if( $notify )
@ -1378,14 +1416,6 @@ if( $user_sig != "" )
$template->assign_block_vars("signature_checkbox", array()); $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 // Delete selection
// //

View file

@ -31,11 +31,11 @@ function insertCode(formObj, selectObj)
<td class="row2"><span class="courier"><input type="text" name="subject" size="50" maxlength="100" value="{SUBJECT}" /></span></td> <td class="row2"><span class="courier"><input type="text" name="subject" size="50" maxlength="100" value="{SUBJECT}" /></span></td>
</tr> </tr>
<tr> <tr>
<td class="row1"><span class="gen"><b>{L_MESSAGE_BODY}</b></span><br><br><span class="gensmall">{L_HTML_IS} <u>{HTML_STATUS}</u><br />{L_BBCODE_IS} <u>{BBCODE_STATUS}</u><br />{L_SMILIES_ARE} <u>{SMILIES_STATUS}</u></span></td> <td class="row1"><span class="gen"><b>{L_MESSAGE_BODY}</b></span><br /><br /><span class="gensmall">{L_HTML_IS} <u>{HTML_STATUS}</u><br />{L_BBCODE_IS} <u>{BBCODE_STATUS}</u><br />{L_SMILIES_ARE} <u>{SMILIES_STATUS}</u></span></td>
<td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0"> <td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td><span class="gen"><textarea name="message" rows="10" cols="45" wrap="virtual">{MESSAGE}</textarea></span></td> <td><span class="courier"><textarea name="message" rows="10" cols="45" wrap="virtual">{MESSAGE}</textarea></span></td>
<td valign="top">&nbsp;<span class="gensmall">BBcodes:</span><br><span class="couriersmall"><select class="small" name="addbbcode" size="6" onchange="insertCode(this.form, this);"> <option value="[b][/b]">[b] [/b]</option> <option value="[i][/i]">[i] [/i]</option> <option value="[quote][/quote]">[quote] [/quote]</option> <option value="[code][/code]">[code] [/code]</option> <option value="[list][/list]">[list] [/list]</option> <option value="[list=][/list]">[list=] [/list]</option> <option value="[img][/img]">[img] [/img]</option> <option value="[url][/url]">[url] [/url]</option></select></span> <br clear="all" />&nbsp;<span class="gensmall">Smiley codes:</span><br><span class="couriersmall"><select class="small" name="addsmiley" size="1" onchange="insertCode(this.form, this);"> <option value=":)">Smiley</option> </option> <option value=";)">Wink</option> <option value=":d">Big Grin</option> <option value=":lol:">Laugh Out Loud</option> <option value=":(">Sad</option> <option value=":o">Eek!</option> <option value=":">Eek!</option> <option value=":oops:">Opps!</option> <option value="8)">Cool</option> <option value=":?">Confused</option> <option value=":roll:">Rolling Eyes</option> <option value=":p">Razz</option> <option value=":x">Mad</option> <option value=":|">Neutral</option> <option value=":!:">Exclamation</option> <option value=":?:">Question</option> <option value=":idea:">Idea</option> <option value=":arrow:">Arrow</option></select></span></td> <td valign="top">&nbsp;<span class="gensmall">BBcodes:</span><br /><span class="couriersmall"><select class="small" name="addbbcode" size="6" onchange="insertCode(this.form, this);"> <option value="[b][/b]">[b] [/b]</option> <option value="[i][/i]">[i] [/i]</option> <option value="[quote][/quote]">[quote] [/quote]</option> <option value="[code][/code]">[code] [/code]</option> <option value="[list][/list]">[list] [/list]</option> <option value="[list=][/list]">[list=] [/list]</option> <option value="[img][/img]">[img] [/img]</option> <option value="[url][/url]">[url] [/url]</option></select></span> <br clear="all" />&nbsp;<span class="gensmall">Smiley codes:</span><br /><span class="couriersmall"><select class="small" name="addsmiley" size="1" onchange="insertCode(this.form, this);"> <option value=":)">Smiley</option> </option> <option value=";)">Wink</option> <option value=":d">Big Grin</option> <option value=":lol:">Laugh Out Loud</option> <option value=":(">Sad</option> <option value=":o">Eek!</option> <option value=":">Eek!</option> <option value=":oops:">Opps!</option> <option value="8)">Cool</option> <option value=":?">Confused</option> <option value=":roll:">Rolling Eyes</option> <option value=":p">Razz</option> <option value=":x">Mad</option> <option value=":|">Neutral</option> <option value=":!:">Exclamation</option> <option value=":?:">Question</option> <option value=":idea:">Idea</option> <option value=":arrow:">Arrow</option></select></span></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
@ -66,12 +66,10 @@ function insertCode(formObj, selectObj)
<td><span class="gen">{L_ATTACH_SIGNATURE}</span></td> <td><span class="gen">{L_ATTACH_SIGNATURE}</span></td>
</tr> </tr>
<!-- END signature_checkbox --> <!-- END signature_checkbox -->
<!-- BEGIN notify_checkbox -->
<tr> <tr>
<td><input type="checkbox" name="notify" {S_NOTIFY_CHECKED} /></td> <td><input type="checkbox" name="notify" {S_NOTIFY_CHECKED} /></td>
<td><span class="gen">{L_NOTIFY_ON_REPLY}</span></td> <td><span class="gen">{L_NOTIFY_ON_REPLY}</span></td>
</tr> </tr>
<!-- END notify_checkbox -->
<!-- BEGIN delete_checkbox --> <!-- BEGIN delete_checkbox -->
<tr> <tr>
<td><input type="checkbox" name="delete" /></td> <td><input type="checkbox" name="delete" /></td>

View file

@ -11,7 +11,7 @@
<tr> <tr>
<th>&nbsp;{L_MESSAGE}&nbsp;</th> <th>&nbsp;{L_MESSAGE}&nbsp;</th>
</tr> </tr>
<tr bgcolor="{ROW_COLOR}"> <tr bgcolor="{T_TD_COLOR1}">
<td height="100%"><table width="100%" height="100%" cellspacing="1" cellpadding="0" border="0"> <td height="100%"><table width="100%" height="100%" cellspacing="1" cellpadding="0" border="0">
<tr> <tr>
<td><img src="images/icon_minipost.gif" alt="Post image icon" /><span class="gensmall">{L_POSTED}: {POST_DATE}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Post Subject: {POST_SUBJECT}</span><hr /></td> <td><img src="images/icon_minipost.gif" alt="Post image icon" /><span class="gensmall">{L_POSTED}: {POST_DATE}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Post Subject: {POST_SUBJECT}</span><hr /></td>