summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-04-27 22:33:14 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-04-27 22:33:14 +0200
commit21dc4ceace513a0d6cd934f5fc4bb9cc643bb570 (patch)
treea22ce222550ee1a60266d6adea990402235df78b /app
parent0e95494e29353a9ae31fb1196c6c9aaf556ae981 (diff)
Fix issue #64 : stockage des favicons en local
Diffstat (limited to 'app')
-rw-r--r--app/layout/aside_feed.phtml2
-rw-r--r--app/layout/aside_flux.phtml2
-rw-r--r--app/models/Feed.php10
-rw-r--r--app/views/index/index.phtml2
4 files changed, 13 insertions, 3 deletions
diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml
index 4be37868d..ec4993a70 100644
--- a/app/layout/aside_feed.phtml
+++ b/app/layout/aside_feed.phtml
@@ -43,7 +43,7 @@
<?php foreach ($this->feeds as $feed) { ?>
<li class="item<?php echo ($this->flux && $this->flux->id () == $feed->id ()) ? ' active' : ''; ?>">
<a href="<?php echo _url ('configure', 'feed', 'id', $feed->id ()); ?>">
- <img class="favicon" src="http://g.etfv.co/<?php echo $feed->website (); ?>" alt="" />
+ <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" />
<?php echo $feed->name (); ?>
</a>
</li>
diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml
index 60fcbe457..d2e5341e3 100644
--- a/app/layout/aside_flux.phtml
+++ b/app/layout/aside_flux.phtml
@@ -87,7 +87,7 @@
<?php $not_read = $feed->nbNotRead (); ?>
- <img class="favicon" src="http://g.etfv.co/<?php echo $feed->website (); ?>" alt="" />
+ <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" />
<?php echo $not_read > 0 ? '<b>' : ''; ?>
<a class="feed" href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>">
<?php echo $not_read > 0 ? '(' . $not_read . ') ' : ''; ?>
diff --git a/app/models/Feed.php b/app/models/Feed.php
index 08cf7425f..97cbe55d1 100644
--- a/app/models/Feed.php
+++ b/app/models/Feed.php
@@ -77,6 +77,16 @@ class Feed extends Model {
$feedDAO = new FeedDAO ();
return $feedDAO->countNotRead ($this->id ());
}
+ public function favicon () {
+ $file = '/data/favicons/' . $this->id () . '.ico';
+
+ $favicon_url = Url::display ($file);
+ if (!file_exists (PUBLIC_PATH . $file)) {
+ $favicon_url = dowload_favicon ($this->website (), $this->id ());
+ }
+
+ return $favicon_url;
+ }
public function _id ($value) {
$this->id = $value;
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml
index a7b67bcbc..c9be7169d 100644
--- a/app/views/index/index.phtml
+++ b/app/views/index/index.phtml
@@ -49,7 +49,7 @@ if (isset ($this->entryPaginator)) {
</li>
<?php } ?>
<?php $feed = $item->feed (true); ?>
- <li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="http://g.etfv.co/<?php echo $feed->website (); ?>" alt="" /> <span><?php echo $feed->name (); ?></span></a></li>
+ <li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" /> <span><?php echo $feed->name (); ?></span></a></li>
<li class="item title"><?php echo $item->title (); ?></li>
<li class="item date"><?php echo $item->date (); ?></li>
<li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>">&nbsp;</a></li>