aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp/ucp_pm_compose.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/ucp/ucp_pm_compose.php')
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php42
1 files changed, 35 insertions, 7 deletions
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 008d8d6c88..1d428ce92e 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -46,6 +46,9 @@ function compose_pm($id, $mode, $action)
$draft_id = request_var('d', 0);
$lastclick = request_var('lastclick', 0);
+ // Reply to all triggered (quote/reply)
+ $reply_to_all = request_var('reply_to_all', 0);
+
// Do NOT use request_var or specialchars here
$address_list = isset($_REQUEST['address_list']) ? $_REQUEST['address_list'] : array();
@@ -85,6 +88,10 @@ function compose_pm($id, $mode, $action)
redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'));
}
+ // Since viewtopic.php language entries are used in several modes,
+ // we include the language file here
+ $user->add_lang('viewtopic');
+
// Output PM_TO box if message composing
if ($action != 'edit')
{
@@ -310,13 +317,14 @@ function compose_pm($id, $mode, $action)
if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview)
{
- if ($action == 'quotepost')
+ // Add the original author as the recipient if quoting a post or only replying and not having checked "reply to all"
+ if ($action == 'quotepost' || !$reply_to_all)
{
$address_list = array('u' => array($post['author_id'] => 'to'));
}
else
{
- // We try to include every previously listed member from the TO Header
+ // We try to include every previously listed member from the TO Header - Reply to all
$address_list = rebuild_header(array('to' => $post['to_address']));
// Add the author (if he is already listed then this is no shame (it will be overwritten))
@@ -439,7 +447,7 @@ function compose_pm($id, $mode, $action)
$max_recipients = (!$max_recipients) ? $config['pm_max_recipients'] : $max_recipients;
// If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients
- if (($action == 'reply' || $action == 'quote') && $max_recipients)
+ if (($action == 'reply' || $action == 'quote') && $max_recipients && $reply_to_all)
{
// We try to include every previously listed member from the TO Header
$list = rebuild_header(array('to' => $post['to_address']));
@@ -631,7 +639,7 @@ function compose_pm($id, $mode, $action)
// Load Drafts
if ($load && $drafts)
{
- load_drafts(0, 0, $id);
+ load_drafts(0, 0, $id, $action, $msg_id);
}
if ($submit || $preview || $refresh)
@@ -661,7 +669,22 @@ function compose_pm($id, $mode, $action)
}
// Parse Attachments - before checksum is calculated
- $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true);
+ if ($action == 'edit')
+ {
+ $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true, $msg_id);
+ if (sizeof($message_parser->attachment_data))
+ {
+ // Update attachment indicators for pms having attachments now, as a precaution if the pm does not get stored by submit
+ $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
+ SET message_attachment = 1
+ WHERE msg_id = ' . $msg_id;
+ $db->sql_query($sql);
+ }
+ }
+ else
+ {
+ $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true);
+ }
if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc))
{
@@ -746,7 +769,6 @@ function compose_pm($id, $mode, $action)
// Preview
if (!sizeof($error) && $preview)
{
- $user->add_lang('viewtopic');
$preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
$preview_signature = $user->data['user_sig'];
@@ -1141,8 +1163,14 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
global $refresh, $submit, $preview;
- $refresh = $preview = true;
+ $refresh = true;
$submit = false;
+
+ // Preview is only true if there was also a message entered
+ if (request_var('message', ''))
+ {
+ $preview = true;
+ }
}
// Add User/Group [TO]