Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id$
| * $Id: massmail.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
|
*/
|
| // Disallow direct access to this file for security reasons if(!defined("IN_MYBB")) { die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); }
|
require_once MYBB_ROOT."/inc/functions_massmail.php"; require_once MYBB_ROOT."inc/datahandlers/pm.php";
| require_once MYBB_ROOT."/inc/functions_massmail.php"; require_once MYBB_ROOT."inc/datahandlers/pm.php";
|
Zeile 22 | Zeile 28 |
---|
if($mass_email['status'] == 1) { $db->update_query("massemails", array('status' => 2), "mid='{$mass_email['mid']}'", 1);
|
if($mass_email['status'] == 1) { $db->update_query("massemails", array('status' => 2), "mid='{$mass_email['mid']}'", 1);
|
}
| }
|
$sentcount = 0;
| $sentcount = 0;
|
Zeile 35 | Zeile 41 |
---|
{ $mass_email['htmlmessage'] = nl2br($mass_email['htmlmessage']); }
|
{ $mass_email['htmlmessage'] = nl2br($mass_email['htmlmessage']); }
|
|
|
$mass_email['orig_message'] = $mass_email['message']; $mass_email['orig_htmlmessage'] = $mass_email['htmlmessage'];
|
$mass_email['orig_message'] = $mass_email['message']; $mass_email['orig_htmlmessage'] = $mass_email['htmlmessage'];
|
|
|
// Need to perform the search to fetch the number of users we're emailing $member_query = build_mass_mail_query(unserialize($mass_email['conditions']));
|
// Need to perform the search to fetch the number of users we're emailing $member_query = build_mass_mail_query(unserialize($mass_email['conditions']));
|
| $count_query = $db->simple_select("users u", "COUNT(uid) AS num", $member_query); $mass_email['totalcount'] = $db->fetch_field($count_query, "num");
|
$query2 = $db->simple_select("users u", "u.uid, u.language, u.pmnotify, u.lastactive, u.username, u.email", $member_query, array('limit_start' => $mass_email['sentcount'], 'limit' => $mass_email['perpage'], 'order_by' => 'u.uid', 'order_dir' => 'asc')); while($user = $db->fetch_array($query2)) {
|
$query2 = $db->simple_select("users u", "u.uid, u.language, u.pmnotify, u.lastactive, u.username, u.email", $member_query, array('limit_start' => $mass_email['sentcount'], 'limit' => $mass_email['perpage'], 'order_by' => 'u.uid', 'order_dir' => 'asc')); while($user = $db->fetch_array($query2)) {
|
$mass_email['message'] = str_replace("{uid}", $user['uid'], $mass_email['message']); $mass_email['message'] = str_replace("{username}", $user['username'], $mass_email['message']); $mass_email['message'] = str_replace("{email}", $user['email'], $mass_email['message']); $mass_email['message'] = str_replace("{bbname}", $mybb->settings['bbname'], $mass_email['message']); $mass_email['message'] = str_replace("{bburl}", $mybb->settings['bburl'], $mass_email['message']);
| $replacement_fields = array( "{uid}" => $user['uid'], "{username}" => $user['username'], "{email}" => $user['email'], "{bbname}" => $mybb->settings['bbname'], "{bburl}" => $mybb->settings['bburl'], "[".$lang->massmail_username."]" => $user['username'], "[".$lang->email_addr."]" => $user['email'], "[".$lang->board_name."]" => $mybb->settings['bbname'], "[".$lang->board_url."]" => $mybb->settings['bburl'] );
|
|
|
$mass_email['htmlmessage'] = str_replace("{uid}", $user['uid'], $mass_email['htmlmessage']); $mass_email['htmlmessage'] = str_replace("{username}", $user['username'], $mass_email['htmlmessage']); $mass_email['htmlmessage'] = str_replace("{email}", $user['email'], $mass_email['htmlmessage']); $mass_email['htmlmessage'] = str_replace("{bbname}", $mybb->settings['bbname'], $mass_email['htmlmessage']); $mass_email['htmlmessage'] = str_replace("{bburl}", $mybb->settings['bburl'], $mass_email['htmlmessage']);
| foreach($replacement_fields as $find => $replace) { $mass_email['message'] = str_replace($find, $replace, $mass_email['message']); $mass_email['htmlmessage'] = str_replace($find, $replace, $mass_email['htmlmessage']); }
|
// Private Message if($mass_email['type'] == 1)
| // Private Message if($mass_email['type'] == 1)
|
Zeile 72 | Zeile 87 |
---|
$pm['to'] = explode(",", $user['username']); $pm_handler->set_data($pm);
|
$pm['to'] = explode(",", $user['username']); $pm_handler->set_data($pm);
|
$pm_handler->validate_pm(); $pm_handler->insert_pm();
| if(!$pm_handler->validate_pm()) { $friendly_errors = implode('\n', $pm_handler->get_friendly_errors()); add_task_log($task, $lang->sprintf($lang->task_massmail_ran_errors, htmlspecialchars_uni($user['username']), $friendly_errors)); $friendly_errors = ""; } else { $pm_handler->insert_pm(); }
|
} // Normal Email else
| } // Normal Email else
|
Zeile 105 | Zeile 128 |
---|
$update_array = array(); $update_array['sentcount'] = $mass_email['sentcount'] + $sentcount;
|
$update_array = array(); $update_array['sentcount'] = $mass_email['sentcount'] + $sentcount;
|
| $update_array['totalcount'] = $mass_email['totalcount'];
|
if($update_array['sentcount'] >= $mass_email['totalcount']) {
| if($update_array['sentcount'] >= $mass_email['totalcount']) {
|