Fix bug #487951 but mass email needs some other additions, notes are in file ...

git-svn-id: file:///svn/phpbb/trunk@1498 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-12-03 00:11:18 +00:00
parent 6432e3dd27
commit 5fc368388f
2 changed files with 76 additions and 62 deletions

View file

@ -19,11 +19,6 @@
*
***************************************************************************/
/***************************************************************************
Mass Mailings can be used by admin to mail either the entire board or
all members of a specific group.
***************************************************************************/
if($setmodules == 1)
{
$filename = basename(__FILE__);
@ -45,12 +40,12 @@ require('pagestart.inc');
//
@set_time_limit(1200);
//
// Set form names
//
$f_title = 'e_title';
$f_msg = 'e_msg';
$message = "";
$subject = "";
//
// Do the job ...
//
if( isset($HTTP_POST_VARS['submit']) )
{
$group_id = intval($HTTP_POST_VARS[POST_GROUPS_URL]);
@ -58,9 +53,10 @@ if( isset($HTTP_POST_VARS['submit']) )
if( $group_id != -1 )
{
$sql = "SELECT u.user_email
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " g
WHERE u.user_id = g.user_id
AND g.group_id = $group_id";
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id
AND ug.user_pending <> " . TRUE . "
AND u.user_id = ug.user_id";
}
else
{
@ -72,11 +68,28 @@ if( isset($HTTP_POST_VARS['submit']) )
{
message_die(GENERAL_ERROR, "Coult not select group members!", __LINE__, __FILE__, $sql);
}
if( !$db->sql_numrows($result) )
{
//
// Output a relevant GENERAL_MESSAGE about users/group
// not existing
//
}
$email_list = $db->sql_fetchrowset($g_result);
$subject = stripslashes($HTTP_POST_VARS["$f_title"]);
$message = stripslashes($HTTP_POST_VARS["$f_msg"]);
$subject = stripslashes($HTTP_POST_VARS["subject"]);
$message = stripslashes($HTTP_POST_VARS["message"]);
//
// Error checking needs to go here ... if no subject and/or
// no message then skip over the send and return to the form
//
$error = FALSE;
if( !$error )
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
@ -119,7 +132,7 @@ if( isset($HTTP_POST_VARS['submit']) )
$message = $lang['Email_sent'] . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
}
//
@ -152,6 +165,9 @@ $template->set_filenames(array(
);
$template->assign_vars(array(
"MESSAGE" => $message,
"SUBJECT" => $subject,
"L_EMAIL_TITLE" => $lang['Email'],
"L_EMAIL_EXPLAIN" => $lang['Mass_email_explain'],
"L_COMPOSE" => $lang['Compose'],
@ -162,9 +178,7 @@ $template->assign_vars(array(
"L_NOTICE" => $notice,
"S_USER_ACTION" => append_sid('admin_mass_email.'.$phpEx),
"S_GROUP_SELECT" => $select_list,
"S_EMAIL_SUBJECT" => $f_title,
"S_EMAIL_MSG" => $f_msg)
"S_GROUP_SELECT" => $select_list)
);
$template->pparse('body');

View file

@ -13,11 +13,11 @@
</tr>
<tr>
<td class="row1" align="right"><b>{L_EMAIL_SUBJECT}</b></td>
<td class="row2"><span class="gen"><input type="text" name="{S_EMAIL_SUBJECT}" size="45" maxlength="100" style="width:450px" tabindex="2" class="post" /></span></td>
<td class="row2"><span class="gen"><input type="text" name="subject" size="45" maxlength="100" tabindex="2" class="post" value="{SUBJECT}" /></span></td>
</tr>
<tr>
<td class="row1" align="right" valign="top"> <span class="gen"><b>{L_EMAIL_MSG}</b></span>
<td class="row2"><span class="gen"> <textarea name="{S_EMAIL_MSG}" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post"></textarea></span>
<td class="row2"><span class="gen"> <textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post">{MESSAGE}</textarea></span>
</tr>
<tr>
<td class="catBottom" align="center" colspan="2"><input type="submit" value="{L_EMAIL}" name="submit" class="mainoption" /></td>