Skip to content

Commit

Permalink
Prevent visitors from reading shaarli version
Browse files Browse the repository at this point in the history
 * fixes #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.
  • Loading branch information
nodiscc committed Feb 25, 2015
1 parent 0c57460 commit dbcad74
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.php
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions shaarli_version.php
@@ -0,0 +1 @@
<?php /* 0.0.43beta */ ?>
1 change: 0 additions & 1 deletion shaarli_version.txt

This file was deleted.

0 comments on commit dbcad74

Please sign in to comment.