From 807ad145218ab6d4c57b6d200f4c89f63620502f Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Wed, 19 Sep 2018 23:55:29 +0200 Subject: [PATCH 01/12] calculate form return_url for post and message instead of using SESSION var --- mod/editpost.php | 8 +++++++- mod/message.php | 2 +- src/Object/Post.php | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mod/editpost.php b/mod/editpost.php index 258585ef1c..61dfcf911d 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -21,12 +21,18 @@ function editpost_content(App $a) } $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); + $return_url = (($a->argc > 1) ? 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_path']; + } + $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'type', 'body', 'title', 'file', 'wall', 'post-type']; @@ -95,7 +101,7 @@ function editpost_content(App $a) $o .= replace_macros($tpl, [ '$is_edit' => true, - '$return_path' => $_SESSION['return_url'], + '$return_path' => $return_url, '$action' => 'item', '$share' => L10n::t('Save'), '$upload' => L10n::t('Upload photo'), diff --git a/mod/message.php b/mod/message.php index 8c9aa657df..9ac0ddbc0b 100644 --- a/mod/message.php +++ b/mod/message.php @@ -92,7 +92,7 @@ function message_post(App $a) $a->argc = 2; $a->argv[1] = 'new'; } else { - goaway($_SESSION['return_url']); + goaway(System::baseUrl() . '/' . $a->cmd . '/' . $ret); } } diff --git a/src/Object/Post.php b/src/Object/Post.php index 038ca270d7..c52078e521 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'], L10n::t("Edit")]; + $edpost = ["editpost/" . $item['id'] . "/" . base64_encode($a->cmd), L10n::t("Edit")]; } $dropping = in_array($item['uid'], [0, local_user()]); } else { From 58f26d195f5b89c7276395a145b58e10917d085e Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Thu, 20 Sep 2018 14:41:52 +0200 Subject: [PATCH 02/12] adjust argc check in mod/editpost + relative path in mod/message --- mod/editpost.php | 2 +- mod/message.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/editpost.php b/mod/editpost.php index 61dfcf911d..d4f5567eeb 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -21,7 +21,7 @@ function editpost_content(App $a) } $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); - $return_url = (($a->argc > 1) ? base64_decode($a->argv[2]) : ''); + $return_url = (($a->argc > 2) ? base64_decode($a->argv[2]) : ''); if (!$post_id) { notice(L10n::t('Item not found') . EOL); diff --git a/mod/message.php b/mod/message.php index 9ac0ddbc0b..7377ba5e48 100644 --- a/mod/message.php +++ b/mod/message.php @@ -92,7 +92,7 @@ function message_post(App $a) $a->argc = 2; $a->argv[1] = 'new'; } else { - goaway(System::baseUrl() . '/' . $a->cmd . '/' . $ret); + goaway($a->cmd . '/' . $ret); } } From 0f63a6276127f9e76bc11e70c03604ed33b6b9b0 Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Thu, 20 Sep 2018 15:55:24 +0200 Subject: [PATCH 03/12] fix return fallback to SESSION Variable --- mod/editpost.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/editpost.php b/mod/editpost.php index d4f5567eeb..9f4aee31d6 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -30,7 +30,7 @@ function editpost_content(App $a) // Fallback to SESSION return_path if (empty($return_url)) { - $return_url = $_SESSION['return_path']; + $return_url = $_SESSION['return_url']; } $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', From b1720c07ec963fa5fa3800911068ad680404f792 Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Thu, 20 Sep 2018 16:20:33 +0200 Subject: [PATCH 04/12] Add Share button for preview new post --- view/theme/frio/templates/jot.tpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/view/theme/frio/templates/jot.tpl b/view/theme/frio/templates/jot.tpl index 423be5a5d9..c4ccdfd864 100644 --- a/view/theme/frio/templates/jot.tpl +++ b/view/theme/frio/templates/jot.tpl @@ -117,7 +117,12 @@ {{$acl}} - + + From 4c56724715d1e87517cb8ae2fd79accc18f19394 Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Thu, 20 Sep 2018 16:50:58 +0200 Subject: [PATCH 05/12] make share button visible in preview --- view/theme/frio/templates/jot.tpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/view/theme/frio/templates/jot.tpl b/view/theme/frio/templates/jot.tpl index c4ccdfd864..7a4854ce44 100644 --- a/view/theme/frio/templates/jot.tpl +++ b/view/theme/frio/templates/jot.tpl @@ -117,6 +117,9 @@ {{$acl}} + + +