mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
- mass email
git-svn-id: file:///svn/phpbb/trunk@5321 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
5953bd635b
commit
5c64235b6f
6 changed files with 323 additions and 278 deletions
|
@ -1,274 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package acp
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
if (!empty($setmodules))
|
|
||||||
{
|
|
||||||
$file = basename(__FILE__);
|
|
||||||
$module['GENERAL']['MASS_EMAIL'] = ($auth->acl_get('a_email')) ? "$file$SID" : '';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
|
||||||
// Include files
|
|
||||||
$phpbb_root_path = './../';
|
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
||||||
require('pagestart.' . $phpEx);
|
|
||||||
|
|
||||||
// Check permissions
|
|
||||||
if (!$auth->acl_get('a_email'))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_ADMIN']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set some vars
|
|
||||||
$message = $subject = $group_id = '';
|
|
||||||
|
|
||||||
// Do the job ...
|
|
||||||
if (isset($_POST['submit']))
|
|
||||||
{
|
|
||||||
// Error checking needs to go here ... if no subject and/or no message then skip
|
|
||||||
// over the send and return to the form
|
|
||||||
$group_id = request_var('g', 0);
|
|
||||||
$usernames = request_var('usernames', '');
|
|
||||||
$subject = preg_replace('#&(\#[0-9]+;)#', '&\1', strtr(request_var('subject', ''), array_flip(get_html_translation_table(HTML_ENTITIES))));
|
|
||||||
$message = preg_replace('#&(\#[0-9]+;)#', '&\1', strtr(request_var('message', ''), array_flip(get_html_translation_table(HTML_ENTITIES))));
|
|
||||||
$use_queue = (isset($_POST['send_immediatly'])) ? false : true;
|
|
||||||
$priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);
|
|
||||||
|
|
||||||
// NOTE: Only temporary, i do not think this is a good idea for the final code, but i have to test this more than once. ;)
|
|
||||||
$log_session= (isset($_POST['log_session'])) ? true : false;
|
|
||||||
|
|
||||||
$error = array();
|
|
||||||
if (!$subject)
|
|
||||||
{
|
|
||||||
$error[] = $user->lang['NO_EMAIL_SUBJECT'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$message)
|
|
||||||
{
|
|
||||||
$error[] = $user->lang['NO_EMAIL_MESSAGE'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sizeof($error))
|
|
||||||
{
|
|
||||||
if ($usernames)
|
|
||||||
{
|
|
||||||
$usernames = implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", explode("\n", $usernames)));
|
|
||||||
|
|
||||||
$sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang
|
|
||||||
FROM ' . USERS_TABLE . "
|
|
||||||
WHERE username IN ($usernames)
|
|
||||||
AND user_allow_massemail = 1
|
|
||||||
ORDER BY user_lang, user_notify_type, SUBSTRING(user_email FROM INSTR(user_email,'@'))";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sql = ($group_id) ? 'SELECT u.user_email, u.username, u.user_lang, u.user_jabber, u.user_notify_type FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> 1 AND u.user_id = ug.user_id AND u.user_allow_massemail = 1" : 'SELECT u.username, u.user_email, u.user_jabber, u.user_notify_type, u.user_lang FROM ' . USERS_TABLE . ' u WHERE u.user_allow_massemail = 1';
|
|
||||||
|
|
||||||
// TODO: different for other db servers?
|
|
||||||
$sql .= " ORDER BY u.user_lang, u.user_notify_type, SUBSTRING(u.user_email FROM INSTR(u.user_email,'@'))";
|
|
||||||
}
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
if (!($row = $db->sql_fetchrow($result)))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_USER']);
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$i = $j = 0;
|
|
||||||
// Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
|
|
||||||
$max_chunk_size = 50;
|
|
||||||
$email_list = array();
|
|
||||||
$old_lang = $row['user_lang'];
|
|
||||||
$old_notify_type = $row['user_notify_type'];
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (($row['user_notify'] == NOTIFY_EMAIL && $row['user_email']) ||
|
|
||||||
($row['user_notify'] == NOTIFY_IM && $row['user_jabber']) ||
|
|
||||||
($row['user_notify'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber']))
|
|
||||||
{
|
|
||||||
if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type)
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
$j++;
|
|
||||||
$old_lang = $row['user_lang'];
|
|
||||||
$old_notify_type = $row['user_notify_type'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$email_list[$j][$i]['lang'] = $row['user_lang'];
|
|
||||||
$email_list[$j][$i]['method'] = $row['user_notify_type'];
|
|
||||||
$email_list[$j][$i]['email'] = $row['user_email'];
|
|
||||||
$email_list[$j][$i]['name'] = $row['username'];
|
|
||||||
$email_list[$j][$i]['jabber'] = $row['user_jabber'];
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while ($row = $db->sql_fetchrow($result));
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// Send the messages
|
|
||||||
include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
|
|
||||||
$messenger = new messenger($use_queue);
|
|
||||||
|
|
||||||
$errored = false;
|
|
||||||
|
|
||||||
for ($i = 0; $i < sizeof($email_list); $i++)
|
|
||||||
{
|
|
||||||
$used_lang = $email_list[$i][0]['lang'];
|
|
||||||
$used_method = $email_list[$i][0]['method'];
|
|
||||||
|
|
||||||
for ($j = 0; $j < sizeof($email_list[$i]); $j++)
|
|
||||||
{
|
|
||||||
$email_row = $email_list[$i][$j];
|
|
||||||
|
|
||||||
$messenger->{((sizeof($email_list[$i]) == 1) ? 'to' : 'bcc')}($email_row['email'], $email_row['name']);
|
|
||||||
$messenger->im($email_row['jabber'], $email_row['name']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$messenger->template('admin_send_email', $used_lang);
|
|
||||||
|
|
||||||
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
|
|
||||||
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
|
|
||||||
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
|
|
||||||
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
|
|
||||||
|
|
||||||
$messenger->subject($subject);
|
|
||||||
$messenger->replyto($config['board_email']);
|
|
||||||
$messenger->set_mail_priority($priority);
|
|
||||||
|
|
||||||
$messenger->assign_vars(array(
|
|
||||||
'SITENAME' => $config['sitename'],
|
|
||||||
'CONTACT_EMAIL' => $config['board_contact'],
|
|
||||||
'MESSAGE' => $message)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!($messenger->send($used_method, $log_session)))
|
|
||||||
{
|
|
||||||
$errored = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($email_list);
|
|
||||||
|
|
||||||
$messenger->save_queue();
|
|
||||||
|
|
||||||
if ($group_id)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT group_name
|
|
||||||
FROM ' . GROUPS_TABLE . "
|
|
||||||
WHERE group_id = $group_id";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$row = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
extract($row);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Not great but the logging routine doesn't cope well with localising
|
|
||||||
// on the fly
|
|
||||||
$group_name = $user->lang['ALL_USERS'];
|
|
||||||
}
|
|
||||||
|
|
||||||
add_log('admin', 'LOG_MASS_EMAIL', $group_name);
|
|
||||||
$message = (!$errored) ? $user->lang['EMAIL_SENT'] : sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="admin_viewlogs.' . $phpEx . $SID . '&mode=critical" class="gen">', '</a>');
|
|
||||||
trigger_error($message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initial selection
|
|
||||||
$sql = 'SELECT group_id, group_type, group_name
|
|
||||||
FROM ' . GROUPS_TABLE . '
|
|
||||||
ORDER BY group_type DESC, group_name ASC';
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
|
|
||||||
if ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
$selected = ($group_id == $row['group_id']) ? ' selected="selected"' : '';
|
|
||||||
$select_list .= '<option value = "' . $row['group_id'] . '"' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="blue"' : '') . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
|
|
||||||
}
|
|
||||||
while ($row = $db->sql_fetchrow($result));
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>';
|
|
||||||
$s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
|
|
||||||
$s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>';
|
|
||||||
|
|
||||||
adm_page_header($user->lang['MASS_EMAIL']);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang['MASS_EMAIL']; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang['MASS_EMAIL_EXPLAIN']; ?></p>
|
|
||||||
|
|
||||||
<form method="post" action="<?php echo "admin_email.$phpEx$SID"; ?>" name="email"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><?php echo $user->lang['COMPOSE']; ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if (sizeof($error))
|
|
||||||
{
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="2" align="center"><span class="error"><?php echo implode('<br />', $error); ?></span></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b><?php echo $user->lang['SEND_TO_GROUP']; ?>: </b></td>
|
|
||||||
<td class="row2"><select name="g"><?php echo $select_list; ?></select></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" valign="top"><b><?php echo $user->lang['SEND_TO_USERS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SEND_TO_USERS_EXPLAIN']; ?><br />[ <a href="" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&mode=searchuser&form=email&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;"><?php echo $user->lang['FIND_USERNAME']; ?></a> ]</span></td>
|
|
||||||
<td class="row2" align="left"><textarea name="usernames" rows="5" cols="40"><?php echo $usernames; ?></textarea></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1"><b><?php echo $user->lang['SUBJECT']; ?>: </b></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="subject" size="45" maxlength="100" tabindex="2" value="<?php echo $subject; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" valign="top"><span class="gen"><b><?php echo $user->lang['MASS_MESSAGE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MASS_MESSAGE_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><textarea class="post" name="message" rows="10" cols="60" tabindex="3"><?php echo $message; ?></textarea></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1"><b><?php echo $user->lang['MAIL_PRIORITY']; ?>: </b></td>
|
|
||||||
<td class="row2"><select name="mail_priority_flag"><?php echo $s_priority_options; ?></select></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1"><b><?php echo $user->lang['SEND_IMMEDIATLY']; ?>: </b></td>
|
|
||||||
<td class="row2"><input type="checkbox" name="send_immediatly" class="text" checked="checked" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1"><b><?php echo $user->lang['LOG_SESSION']; ?>: </b></td>
|
|
||||||
<td class="row2"><input type="checkbox" name="log_session" class="text" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $user->lang['EMAIL']; ?>" name="submit" class="btnmain" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
|
|
||||||
?>
|
|
253
phpBB/includes/acp/acp_email.php
Normal file
253
phpBB/includes/acp/acp_email.php
Normal file
|
@ -0,0 +1,253 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package acp
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2005 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package acp
|
||||||
|
*/
|
||||||
|
class acp_email
|
||||||
|
{
|
||||||
|
function main($id, $mode)
|
||||||
|
{
|
||||||
|
global $config, $db, $user, $auth, $template, $cache;
|
||||||
|
global $SID, $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
|
||||||
|
|
||||||
|
$user->add_lang('acp/email');
|
||||||
|
$this->tpl_name = 'acp_email';
|
||||||
|
$this->page_title = 'ACP_MASS_EMAIL';
|
||||||
|
|
||||||
|
$u_action = "{$phpbb_admin_path}index.$phpEx$SID&i=$id&mode=$mode";
|
||||||
|
|
||||||
|
// Set some vars
|
||||||
|
$submit = (isset($_POST['submit'])) ? true : false;
|
||||||
|
$error = array();
|
||||||
|
|
||||||
|
$usernames = request_var('usernames', '');
|
||||||
|
$group_id = request_var('g', 0);
|
||||||
|
|
||||||
|
// Do the job ...
|
||||||
|
if ($submit)
|
||||||
|
{
|
||||||
|
// Error checking needs to go here ... if no subject and/or no message then skip
|
||||||
|
// over the send and return to the form
|
||||||
|
$subject = html_entity_decode(request_var('subject', '', true));
|
||||||
|
$message = html_entity_decode(request_var('message', '', true));
|
||||||
|
$use_queue = (isset($_POST['send_immediatly'])) ? false : true;
|
||||||
|
$priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);
|
||||||
|
|
||||||
|
if (!$subject)
|
||||||
|
{
|
||||||
|
$error[] = $user->lang['NO_EMAIL_SUBJECT'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$message)
|
||||||
|
{
|
||||||
|
$error[] = $user->lang['NO_EMAIL_MESSAGE'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sizeof($error))
|
||||||
|
{
|
||||||
|
if ($usernames)
|
||||||
|
{
|
||||||
|
$usernames = implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", explode("\n", $usernames)));
|
||||||
|
|
||||||
|
$sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang
|
||||||
|
FROM ' . USERS_TABLE . "
|
||||||
|
WHERE username IN ($usernames)
|
||||||
|
AND user_allow_massemail = 1
|
||||||
|
ORDER BY user_lang, user_notify_type"; // , SUBSTRING(user_email FROM INSTR(user_email, '@'))
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($group_id)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT u.user_email, u.username, u.user_lang, u.user_jabber, u.user_notify_type
|
||||||
|
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
|
||||||
|
WHERE ug.group_id = $group_id
|
||||||
|
AND ug.user_pending <> 1
|
||||||
|
AND u.user_id = ug.user_id
|
||||||
|
AND u.user_allow_massemail = 1
|
||||||
|
ORDER BY u.user_lang, u.user_notify_type";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang
|
||||||
|
FROM ' . USERS_TABLE . '
|
||||||
|
WHERE user_allow_massemail = 1
|
||||||
|
ORDER BY user_lang, user_notify_type';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
if (!($row = $db->sql_fetchrow($result)))
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['NO_USER'] . adm_back_link($u_action));
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$i = $j = 0;
|
||||||
|
// Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
|
||||||
|
$max_chunk_size = 50;
|
||||||
|
$email_list = array();
|
||||||
|
$old_lang = $row['user_lang'];
|
||||||
|
$old_notify_type = $row['user_notify_type'];
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email']) ||
|
||||||
|
($row['user_notify_type'] == NOTIFY_IM && $row['user_jabber']) ||
|
||||||
|
($row['user_notify_type'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber']))
|
||||||
|
{
|
||||||
|
if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$j++;
|
||||||
|
$old_lang = $row['user_lang'];
|
||||||
|
$old_notify_type = $row['user_notify_type'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$email_list[$j][$i]['lang'] = $row['user_lang'];
|
||||||
|
$email_list[$j][$i]['method'] = $row['user_notify_type'];
|
||||||
|
$email_list[$j][$i]['email'] = $row['user_email'];
|
||||||
|
$email_list[$j][$i]['name'] = $row['username'];
|
||||||
|
$email_list[$j][$i]['jabber'] = $row['user_jabber'];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
// Send the messages
|
||||||
|
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
||||||
|
$messenger = new messenger($use_queue);
|
||||||
|
|
||||||
|
$errored = false;
|
||||||
|
|
||||||
|
for ($i = 0, $size = sizeof($email_list); $i < $size; $i++)
|
||||||
|
{
|
||||||
|
$used_lang = $email_list[$i][0]['lang'];
|
||||||
|
$used_method = $email_list[$i][0]['method'];
|
||||||
|
|
||||||
|
for ($j = 0, $list_size = sizeof($email_list[$i]); $j < $list_size; $j++)
|
||||||
|
{
|
||||||
|
$email_row = $email_list[$i][$j];
|
||||||
|
|
||||||
|
$messenger->{((sizeof($email_list[$i]) == 1) ? 'to' : 'bcc')}($email_row['email'], $email_row['name']);
|
||||||
|
$messenger->im($email_row['jabber'], $email_row['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$messenger->template('admin_send_email', $used_lang);
|
||||||
|
|
||||||
|
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
|
||||||
|
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
|
||||||
|
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
|
||||||
|
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
|
||||||
|
|
||||||
|
$messenger->subject($subject);
|
||||||
|
$messenger->replyto($config['board_email']);
|
||||||
|
$messenger->set_mail_priority($priority);
|
||||||
|
|
||||||
|
$messenger->assign_vars(array(
|
||||||
|
'SITENAME' => $config['sitename'],
|
||||||
|
'CONTACT_EMAIL' => $config['board_contact'],
|
||||||
|
'MESSAGE' => $message)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!($messenger->send($used_method)))
|
||||||
|
{
|
||||||
|
$errored = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($email_list);
|
||||||
|
|
||||||
|
$messenger->save_queue();
|
||||||
|
|
||||||
|
if ($group_id)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT group_name
|
||||||
|
FROM ' . GROUPS_TABLE . "
|
||||||
|
WHERE group_id = $group_id";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$group_name = (string) $db->sql_fetchfield('group_name', 0, $result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Not great but the logging routine doesn't cope well with localising
|
||||||
|
// on the fly
|
||||||
|
$group_name = $user->lang['ALL_USERS'];
|
||||||
|
}
|
||||||
|
|
||||||
|
add_log('admin', 'LOG_MASS_EMAIL', $group_name);
|
||||||
|
$message = (!$errored) ? $user->lang['EMAIL_SENT'] : sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="' . $phpbb_admin_path . "index.$phpEx$SID&i=logs&mode=critical" . '">', '</a>');
|
||||||
|
trigger_error($message . adm_back_link($u_action));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initial selection
|
||||||
|
$sql = 'SELECT group_id, group_type, group_name
|
||||||
|
FROM ' . GROUPS_TABLE . '
|
||||||
|
ORDER BY group_type DESC, group_name ASC';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$selected = ($group_id == $row['group_id']) ? ' selected="selected"' : '';
|
||||||
|
$select_list .= '<option value = "' . $row['group_id'] . '"' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>';
|
||||||
|
$s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
|
||||||
|
$s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>';
|
||||||
|
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'S_WARNING' => (sizeof($error)) ? true : false,
|
||||||
|
'WARNING_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||||
|
'U_ACTION' => $u_action,
|
||||||
|
'S_GROUP_OPTIONS' => $select_list,
|
||||||
|
'USERNAMES' => $usernames,
|
||||||
|
'U_FIND_USERNAME' => $phpbb_root_path . "memberlist.$phpEx$SID&mode=searchuser&form=acp_email&field=usernames",
|
||||||
|
'SUBJECT' => request_var('subject', ''),
|
||||||
|
'MESSAGE' => request_var('message', ''),
|
||||||
|
'S_PRIORITY_OPTIONS' => $s_priority_options)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package module_install
|
||||||
|
*/
|
||||||
|
class acp_email_info
|
||||||
|
{
|
||||||
|
function module()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'filename' => 'acp_email',
|
||||||
|
'title' => 'ACP_MASS_EMAIL',
|
||||||
|
'version' => '1.0.0',
|
||||||
|
'modes' => array(
|
||||||
|
'email' => array('title' => 'ACP_MASS_EMAIL', 'auth' => 'acl_a_email'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function install()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
|
@ -231,7 +231,7 @@ class messenger
|
||||||
$user->session_begin();
|
$user->session_begin();
|
||||||
|
|
||||||
include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
|
include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
|
||||||
add_log('critical', 'LOG_' . $type . '_ERROR', $msg);
|
add_log('critical', 'LOG_ERROR_' . $type, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -544,7 +544,7 @@ class queue
|
||||||
@unlink($this->cache_file . '.lock');
|
@unlink($this->cache_file . '.lock');
|
||||||
|
|
||||||
$message = 'Method: [ ' . (($config['smtp_delivery']) ? 'SMTP' : 'PHP') . ' ]<br /><br />' . $err_msg . '<br /><br /><u>CALLING PAGE</u><br /><br />' . ((!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']);
|
$message = 'Method: [ ' . (($config['smtp_delivery']) ? 'SMTP' : 'PHP') . ' ]<br /><br />' . $err_msg . '<br /><br /><u>CALLING PAGE</u><br /><br />' . ((!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']);
|
||||||
messenger::error('MAIL', $message);
|
messenger::error('EMAIL', $message);
|
||||||
continue 3;
|
continue 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -160,8 +160,7 @@ class template
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
$this->display($handle, $include_once);
|
$this->display($handle, $include_once);
|
||||||
$contents = ob_get_contents();
|
$contents = ob_get_clean();
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
if ($return_content)
|
if ($return_content)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,12 +34,14 @@ $lang += array(
|
||||||
'ACP_ATTACHMENTS' => 'Attachments',
|
'ACP_ATTACHMENTS' => 'Attachments',
|
||||||
'ACP_ATTACHMENT_SETTINGS' => 'Attachment Settings',
|
'ACP_ATTACHMENT_SETTINGS' => 'Attachment Settings',
|
||||||
'ACP_AUTH_SETTINGS' => 'Authentication',
|
'ACP_AUTH_SETTINGS' => 'Authentication',
|
||||||
|
'ACP_AUTOMATION' => 'Automation',
|
||||||
'ACP_AVATAR_SETTINGS' => 'Avatar Settings',
|
'ACP_AVATAR_SETTINGS' => 'Avatar Settings',
|
||||||
'ACP_BBCODES' => 'BBCodes',
|
'ACP_BBCODES' => 'BBCodes',
|
||||||
'ACP_BOARD_DEFAULTS' => 'Board Defaults',
|
'ACP_BOARD_DEFAULTS' => 'Board Defaults',
|
||||||
'ACP_BOARD_MANAGEMENT' => 'Board Management',
|
'ACP_BOARD_MANAGEMENT' => 'Board Management',
|
||||||
'ACP_BOARD_SETTINGS' => 'Board Settings',
|
'ACP_BOARD_SETTINGS' => 'Board Settings',
|
||||||
'ACP_BOTS' => 'Spiders/Robots',
|
'ACP_BOTS' => 'Spiders/Robots',
|
||||||
|
'ACP_CAT_DOT_MODS' => '.Mods',
|
||||||
'ACP_CAT_GENERAL' => 'General',
|
'ACP_CAT_GENERAL' => 'General',
|
||||||
'ACP_CAT_MAINTANENCE' => 'Maintanence',
|
'ACP_CAT_MAINTANENCE' => 'Maintanence',
|
||||||
'ACP_CAT_POSTING' => 'Posting',
|
'ACP_CAT_POSTING' => 'Posting',
|
||||||
|
@ -66,6 +68,7 @@ $lang += array(
|
||||||
'ACP_LOGGING' => 'Logging',
|
'ACP_LOGGING' => 'Logging',
|
||||||
'ACP_MAIN' => 'Admin index',
|
'ACP_MAIN' => 'Admin index',
|
||||||
'ACP_MANAGE_EXTENSIONS' => 'Manage Extensions',
|
'ACP_MANAGE_EXTENSIONS' => 'Manage Extensions',
|
||||||
|
'ACP_MASS_EMAIL' => 'Mass Email',
|
||||||
'ACP_MESSAGES' => 'Messages',
|
'ACP_MESSAGES' => 'Messages',
|
||||||
'ACP_MESSAGE_SETTINGS' => 'Message Settings',
|
'ACP_MESSAGE_SETTINGS' => 'Message Settings',
|
||||||
'ACP_MODULE_MANAGEMENT' => 'Module Management',
|
'ACP_MODULE_MANAGEMENT' => 'Module Management',
|
||||||
|
@ -239,6 +242,9 @@ $lang += array(
|
||||||
'LOG_DOWNLOAD_IP' => '<b>Added ip/hostname to download list</b><br />» %s',
|
'LOG_DOWNLOAD_IP' => '<b>Added ip/hostname to download list</b><br />» %s',
|
||||||
'LOG_DOWNLOAD_REMOVE_IP' => '<b>Removed ip/hostname from download list</b><br />» %s',
|
'LOG_DOWNLOAD_REMOVE_IP' => '<b>Removed ip/hostname from download list</b><br />» %s',
|
||||||
|
|
||||||
|
'LOG_ERROR_JABBER' => '<b>Jabber Error</b><br />» %s',
|
||||||
|
'LOG_ERROR_EMAIL' => '<b>Email Error</b><br />» %s',
|
||||||
|
|
||||||
'LOG_GROUP_CREATED' => '<b>New usergroup created</b><br />» %s',
|
'LOG_GROUP_CREATED' => '<b>New usergroup created</b><br />» %s',
|
||||||
'LOG_GROUP_DEFAULTS' => '<b>Group made default for members</b><br />» %s',
|
'LOG_GROUP_DEFAULTS' => '<b>Group made default for members</b><br />» %s',
|
||||||
'LOG_GROUP_DELETE' => '<b>Usergroup deleted</b><br />» %s',
|
'LOG_GROUP_DELETE' => '<b>Usergroup deleted</b><br />» %s',
|
||||||
|
@ -262,6 +268,8 @@ $lang += array(
|
||||||
'LOG_LANGUAGE_PACK_INSTALLED' => '<b>Installed language pack</b><br />» %s',
|
'LOG_LANGUAGE_PACK_INSTALLED' => '<b>Installed language pack</b><br />» %s',
|
||||||
'LOG_LANGUAGE_PACK_UPDATED' => '<b>Updated language pack details</b><br />» %s',
|
'LOG_LANGUAGE_PACK_UPDATED' => '<b>Updated language pack details</b><br />» %s',
|
||||||
|
|
||||||
|
'LOG_MASS_EMAIL' => '<b>Sent mass email</b><br />» %s',
|
||||||
|
|
||||||
'LOG_MODULE_DISABLE' => '<b>Module disabled</b>',
|
'LOG_MODULE_DISABLE' => '<b>Module disabled</b>',
|
||||||
'LOG_MODULE_ENABLE' => '<b>Module enabled</b>',
|
'LOG_MODULE_ENABLE' => '<b>Module enabled</b>',
|
||||||
'LOG_MODULE_MOVE_DOWN' => '<b>Module moved down</b><br />» %s',
|
'LOG_MODULE_MOVE_DOWN' => '<b>Module moved down</b><br />» %s',
|
||||||
|
|
59
phpBB/language/en/acp/email.php
Normal file
59
phpBB/language/en/acp/email.php
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* acp_email [English]
|
||||||
|
*
|
||||||
|
* @package language
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2005 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DO NOT CHANGE
|
||||||
|
*/
|
||||||
|
if (empty($lang) || !is_array($lang))
|
||||||
|
{
|
||||||
|
$lang = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEVELOPERS PLEASE NOTE
|
||||||
|
//
|
||||||
|
// Placeholders can now contain order information, e.g. instead of
|
||||||
|
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
|
||||||
|
// translators to re-order the output of data while ensuring it remains correct
|
||||||
|
//
|
||||||
|
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
|
||||||
|
// equally where a string contains only two placeholders which are used to wrap text
|
||||||
|
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||||
|
|
||||||
|
// Bot settings
|
||||||
|
$lang += array(
|
||||||
|
'ACP_MASS_EMAIL_EXPLAIN' => 'Here you can email a message to either all of your users, or all users of a specific group. To do this, an email will be sent out to the administrative email address supplied, with a blind carbon copy sent to all recipients. If you are emailing a large group of people please be patient after submitting and do not stop the page halfway through. It is normal for a mass emailing to take a long time, you will be notified when the script has completed',
|
||||||
|
'ALL_USERS' => 'All Users',
|
||||||
|
|
||||||
|
'COMPOSE' => 'Compose',
|
||||||
|
|
||||||
|
'EMAIL_SEND_ERROR' => 'There were one or more errors while sending the email. Please check the %sError Log%s for detailed error messages.',
|
||||||
|
'EMAIL_SENT' => 'Your message has been queued for sending.',
|
||||||
|
|
||||||
|
'LOG_SESSION' => 'Log mail session to critical log',
|
||||||
|
|
||||||
|
'SEND_IMMEDIATLY' => 'Send immediatly',
|
||||||
|
'SEND_TO_GROUP' => 'Send to group',
|
||||||
|
'SEND_TO_USERS' => 'Send to users',
|
||||||
|
'SEND_TO_USERS_EXPLAIN' => 'Entering names here will override any group selected above. Enter each username on a new line.',
|
||||||
|
|
||||||
|
'MAIL_HIGH_PRIORITY' => 'High',
|
||||||
|
'MAIL_LOW_PRIORITY' => 'Low',
|
||||||
|
'MAIL_NORMAL_PRIORITY' => 'Normal',
|
||||||
|
'MAIL_PRIORITY' => 'Mail Priority',
|
||||||
|
'MASS_MESSAGE' => 'Your message',
|
||||||
|
'MASS_MESSAGE_EXPLAIN' => 'Please note that you may enter only plain text. All markup will be removed before sending.',
|
||||||
|
|
||||||
|
'NO_EMAIL_MESSAGE' => 'You must enter a message.',
|
||||||
|
'NO_EMAIL_SUBJECT' => 'You must specify a subject for your message.',
|
||||||
|
);
|
||||||
|
|
||||||
|
?>
|
Loading…
Add table
Reference in a new issue