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:
nodiscc 2015-02-25 13:25:45 +01:00
parent 0c5746061e
commit dbcad7406e
3 changed files with 3 additions and 3 deletions

View file

@ -184,8 +184,8 @@ function checkUpdate()
if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL'])))
{
$version=shaarli_version;
list($httpstatus,$headers,$data) = getHTTP('https://raw.githubusercontent.com/shaarli/Shaarli/master/shaarli_version.txt',2);
if (strpos($httpstatus,'200 OK')!==false) $version=$data;
list($httpstatus,$headers,$data) = getHTTP('https://raw.githubusercontent.com/shaarli/Shaarli/master/shaarli_version.php',2);
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.
file_put_contents($GLOBALS['config']['UPDATECHECK_FILENAME'],$version); // touch file date
}

1
shaarli_version.php Normal file
View file

@ -0,0 +1 @@
<?php /* 0.0.43beta */ ?>

View file

@ -1 +0,0 @@
0.0.43beta