summaryrefslogtreecommitdiff
path: root/modules/comment/helpers/comment_rss.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-08-29 11:43:10 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-08-29 11:43:10 -0700
commit38b2efc44cf3345d97798e9637db241b05e2dded (patch)
tree9440cac4af2623491356ab8bb0c193fea35b1554 /modules/comment/helpers/comment_rss.php
parent27b81257fa3b65de555111372648a65e7152633a (diff)
Fix for 641... extend viewable functionality to comments. Viewable unit test is not working.
Diffstat (limited to 'modules/comment/helpers/comment_rss.php')
-rw-r--r--modules/comment/helpers/comment_rss.php55
1 files changed, 25 insertions, 30 deletions
diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php
index ab3d2283..a8171ce7 100644
--- a/modules/comment/helpers/comment_rss.php
+++ b/modules/comment/helpers/comment_rss.php
@@ -33,42 +33,37 @@ class comment_rss_Core {
return;
}
- $comments = ORM::factory("comment")
- ->where("state", "published")
- ->orderby("created", "DESC");
- $all_comments = ORM::factory("comment")
+ $comment_model = ORM::factory("comment")
+ ->viewable()
->where("state", "published")
->orderby("created", "DESC");
if ($feed_id == "item") {
- $comments->where("item_id", $id);
- $all_comments->where("item_id", $id);
+ $comment_model->where("item_id", $id);
}
- if (!empty($comments)) {
- $feed->view = "comment.mrss";
- $comments = $comments->find_all($limit, $offset);
- $feed->children = array();
- foreach ($comments as $comment) {
- $item = $comment->item();
- $feed->children[] = new ArrayObject(
- array("pub_date" => date("D, d M Y H:i:s T", $comment->created),
- "text" => nl2br(p::purify($comment->text)),
- "thumb_url" => $item->thumb_url(),
- "thumb_height" => $item->thumb_height,
- "thumb_width" => $item->thumb_width,
- "item_uri" => url::abs_site("{$item->type}s/$item->id"),
- "title" => p::purify($item->title),
- "author" => p::clean($comment->author_name())),
- ArrayObject::ARRAY_AS_PROPS);
- }
+ $comments = $comment_model->find_all($limit, $offset);
+ $feed->view = "comment.mrss";
+ $feed->children = array();
+ foreach ($comments as $comment) {
+ $item = $comment->item();
+ $feed->children[] = new ArrayObject(
+ array("pub_date" => date("D, d M Y H:i:s T", $comment->created),
+ "text" => nl2br(p::purify($comment->text)),
+ "thumb_url" => $item->thumb_url(),
+ "thumb_height" => $item->thumb_height,
+ "thumb_width" => $item->thumb_width,
+ "item_uri" => url::abs_site("{$item->type}s/$item->id"),
+ "title" => p::purify($item->title),
+ "author" => p::clean($comment->author_name())),
+ ArrayObject::ARRAY_AS_PROPS);
+ }
- $feed->max_pages = ceil($all_comments->find_all()->count() / $limit);
- $feed->title = htmlspecialchars(t("Recent Comments"));
- $feed->uri = url::abs_site("albums/" . (empty($id) ? "1" : $id));
- $feed->description = t("Recent Comments");
+ $feed->max_pages = ceil($comment_model->count_all() / $limit);
+ $feed->title = htmlspecialchars(t("Recent Comments"));
+ $feed->uri = url::abs_site("albums/" . (empty($id) ? "1" : $id));
+ $feed->description = t("Recent Comments");
- return $feed;
- }
+ return $feed;
}
-} \ No newline at end of file
+}