diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-06-15 08:15:40 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | 3447d888d7881eed437117a6de2450abb96f6a76 (patch) | |
tree | 6e04cb9ed27d587f9ded92fc2faf5dc58b6332e4 /index.php | |
parent | 7b8a6f2858248601d43c1b8247deb91b74392d2e (diff) | |
download | Shaarli-3447d888d7881eed437117a6de2450abb96f6a76.tar.gz Shaarli-3447d888d7881eed437117a6de2450abb96f6a76.tar.zst Shaarli-3447d888d7881eed437117a6de2450abb96f6a76.zip |
Pin bookmarks through Slim controller
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 17 |
1 files changed, 3 insertions, 14 deletions
@@ -567,20 +567,8 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM | |||
567 | } | 567 | } |
568 | 568 | ||
569 | if ($targetPage == Router::$PAGE_PINLINK) { | 569 | if ($targetPage == Router::$PAGE_PINLINK) { |
570 | if (! isset($_GET['id']) || !$bookmarkService->exists($_GET['id'])) { | 570 | // This route is no longer supported in legacy mode |
571 | // FIXME! Use a proper error system. | 571 | header('Location: ./'); |
572 | $msg = t('Invalid link ID provided'); | ||
573 | echo '<script>alert("'. $msg .'");document.location=\''. index_url($_SERVER) .'\';</script>'; | ||
574 | exit; | ||
575 | } | ||
576 | if (! $sessionManager->checkToken($_GET['token'])) { | ||
577 | die('Wrong token.'); | ||
578 | } | ||
579 | |||
580 | $link = $bookmarkService->get($_GET['id']); | ||
581 | $link->setSticky(! $link->isSticky()); | ||
582 | $bookmarkService->set($link); | ||
583 | header('Location: '.index_url($_SERVER)); | ||
584 | exit; | 572 | exit; |
585 | } | 573 | } |
586 | 574 | ||
@@ -1121,6 +1109,7 @@ $app->group('', function () { | |||
1121 | $this->post('/admin/shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:save'); | 1109 | $this->post('/admin/shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:save'); |
1122 | $this->get('/admin/shaare/delete', '\Shaarli\Front\Controller\Admin\ManageShaareController:deleteBookmark'); | 1110 | $this->get('/admin/shaare/delete', '\Shaarli\Front\Controller\Admin\ManageShaareController:deleteBookmark'); |
1123 | $this->get('/admin/shaare/visibility', '\Shaarli\Front\Controller\Admin\ManageShaareController:changeVisibility'); | 1111 | $this->get('/admin/shaare/visibility', '\Shaarli\Front\Controller\Admin\ManageShaareController:changeVisibility'); |
1112 | $this->get('/admin/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark'); | ||
1124 | 1113 | ||
1125 | $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage'); | 1114 | $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage'); |
1126 | $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility'); | 1115 | $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility'); |