X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=mod%2Fmessage.php;h=3ff84a1e6684478b2200d2c552451aad2d2401c3;hb=e7be87df93895de47414a5a788cd6487adb98a29;hp=ec5669937370a8d7709cc350869044b6c0276062;hpb=9b37f5c0855c8071075fa3ce49b7e9c38f2c6a2e;p=friendica.git diff --git a/mod/message.php b/mod/message.php index ec56699373..3ff84a1e66 100644 --- a/mod/message.php +++ b/mod/message.php @@ -5,16 +5,21 @@ 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; - -require_once 'include/acl_selectors.php'; -require_once 'include/conversation.php'; +use Friendica\Util\Proxy as ProxyUtils; +use Friendica\Util\Strings; +use Friendica\Util\Temporal; function message_init(App $a) { @@ -31,21 +36,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 ]); @@ -58,10 +57,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; @@ -89,7 +88,7 @@ function message_post(App $a) $a->argc = 2; $a->argv[1] = 'new'; } else { - goaway($_SESSION['return_url']); + $a->internalRedirect($a->cmd . '/' . $ret); } } @@ -100,14 +99,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')) { @@ -116,7 +130,7 @@ function message_content(App $a) } // Check if we should do HTML-based delete confirmation - if ($_REQUEST['confirm']) { + if (!empty($_REQUEST['confirm'])) { //