From 329e0768792b4fd22e548c0e1c4153aec3d6bcd1 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 20 Feb 2015 22:28:10 +0100 Subject: [PATCH] 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 ++++ tpl/configure.html | 4 ++++ tpl/install.html | 25 ++++++++++++++----------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/index.php b/index.php index dfebdca..9d4ce15 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) { diff --git a/tpl/configure.html b/tpl/configure.html index c096018..887be32 100644 --- a/tpl/configure.html +++ b/tpl/configure.html @@ -29,6 +29,10 @@ + + Update: + + diff --git a/tpl/install.html b/tpl/install.html index df42bf6..88eb540 100644 --- a/tpl/install.html +++ b/tpl/install.html @@ -3,17 +3,20 @@ {include="includes"}{$timezone_js}
-

Shaarli

-It looks like it's the first time you run Shaarli. Please configure it:
-
- - - -{$timezone_html} - - -
Login:
Password:
Page title:
-
+

Shaarli

+ It looks like it's the first time you run Shaarli. Please configure it:
+
+ + + + {$timezone_html} + + + + +
Login:
Password:
Page title:
Update: +
+
{include="page.footer"}