From 329e0768792b4fd22e548c0e1c4153aec3d6bcd1 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 20 Feb 2015 22:28:10 +0100 Subject: shaarli/Shaarli#34: Make update check optional * Add a check box at installation (checked by default) * Add a check box in configuration page --- index.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'index.php') diff --git a/index.php b/index.php index dfebdcad..9d4ce156 100644 --- a/index.php +++ b/index.php @@ -178,6 +178,7 @@ function checkphpversion() function checkUpdate() { if (!isLoggedIn()) return ''; // Do not check versions for visitors. + if (empty($GLOBALS['config']['ENABLE_UPDATECHECK'])) return ''; // Do not check if the user doesn't want to. // Get latest version number at most once a day. if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])alert("Configuration was saved.");document.location=\'?do=tools\';'; exit; @@ -2191,6 +2193,7 @@ function install() $GLOBALS['salt'] = sha1(uniqid('',true).'_'.mt_rand()); // Salt renders rainbow-tables attacks useless. $GLOBALS['hash'] = sha1($_POST['setpassword'].$GLOBALS['login'].$GLOBALS['salt']); $GLOBALS['title'] = (empty($_POST['title']) ? 'Shared links on '.htmlspecialchars(indexUrl()) : $_POST['title'] ); + $GLOBALS['config']['ENABLE_UPDATECHECK'] = !empty($_POST['updateCheck']); writeConfig(); echo ''; exit; @@ -2359,6 +2362,7 @@ function writeConfig() $config .= '$GLOBALS[\'disablejquery\']='.var_export($GLOBALS['disablejquery'],true).'; '; $config .= '$GLOBALS[\'privateLinkByDefault\']='.var_export($GLOBALS['privateLinkByDefault'],true).'; '; $config .= '$GLOBALS[\'config\'][\'ENABLE_RSS_PERMALINKS\']='.var_export($GLOBALS['config']['ENABLE_RSS_PERMALINKS'], true).'; '; + $config .= '$GLOBALS[\'config\'][\'ENABLE_UPDATECHECK\']='.var_export($GLOBALS['config']['ENABLE_UPDATECHECK'], true).'; '; $config .= ' ?>'; if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0) { -- cgit v1.2.3