aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php57
1 files changed, 16 insertions, 41 deletions
diff --git a/index.php b/index.php
index c0e0c66d..a31cbeab 100644
--- a/index.php
+++ b/index.php
@@ -457,57 +457,19 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
457 457
458 // -------- User wants to change the number of bookmarks per page (linksperpage=...) 458 // -------- User wants to change the number of bookmarks per page (linksperpage=...)
459 if (isset($_GET['linksperpage'])) { 459 if (isset($_GET['linksperpage'])) {
460 if (is_numeric($_GET['linksperpage'])) { 460 header('Location: ./links-per-page?nb='. $_GET['linksperpage']);
461 $_SESSION['LINKS_PER_PAGE']=abs(intval($_GET['linksperpage']));
462 }
463
464 if (! empty($_SERVER['HTTP_REFERER'])) {
465 $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('linksperpage'));
466 } else {
467 $location = '?';
468 }
469 header('Location: '. $location);
470 exit; 461 exit;
471 } 462 }
472 463
473 // -------- User wants to see only private bookmarks (toggle) 464 // -------- User wants to see only private bookmarks (toggle)
474 if (isset($_GET['visibility'])) { 465 if (isset($_GET['visibility'])) {
475 if ($_GET['visibility'] === 'private') { 466 header('Location: ./visibility/'. $_GET['visibility']);
476 // Visibility not set or not already private, set private, otherwise reset it
477 if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'private') {
478 // See only private bookmarks
479 $_SESSION['visibility'] = 'private';
480 } else {
481 unset($_SESSION['visibility']);
482 }
483 } elseif ($_GET['visibility'] === 'public') {
484 if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'public') {
485 // See only public bookmarks
486 $_SESSION['visibility'] = 'public';
487 } else {
488 unset($_SESSION['visibility']);
489 }
490 }
491
492 if (! empty($_SERVER['HTTP_REFERER'])) {
493 $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('visibility'));
494 } else {
495 $location = '?';
496 }
497 header('Location: '. $location);
498 exit; 467 exit;
499 } 468 }
500 469
501 // -------- User wants to see only untagged bookmarks (toggle) 470 // -------- User wants to see only untagged bookmarks (toggle)
502 if (isset($_GET['untaggedonly'])) { 471 if (isset($_GET['untaggedonly'])) {
503 $_SESSION['untaggedonly'] = empty($_SESSION['untaggedonly']); 472 header('Location: ./untagged-only');
504
505 if (! empty($_SERVER['HTTP_REFERER'])) {
506 $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('untaggedonly'));
507 } else {
508 $location = '?';
509 }
510 header('Location: '. $location);
511 exit; 473 exit;
512 } 474 }
513 475
@@ -1549,6 +1511,19 @@ $app->group('', function () {
1549 1511
1550 $this->get('/add-tag/{newTag}', '\Shaarli\Front\Controller\TagController:addTag')->setName('add-tag'); 1512 $this->get('/add-tag/{newTag}', '\Shaarli\Front\Controller\TagController:addTag')->setName('add-tag');
1551 $this->get('/remove-tag/{tag}', '\Shaarli\Front\Controller\TagController:removeTag')->setName('remove-tag'); 1513 $this->get('/remove-tag/{tag}', '\Shaarli\Front\Controller\TagController:removeTag')->setName('remove-tag');
1514
1515 $this
1516 ->get('/links-per-page', '\Shaarli\Front\Controller\SessionFilterController:linksPerPage')
1517 ->setName('filter-links-per-page')
1518 ;
1519 $this
1520 ->get('/visibility/{visibility}', '\Shaarli\Front\Controller\SessionFilterController:visibility')
1521 ->setName('visibility')
1522 ;
1523 $this
1524 ->get('/untagged-only', '\Shaarli\Front\Controller\SessionFilterController:untaggedOnly')
1525 ->setName('untagged-only')
1526 ;
1552})->add('\Shaarli\Front\ShaarliMiddleware'); 1527})->add('\Shaarli\Front\ShaarliMiddleware');
1553 1528
1554$response = $app->run(true); 1529$response = $app->run(true);