aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorWilli Eggeling <thewilli@gmail.com>2017-08-31 00:39:15 +0200
committerWilli Eggeling <thewilli@gmail.com>2017-09-03 11:46:49 +0200
commit27e21231e168e5a2a89563b2538a4f86df24e582 (patch)
tree851c51115ce4d01dd30e57a048f8ed8b2a3c4e1b /index.php
parent96a1c79456b27892b9221707803f29585565b9dc (diff)
downloadShaarli-27e21231e168e5a2a89563b2538a4f86df24e582.tar.gz
Shaarli-27e21231e168e5a2a89563b2538a4f86df24e582.tar.zst
Shaarli-27e21231e168e5a2a89563b2538a4f86df24e582.zip
added option to redirect all anonymous users to login page
- new setting *force_login* added and documented - if both, *force_login* and *hide_public_links* are set to true, all requests (except for the feeds) are redirected to the login page
Diffstat (limited to 'index.php')
-rw-r--r--index.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/index.php b/index.php
index 218d317d..fb00a9fa 100644
--- a/index.php
+++ b/index.php
@@ -718,6 +718,23 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
718 $query = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : ''; 718 $query = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : '';
719 $targetPage = Router::findPage($query, $_GET, isLoggedIn()); 719 $targetPage = Router::findPage($query, $_GET, isLoggedIn());
720 720
721 if (
722 // if the user isn't logged in
723 !isLoggedIn() &&
724 // and Shaarli doesn't have public content...
725 $conf->get('privacy.hide_public_links') &&
726 // and is configured to enforce the login
727 $conf->get('privacy.force_login') &&
728 // and the current page isn't already the login page
729 $targetPage !== Router::$PAGE_LOGIN &&
730 // and the user is not requesting a feed (which would lead to a different content-type as expected)
731 $targetPage !== Router::$PAGE_FEED_ATOM &&
732 $targetPage !== Router::$PAGE_FEED_RSS
733 ) {
734 // force current page to be the login page
735 $targetPage = Router::$PAGE_LOGIN;
736 }
737
721 // Call plugin hooks for header, footer and includes, specifying which page will be rendered. 738 // Call plugin hooks for header, footer and includes, specifying which page will be rendered.
722 // Then assign generated data to RainTPL. 739 // Then assign generated data to RainTPL.
723 $common_hooks = array( 740 $common_hooks = array(