123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <?php
- if (!defined('STATUSNET')) {
-
-
- exit(1);
- }
- class PeopletagNoticeStream extends ScopingNoticeStream
- {
- function __construct($plist, $profile = -1)
- {
- if (is_int($profile) && $profile == -1) {
- $profile = Profile::current();
- }
- parent::__construct(new CachingNoticeStream(new RawPeopletagNoticeStream($plist),
- 'profile_list:notice_ids:' . $plist->id),
- $profile);
- }
- }
- class RawPeopletagNoticeStream extends NoticeStream
- {
- protected $profile_list;
- function __construct($profile_list)
- {
- $this->profile_list = $profile_list;
- }
-
- function getNoticeIds($offset, $limit, $since_id, $max_id)
- {
- $notice = new Notice();
- $notice->selectAdd();
- $notice->selectAdd('notice.id');
- $ptag = new Profile_tag();
- $ptag->tag = $this->profile_list->tag;
- $ptag->tagger = $this->profile_list->tagger;
- $notice->joinAdd(array('profile_id', 'profile_tag:tagged'));
- $notice->whereAdd('profile_tag.tagger = ' . $this->profile_list->tagger);
- $notice->whereAdd(sprintf('profile_tag.tag = "%s"', $this->profile_list->tag));
- if ($since_id != 0) {
- $notice->whereAdd('notice.id > ' . $since_id);
- }
- if ($max_id != 0) {
- $notice->whereAdd('notice.id <= ' . $max_id);
- }
- $notice->orderBy('notice.id DESC');
- if (!is_null($offset)) {
- $notice->limit($offset, $limit);
- }
- $ids = array();
- if ($notice->find()) {
- while ($notice->fetch()) {
- $ids[] = $notice->id;
- }
- }
- return $ids;
- }
- }
|