bug #327 - composed private message is lost if no recip specified.

This commit is contained in:
friendica 2012-03-10 15:50:51 -08:00
parent 4f606ff633
commit 1bddd48661
2 changed files with 16 additions and 6 deletions

View file

@ -10,17 +10,19 @@ function message_post(&$a) {
return; return;
} }
$replyto = ((x($_POST,'replyto')) ? notags(trim($_POST['replyto'])) : ''); $replyto = ((x($_REQUEST,'replyto')) ? notags(trim($_REQUEST['replyto'])) : '');
$subject = ((x($_POST,'subject')) ? notags(trim($_POST['subject'])) : ''); $subject = ((x($_REQUEST,'subject')) ? notags(trim($_REQUEST['subject'])) : '');
$body = ((x($_POST,'body')) ? escape_tags(trim($_POST['body'])) : ''); $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : '');
$recipient = ((x($_POST,'messageto')) ? intval($_POST['messageto']) : 0 ); $recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 );
$ret = send_message($recipient, $body, $subject, $replyto); $ret = send_message($recipient, $body, $subject, $replyto);
$norecip = false;
switch($ret){ switch($ret){
case -1: case -1:
notice( t('No recipient selected.') . EOL ); notice( t('No recipient selected.') . EOL );
$norecip = true;
break; break;
case -2: case -2:
notice( t('Unable to locate contact information.') . EOL ); notice( t('Unable to locate contact information.') . EOL );
@ -35,6 +37,13 @@ function message_post(&$a) {
info( t('Message sent.') . EOL ); 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) { function message_content(&$a) {
@ -151,7 +160,8 @@ function message_content(&$a) {
'$header' => t('Send Private Message'), '$header' => t('Send Private Message'),
'$to' => t('To:'), '$to' => t('To:'),
'$subject' => t('Subject:'), '$subject' => t('Subject:'),
'$subjtxt' => '', '$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''),
'$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''),
'$readonly' => '', '$readonly' => '',
'$yourmessage' => t('Your message:'), '$yourmessage' => t('Your message:'),
'$select' => $select, '$select' => $select,

View file

@ -13,7 +13,7 @@ $select
<input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="$subjtxt" $readonly /> <input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="$subjtxt" $readonly />
<div id="prvmail-message-label">$yourmessage</div> <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" > <div id="prvmail-submit-wrapper" >