aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-05-22 22:44:38 +0200
committerArthurHoaro <arthur@hoa.ro>2018-10-06 12:55:05 +0200
commit4154c25b5f2f8044a37d7f84e04173bb54f2375b (patch)
treee7f61835072a54eee8590286496bdbbbef0e4a37 /index.php
parent10a7b5cee96a742fbe86edbea977f3c55c92e9aa (diff)
downloadShaarli-4154c25b5f2f8044a37d7f84e04173bb54f2375b.tar.gz
Shaarli-4154c25b5f2f8044a37d7f84e04173bb54f2375b.tar.zst
Shaarli-4154c25b5f2f8044a37d7f84e04173bb54f2375b.zip
Add a button to set links as sticky
Meaning that they always appear on top of all links Fixes #186
Diffstat (limited to 'index.php')
-rw-r--r--index.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/index.php b/index.php
index 0ef33633..b702bd13 100644
--- a/index.php
+++ b/index.php
@@ -1353,6 +1353,25 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
1353 exit; 1353 exit;
1354 } 1354 }
1355 1355
1356 if ($targetPage == Router::$PAGE_PINLINK) {
1357 if (! isset($_GET['id']) || empty($LINKSDB[$_GET['id']])) {
1358 // FIXME! Use a proper error system.
1359 $msg = t('Invalid link ID provided');
1360 echo '<script>alert("'. $msg .'");document.location=\''. index_url($_SERVER) .'\';</script>';
1361 exit;
1362 }
1363 if (! $sessionManager->checkToken($_GET['token'])) {
1364 die('Wrong token.');
1365 }
1366
1367 $link = $LINKSDB[$_GET['id']];
1368 $link['sticky'] = ! $link['sticky'];
1369 $LINKSDB[(int) $_GET['id']] = $link;
1370 $LINKSDB->save($conf->get('resource.page_cache'));
1371 header('Location: '.index_url($_SERVER));
1372 exit;
1373 }
1374
1356 if ($targetPage == Router::$PAGE_EXPORT) { 1375 if ($targetPage == Router::$PAGE_EXPORT) {
1357 // Export links as a Netscape Bookmarks file 1376 // Export links as a Netscape Bookmarks file
1358 1377