X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Frepliesrss.php;h=43be133a43a3ffb8a21e05474b96738ab504c465;hb=bc15d027a804e60e76bdaf6fd47e69d41b395e7e;hp=b811db7eb3067b020cb463202ea061427dacc1cd;hpb=7ff02bb7d4483b3dc24edd78551a3936798056a8;p=quix0rs-gnu-social.git diff --git a/actions/repliesrss.php b/actions/repliesrss.php index b811db7eb3..43be133a43 100644 --- a/actions/repliesrss.php +++ b/actions/repliesrss.php @@ -23,71 +23,62 @@ require_once(INSTALLDIR.'/lib/rssaction.php'); // Formatting of RSS handled by Rss10Action -class RepliesrssAction extends Rss10Action { +class RepliesrssAction extends Rss10Action +{ - var $user = NULL; + var $user = null; - function init() { - $nickname = $this->trimmed('nickname'); - $this->user = User::staticGet('nickname', $nickname); + function init() + { + $nickname = $this->trimmed('nickname'); + $this->user = User::staticGet('nickname', $nickname); - if (!$this->user) { - common_user_error(_('No such user.')); - return false; - } else { - return true; - } - } + if (!$this->user) { + $this->clientError(_('No such user.')); + return false; + } else { + return true; + } + } - function get_notices($limit=0) { + function get_notices($limit=0) + { - $user = $this->user; - $notices = array(); + $user = $this->user; - $reply = new Reply(); - $reply->profile_id = $user->id; - $reply->orderBy('modified DESC'); - if ($limit) { - $reply->limit(0, $limit); - } + $notice = $user->getReplies(0, ($limit == 0) ? 48 : $limit); - $cnt = $reply->find(); + $notices = array(); + + while ($notice->fetch()) { + $notices[] = clone($notice); + } - if ($cnt) { - while ($reply->fetch()) { - $notice = new Notice(); - $notice->id = $reply->notice_id; - $result = $notice->find(true); - if (!$result) { - continue; - } - $notices[] = clone($notice); - } - } + return $notices; + } - return $notices; - } + function get_channel() + { + $user = $this->user; + $c = array('url' => common_local_url('repliesrss', + array('nickname' => + $user->nickname)), + 'title' => sprintf(_("Replies to %s"), $user->nickname), + 'link' => common_local_url('replies', + array('nickname' => + $user->nickname)), + 'description' => sprintf(_('Feed for replies to %s'), $user->nickname)); + return $c; + } - function get_channel() { - $user = $this->user; - $c = array('url' => common_local_url('repliesrss', - array('nickname' => - $user->nickname)), - 'title' => sprintf(_("Replies to %s"), $user->nickname), - 'link' => common_local_url('replies', - array('nickname' => - $user->nickname)), - 'description' => sprintf(_('Feed for replies to %s'), $user->nickname)); - return $c; - } - - function get_image() { - $user = $this->user; - $profile = $user->getProfile(); - if (!$profile) { - return NULL; - } - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); - return ($avatar) ? $avatar->url : NULL; - } + function get_image() + { + $user = $this->user; + $profile = $user->getProfile(); + if (!$profile) { + return null; + } + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); + return ($avatar) ? $avatar->url : null; + } } \ No newline at end of file