public $flattrItemURL;
public $numflattrs;
- public function checkItem($urltoflattr) {
- $this->cacheflattrfile($urltoflattr);
- $flattrResponse = file_get_contents(CACHE . "/flattr/".md5($urltoflattr).".cache");
+ public function checkItem($urltoflattr,$id) {
+ $this->cacheflattrfile($urltoflattr, $id);
+ $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache");
+ print_r($flattrResponse);
if($flattrResponse != FALSE) {
$result = json_decode($flattrResponse);
if (isset($result->message)){
}
}
- private function cacheflattrfile($urltoflattr) {
+ private function cacheflattrfile($urltoflattr, $id) {
if (!is_dir(CACHE . '/flattr')) {
mkdir(CACHE . '/flattr', 0777);
}
// 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/".md5($urltoflattr).".cache")) || (time() - filemtime(CACHE . "/flattr/".md5($urltoflattr).".cache") > 86400)) {
+ if ((!file_exists(CACHE . "/flattr/".$id.".cache")) || (time() - filemtime(CACHE . "/flattr/".$id.".cache") > 86400)) {
$askForFlattr = Tools::getFile(FLATTR_API . $urltoflattr);
- $flattrCacheFile = fopen(CACHE . "/flattr/".md5($urltoflattr).".cache", 'w+');
+ $flattrCacheFile = fopen(CACHE . "/flattr/".$id.".cache", 'w+');
fwrite($flattrCacheFile, $askForFlattr);
fclose($flattrCacheFile);
}