X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fmessage.php;h=0a54f9428d1c60fd224eda6925ab5c73e3e4d484;hb=660bd39efad52b1c69bd8dd0ca27141b81f84ca5;hp=7ca3fba70af9e939b744ca45b9cdec7797162a22;hpb=1392c58377b462c10f9db5edc97cd82d3a683dc7;p=friendica.git diff --git a/mod/message.php b/mod/message.php index 7ca3fba70a..0a54f9428d 100644 --- a/mod/message.php +++ b/mod/message.php @@ -82,6 +82,8 @@ function message_post(&$a) { $a->argc = 2; $a->argv[1] = 'new'; } + else + goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); } @@ -185,6 +187,36 @@ function message_content(&$a) { if(($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) { if(! intval($a->argv[2])) return; + + // Check if we should do HTML-based delete confirmation + if($_REQUEST['confirm']) { + //
can't take arguments in its "action" parameter + // so add any arguments as hidden inputs + $query = explode_querystring($a->query_string); + $inputs = array(); + foreach($query['args'] as $arg) { + if(strpos($arg, 'confirm=') === false) { + $arg_parts = explode('=', $arg); + $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]); + } + } + + //$a->page['aside'] = ''; + return replace_macros(get_markup_template('confirm.tpl'), array( + '$method' => 'get', + '$message' => t('Do you really want to delete this message?'), + '$extra_inputs' => $inputs, + '$confirm' => t('Yes'), + '$confirm_url' => $query['base'], + '$confirm_name' => 'confirmed', + '$cancel' => t('Cancel'), + )); + } + // Now check how the user responded to the confirmation query + if($_REQUEST['canceled']) { + goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); + } + $cmd = $a->argv[1]; if($cmd === 'drop') { $r = q("DELETE FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", @@ -194,7 +226,8 @@ function message_content(&$a) { if($r) { info( t('Message deleted.') . EOL ); } - goaway($a->get_baseurl(true) . '/message' ); + //goaway($a->get_baseurl(true) . '/message' ); + goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); } else { $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", @@ -224,7 +257,8 @@ function message_content(&$a) { if($r) info( t('Conversation removed.') . EOL ); } - goaway($a->get_baseurl(true) . '/message' ); + //goaway($a->get_baseurl(true) . '/message' ); + goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); } } @@ -282,30 +316,31 @@ function message_content(&$a) { $tpl = get_markup_template('prv_message.tpl'); $o .= replace_macros($tpl,array( - '$reply' => array( - 'header' => t('Send Private Message'), - 'to' => t('To:'), - 'showinputs' => 'true', - 'prefill' => $prefill, - 'autocomp' => $autocomp, - 'preid' => $preid, - 'subject' => t('Subject:'), - 'subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''), - 'text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''), - 'readonly' => '', - 'yourmessage' => t('Your message:'), - 'select' => $select, - 'parent' => '', - 'upload' => t('Upload photo'), - 'insert' => t('Insert web link'), - 'wait' => t('Please wait'), - 'submit' => t('Submit') - ) + '$header' => t('Send Private Message'), + '$to' => t('To:'), + '$showinputs' => 'true', + '$prefill' => $prefill, + '$autocomp' => $autocomp, + '$preid' => $preid, + '$subject' => t('Subject:'), + '$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''), + '$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''), + '$readonly' => '', + '$yourmessage' => t('Your message:'), + '$select' => $select, + '$parent' => '', + '$upload' => t('Upload photo'), + '$insert' => t('Insert web link'), + '$wait' => t('Please wait'), + '$submit' => t('Submit') )); return $o; } + + $_SESSION['return_url'] = $a->query_string; + if($a->argc == 1) { // list messages @@ -497,12 +532,6 @@ function message_content(&$a) { $tpl = get_markup_template('mail_display.tpl'); - $includes = array( - '$mail_conv' => 'mail_conv.tpl', - '$prv_message' => 'prv_message.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - if($a->theme['template_engine'] === 'internal') { $subjtxt_e = template_escape($message['title']); } @@ -510,7 +539,7 @@ function message_content(&$a) { $subjtxt_e = $message['title']; } - $o = replace_macros($tpl, $includes + array( + $o = replace_macros($tpl, array( '$thread_id' => $a->argv[1], '$thread_subject' => $message['title'], '$thread_seen' => $seen, @@ -520,22 +549,20 @@ function message_content(&$a) { '$mails' => $mails, // reply - '$reply_info' => array( - 'header' => t('Send Reply'), - 'to' => t('To:'), - 'showinputs' => '', - 'subject' => t('Subject:'), - 'subjtxt' => $subjtxt_e, - 'readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', - 'yourmessage' => t('Your message:'), - 'text' => '', - 'select' => $select, - 'parent' => $parent, - 'upload' => t('Upload photo'), - 'insert' => t('Insert web link'), - 'submit' => t('Submit'), - 'wait' => t('Please wait'), - ), + '$header' => t('Send Reply'), + '$to' => t('To:'), + '$showinputs' => '', + '$subject' => t('Subject:'), + '$subjtxt' => $subjtxt_e, + '$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', + '$yourmessage' => t('Your message:'), + '$text' => '', + '$select' => $select, + '$parent' => $parent, + '$upload' => t('Upload photo'), + '$insert' => t('Insert web link'), + '$submit' => t('Submit'), + '$wait' => t('Please wait') ));