From: Nicolas LÅ“uillet Date: Fri, 6 Dec 2013 13:37:42 +0000 (+0100) Subject: [add] rss for tag X-Git-Tag: 1.3.0^2~10^2~3 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=f778e47283c9691d2992045e0fbcdfc6685f157f;p=github%2Fwallabag%2Fwallabag.git [add] rss for tag --- diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index fefbb02d..68f56d62 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -446,8 +446,11 @@ class Poche ); break; case 'tags': + $token = $this->user->getConfigValue('token'); $tags = $this->store->retrieveAllTags(); $tpl_vars = array( + 'token' => $token, + 'user_id' => $this->user->getId(), 'tags' => $tags, ); break; @@ -884,9 +887,9 @@ class Poche $_SESSION['poche_user']->setConfig($currentConfig); } - public function generateFeeds($token, $user_id, $type = 'home') + public function generateFeeds($token, $user_id, $tag_id, $type = 'home') { - $allowed_types = array('home', 'fav', 'archive'); + $allowed_types = array('home', 'fav', 'archive', 'tag'); $config = $this->store->getConfigUser($user_id); if (!in_array($type, $allowed_types) || @@ -901,7 +904,13 @@ class Poche $feed->setChannelElement('updated', date(DATE_RSS , time())); $feed->setChannelElement('author', 'poche'); - $entries = $this->store->getEntriesByView($type, $user_id); + if ($type == 'tag') { + $entries = $this->store->retrieveEntriesByTag($tag_id); + } + else { + $entries = $this->store->getEntriesByView($type, $user_id); + } + if (count($entries) > 0) { foreach ($entries as $entry) { $newItem = $feed->createNewItem(); diff --git a/index.php b/index.php index 96f28a72..836730bf 100644 --- a/index.php +++ b/index.php @@ -75,7 +75,8 @@ if (isset($_GET['login'])) { $poche->generateToken(); } else { - $poche->generateFeeds($_GET['token'], $_GET['user_id'], $_GET['type']); + $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); + $poche->generateFeeds($_GET['token'], $_GET['user_id'], $tag_id, $_GET['type']); } } diff --git a/themes/default/img/default/rss.png b/themes/default/img/default/rss.png new file mode 100644 index 00000000..21bad1a1 Binary files /dev/null and b/themes/default/img/default/rss.png differ diff --git a/themes/default/tags.twig b/themes/default/tags.twig index e179143d..cff6b1d7 100644 --- a/themes/default/tags.twig +++ b/themes/default/tags.twig @@ -4,5 +4,5 @@ {% include '_menu.twig' %} {% endblock %} {% block content %} -{% for tag in tags %}{{ tag.value }} {% endfor %} +{% for tag in tags %}{{ tag.value }} {% if token != '' %}{% endif %} {% endfor %} {% endblock %} \ No newline at end of file