aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorEmilien Klein <emilien@klein.st>2015-02-21 14:45:48 +0100
committerEmilien Klein <emilien@klein.st>2015-02-21 14:45:48 +0100
commit0c5746061e49fb857ce2c170ade8ad7dc594a405 (patch)
treef77585efe4d00c7a81c4599fdaed951d01b2459e /index.php
parentbe3f0b4ec361f63a6fa4ed8291c912c9a426cd16 (diff)
parent329e0768792b4fd22e548c0e1c4153aec3d6bcd1 (diff)
downloadShaarli-0c5746061e49fb857ce2c170ade8ad7dc594a405.tar.gz
Shaarli-0c5746061e49fb857ce2c170ade8ad7dc594a405.tar.zst
Shaarli-0c5746061e49fb857ce2c170ade8ad7dc594a405.zip
Merge pull request #120 from ArthurHoaro/optionalupdate
shaarli/Shaarli#34: Make update check optional
Diffstat (limited to 'index.php')
-rw-r--r--index.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/index.php b/index.php
index dfebdcad..9d4ce156 100644
--- a/index.php
+++ b/index.php
@@ -178,6 +178,7 @@ function checkphpversion()
178function checkUpdate() 178function checkUpdate()
179{ 179{
180 if (!isLoggedIn()) return ''; // Do not check versions for visitors. 180 if (!isLoggedIn()) return ''; // Do not check versions for visitors.
181 if (empty($GLOBALS['config']['ENABLE_UPDATECHECK'])) return ''; // Do not check if the user doesn't want to.
181 182
182 // Get latest version number at most once a day. 183 // Get latest version number at most once a day.
183 if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL']))) 184 if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL'])))
@@ -1462,6 +1463,7 @@ function renderPage()
1462 $GLOBALS['disablejquery']=!empty($_POST['disablejquery']); 1463 $GLOBALS['disablejquery']=!empty($_POST['disablejquery']);
1463 $GLOBALS['privateLinkByDefault']=!empty($_POST['privateLinkByDefault']); 1464 $GLOBALS['privateLinkByDefault']=!empty($_POST['privateLinkByDefault']);
1464 $GLOBALS['config']['ENABLE_RSS_PERMALINKS']= !empty($_POST['enableRssPermalinks']); 1465 $GLOBALS['config']['ENABLE_RSS_PERMALINKS']= !empty($_POST['enableRssPermalinks']);
1466 $GLOBALS['config']['ENABLE_UPDATECHECK'] = !empty($_POST['updateCheck']);
1465 writeConfig(); 1467 writeConfig();
1466 echo '<script>alert("Configuration was saved.");document.location=\'?do=tools\';</script>'; 1468 echo '<script>alert("Configuration was saved.");document.location=\'?do=tools\';</script>';
1467 exit; 1469 exit;
@@ -2191,6 +2193,7 @@ function install()
2191 $GLOBALS['salt'] = sha1(uniqid('',true).'_'.mt_rand()); // Salt renders rainbow-tables attacks useless. 2193 $GLOBALS['salt'] = sha1(uniqid('',true).'_'.mt_rand()); // Salt renders rainbow-tables attacks useless.
2192 $GLOBALS['hash'] = sha1($_POST['setpassword'].$GLOBALS['login'].$GLOBALS['salt']); 2194 $GLOBALS['hash'] = sha1($_POST['setpassword'].$GLOBALS['login'].$GLOBALS['salt']);
2193 $GLOBALS['title'] = (empty($_POST['title']) ? 'Shared links on '.htmlspecialchars(indexUrl()) : $_POST['title'] ); 2195 $GLOBALS['title'] = (empty($_POST['title']) ? 'Shared links on '.htmlspecialchars(indexUrl()) : $_POST['title'] );
2196 $GLOBALS['config']['ENABLE_UPDATECHECK'] = !empty($_POST['updateCheck']);
2194 writeConfig(); 2197 writeConfig();
2195 echo '<script>alert("Shaarli is now configured. Please enter your login/password and start shaaring your links!");document.location=\'?do=login\';</script>'; 2198 echo '<script>alert("Shaarli is now configured. Please enter your login/password and start shaaring your links!");document.location=\'?do=login\';</script>';
2196 exit; 2199 exit;
@@ -2359,6 +2362,7 @@ function writeConfig()
2359 $config .= '$GLOBALS[\'disablejquery\']='.var_export($GLOBALS['disablejquery'],true).'; '; 2362 $config .= '$GLOBALS[\'disablejquery\']='.var_export($GLOBALS['disablejquery'],true).'; ';
2360 $config .= '$GLOBALS[\'privateLinkByDefault\']='.var_export($GLOBALS['privateLinkByDefault'],true).'; '; 2363 $config .= '$GLOBALS[\'privateLinkByDefault\']='.var_export($GLOBALS['privateLinkByDefault'],true).'; ';
2361 $config .= '$GLOBALS[\'config\'][\'ENABLE_RSS_PERMALINKS\']='.var_export($GLOBALS['config']['ENABLE_RSS_PERMALINKS'], true).'; '; 2364 $config .= '$GLOBALS[\'config\'][\'ENABLE_RSS_PERMALINKS\']='.var_export($GLOBALS['config']['ENABLE_RSS_PERMALINKS'], true).'; ';
2365 $config .= '$GLOBALS[\'config\'][\'ENABLE_UPDATECHECK\']='.var_export($GLOBALS['config']['ENABLE_UPDATECHECK'], true).'; ';
2362 $config .= ' ?>'; 2366 $config .= ' ?>';
2363 if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0) 2367 if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0)
2364 { 2368 {