diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 573423fb19..b628e3dd8b 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -688,15 +688,21 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers
$mail_rcpt['to'][] = '<' . trim($which_ary['email']) . '>';
}
- foreach ($addresses['bcc'] as $which_ary)
+ if (isset($addresses['bcc']) && sizeof($addresses['bcc']))
{
- $mail_rcpt['bcc'][] = '<' . trim($which_ary['email']) . '>';
+ foreach ($addresses['bcc'] as $which_ary)
+ {
+ $mail_rcpt['bcc'][] = '<' . trim($which_ary['email']) . '>';
+ }
}
- foreach ($addresses['cc'] as $which_ary)
+ if (isset($addresses['cc']) && sizeof($addresses['cc']))
{
- $mail_cc[] = ($which_ary['name'] != '') ? mail_encode(trim($which_ary['name']), $encoding) . ' <' . trim($which_ary['email']) . '>' : '<' . trim($which_ary['email']) . '>';
- $mail_rcpt['cc'][] = '<' . trim($which_ary['email']) . '>';
+ foreach ($addresses['cc'] as $which_ary)
+ {
+ $mail_cc[] = ($which_ary['name'] != '') ? mail_encode(trim($which_ary['name']), $encoding) . ' <' . trim($which_ary['email']) . '>' : '<' . trim($which_ary['email']) . '>';
+ $mail_rcpt['cc'][] = '<' . trim($which_ary['email']) . '>';
+ }
}
$smtp = new smtp_class;
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 019c8f8826..9864691c7f 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -1058,7 +1058,7 @@ function submit_pm($mode, $subject, $data, $update_message, $put_in_outbox = tru
{
return;
}
-
+ print_r($data);
$current_time = time();
// Collect some basic informations about which tables and which rows to update/insert
@@ -1074,7 +1074,7 @@ function submit_pm($mode, $subject, $data, $update_message, $put_in_outbox = tru
// u|g => array($user_id => 'to'|'bcc')
foreach (array('u', 'g') as $ug_type)
{
- if (sizeof($data['address_list'][$ug_type]))
+ if (isset($data['address_list'][$ug_type]) && sizeof($data['address_list'][$ug_type]))
{
foreach ($data['address_list'][$ug_type] as $id => $field)
{
@@ -1088,7 +1088,7 @@ function submit_pm($mode, $subject, $data, $update_message, $put_in_outbox = tru
}
}
- if (sizeof($data['address_list']['g']))
+ if (isset($data['address_list']['g']) && sizeof($data['address_list']['g']))
{
$sql = 'SELECT group_id, user_id
FROM ' . USER_GROUP_TABLE . '
@@ -1141,7 +1141,7 @@ function submit_pm($mode, $subject, $data, $update_message, $put_in_outbox = tru
'message_text' => $data['message'],
'message_checksum' => $data['message_md5'],
'message_encoding' => $user->lang['ENCODING'],
- 'message_attachment'=> (sizeof($data['filename_data']['physical_filename'])) ? 1 : 0,
+ 'message_attachment'=> (isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data']['physical_filename'])) ? 1 : 0,
'bbcode_bitfield' => $data['bbcode_bitfield'],
'bbcode_uid' => $data['bbcode_uid'],
'to_address' => implode(':', $to),
@@ -1360,7 +1360,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
if (trim($row['user_email']))
{
$msg_list_ary[] = array(
- 'method' => $row['method'],
+ 'method' => $row['user_notify_type'],
'email' => $row['user_email'],
'jabber' => $row['user_jabber'],
'name' => $row['username'],
@@ -1393,6 +1393,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
'SITENAME' => $config['sitename'],
'SUBJECT' => $subject,
'AUTHOR_NAME' => $author,
+ 'USERNAME' => $addr['name'],
'U_INBOX' => generate_board_url() . "/ucp.$phpEx?i=pm&mode=unread")
);
diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php
index c7d9fc11d3..d0eb0d8eae 100644
--- a/phpBB/includes/ucp/ucp_pm.php
+++ b/phpBB/includes/ucp/ucp_pm.php
@@ -333,6 +333,11 @@ class ucp_pm extends module
'MSG_ID' => $msg_id)
);
+ if (!$msg_id)
+ {
+ trigger_error('NO_MESSAGE');
+ }
+
include($phpbb_root_path . 'includes/ucp/ucp_pm_viewmessage.'.$phpEx);
view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row);
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 9727f5b63c..bef2fc5425 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -212,11 +212,14 @@ function compose_pm($id, $mode, $action)
{
$address_list['g'][$to_group_id] = 'to';
}
- unset($to_user_id, $to_group_id);
-
$check_value = 0;
}
+ if (($to_group_id || isset($address_list['g'])) && !$config['allow_mass_pm'])
+ {
+ trigger_error('NOT_ALLOWED_MASS_PM');
+ }
+
if ($action == 'edit' && !$refresh && !$preview && !$submit)
{
if (!($message_time > time() - $config['pm_edit_time'] || !$config['pm_edit_time']))
@@ -458,7 +461,7 @@ function compose_pm($id, $mode, $action)
}
// Subject defined
- if (!$subject)
+ if (!$subject && !($remove_u || $remove_g || $add_to || $add_bcc))
{
$error[] = $user->lang['EMPTY_SUBJECT'];
}
@@ -468,7 +471,7 @@ function compose_pm($id, $mode, $action)
$error[] = $user->lang['NO_RECIPIENT'];
}
- if (sizeof($message_parser->warn_msg))
+ if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc))
{
$error[] = implode('
', $message_parser->warn_msg);
}
@@ -477,22 +480,16 @@ function compose_pm($id, $mode, $action)
if (!sizeof($error) && $submit)
{
$pm_data = array(
- 'subject' => (!$message_subject) ? $subject : $message_subject,
'msg_id' => (int) $msg_id,
- 'reply_from_root_level' => (int) $root_level,
+ 'reply_from_root_level' => (isset($root_level)) ? (int) $root_level : 0,
'reply_from_msg_id' => (int) $msg_id,
'icon_id' => (int) $icon_id,
- 'author_id' => (int) $author_id,
'enable_sig' => (bool) $enable_sig,
'enable_bbcode' => (bool) $enable_bbcode,
'enable_html' => (bool) $enable_html,
'enable_smilies' => (bool) $enable_smilies,
'enable_urls' => (bool) $enable_urls,
'message_md5' => (int) $message_md5,
- 'post_checksum' => (int) $post_checksum,
- 'post_edit_reason' => $post_edit_reason,
- 'post_edit_user' => ($action == 'edit') ? $user->data['user_id'] : (int) $post_edit_user,
- 'author_ip' => (int) $author_ip,
'bbcode_bitfield' => (int) $message_parser->bbcode_bitfield,
'bbcode_uid' => $message_parser->bbcode_uid,
'message' => $message_parser->message,
@@ -502,13 +499,14 @@ function compose_pm($id, $mode, $action)
);
unset($message_parser);
- $msg_id = submit_pm($action, $subject, $username, $pm_data, $update_message);
+ // ((!$message_subject) ? $subject : $message_subject)
+ $msg_id = submit_pm($action, $subject, $pm_data, $update_message);
- $return_message_url = "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=view_messages&action=view_message&p=" . $data['msg_id'];
+ $return_message_url = "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=view_messages&action=view_message&p=" . $msg_id;
$return_folder_url = "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&folder=outbox";
meta_refresh(3, $return_message_url);
- $message = $user->lang['MESSAGE_STORED'] . '
' . sprintf($user->lang['VIEW_MESSAGE'], '', '') . '
' . sprintf($user->lang['RETURN_FOLDER'], '', '');
+ $message = $user->lang['MESSAGE_STORED'] . '
' . sprintf($user->lang['VIEW_MESSAGE'], '', '') . '
' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_OUTBOX']);
trigger_error($message);
}
@@ -634,7 +632,7 @@ function compose_pm($id, $mode, $action)
{
$result['g'] = $db->sql_query('SELECT group_id as id, group_name as name, group_colour as colour
FROM ' . GROUPS_TABLE . '
- WHERE group_id IN (' . implode(', ', array_map('intval', array_keys($address_list['g']))) . ')');
+ WHERE group_receive_pm = 1 AND group_id IN (' . implode(', ', array_map('intval', array_keys($address_list['g']))) . ')');
}
$u = $g = array();
@@ -656,6 +654,12 @@ function compose_pm($id, $mode, $action)
{
foreach ($adr_ary as $id => $field)
{
+ if (!isset(${$type}[$id]))
+ {
+ unset($address_list[$type][$id]);
+ break;
+ }
+
$field = ($field == 'to') ? 'to' : 'bcc';
$type = ($type == 'u') ? 'u' : 'g';
$id = (int) $id;
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 1bdbe5ebbe..6a72d8d651 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -540,26 +540,6 @@ $unused = array(
'Find' => 'Find',
'Flag' => 'Flag',
'From' => 'From',
- 'Group_Control_Panel' => 'Group Control Panel',
- 'Group_Information' => 'Group Information',
- 'Group_Members' => 'Group Members',
- 'Group_Moderator' => 'Group Moderator',
- 'Group_added' => 'You have been added to this usergroup',
- 'Group_approved' => 'Your request has been approved',
- 'Group_closed' => 'Closed group',
- 'Group_description' => 'Group description',
- 'Group_hidden' => 'Hidden group',
- 'Group_hidden_members' => 'This group is hidden, you cannot view its membership',
- 'Group_joined' => 'You have successfully subscribed to this group
You will be notified when your subscription is approved by the group moderator',
- 'Group_member_details' => 'Group Membership Details',
- 'Group_member_join' => 'Join a Group',
- 'Group_membership' => 'Group membership',
- 'Group_name' => 'Group name',
- 'Group_not_exist' => 'That user group does not exist',
- 'Group_open' => 'Open group',
- 'Group_request' => 'A request to join your group has been made',
- 'Group_type' => 'Group type',
- 'Group_type_updated' => 'Successfully updated group type',
'IP_ADDRESS' => 'IP Address',
'Inbox' => 'Inbox',
'Inbox_size' => 'Your Inbox is %d%% full',
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index f59e0c343e..7a90e242cd 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -169,6 +169,7 @@ $lang += array(
'MESSAGE_COLOURS' => 'Message Colours',
'MESSAGE_HISTORY' => 'Message History',
'MESSAGE_REPORTED_MESSAGE' => 'Reported Message',
+ 'MESSAGE_STORED' => 'The message has been send successfully',
'MINIMUM_KARMA' => 'Minimum User Karma',
'MINIMUM_KARMA_EXPLAIN' => 'Posts by users with Karma less than this will be ignored.',
'MOVE_DOWN' => 'Move down',