]> git.mxchange.org Git - friendica.git/blobdiff - mod/message.php
Fix overly strict return value for terminateFriendship methods
[friendica.git] / mod / message.php
index a18a5f9df3d38b2348a29067aff445945a73fa29..7324840a0e3acb4d1183246dd673416f27e9a960 100644 (file)
@@ -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:')
                ]);
 
@@ -292,7 +289,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 +428,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']) {