aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <thomas.citharet@gmail.com>2013-09-08 21:52:01 +0200
committerThomas Citharel <thomas.citharet@gmail.com>2013-09-08 21:52:01 +0200
commitaf1d2792263d45c5ffea2e5485dd81bf59b7bded (patch)
tree1c0814b8929028fab0872a5f1f5b3ed4a0f1d779
parenta32231274060ec2de453124117518458c4fa00df (diff)
downloadwallabag-af1d2792263d45c5ffea2e5485dd81bf59b7bded.tar.gz
wallabag-af1d2792263d45c5ffea2e5485dd81bf59b7bded.tar.zst
wallabag-af1d2792263d45c5ffea2e5485dd81bf59b7bded.zip
Fixed errors and changed source of flattrs
Fixed errors, and the number displayed is no longer the number of peope who has flattred an article, but the number of flattrs he has got.
-rw-r--r--inc/poche/Poche.class.php16
-rw-r--r--tpl/view.twig2
2 files changed, 9 insertions, 9 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 5dab10df..8b24e5cd 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -249,20 +249,21 @@ class Poche
249 $content = $tidy->value; 249 $content = $tidy->value;
250 250
251 // flattr checking 251 // flattr checking
252 $flattr = new FlattrItem(); 252 $flattr = new FlattrItem();
253 $flattr->checkitem($entry['url']); 253 $flattr->checkitem($entry['url']);
254 254
255 $tpl_vars = array( 255 $tpl_vars = array(
256 'entry' => $entry, 256 'entry' => $entry,
257 'content' => $content, 257 'content' => $content,
258 'flattr' => $flattr, 258 'flattr' => $flattr
259 ); 259 );
260 }
260 } 261 }
261 else { 262 else {
262 Tools::logm('error in view call : entry is null'); 263 Tools::logm('error in view call : entry is null');
263 } 264 }
264 break; 265 break;
265 default: # home, favorites and archive views 266 default : // home, favorites and archive views
266 $entries = $this->store->getEntriesByView($view, $this->user->getId()); 267 $entries = $this->store->getEntriesByView($view, $this->user->getId());
267 $tpl_vars = array( 268 $tpl_vars = array(
268 'entries' => '', 269 'entries' => '',
@@ -577,7 +578,6 @@ class FlattrItem{
577 public function checkitem($urltoflattr){ 578 public function checkitem($urltoflattr){
578 $this->cacheflattrfile($urltoflattr); 579 $this->cacheflattrfile($urltoflattr);
579 $flattrResponse = file_get_contents("cache/flattr/".base64_encode($urltoflattr).".cache"); 580 $flattrResponse = file_get_contents("cache/flattr/".base64_encode($urltoflattr).".cache");
580 var_dump($flattrResponse);
581 if($flattrResponse != FALSE){ 581 if($flattrResponse != FALSE){
582 $result = json_decode($flattrResponse); 582 $result = json_decode($flattrResponse);
583 if (isset($result->message)){ 583 if (isset($result->message)){
@@ -588,7 +588,7 @@ class FlattrItem{
588 elseif ($result->link) { 588 elseif ($result->link) {
589 $this->status = "flattred"; 589 $this->status = "flattred";
590 $this->flattrItemURL = $result->link; 590 $this->flattrItemURL = $result->link;
591 $this->numflattrs = $result->flattrs_user_count; 591 $this->numflattrs = $result->flattrs;
592 } 592 }
593 else{ 593 else{
594 $this->status = "not flattrable"; 594 $this->status = "not flattrable";
diff --git a/tpl/view.twig b/tpl/view.twig
index 7b15c7c7..c101db0a 100644
--- a/tpl/view.twig
+++ b/tpl/view.twig
@@ -31,7 +31,7 @@
31 {% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@getpoche" target="_blank" class="tool twitter" title="{% trans "tweet" %}"><span>{% trans "tweet" %}</span></a></li>{% endif %} 31 {% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@getpoche" target="_blank" class="tool twitter" title="{% trans "tweet" %}"><span>{% trans "tweet" %}</span></a></li>{% endif %}
32 {% if constant('SHARE_MAIL') == 1 %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@getpoche" class="tool email" title="{% trans "email" %}"><span>{% trans "email" %}</span></a></li>{% endif %} 32 {% if constant('SHARE_MAIL') == 1 %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@getpoche" class="tool email" title="{% trans "email" %}"><span>{% trans "email" %}</span></a></li>{% endif %}
33 {% if constant('SHARE_SHAARLI') == 1 %}<li><a href="{{ constant('SHAARLI_URL') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans "shaarli" %}"><span>{% trans "shaarli" %}</span></a></li>{% endif %} 33 {% if constant('SHARE_SHAARLI') == 1 %}<li><a href="{{ constant('SHAARLI_URL') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans "shaarli" %}"><span>{% trans "shaarli" %}</span></a></li>{% endif %}
34 <li>{% if flattr.status == "flattrable" %} This thing is flattrable !{% elseif flattr.status == "flattred" %} <a href="{{ flattr.flattrItemURL }}" >This thing has already been flattred by {{ flattr.numflattrs }} users and can be flattred !</a>{% else %}This article cannot be flattred{% endif %}</li> 34 <li>{% if flattr.status == "flattrable" %} This thing is flattrable !{% elseif flattr.status == "flattred" %} <a href="{{ flattr.flattrItemURL }}" >This thing has already been flattred {{ flattr.numflattrs }} times and can be flattred !</a>{% else %}This article cannot be flattred{% endif %}</li>
35 </ul> 35 </ul>
36 <p>{% trans "this article appears wrong?" %} <a href="https://github.com/inthepoche/poche/issues/new">{% trans "create an issue" %}</a> {% trans "or" %} <a href="mailto:support@inthepoche.com?subject=Wrong%20display%20in%20poche&amp;body={{ entry.url|url_encode }}">{% trans "contact us by mail" %}</a></p> 36 <p>{% trans "this article appears wrong?" %} <a href="https://github.com/inthepoche/poche/issues/new">{% trans "create an issue" %}</a> {% trans "or" %} <a href="mailto:support@inthepoche.com?subject=Wrong%20display%20in%20poche&amp;body={{ entry.url|url_encode }}">{% trans "contact us by mail" %}</a></p>
37 </div> 37 </div>