123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <?php
- if (!defined('GNUSOCIAL')) {
- exit(1);
- }
- class InboxNoticeStream extends ScopingNoticeStream
- {
-
- public function __construct(Profile $target, Profile $scoped = null)
- {
- parent::__construct(new CachingNoticeStream(new RawInboxNoticeStream($target), 'profileall:'.$target->getID()), $scoped);
- }
- }
- class RawInboxNoticeStream extends FullNoticeStream
- {
- protected $target = null;
- protected $inbox = null;
-
- public function __construct(Profile $target)
- {
- parent::__construct();
- $this->target = $target;
- }
-
- public function getNoticeIds($offset, $limit, $since_id = null, $max_id = null)
- {
- $notice = new Notice();
- $notice->selectAdd();
- $notice->selectAdd('id');
- $notice->whereAdd(sprintf('notice.created > "%s"', $notice->escape($this->target->created)));
-
-
-
-
-
- $notice->whereAdd(
- sprintf('id IN (SELECT DISTINCT id FROM (' .
- '(SELECT id FROM notice WHERE profile_id IN (SELECT subscribed FROM subscription WHERE subscriber = %1$d)) UNION ' .
- '(SELECT notice_id AS id FROM reply WHERE profile_id = %1$d) UNION ' .
- '(SELECT notice_id AS id FROM attention WHERE profile_id = %1$d) UNION ' .
- '(SELECT notice_id AS id FROM group_inbox WHERE group_id IN (SELECT group_id FROM group_member WHERE profile_id = %1$d)) ' .
- 'ORDER BY id DESC) AS T)',
- $this->target->getID())
- );
- if (!empty($since_id)) {
- $notice->whereAdd(sprintf('notice.id > %d', $since_id));
- }
- if (!empty($max_id)) {
- $notice->whereAdd(sprintf('notice.id <= %d', $max_id));
- }
- self::filterVerbs($notice, $this->selectVerbs);
- $notice->limit($offset, $limit);
- if (!$notice->find()) {
- return [];
- }
- return $notice->fetchAll('id');
- }
- }
|