X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fmessage.php;h=d431668b94e072822d6a653c2c276e1f4144047f;hb=2e05dac7dae0a3d028b442a2d5afbd4176a32e99;hp=a18a5f9df3d38b2348a29067aff445945a73fa29;hpb=540ddb92651a44380ad6f6f84ef425a7e540bca4;p=friendica.git diff --git a/mod/message.php b/mod/message.php index a18a5f9df3..d431668b94 100644 --- a/mod/message.php +++ b/mod/message.php @@ -70,10 +70,10 @@ function message_post(App $a) return; } - $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['recipient']) ? intval($_REQUEST['recipient']) : 0; + $replyto = !empty($_REQUEST['replyto']) ? trim($_REQUEST['replyto']) : ''; + $subject = !empty($_REQUEST['subject']) ? trim($_REQUEST['subject']) : ''; + $body = !empty($_REQUEST['body']) ? Strings::escapeHtml(trim($_REQUEST['body'])) : ''; + $recipient = !empty($_REQUEST['recipient']) ? intval($_REQUEST['recipient']) : 0; $ret = Mail::send($recipient, $body, $subject, $replyto); $norecip = false; @@ -112,7 +112,7 @@ function message_content(App $a) return Login::form(); } - $myprofile = DI::baseUrl() . '/profile/' . $a->user['nickname']; + $myprofile = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname(); $tpl = Renderer::getMarkupTemplate('mail_head.tpl'); if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new') { @@ -158,12 +158,9 @@ function message_content(App $a) DI::baseUrl()->redirect('message/' . $conversation['id'] ); } else { - $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval(DI::args()->getArgv()[2]), - intval(local_user()) - ); - if (DBA::isResult($r)) { - $parent = $r[0]['parent-uri']; + $parentmail = DBA::selectFirst('mail', ['parent-uri'], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]); + if (DBA::isResult($parentmail)) { + $parent = $parentmail['parent-uri']; if (!DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) { notice(DI::l10n()->t('Conversation was not removed.')); @@ -179,7 +176,7 @@ function message_content(App $a) $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => DI::baseUrl()->get(true), - '$nickname' => $a->user['nickname'], + '$nickname' => $a->getLoggedInUserNickname(), '$linkurl' => DI::l10n()->t('Please enter a link URL:') ]); @@ -215,14 +212,7 @@ function message_content(App $a) $o .= $header; - $total = 0; - $r = q("SELECT count(*) AS `total`, ANY_VALUE(`created`) AS `created` FROM `mail` - WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC", - intval(local_user()) - ); - if (DBA::isResult($r)) { - $total = $r[0]['total']; - } + $total = DBA::count('mail', ['uid' => local_user()], ['distinct' => true, 'expression' => 'parent-uri']); $pager = new Pager(DI::l10n(), DI::args()->getQueryString()); @@ -292,7 +282,7 @@ function message_content(App $a) $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => DI::baseUrl()->get(true), - '$nickname' => $a->user['nickname'], + '$nickname' => $a->getLoggedInUserNickname(), '$linkurl' => DI::l10n()->t('Please enter a link URL:') ]); @@ -431,7 +421,7 @@ function render_messages(array $msg, $t) $tpl = Renderer::getMarkupTemplate($t); $rslt = ''; - $myprofile = DI::baseUrl() . '/profile/' . $a->user['nickname']; + $myprofile = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname(); foreach ($msg as $rr) { if ($rr['unknown']) {