diff --git a/index.php b/index.php index 2e8431d..94a8297 100644 --- a/index.php +++ b/index.php @@ -231,6 +231,26 @@ Router\get_action('history', function() { }); +// Display feed items page +Router\get_action('feed-items', function() { + + $feed_id = Request\int_param('feed_id', 0); + $offset = Request\int_param('offset', 0); + $nb_items = Model\count_feed_items($feed_id); + $feed = Model\get_feed($feed_id); + + Response\html(Template\layout('feed_items', array( + 'feed' => $feed, + 'items' => Model\get_feed_items($feed_id, $offset, Model\get_config_value('items_per_page')), + 'nb_items' => $nb_items, + 'offset' => $offset, + 'items_per_page' => Model\get_config_value('items_per_page'), + 'menu' => 'feeds', + 'title' => '('.$nb_items.') '.$feed['title'] + ))); +}); + + // Display bookmarks page Router\get_action('bookmarks', function() { diff --git a/locales/fr_FR/translations.php b/locales/fr_FR/translations.php index cf73dc7..871ab55 100644 --- a/locales/fr_FR/translations.php +++ b/locales/fr_FR/translations.php @@ -1,6 +1,8 @@ 'Aucun élément', + 'items' => 'éléments', 'The following feeds are empty, there is maybe an error: %s' => 'Les abonnements suivants sont vides, il y a peut-être une erreur : %s', 'Items per page' => 'Nombre d\'éléments par page', diff --git a/model.php b/model.php index 0489de3..88981e6 100644 --- a/model.php +++ b/model.php @@ -362,6 +362,31 @@ function get_bookmarks($offset = null, $limit = null) } +function count_feed_items($feed_id) +{ + return \PicoTools\singleton('db') + ->table('items') + ->eq('feed_id', $feed_id) + ->in('status', array('read', 'unread')) + ->count(); +} + + +function get_feed_items($feed_id, $offset = null, $limit = null) +{ + return \PicoTools\singleton('db') + ->table('items') + ->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.status', 'items.bookmark', 'feeds.site_url') + ->join('feeds', 'id', 'feed_id') + ->in('status', array('read', 'unread')) + ->eq('feed_id', $feed_id) + ->desc('updated') + ->offset($offset) + ->limit($limit) + ->findAll(); +} + + function get_item($id) { return \PicoTools\singleton('db') diff --git a/templates/app_header.php b/templates/app_header.php index 36c3da0..e29b16a 100644 --- a/templates/app_header.php +++ b/templates/app_header.php @@ -9,7 +9,7 @@ - <?= isset($title) ? $title : 'miniflux' ?> + <?= isset($title) ? Helper\escape($title) : 'miniflux' ?> diff --git a/templates/feed_items.php b/templates/feed_items.php new file mode 100644 index 0000000..1e51835 --- /dev/null +++ b/templates/feed_items.php @@ -0,0 +1,54 @@ + + +

+ + + + + +
+ + +
+

+ + + + +

+

+ | + | + + + + +

+
+ + + + +
+ + \ No newline at end of file diff --git a/templates/feeds.php b/templates/feeds.php index ac5d372..e37e81a 100644 --- a/templates/feeds.php +++ b/templates/feeds.php @@ -29,6 +29,7 @@ | | | + |