X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fmessage.php;h=d0a583967b047c3a61a6261f5dd10f9f6657693c;hb=761bdafa34bfdf1b2b43a3f06ae092e0925898ac;hp=9e0cb32c0e1a93b451dbe45ce5e2e7e9da4a5bcd;hpb=92b501aa835cbad4e70784875d732923bc5bfd65;p=friendica.git diff --git a/mod/message.php b/mod/message.php index 9e0cb32c0e..d0a583967b 100644 --- a/mod/message.php +++ b/mod/message.php @@ -1,13 +1,22 @@ t('New Message'), + $new = [ + 'label' => L10n::t('New Message'), 'url' => 'message/new', 'sel' => $a->argc > 1 && $a->argv[1] == 'new', 'accesskey' => 'm', - ); + ]; $tpl = get_markup_template('message_side.tpl'); - $a->page['aside'] = replace_macros($tpl, array( + $a->page['aside'] = replace_macros($tpl, [ '$tabs' => $tabs, '$new' => $new, - )); + ]); $base = System::baseUrl(); $head_tpl = get_markup_template('message-head.tpl'); - $a->page['htmlhead'] .= replace_macros($head_tpl, array( + $a->page['htmlhead'] .= replace_macros($head_tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base - )); + ]); $end_tpl = get_markup_template('message-end.tpl'); - $a->page['end'] .= replace_macros($end_tpl, array( + $a->page['end'] .= replace_macros($end_tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base - )); + ]); } function message_post(App $a) { if (!local_user()) { - notice(t('Permission denied.') . EOL); + notice(L10n::t('Permission denied.') . EOL); return; } @@ -57,25 +66,25 @@ function message_post(App $a) $body = x($_REQUEST, 'body') ? escape_tags(trim($_REQUEST['body'])) : ''; $recipient = x($_REQUEST, 'messageto') ? intval($_REQUEST['messageto']) : 0; - $ret = send_message($recipient, $body, $subject, $replyto); + $ret = Mail::send($recipient, $body, $subject, $replyto); $norecip = false; switch ($ret) { case -1: - notice(t('No recipient selected.') . EOL); + notice(L10n::t('No recipient selected.') . EOL); $norecip = true; break; case -2: - notice(t('Unable to locate contact information.') . EOL); + notice(L10n::t('Unable to locate contact information.') . EOL); break; case -3: - notice(t('Message could not be sent.') . EOL); + notice(L10n::t('Message could not be sent.') . EOL); break; case -4: - notice(t('Message collection failure.') . EOL); + notice(L10n::t('Message collection failure.') . EOL); break; default: - info(t('Message sent.') . EOL); + info(L10n::t('Message sent.') . EOL); } // fake it to go back to the input form if no recipient listed @@ -83,26 +92,41 @@ function message_post(App $a) $a->argc = 2; $a->argv[1] = 'new'; } else { - goaway($_SESSION['return_url']); + goaway($a->cmd . '/' . $ret); } } function message_content(App $a) { $o = ''; - nav_set_selected('messages'); + Nav::setSelected('messages'); if (!local_user()) { - notice(t('Permission denied.') . EOL); + notice(L10n::t('Permission denied.') . EOL); return; } $myprofile = System::baseUrl() . '/profile/' . $a->user['nickname']; $tpl = get_markup_template('mail_head.tpl'); - $header = replace_macros($tpl, array( - '$messages' => t('Messages'), - )); + if ($a->argc > 1 && $a->argv[1] == 'new') { + $button = [ + 'label' => L10n::t('Discard'), + 'url' => '/message', + 'sel' => 'close', + ]; + } else { + $button = [ + 'label' => L10n::t('New Message'), + 'url' => '/message/new', + 'sel' => 'new', + 'accesskey' => 'm', + ]; + } + $header = replace_macros($tpl, [ + '$messages' => L10n::t('Messages'), + '$button' => $button, + ]); if (($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) { if (!intval($a->argv[2])) { @@ -110,43 +134,41 @@ function message_content(App $a) } // Check if we should do HTML-based delete confirmation - if ($_REQUEST['confirm']) { + if (!empty($_REQUEST['confirm'])) { //