aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-11-05 14:13:18 +0100
committerArthurHoaro <arthur@hoa.ro>2016-11-05 14:30:56 +0100
commit4df7ef0b3d703ac3380404749e9c0bc801c3e0b8 (patch)
treebf228fd84a92e03543f898df6a7bb3308333de04 /index.php
parent9596cb130d59003deffbd07defbde77dd2bb0368 (diff)
downloadShaarli-4df7ef0b3d703ac3380404749e9c0bc801c3e0b8.tar.gz
Shaarli-4df7ef0b3d703ac3380404749e9c0bc801c3e0b8.tar.zst
Shaarli-4df7ef0b3d703ac3380404749e9c0bc801c3e0b8.zip
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
Diffstat (limited to 'index.php')
-rw-r--r--index.php13
1 files changed, 7 insertions, 6 deletions
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)
1314 } 1314 }
1315 1315
1316 // -------- User clicked the "Delete" button when editing a link: Delete link from database. 1316 // -------- User clicked the "Delete" button when editing a link: Delete link from database.
1317 if (isset($_POST['delete_link'])) 1317 if ($targetPage == Router::$PAGE_DELETELINK)
1318 { 1318 {
1319 if (!tokenOk($_POST['token'])) die('Wrong token.'); 1319 if (!tokenOk($_GET['token'])) die('Wrong token.');
1320 // We do not need to ask for confirmation: 1320 // We do not need to ask for confirmation:
1321 // - confirmation is handled by JavaScript 1321 // - confirmation is handled by JavaScript
1322 // - we are protected from XSRF by the token. 1322 // - we are protected from XSRF by the token.
1323 $linkdate=$_POST['lf_linkdate']; 1323 $linkdate = $_GET['delete_link'];
1324 1324 $link = $LINKSDB[$linkdate];
1325 $pluginManager->executeHooks('delete_link', $LINKSDB[$linkdate]); 1325
1326 $pluginManager->executeHooks('delete_link', $link);
1326 1327
1327 unset($LINKSDB[$linkdate]); 1328 unset($LINKSDB[$linkdate]);
1328 $LINKSDB->save('resource.page_cache'); // save to disk 1329 $LINKSDB->save($conf->get('resource.page_cache')); // save to disk
1329 1330
1330 // If we are called from the bookmarklet, we must close the popup: 1331 // If we are called from the bookmarklet, we must close the popup:
1331 if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo '<script>self.close();</script>'; exit; } 1332 if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo '<script>self.close();</script>'; exit; }