1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-15 13:45:04 -05:00

Changed url's encryption from base64 to md5

Fixes Issue #243.
md5 hashes are only coded on 32 hexadecimal characters, so it won't make
too long file names.
This commit is contained in:
Thomas Citharel 2013-09-26 22:00:44 +02:00
parent 3408ed48ba
commit be2b9055b9

View File

@ -11,7 +11,7 @@ class FlattrItem {
public function checkItem($urltoflattr) { public function checkItem($urltoflattr) {
$this->cacheflattrfile($urltoflattr); $this->cacheflattrfile($urltoflattr);
$flattrResponse = file_get_contents(CACHE . "/flattr/".base64_encode($urltoflattr).".cache"); $flattrResponse = file_get_contents(CACHE . "/flattr/".md5($urltoflattr).".cache");
if($flattrResponse != FALSE) { if($flattrResponse != FALSE) {
$result = json_decode($flattrResponse); $result = json_decode($flattrResponse);
if (isset($result->message)){ if (isset($result->message)){
@ -39,9 +39,9 @@ class FlattrItem {
} }
// if a cache flattr file for this url already exists and it's been less than one day than it have been updated, see in /cache // if a cache flattr file for this url already exists and it's been less than one day than it have been updated, see in /cache
if ((!file_exists(CACHE . "/flattr/".base64_encode($urltoflattr).".cache")) || (time() - filemtime(CACHE . "/flattr/".base64_encode($urltoflattr).".cache") > 86400)) { if ((!file_exists(CACHE . "/flattr/".md5($urltoflattr).".cache")) || (time() - filemtime(CACHE . "/flattr/".md5($urltoflattr).".cache") > 86400)) {
$askForFlattr = Tools::getFile(FLATTR_API . $urltoflattr); $askForFlattr = Tools::getFile(FLATTR_API . $urltoflattr);
$flattrCacheFile = fopen(CACHE . "/flattr/".base64_encode($urltoflattr).".cache", 'w+'); $flattrCacheFile = fopen(CACHE . "/flattr/".md5($urltoflattr).".cache", 'w+');
fwrite($flattrCacheFile, $askForFlattr); fwrite($flattrCacheFile, $askForFlattr);
fclose($flattrCacheFile); fclose($flattrCacheFile);
} }