aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-11-23 20:24:35 +0100
committerVirtualTam <virtualtam@flibidi.net>2015-11-23 20:24:35 +0100
commitc580024cfbe5f0d290b09157b9665d1b4131d7f4 (patch)
tree5963b10a6eeb3ac731d2da6b4046e3770b5f105a /index.php
parent98348200e397864396cfea7db6b9fca698b033e1 (diff)
parent02ad8fb6ce6b09e7416a4a4c158748849df16df3 (diff)
downloadShaarli-c580024cfbe5f0d290b09157b9665d1b4131d7f4.tar.gz
Shaarli-c580024cfbe5f0d290b09157b9665d1b4131d7f4.tar.zst
Shaarli-c580024cfbe5f0d290b09157b9665d1b4131d7f4.zip
Merge pull request #384 from roidelapluie/master
fill session info when shaarli is in open mode
Diffstat (limited to 'index.php')
-rw-r--r--index.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/index.php b/index.php
index 8eda9880..be181a2c 100644
--- a/index.php
+++ b/index.php
@@ -248,11 +248,11 @@ header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper int
248//================================================================================================== 248//==================================================================================================
249 249
250function setup_login_state() { 250function 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
@@ -1759,10 +1759,10 @@ HTML;
1759// Process the import file form. 1759// Process the import file form.
1760function importFile() 1760function importFile()
1761{ 1761{
1762 if (!(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'])) { die('Not allowed.'); } 1762 if (!isLoggedIn()) { die('Not allowed.'); }
1763 $LINKSDB = new LinkDB( 1763 $LINKSDB = new LinkDB(
1764 $GLOBALS['config']['DATASTORE'], 1764 $GLOBALS['config']['DATASTORE'],
1765 isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'], 1765 isLoggedIn(),
1766 $GLOBALS['config']['HIDE_PUBLIC_LINKS'] 1766 $GLOBALS['config']['HIDE_PUBLIC_LINKS']
1767 ); 1767 );
1768 $filename=$_FILES['filetoupload']['name']; 1768 $filename=$_FILES['filetoupload']['name'];