diff --git a/mod/contacts.php b/mod/contacts.php index 298c314b29..8342906952 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -162,11 +162,7 @@ function contacts_batch_actions(App $a) info(L10n::tt("%d contact edited.", "%d contacts edited.", $count_actions)); } - if (x($_SESSION, 'return_url')) { - goaway('' . $_SESSION['return_url']); - } else { - goaway('contacts'); - } + goaway('contacts'); } function contacts_post(App $a) @@ -470,20 +466,13 @@ function contacts_content(App $a, $update = 0) } // Now check how the user responded to the confirmation query if (x($_REQUEST, 'canceled')) { - if (x($_SESSION, 'return_url')) { - goaway('' . $_SESSION['return_url']); - } else { - goaway('contacts'); - } + goaway('contacts'); } _contact_drop($orig_record); info(L10n::t('Contact has been removed.') . EOL); - if (x($_SESSION, 'return_url')) { - goaway('' . $_SESSION['return_url']); - } else { - goaway('contacts'); - } + + goaway('contacts'); return; // NOTREACHED } if ($cmd === 'posts') { diff --git a/mod/follow.php b/mod/follow.php index 627ab52033..04c279c5b6 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -20,12 +20,12 @@ function follow_post(App $a) } if (isset($_REQUEST['cancel'])) { - goaway($_SESSION['return_url']); + goaway('contacts'); } $uid = local_user(); $url = notags(trim($_REQUEST['url'])); - $return_url = $_SESSION['return_url']; + $return_url = 'contacts'; // Makes the connection request for friendica contacts easier // This is just a precaution if maybe this page is called somewhere directly via POST @@ -39,7 +39,7 @@ function follow_post(App $a) } goaway($return_url); } elseif ($result['cid']) { - goaway(System::baseUrl() . '/contacts/' . $result['cid']); + goaway('contacts/' . $result['cid']); } info(L10n::t('The contact could not be added.')); @@ -50,9 +50,11 @@ function follow_post(App $a) function follow_content(App $a) { + $return_url = 'contacts'; + if (!local_user()) { notice(L10n::t('Permission denied.')); - goaway($_SESSION['return_url']); + goaway($return_url); // NOTREACHED } @@ -116,7 +118,7 @@ function follow_content(App $a) if (!$r) { notice(L10n::t('Permission denied.')); - goaway($_SESSION['return_url']); + goaway($return_url); // NOTREACHED } diff --git a/mod/message.php b/mod/message.php index 7dc4217763..13ae2f7512 100644 --- a/mod/message.php +++ b/mod/message.php @@ -154,17 +154,28 @@ function message_content(App $a) // Now check how the user responded to the confirmation query if (!empty($_REQUEST['canceled'])) { - goaway($_SESSION['return_url']); + goaway('/message'); } $cmd = $a->argv[1]; if ($cmd === 'drop') { + $message = DBA::selectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]); + if(!DBA::isResult($message)){ + info(L10n::t('Conversation not found.') . EOL); + goaway('/message'); + } + if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) { info(L10n::t('Message deleted.') . EOL); } - //goaway(System::baseUrl(true) . '/message' ); - goaway($_SESSION['return_url']); + $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/' . $conversation['id'] ); } else { $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[2]), @@ -178,8 +189,7 @@ function message_content(App $a) info(L10n::t('Conversation removed.') . EOL); } } - //goaway(System::baseUrl(true) . '/message' ); - goaway($_SESSION['return_url']); + goaway('/message' ); } } diff --git a/mod/unfollow.php b/mod/unfollow.php index b80263a3ec..9b0e206904 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -14,18 +14,14 @@ use Friendica\Model\User; function unfollow_post() { - $return_url = $_SESSION['return_url']; + $return_url = 'contacts'; 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); + goaway($return_url . '/' . $contact['id']); // NOTREACHED } @@ -69,9 +69,11 @@ function unfollow_post() function unfollow_content(App $a) { + $return_url = 'contacts'; + if (!local_user()) { notice(L10n::t('Permission denied.')); - goaway($_SESSION['return_url']); + goaway('/login'); // NOTREACHED } @@ -86,7 +88,7 @@ function unfollow_content(App $a) if (!DBA::isResult($contact)) { notice(L10n::t("You aren't following this contact.")); - goaway('contacts'); + goaway($return_url); // NOTREACHED } @@ -103,7 +105,7 @@ function unfollow_content(App $a) if (!DBA::isResult($self)) { notice(L10n::t('Permission denied.')); - goaway($_SESSION['return_url']); + goaway($return_url); // NOTREACHED }