Prevent visitors from reading shaarli version
* fixes https://github.com/shaarli/Shaarli/issues/122 * the shaarli version is now in a php comment block, which prevents visitors from reading it when it is place on a PHP-enabled server, but still allows the update mechanism to read it from the source on github.
This commit is contained in:
parent
0c5746061e
commit
dbcad7406e
3 changed files with 3 additions and 3 deletions
|
@ -184,8 +184,8 @@ function checkUpdate()
|
||||||
if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL'])))
|
if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL'])))
|
||||||
{
|
{
|
||||||
$version=shaarli_version;
|
$version=shaarli_version;
|
||||||
list($httpstatus,$headers,$data) = getHTTP('https://raw.githubusercontent.com/shaarli/Shaarli/master/shaarli_version.txt',2);
|
list($httpstatus,$headers,$data) = getHTTP('https://raw.githubusercontent.com/shaarli/Shaarli/master/shaarli_version.php',2);
|
||||||
if (strpos($httpstatus,'200 OK')!==false) $version=$data;
|
if (strpos($httpstatus,'200 OK')!==false) $version=str_replace(' */ ?>','',str_replace('<?php /* ','',$data));
|
||||||
// If failed, never mind. We don't want to bother the user with that.
|
// If failed, never mind. We don't want to bother the user with that.
|
||||||
file_put_contents($GLOBALS['config']['UPDATECHECK_FILENAME'],$version); // touch file date
|
file_put_contents($GLOBALS['config']['UPDATECHECK_FILENAME'],$version); // touch file date
|
||||||
}
|
}
|
||||||
|
|
1
shaarli_version.php
Normal file
1
shaarli_version.php
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<?php /* 0.0.43beta */ ?>
|
|
@ -1 +0,0 @@
|
||||||
0.0.43beta
|
|
Loading…
Reference in a new issue