diff options
-rw-r--r-- | index.php | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -248,11 +248,11 @@ header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper int | |||
248 | //================================================================================================== | 248 | //================================================================================================== |
249 | 249 | ||
250 | function setup_login_state() { | 250 | function setup_login_state() { |
251 | $userIsLoggedIn = false; // By default, we do not consider the user as logged in; | ||
252 | $loginFailure = false; // If set to true, every attempt to authenticate the user will fail. This indicates that an important condition isn't met. | ||
253 | if ($GLOBALS['config']['OPEN_SHAARLI']) { | 251 | if ($GLOBALS['config']['OPEN_SHAARLI']) { |
254 | $userIsLoggedIn = true; | 252 | return true; |
255 | } | 253 | } |
254 | $userIsLoggedIn = false; // By default, we do not consider the user as logged in; | ||
255 | $loginFailure = false; // If set to true, every attempt to authenticate the user will fail. This indicates that an important condition isn't met. | ||
256 | if (!isset($GLOBALS['login'])) { | 256 | if (!isset($GLOBALS['login'])) { |
257 | $userIsLoggedIn = false; // Shaarli is not configured yet. | 257 | $userIsLoggedIn = false; // Shaarli is not configured yet. |
258 | $loginFailure = true; | 258 | $loginFailure = true; |
@@ -727,7 +727,7 @@ function showRSS() | |||
727 | // If cached was not found (or not usable), then read the database and build the response: | 727 | // If cached was not found (or not usable), then read the database and build the response: |
728 | $LINKSDB = new LinkDB( | 728 | $LINKSDB = new LinkDB( |
729 | $GLOBALS['config']['DATASTORE'], | 729 | $GLOBALS['config']['DATASTORE'], |
730 | isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], | 730 | isLoggedIn(), |
731 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] | 731 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] |
732 | ); | 732 | ); |
733 | // Read links from database (and filter private links if user it not logged in). | 733 | // Read links from database (and filter private links if user it not logged in). |
@@ -816,7 +816,7 @@ function showATOM() | |||
816 | // Read links from database (and filter private links if used it not logged in). | 816 | // Read links from database (and filter private links if used it not logged in). |
817 | $LINKSDB = new LinkDB( | 817 | $LINKSDB = new LinkDB( |
818 | $GLOBALS['config']['DATASTORE'], | 818 | $GLOBALS['config']['DATASTORE'], |
819 | isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], | 819 | isLoggedIn(), |
820 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] | 820 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] |
821 | ); | 821 | ); |
822 | 822 | ||
@@ -910,7 +910,7 @@ function showDailyRSS() { | |||
910 | // Read links from database (and filter private links if used it not logged in). | 910 | // Read links from database (and filter private links if used it not logged in). |
911 | $LINKSDB = new LinkDB( | 911 | $LINKSDB = new LinkDB( |
912 | $GLOBALS['config']['DATASTORE'], | 912 | $GLOBALS['config']['DATASTORE'], |
913 | isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], | 913 | isLoggedIn(), |
914 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] | 914 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] |
915 | ); | 915 | ); |
916 | 916 | ||
@@ -997,7 +997,7 @@ function showDaily() | |||
997 | { | 997 | { |
998 | $LINKSDB = new LinkDB( | 998 | $LINKSDB = new LinkDB( |
999 | $GLOBALS['config']['DATASTORE'], | 999 | $GLOBALS['config']['DATASTORE'], |
1000 | isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], | 1000 | isLoggedIn(), |
1001 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] | 1001 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] |
1002 | ); | 1002 | ); |
1003 | 1003 | ||
@@ -1088,7 +1088,7 @@ function renderPage() | |||
1088 | { | 1088 | { |
1089 | $LINKSDB = new LinkDB( | 1089 | $LINKSDB = new LinkDB( |
1090 | $GLOBALS['config']['DATASTORE'], | 1090 | $GLOBALS['config']['DATASTORE'], |
1091 | isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], | 1091 | isLoggedIn(), |
1092 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] | 1092 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] |
1093 | ); | 1093 | ); |
1094 | 1094 | ||
@@ -1751,10 +1751,10 @@ HTML; | |||
1751 | // Process the import file form. | 1751 | // Process the import file form. |
1752 | function importFile() | 1752 | function importFile() |
1753 | { | 1753 | { |
1754 | if (!(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'])) { die('Not allowed.'); } | 1754 | if (!isLoggedIn()) { die('Not allowed.'); } |
1755 | $LINKSDB = new LinkDB( | 1755 | $LINKSDB = new LinkDB( |
1756 | $GLOBALS['config']['DATASTORE'], | 1756 | $GLOBALS['config']['DATASTORE'], |
1757 | isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], | 1757 | isLoggedIn(), |
1758 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] | 1758 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] |
1759 | ); | 1759 | ); |
1760 | $filename=$_FILES['filetoupload']['name']; | 1760 | $filename=$_FILES['filetoupload']['name']; |