Merge pull request #120 from ArthurHoaro/optionalupdate
shaarli/Shaarli#34: Make update check optional
This commit is contained in:
commit
0c5746061e
3 changed files with 22 additions and 11 deletions
|
@ -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'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL'])))
|
||||
|
@ -1462,6 +1463,7 @@ function renderPage()
|
|||
$GLOBALS['disablejquery']=!empty($_POST['disablejquery']);
|
||||
$GLOBALS['privateLinkByDefault']=!empty($_POST['privateLinkByDefault']);
|
||||
$GLOBALS['config']['ENABLE_RSS_PERMALINKS']= !empty($_POST['enableRssPermalinks']);
|
||||
$GLOBALS['config']['ENABLE_UPDATECHECK'] = !empty($_POST['updateCheck']);
|
||||
writeConfig();
|
||||
echo '<script>alert("Configuration was saved.");document.location=\'?do=tools\';</script>';
|
||||
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 '<script>alert("Shaarli is now configured. Please enter your login/password and start shaaring your links!");document.location=\'?do=login\';</script>';
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
<td>
|
||||
<input type="checkbox" name="enableRssPermalinks" id="enableRssPermalinks" {if="!empty($GLOBALS['config']['ENABLE_RSS_PERMALINKS'])"}checked{/if}/><label for="enableRssPermalinks"> Switches the RSS feed URLs between full URLs and shortlinks. Enabling it will show a permalink in the description, and the feed item will be linked to the absolute URL. Disabling it swaps this behaviour around (permalink in title and link in description). RSS Permalinks are currently <b>{if="$GLOBALS['config']['ENABLE_RSS_PERMALINKS']"}enabled{else}disabled{/if}</b></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td valign="top"><b>Update:</b></td><td>
|
||||
<input type="checkbox" name="updateCheck" id="updateCheck" {if="!empty($GLOBALS['config']['ENABLE_UPDATECHECK'])"}checked{/if}/>
|
||||
<label for="updateCheck"> Notify me when a new release is ready</label></td>
|
||||
</tr>
|
||||
<tr><td></td><td class="right"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr>
|
||||
</table>
|
||||
|
|
|
@ -11,6 +11,9 @@ <h1>Shaarli</h1>
|
|||
<tr><td><b>Password:</b></td><td><input type="password" name="setpassword" size="30"></td></tr>
|
||||
{$timezone_html}
|
||||
<tr><td><b>Page title:</b></td><td><input type="text" name="title" size="30"></td></tr>
|
||||
<tr><td valign="top"><b>Update:</b></td><td>
|
||||
<input type="checkbox" name="updateCheck" id="updateCheck" checked="checked"><label for="updateCheck"> Notify me when a new release is ready</label></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue