aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-03-10 15:50:51 -0800
committerfriendica <info@friendica.com>2012-03-10 15:50:51 -0800
commit1bddd4866151f53f4469dee636a3742fe8381306 (patch)
tree352ea13dcd966e825323ace7ba295ee1cb592066
parent4f606ff633dc7abcf2c837876ac9cdd8aee3b47e (diff)
downloadvolse-hubzilla-1bddd4866151f53f4469dee636a3742fe8381306.tar.gz
volse-hubzilla-1bddd4866151f53f4469dee636a3742fe8381306.tar.bz2
volse-hubzilla-1bddd4866151f53f4469dee636a3742fe8381306.zip
bug #327 - composed private message is lost if no recip specified.
-rwxr-xr-xmod/message.php20
-rwxr-xr-xview/prv_message.tpl2
2 files changed, 16 insertions, 6 deletions
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,
diff --git a/view/prv_message.tpl b/view/prv_message.tpl
index 25bf93b99..4b904cbcd 100755
--- a/view/prv_message.tpl
+++ b/view/prv_message.tpl
@@ -13,7 +13,7 @@ $select
<input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="$subjtxt" $readonly />
<div id="prvmail-message-label">$yourmessage</div>
-<textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" ></textarea>
+<textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" >$text</textarea>
<div id="prvmail-submit-wrapper" >