From 1bddd4866151f53f4469dee636a3742fe8381306 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 10 Mar 2012 15:50:51 -0800 Subject: [PATCH] bug #327 - composed private message is lost if no recip specified. --- mod/message.php | 20 +++++++++++++++----- view/prv_message.tpl | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/mod/message.php b/mod/message.php index 91db5baef1..dcaaf69753 100755 --- a/mod/message.php +++ b/mod/message.php @@ -10,17 +10,19 @@ function message_post(&$a) { return; } - $replyto = ((x($_POST,'replyto')) ? notags(trim($_POST['replyto'])) : ''); - $subject = ((x($_POST,'subject')) ? notags(trim($_POST['subject'])) : ''); - $body = ((x($_POST,'body')) ? escape_tags(trim($_POST['body'])) : ''); - $recipient = ((x($_POST,'messageto')) ? intval($_POST['messageto']) : 0 ); + $replyto = ((x($_REQUEST,'replyto')) ? notags(trim($_REQUEST['replyto'])) : ''); + $subject = ((x($_REQUEST,'subject')) ? notags(trim($_REQUEST['subject'])) : ''); + $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : ''); + $recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 ); $ret = send_message($recipient, $body, $subject, $replyto); + $norecip = false; switch($ret){ case -1: notice( t('No recipient selected.') . EOL ); + $norecip = true; break; case -2: notice( t('Unable to locate contact information.') . EOL ); @@ -35,6 +37,13 @@ function message_post(&$a) { info( t('Message sent.') . EOL ); } + // fake it to go back to the input form if no recipient listed + + if($norecip) { + $a->argc = 2; + $a->argv[1] = 'new'; + } + } function message_content(&$a) { @@ -151,7 +160,8 @@ function message_content(&$a) { '$header' => t('Send Private Message'), '$to' => t('To:'), '$subject' => t('Subject:'), - '$subjtxt' => '', + '$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''), + '$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''), '$readonly' => '', '$yourmessage' => t('Your message:'), '$select' => $select, diff --git a/view/prv_message.tpl b/view/prv_message.tpl index 25bf93b99c..4b904cbcd6 100755 --- a/view/prv_message.tpl +++ b/view/prv_message.tpl @@ -13,7 +13,7 @@ $select
$yourmessage
- +
-- 2.39.5