From be2e6c39298121872debf8b21e25169981ebdb06 Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Tue, 16 Oct 2018 19:14:55 +0200 Subject: [PATCH] Fix Issue #5896 by setting static return for edit_post to display item page (kind of revert parts of #5774) --- mod/editpost.php | 10 ++-------- src/Object/Post.php | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/mod/editpost.php b/mod/editpost.php index d6493b3c0c..780145ed3f 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -21,20 +21,14 @@ function editpost_content(App $a) } $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); - $return_url = (($a->argc > 2) ? base64_decode($a->argv[2]) : ''); if (!$post_id) { notice(L10n::t('Item not found') . EOL); return; } - // Fallback to SESSION return_path - if (empty($return_url)) { - $return_url = $_SESSION['return_url']; - } - $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', - 'type', 'body', 'title', 'file', 'wall', 'post-type']; + 'type', 'body', 'title', 'file', 'wall', 'post-type', 'guid']; $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]); @@ -92,7 +86,7 @@ function editpost_content(App $a) $o .= replace_macros($tpl, [ '$is_edit' => true, - '$return_path' => $return_url, + '$return_path' => '/display/' . $item['guid'], '$action' => 'item', '$share' => L10n::t('Save'), '$upload' => L10n::t('Upload photo'), diff --git a/src/Object/Post.php b/src/Object/Post.php index 48ffe65b74..34a5f8138a 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -157,7 +157,7 @@ class Post extends BaseObject if ($item["event-id"] != 0) { $edpost = ["events/event/" . $item['event-id'], L10n::t("Edit")]; } else { - $edpost = ["editpost/" . $item['id'] . "/" . base64_encode($a->cmd), L10n::t("Edit")]; + $edpost = ["editpost/" . $item['id'], L10n::t("Edit")]; } $dropping = in_array($item['uid'], [0, local_user()]); } else {