]> git.mxchange.org Git - friendica.git/commitdiff
Code Standards + return path for \!local_user() and cancel
authorJonny Tischbein <jonny_tischbein@systemli.org>
Tue, 2 Oct 2018 16:13:58 +0000 (18:13 +0200)
committerJonny Tischbein <jonny_tischbein@systemli.org>
Tue, 2 Oct 2018 16:13:58 +0000 (18:13 +0200)
mod/message.php
mod/unfollow.php

index bf1895f67dec3693066a5ae999062d3401eb6e7b..4a569155b5d8afa8c4919ef9d76f2b9dfed5a2c1 100644 (file)
@@ -165,9 +165,9 @@ function message_content(App $a)
 
                $cmd = $a->argv[1];
                if ($cmd === 'drop') {
-                       $r = DBA::SelectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]);
+                       $message = DBA::selectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]);
                        if(!DBA::isResult($r)){
-                               info(L10n::t('Conversation not founded.') . EOL);
+                               info(L10n::t('Conversation not found.') . EOL);
                                goaway('/message');
                        }
 
@@ -175,13 +175,13 @@ function message_content(App $a)
                                info(L10n::t('Message deleted.') . EOL);
                        }
 
-                       $rr = DBA::SelectFirst('mail', ['id'], ['convid' => $r['convid'], 'uid' => local_user()]);
-                       if(!DBA::isResult($rr)){
+                       $conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
+                       if(!DBA::isResult($conversation)){
                                info(L10n::t('Conversation removed.') . EOL);
                                goaway('/message');
                        }
 
-                       goaway('/message/'.$rr['id'] );
+                       goaway('/message/' . $conversation'id'] );
                } else {
                        $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                                intval($a->argv[2]),
index 61f99ee489170ffbc2a2b0b81793407d3dc08092..9b0e206904bad703e608d2a460d993a72f39909c 100644 (file)
@@ -18,14 +18,10 @@ function unfollow_post()
 
        if (!local_user()) {
                notice(L10n::t('Permission denied.'));
-               goaway($return_url);
+               goaway('/login');
                // NOTREACHED
        }
 
-       if (!empty($_REQUEST['cancel'])) {
-               goaway($return_url);
-       }
-
        $uid = local_user();
        $url = notags(trim(defaults($_REQUEST, 'url', '')));
 
@@ -40,9 +36,13 @@ function unfollow_post()
                // NOTREACHED
        }
 
+       if (!empty($_REQUEST['cancel'])) {
+               goaway($return_url . '/' . $contact['id']);
+       }
+
        if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
                notice(L10n::t('Unfollowing is currently not supported by your network.'));
-               goaway($return_url.'/'.$contact['id']);
+               goaway($return_url . '/' . $contact['id']);
                // NOTREACHED
        }
 
@@ -73,7 +73,7 @@ function unfollow_content(App $a)
 
        if (!local_user()) {
                notice(L10n::t('Permission denied.'));
-               goaway($return_url);
+               goaway('/login');
                // NOTREACHED
        }