From 1bddd4866151f53f4469dee636a3742fe8381306 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 10 Mar 2012 15:50:51 -0800 Subject: bug #327 - composed private message is lost if no recip specified. --- mod/message.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index 91db5baef..dcaaf6975 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, -- cgit v1.2.3 From d9c5d9d2ebf1d0830020e4dc5971cf5bd2227ed5 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 10 Mar 2012 15:53:36 -0800 Subject: default the text template var on conversations --- mod/message.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod/message.php') diff --git a/mod/message.php b/mod/message.php index dcaaf6975..57d45ee3c 100755 --- a/mod/message.php +++ b/mod/message.php @@ -305,6 +305,7 @@ function message_content(&$a) { '$subjtxt' => template_escape($message['title']), '$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', '$yourmessage' => t('Your message:'), + '$text' => '', '$select' => $select, '$parent' => $parent, '$upload' => t('Upload photo'), -- cgit v1.2.3