diff options
author | Emilien Klein <emilien@klein.st> | 2015-02-21 14:45:48 +0100 |
---|---|---|
committer | Emilien Klein <emilien@klein.st> | 2015-02-21 14:45:48 +0100 |
commit | 0c5746061e49fb857ce2c170ade8ad7dc594a405 (patch) | |
tree | f77585efe4d00c7a81c4599fdaed951d01b2459e /index.php | |
parent | be3f0b4ec361f63a6fa4ed8291c912c9a426cd16 (diff) | |
parent | 329e0768792b4fd22e548c0e1c4153aec3d6bcd1 (diff) | |
download | Shaarli-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.php | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -178,6 +178,7 @@ function checkphpversion() | |||
178 | function checkUpdate() | 178 | function 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 | { |