diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-10-03 14:51:20 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-10-03 14:51:20 +0200 |
commit | 747c6698b668ce645c0a771ddc1a0ef748a58177 (patch) | |
tree | 70c6eab48e74598f9f5534c54c43a67404410be5 /inc | |
parent | 8f91e10faa97df1a50cbbd5fb64eab5190361727 (diff) | |
parent | 4e5b04113d923b54206436c74ce1fa8649854046 (diff) | |
download | wallabag-747c6698b668ce645c0a771ddc1a0ef748a58177.tar.gz wallabag-747c6698b668ce645c0a771ddc1a0ef748a58177.tar.zst wallabag-747c6698b668ce645c0a771ddc1a0ef748a58177.zip |
Merge branch 'dev' of git://github.com/tcitworld/poche into tcitworld-dev
Diffstat (limited to 'inc')
-rw-r--r-- | inc/3rdparty/FlattrItem.class.php | 13 | ||||
-rw-r--r-- | inc/poche/Poche.class.php | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/inc/3rdparty/FlattrItem.class.php b/inc/3rdparty/FlattrItem.class.php index c940fcd6..2b7ea3fa 100644 --- a/inc/3rdparty/FlattrItem.class.php +++ b/inc/3rdparty/FlattrItem.class.php | |||
@@ -9,9 +9,10 @@ class FlattrItem { | |||
9 | public $flattrItemURL; | 9 | public $flattrItemURL; |
10 | public $numflattrs; | 10 | public $numflattrs; |
11 | 11 | ||
12 | public function checkItem($urltoflattr) { | 12 | public function checkItem($urltoflattr,$id) { |
13 | $this->cacheflattrfile($urltoflattr); | 13 | $this->cacheflattrfile($urltoflattr, $id); |
14 | $flattrResponse = file_get_contents(CACHE . "/flattr/".base64_encode($urltoflattr).".cache"); | 14 | $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache"); |
15 | print_r($flattrResponse); | ||
15 | if($flattrResponse != FALSE) { | 16 | if($flattrResponse != FALSE) { |
16 | $result = json_decode($flattrResponse); | 17 | $result = json_decode($flattrResponse); |
17 | if (isset($result->message)){ | 18 | if (isset($result->message)){ |
@@ -33,15 +34,15 @@ class FlattrItem { | |||
33 | } | 34 | } |
34 | } | 35 | } |
35 | 36 | ||
36 | private function cacheflattrfile($urltoflattr) { | 37 | private function cacheflattrfile($urltoflattr, $id) { |
37 | if (!is_dir(CACHE . '/flattr')) { | 38 | if (!is_dir(CACHE . '/flattr')) { |
38 | mkdir(CACHE . '/flattr', 0777); | 39 | mkdir(CACHE . '/flattr', 0777); |
39 | } | 40 | } |
40 | 41 | ||
41 | // 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 | 42 | // 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 |
42 | if ((!file_exists(CACHE . "/flattr/".base64_encode($urltoflattr).".cache")) || (time() - filemtime(CACHE . "/flattr/".base64_encode($urltoflattr).".cache") > 86400)) { | 43 | if ((!file_exists(CACHE . "/flattr/".$id.".cache")) || (time() - filemtime(CACHE . "/flattr/".$id.".cache") > 86400)) { |
43 | $askForFlattr = Tools::getFile(FLATTR_API . $urltoflattr); | 44 | $askForFlattr = Tools::getFile(FLATTR_API . $urltoflattr); |
44 | $flattrCacheFile = fopen(CACHE . "/flattr/".base64_encode($urltoflattr).".cache", 'w+'); | 45 | $flattrCacheFile = fopen(CACHE . "/flattr/".$id.".cache", 'w+'); |
45 | fwrite($flattrCacheFile, $askForFlattr); | 46 | fwrite($flattrCacheFile, $askForFlattr); |
46 | fclose($flattrCacheFile); | 47 | fclose($flattrCacheFile); |
47 | } | 48 | } |
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 8567cd8f..8f54267d 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -388,7 +388,7 @@ class Poche | |||
388 | 388 | ||
389 | # flattr checking | 389 | # flattr checking |
390 | $flattr = new FlattrItem(); | 390 | $flattr = new FlattrItem(); |
391 | $flattr->checkItem($entry['url']); | 391 | $flattr->checkItem($entry['url'],$entry['id']); |
392 | 392 | ||
393 | $tpl_vars = array( | 393 | $tpl_vars = array( |
394 | 'entry' => $entry, | 394 | 'entry' => $entry, |