From 02ad8fb6ce6b09e7416a4a4c158748849df16df3 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Sun, 22 Nov 2015 17:39:50 +0100 Subject: [PATCH] Fix authentification when Shaarli is in Open Mode. --- index.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index 872acf09..3f3823b3 100644 --- a/index.php +++ b/index.php @@ -248,11 +248,11 @@ function stripslashes_deep($value) { $value = is_array($value) ? array_map('stri //================================================================================================== function setup_login_state() { + if ($GLOBALS['config']['OPEN_SHAARLI']) { + return true; + } $userIsLoggedIn = false; // By default, we do not consider the user as logged in; $loginFailure = false; // If set to true, every attempt to authenticate the user will fail. This indicates that an important condition isn't met. - if ($GLOBALS['config']['OPEN_SHAARLI']) { - $userIsLoggedIn = true; - } if (!isset($GLOBALS['login'])) { $userIsLoggedIn = false; // Shaarli is not configured yet. $loginFailure = true; @@ -727,7 +727,7 @@ function showRSS() // If cached was not found (or not usable), then read the database and build the response: $LINKSDB = new LinkDB( $GLOBALS['config']['DATASTORE'], - isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], + isLoggedIn(), $GLOBALS['config']['HIDE_PUBLIC_LINKS'] ); // Read links from database (and filter private links if user it not logged in). @@ -816,7 +816,7 @@ function showATOM() // Read links from database (and filter private links if used it not logged in). $LINKSDB = new LinkDB( $GLOBALS['config']['DATASTORE'], - isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], + isLoggedIn(), $GLOBALS['config']['HIDE_PUBLIC_LINKS'] ); @@ -910,7 +910,7 @@ function showDailyRSS() { // Read links from database (and filter private links if used it not logged in). $LINKSDB = new LinkDB( $GLOBALS['config']['DATASTORE'], - isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], + isLoggedIn(), $GLOBALS['config']['HIDE_PUBLIC_LINKS'] ); @@ -997,7 +997,7 @@ function showDaily() { $LINKSDB = new LinkDB( $GLOBALS['config']['DATASTORE'], - isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], + isLoggedIn(), $GLOBALS['config']['HIDE_PUBLIC_LINKS'] ); @@ -1088,7 +1088,7 @@ function renderPage() { $LINKSDB = new LinkDB( $GLOBALS['config']['DATASTORE'], - isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], + isLoggedIn(), $GLOBALS['config']['HIDE_PUBLIC_LINKS'] ); @@ -1751,10 +1751,10 @@ function renderPage() // Process the import file form. function importFile() { - if (!(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'])) { die('Not allowed.'); } + if (!isLoggedIn()) { die('Not allowed.'); } $LINKSDB = new LinkDB( $GLOBALS['config']['DATASTORE'], - isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], + isLoggedIn(), $GLOBALS['config']['HIDE_PUBLIC_LINKS'] ); $filename=$_FILES['filetoupload']['name'];