From 735b8ddc676cc7d85ca4256994755e61ea6023a1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 22 May 2008 07:41:52 -0400 Subject: RSS feeds for public stream and friends streams darcs-hash:20080522114152-84dde-7e9b6f465829fc71391613c93df112a7956deffc.gz --- actions/allrss.php | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 actions/allrss.php (limited to 'actions/allrss.php') diff --git a/actions/allrss.php b/actions/allrss.php new file mode 100644 index 000000000..7aab423b2 --- /dev/null +++ b/actions/allrss.php @@ -0,0 +1,84 @@ +. + */ + +if (!defined('LACONICA')) { exit(1); } + +require_once(INSTALLDIR.'/lib/rssaction.php'); + +// Formatting of RSS handled by Rss10Action + +class AllrssAction extends Rss10Action { + + var $user = NULL; + + function init() { + $nickname = $this->trimmed('nickname'); + $this->user = User::staticGet('nickname', $nickname); + + if (!$this->user) { + common_user_error(_t('No such nickname.')); + return false; + } else { + return true; + } + } + + function get_notices($limit=0) { + + $user = $this->user; + $notices = array(); + + $notice = DB_DataObject::factory('notice'); + + $notice->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$profile->id.' and subscribed = notice.profile_id)', 'OR'); + $notice->whereAdd('profile_id = ' . $user->id, 'OR'); + + $notice->orderBy('created DESC'); + if ($limit != 0) { + $notice->limit(0, $limit); + } + $notice->find(); + + while ($notice->fetch()) { + $notices[] = clone($notice); + } + + return $notices; + } + + function get_channel() { + $user = $this->user; + $c = array('url' => common_local_url('allrss', + array('nickname' => + $user->nickname)), + 'title' => $user->nickname . _t(' and friends'), + 'link' => common_local_url('all', + array('nickname' => + $user->nickname)), + 'description' => _t('Microblog feed for ') . $user->nickname); + return $c; + } + + function get_image() { + $user = $this->user; + $profile = $user->getProfile(); + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); + return ($avatar) ? $avatar->url : NULL; + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf