aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam+github@flibidi.net>2017-09-18 21:25:02 +0200
committerGitHub <noreply@github.com>2017-09-18 21:25:02 +0200
commitfc1c1b8869817f5864c72d57385761b9124603da (patch)
tree4798f2e5ac2547cac90cfe5f316f3a5664f2cc4f /index.php
parentceb738c59163b47e9c875764c9d3223bbc1eba24 (diff)
parent27e21231e168e5a2a89563b2538a4f86df24e582 (diff)
downloadShaarli-fc1c1b8869817f5864c72d57385761b9124603da.tar.gz
Shaarli-fc1c1b8869817f5864c72d57385761b9124603da.tar.zst
Shaarli-fc1c1b8869817f5864c72d57385761b9124603da.zip
Merge pull request #961 from thewilli/private-shaarli-login-redirect
added option to redirect all anonymous users to 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(