From 4df7ef0b3d703ac3380404749e9c0bc801c3e0b8 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 5 Nov 2016 14:13:18 +0100 Subject: Bugfixes on link deletion, and use a GET form Use a GET form to delete links: harmonize with edit_link and preparation for #585 Bug fixes: * LinkDB element can't be passed as reference, fix error: PHP Notice: Indirect modification of overloaded element of LinkDB has no effect * Resource cache folder setting wasn't set correctly --- index.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 84282b8d..c4c0d15a 100644 --- a/index.php +++ b/index.php @@ -1314,18 +1314,19 @@ function renderPage($conf, $pluginManager) } // -------- User clicked the "Delete" button when editing a link: Delete link from database. - if (isset($_POST['delete_link'])) + if ($targetPage == Router::$PAGE_DELETELINK) { - if (!tokenOk($_POST['token'])) die('Wrong token.'); + if (!tokenOk($_GET['token'])) die('Wrong token.'); // We do not need to ask for confirmation: // - confirmation is handled by JavaScript // - we are protected from XSRF by the token. - $linkdate=$_POST['lf_linkdate']; - - $pluginManager->executeHooks('delete_link', $LINKSDB[$linkdate]); + $linkdate = $_GET['delete_link']; + $link = $LINKSDB[$linkdate]; + + $pluginManager->executeHooks('delete_link', $link); unset($LINKSDB[$linkdate]); - $LINKSDB->save('resource.page_cache'); // save to disk + $LINKSDB->save($conf->get('resource.page_cache')); // save to disk // If we are called from the bookmarklet, we must close the popup: if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo ''; exit; } -- cgit v1.2.3