From d8780b1640e47fce4f94b07645ff0cbf174bb598 Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Tue, 9 Oct 2018 20:10:34 +0200 Subject: [PATCH 1/3] Replace goaway location SESSION var return_url with page as string value --- include/items.php | 8 ++++---- mod/events.php | 2 +- mod/filerm.php | 4 +--- mod/ostatus_subscribe.php | 2 +- mod/repair_ostatus.php | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/items.php b/include/items.php index 9fd557a77..8b666f1ca 100644 --- a/include/items.php +++ b/include/items.php @@ -354,7 +354,7 @@ function drop_item($id) if (!DBA::isResult($item)) { notice(L10n::t('Item not found.') . EOL); - goaway(System::baseUrl() . '/' . $_SESSION['return_url']); + goaway('/network'); } if ($item['deleted']) { @@ -401,17 +401,17 @@ function drop_item($id) } // Now check how the user responded to the confirmation query if (!empty($_REQUEST['canceled'])) { - goaway(System::baseUrl() . '/' . $_SESSION['return_url']); + goaway('/item/drop/' . $id); } // delete the item Item::deleteForUser(['id' => $item['id']], local_user()); - goaway(System::baseUrl() . '/' . $_SESSION['return_url']); + goaway('/item/drop/' . $id); //NOTREACHED } else { notice(L10n::t('Permission denied.') . EOL); - goaway(System::baseUrl() . '/' . $_SESSION['return_url']); + goaway('/item/drop/' . $id); //NOTREACHED } } diff --git a/mod/events.php b/mod/events.php index e5ebf8646..d6ad97eac 100644 --- a/mod/events.php +++ b/mod/events.php @@ -187,7 +187,7 @@ function events_post(App $a) Worker::add(PRIORITY_HIGH, "Notifier", "event", $item_id); } - goaway($_SESSION['return_url']); + goaway('/events'); } function events_content(App $a) diff --git a/mod/filerm.php b/mod/filerm.php index bd46a8bfe..55b218e15 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -25,9 +25,7 @@ function filerm_content(App $a) { file_tag_unsave_file(local_user(),$item_id,$term, $category); } - if (x($_SESSION,'return_url')) { - goaway(System::baseUrl() . '/' . $_SESSION['return_url']); - } + goaway('/network'); killme(); } diff --git a/mod/ostatus_subscribe.php b/mod/ostatus_subscribe.php index 987f31699..ffaa6791f 100644 --- a/mod/ostatus_subscribe.php +++ b/mod/ostatus_subscribe.php @@ -15,7 +15,7 @@ function ostatus_subscribe_content(App $a) { if (! local_user()) { notice(L10n::t('Permission denied.') . EOL); - goaway($_SESSION['return_url']); + goaway('/ostatus_subscribe'); // NOTREACHED } diff --git a/mod/repair_ostatus.php b/mod/repair_ostatus.php index 3acaa687a..449922081 100644 --- a/mod/repair_ostatus.php +++ b/mod/repair_ostatus.php @@ -14,7 +14,7 @@ function repair_ostatus_content(App $a) { if (! local_user()) { notice(L10n::t('Permission denied.') . EOL); - goaway($_SESSION['return_url']); + goaway('/ostatus_repair'); // NOTREACHED } From d18421f7608e855bb0af5e81ed1b85d0a0553619 Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Tue, 9 Oct 2018 20:40:25 +0200 Subject: [PATCH 2/3] Return to item if not owned by user or canceld --- include/items.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/items.php b/include/items.php index 8b666f1ca..cfd792e2d 100644 --- a/include/items.php +++ b/include/items.php @@ -349,7 +349,7 @@ function drop_item($id) // locate item to be deleted - $fields = ['id', 'uid', 'contact-id', 'deleted']; + $fields = ['id', 'uid', 'guid', 'contact-id', 'deleted']; $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]); if (!DBA::isResult($item)) { @@ -401,7 +401,7 @@ function drop_item($id) } // Now check how the user responded to the confirmation query if (!empty($_REQUEST['canceled'])) { - goaway('/item/drop/' . $id); + goaway('/display/' . $item['guid']); } // delete the item @@ -411,7 +411,7 @@ function drop_item($id) //NOTREACHED } else { notice(L10n::t('Permission denied.') . EOL); - goaway('/item/drop/' . $id); + goaway('/display/' . $item['guid']); //NOTREACHED } } From 29033bdf05f1d4db09f319659ca533894eab4c7f Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Tue, 9 Oct 2018 20:44:30 +0200 Subject: [PATCH 3/3] goaway to network if deleted item + remove goaway for filerm --- include/items.php | 2 +- mod/filerm.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/items.php b/include/items.php index cfd792e2d..e8e2a5da0 100644 --- a/include/items.php +++ b/include/items.php @@ -407,7 +407,7 @@ function drop_item($id) // delete the item Item::deleteForUser(['id' => $item['id']], local_user()); - goaway('/item/drop/' . $id); + goaway('/network'); //NOTREACHED } else { notice(L10n::t('Permission denied.') . EOL); diff --git a/mod/filerm.php b/mod/filerm.php index 55b218e15..7fb978ae6 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -25,7 +25,7 @@ function filerm_content(App $a) { file_tag_unsave_file(local_user(),$item_id,$term, $category); } - goaway('/network'); + //goaway('/network'); killme(); }