aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authornodiscc <nodiscc@gmail.com>2015-04-10 20:30:33 +0200
committernodiscc <nodiscc@gmail.com>2015-04-10 20:30:33 +0200
commit0c45b01cc2af1d0c8771f4c20de3e8f732c93080 (patch)
tree4775671ecf60696f2483c1275d4c641b3936ee47 /index.php
parent507849290c802b2a2a45541d6888108a9aef238b (diff)
parent8fa1ebd6059050566bd685c23d88ff4f60a20c55 (diff)
downloadShaarli-0c45b01cc2af1d0c8771f4c20de3e8f732c93080.tar.gz
Shaarli-0c45b01cc2af1d0c8771f4c20de3e8f732c93080.tar.zst
Shaarli-0c45b01cc2af1d0c8771f4c20de3e8f732c93080.zip
Merge remote-tracking branch 'pikzen/disable-public' into next
Diffstat (limited to 'index.php')
-rw-r--r--index.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/index.php b/index.php
index 69a53c56..2014bcea 100644
--- a/index.php
+++ b/index.php
@@ -34,6 +34,7 @@ $GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; // Updates check frequency
34 // Note: You must have publisher.php in the same directory as Shaarli index.php 34 // Note: You must have publisher.php in the same directory as Shaarli index.php
35$GLOBALS['config']['ARCHIVE_ORG'] = false; // For each link, add a link to an archived version on archive.org 35$GLOBALS['config']['ARCHIVE_ORG'] = false; // For each link, add a link to an archived version on archive.org
36$GLOBALS['config']['ENABLE_RSS_PERMALINKS'] = true; // Enable RSS permalinks by default. This corresponds to the default behavior of shaarli before this was added as an option. 36$GLOBALS['config']['ENABLE_RSS_PERMALINKS'] = true; // Enable RSS permalinks by default. This corresponds to the default behavior of shaarli before this was added as an option.
37$GLOBALS['config']['DISABLE_PUBLIC_LINKS'] = false;
37// ----------------------------------------------------------------------------------------------- 38// -----------------------------------------------------------------------------------------------
38// You should not touch below (or at your own risks!) 39// You should not touch below (or at your own risks!)
39// Optional config file. 40// Optional config file.
@@ -1459,6 +1460,7 @@ function renderPage()
1459 $GLOBALS['privateLinkByDefault']=!empty($_POST['privateLinkByDefault']); 1460 $GLOBALS['privateLinkByDefault']=!empty($_POST['privateLinkByDefault']);
1460 $GLOBALS['config']['ENABLE_RSS_PERMALINKS']= !empty($_POST['enableRssPermalinks']); 1461 $GLOBALS['config']['ENABLE_RSS_PERMALINKS']= !empty($_POST['enableRssPermalinks']);
1461 $GLOBALS['config']['ENABLE_UPDATECHECK'] = !empty($_POST['updateCheck']); 1462 $GLOBALS['config']['ENABLE_UPDATECHECK'] = !empty($_POST['updateCheck']);
1463 $GLOBALS['config']['DISABLE_PUBLIC_LINKS'] = !empty($_POST['disablePublicLinks']);
1462 writeConfig(); 1464 writeConfig();
1463 echo '<script>alert("Configuration was saved.");document.location=\'?do=tools\';</script>'; 1465 echo '<script>alert("Configuration was saved.");document.location=\'?do=tools\';</script>';
1464 exit; 1466 exit;
@@ -1899,9 +1901,13 @@ function buildLinkList($PAGE,$LINKSDB)
1899 } 1901 }
1900 $search_type='permalink'; 1902 $search_type='permalink';
1901 } 1903 }
1904 // We chose to disable all private links and the user isn't logged in, do not return any link.
1905 else if ($GLOBALS['config']['DISABLE_PUBLIC_LINKS'] && !isLoggedIn())
1906 $linksToDisplay = array();
1902 else 1907 else
1903 $linksToDisplay = $LINKSDB; // Otherwise, display without filtering. 1908 $linksToDisplay = $LINKSDB; // Otherwise, display without filtering.
1904 1909
1910
1905 // Option: Show only private links 1911 // Option: Show only private links
1906 if (!empty($_SESSION['privateonly'])) 1912 if (!empty($_SESSION['privateonly']))
1907 { 1913 {
@@ -2328,6 +2334,7 @@ function writeConfig()
2328 $config .= '$GLOBALS[\'privateLinkByDefault\']='.var_export($GLOBALS['privateLinkByDefault'],true).'; '; 2334 $config .= '$GLOBALS[\'privateLinkByDefault\']='.var_export($GLOBALS['privateLinkByDefault'],true).'; ';
2329 $config .= '$GLOBALS[\'config\'][\'ENABLE_RSS_PERMALINKS\']='.var_export($GLOBALS['config']['ENABLE_RSS_PERMALINKS'], true).'; '; 2335 $config .= '$GLOBALS[\'config\'][\'ENABLE_RSS_PERMALINKS\']='.var_export($GLOBALS['config']['ENABLE_RSS_PERMALINKS'], true).'; ';
2330 $config .= '$GLOBALS[\'config\'][\'ENABLE_UPDATECHECK\']='.var_export($GLOBALS['config']['ENABLE_UPDATECHECK'], true).'; '; 2336 $config .= '$GLOBALS[\'config\'][\'ENABLE_UPDATECHECK\']='.var_export($GLOBALS['config']['ENABLE_UPDATECHECK'], true).'; ';
2337 $config .= '$GLOBALS[\'config\'][\'DISABLE_PUBLIC_LINKS\']='.var_export($GLOBALS['config']['DISABLE_PUBLIC_LINKS'], true).'; ';
2331 $config .= ' ?>'; 2338 $config .= ' ?>';
2332 if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0) 2339 if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0)
2333 { 2340 {