}
function get_notices($limit=0) {
-
- $user = $this->user;
+
$notices = array();
-
- $notice = DB_DataObject::factory('notice');
-
- # FIXME: bad performance
-
- $notice->whereAdd('EXISTS (SELECT user.id from user where user.id = notice.profile_id)');
-
- $notice->orderBy('created DESC, notice.id DESC');
-
- if ($limit != 0) {
- $notice->limit(0, $limit);
- }
- $notice->find();
-
+
+ $notice = Notice::publicStream(0, ($limit == 0) ? 48 : $limit);
+
while ($notice->fetch()) {
$notices[] = clone($notice);
}
-
+
return $notices;
}