Die Usernamen sind dabei entweder auszuwählen oder durch Semikolon zu trennen.
Code: Alles auswählen
#
#-----[ OPEN ]-----
#
privmsg.php
#
#-----[ FIND ]-----
#
if ( !empty($HTTP_POST_VARS['username']) )
{
$to_username = phpbb_clean_username($HTTP_POST_VARS['username']);
$sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active
FROM " . USERS_TABLE . "
WHERE username = '" . str_replace("\'", "''", $to_username) . "'
AND user_id <> " . ANONYMOUS;
if ( !($result = $db->sql_query($sql)) )
{
$error = TRUE;
$error_msg = $lang['No_such_user'];
}
if (!($to_userdata = $db->sql_fetchrow($result)))
{
$error = TRUE;
$error_msg = $lang['No_such_user'];
}
}
#
#-----[ REPLACE WITH ]-----
#
if ( !empty($HTTP_POST_VARS['username']) )
{
$to_username_array = explode (";", $HTTP_POST_VARS['username']);
$to_name_array = array();
foreach ($to_username_array as $name)
{
$to_name = "'".phpbb_clean_username($name)."'";
$to_usernames .= ($to_usernames != '') ? ', '.$to_name : $to_name;
$to_name_array[] = $to_name;
}
$sql = "SELECT username, user_id, user_notify_pm, user_email, user_lang, user_active
FROM " . USERS_TABLE . "
WHERE username IN ($to_usernames)
AND user_id <> " . ANONYMOUS;
if( !($result2 = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain users PM information', '', __LINE__, __FILE__, $sql);
}
if (!($to_users = $db->sql_fetchrowset($result2)))
{
$error = TRUE;
$error_msg = $lang['No_such_user'];
}
if (!$error)
{
$to_user_names = '';
for ($n = 0; $n < count($to_users); $n++)
{
$to_user_names .= ($to_user_names != '') ? ';'.$to_users[$n]['username'] : $to_users[$n]['username'];
}
$user_not_found = '';
for ($n = 0; $n < count($to_name_array); $n++)
{
$to_name = str_replace("'", '', $to_name_array[$n]);
if (strpos($to_user_names, $to_name) === FALSE)
{
$user_not_found .= ($user_not_found != '') ? ', '.$to_name : $to_name;
}
}
if ($user_not_found != '')
{
$error = TRUE;
$error_msg .= $lang['No_such_user'].": ".$user_not_found;
}
}
}
#
#-----[ FIND ]-----
#
if ( $submit && !$error )
{
//
// Has admin prevented user from sending PM's?
//
if ( !$userdata['user_allow_pm'] )
{
$message = $lang['Cannot_send_privmsg'];
message_die(GENERAL_MESSAGE, $message);
}
#
#-----[ AFTER, ADD ]-----
#
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
foreach($to_users as $to_userdata)
{
#
#-----[ FIND ]-----
#
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
#
#-----[ REPLACE WITH ]-----
#
// include($phpbb_root_path . 'includes/emailer.'.$phpEx);
#
#-----[ FIND ]-----
#
$emailer->send();
$emailer->reset();
}
}
#
#-----[ AFTER, ADD ]-----
#
}
#
#-----[ SAVE/CLOSE ALL FILES ]-----
#
# EoM