X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fmessage.php;h=af194879902e8fd898682b75237ebe901aabd821;hb=66bf39216b890a0b89f9bef537204a5e637ac8b1;hp=ddd5d03d6667255d2d143cb5363a00d34bdc3493;hpb=dd1e6dd4a5ac5b15764b7cc840b229a1119fa67c;p=friendica.git diff --git a/mod/message.php b/mod/message.php index ddd5d03d66..af19487990 100644 --- a/mod/message.php +++ b/mod/message.php @@ -5,15 +5,20 @@ use Friendica\App; use Friendica\Content\Nav; +use Friendica\Content\Pager; use Friendica\Content\Smilies; use Friendica\Content\Text\BBCode; use Friendica\Core\ACL; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Mail; +use Friendica\Module\Login; use Friendica\Util\DateTimeFormat; +use Friendica\Util\Proxy as ProxyUtils; +use Friendica\Util\Strings; use Friendica\Util\Temporal; require_once 'include/conversation.php'; @@ -33,21 +38,15 @@ function message_init(App $a) 'accesskey' => 'm', ]; - $tpl = get_markup_template('message_side.tpl'); - $a->page['aside'] = replace_macros($tpl, [ + $tpl = Renderer::getMarkupTemplate('message_side.tpl'); + $a->page['aside'] = Renderer::replaceMacros($tpl, [ '$tabs' => $tabs, '$new' => $new, ]); $base = System::baseUrl(); - $head_tpl = get_markup_template('message-head.tpl'); - $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, [ + $head_tpl = Renderer::getMarkupTemplate('message-head.tpl'); + $a->page['htmlhead'] .= Renderer::replaceMacros($head_tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base ]); @@ -60,10 +59,10 @@ function message_post(App $a) return; } - $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; + $replyto = !empty($_REQUEST['replyto']) ? Strings::escapeTags(trim($_REQUEST['replyto'])) : ''; + $subject = !empty($_REQUEST['subject']) ? Strings::escapeTags(trim($_REQUEST['subject'])) : ''; + $body = !empty($_REQUEST['body']) ? Strings::escapeHtml(trim($_REQUEST['body'])) : ''; + $recipient = !empty($_REQUEST['messageto']) ? intval($_REQUEST['messageto']) : 0; $ret = Mail::send($recipient, $body, $subject, $replyto); $norecip = false; @@ -91,7 +90,7 @@ function message_post(App $a) $a->argc = 2; $a->argv[1] = 'new'; } else { - goaway($_SESSION['return_url']); + $a->internalRedirect($a->cmd . '/' . $ret); } } @@ -102,14 +101,29 @@ function message_content(App $a) if (!local_user()) { notice(L10n::t('Permission denied.') . EOL); - return; + return Login::form(); } $myprofile = System::baseUrl() . '/profile/' . $a->user['nickname']; - $tpl = get_markup_template('mail_head.tpl'); - $header = replace_macros($tpl, [ + $tpl = Renderer::getMarkupTemplate('mail_head.tpl'); + 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 = Renderer::replaceMacros($tpl, [ '$messages' => L10n::t('Messages'), + '$button' => $button, ]); if (($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) { @@ -118,7 +132,7 @@ function message_content(App $a) } // Check if we should do HTML-based delete confirmation - if ($_REQUEST['confirm']) { + if (!empty($_REQUEST['confirm'])) { //