From 65e4dba0c451c74d6b4daae48371b786c4232827 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Wed, 15 Sep 2010 09:32:09 -0400 Subject: [PATCH] If no criteria are passed, set the limit to 10 items (though this isn't currently honored) Set 'tags' in the criteria array, not tag_id Only show published posts in RSS feeds --- jonah/delivery/rss.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/jonah/delivery/rss.php b/jonah/delivery/rss.php index d50b881cf..e6bfd9061 100644 --- a/jonah/delivery/rss.php +++ b/jonah/delivery/rss.php @@ -15,23 +15,26 @@ $jonah = Horde_Registry::appInit('jonah', array( $driver = $GLOBALS['injector']->getInstance('Jonah_Driver'); -/* See if the criteria has already been loaded by the index page */ +// See if the criteria has already been loaded by the index page $criteria = Horde_Util::nonInputVar('criteria'); if (!$criteria) { $criteria = array( 'channel_id' => Horde_Util::getFormData('channel_id'), - 'tag_id' => Horde_Util::getFormData('tag_id'), - 'feed_type' => basename(Horde_Util::getFormData('type')) + 'tags' => array(Horde_Util::getFormData('tag_id')), + 'feed_type' => basename(Horde_Util::getFormData('type')), + 'limit' => 10, ); } -/* Default to RSS2 */ +// Default to RSS2 if (empty($criteria['feed_type'])) { $criteria['feed_type'] = 'rss2'; } +// Only published stories +$criteria['published'] = true; -/* Fetch the channel info and the story list and check they are both valid. - * Do a simple exit in case of errors. */ +// Fetch the channel info and the story list and check they are both valid. +// Do a simple exit in case of errors. try { $channel = $driver->getChannel($criteria['channel_id']); } catch (Exception $e) { @@ -47,17 +50,12 @@ try { exit; } -/* Build search array */ -$search = array('channel_id' => $criteria['channel_id'], - 'tags' => array($criteria['tag_id'], - 'limit' => 10)); - -/* Used in template for channel name */ +// Used in template for channel name if (!empty($criteria['tag_id'])) { $tag_name = array_shift($driver->getTagNames(array($criteria['tag_id']))); } -/* Fetch stories */ +// Fetch stories try { $stories = $driver->getStories($criteria); } catch (Exception $e) { @@ -65,7 +63,7 @@ try { $stories = array(); } -/* Build the template (@TODO: Use Horde_View) */ +// Build the template (@TODO: Use Horde_View) $template = new Horde_Template(); $template->set('charset', $GLOBALS['registry']->getCharset()); $template->set('jonah', 'Jonah ' . $registry->getVersion() . ' (http://www.horde.org/jonah/)'); -- 2.11.0