1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class SpamNoticeStream extends ScopingNoticeStream
- {
- function __construct(Profile $scoped=null)
- {
- parent::__construct(new CachingNoticeStream(new RawSpamNoticeStream(), 'spam_score:notice_ids'),
- $scoped);
- }
- }
- class RawSpamNoticeStream extends NoticeStream
- {
- function getNoticeIds($offset, $limit, $since_id, $max_id)
- {
- $ss = new Spam_score();
- $ss->is_spam = 1;
- $ss->selectAdd();
- $ss->selectAdd('notice_id');
- Notice::addWhereSinceId($ss, $since_id, 'notice_id');
- Notice::addWhereMaxId($ss, $max_id, 'notice_id');
- $ss->orderBy('notice_created DESC, notice_id DESC');
- if (!is_null($offset)) {
- $ss->limit($offset, $limit);
- }
- $ids = array();
- if ($ss->find()) {
- while ($ss->fetch()) {
- $ids[] = $ss->notice_id;
- }
- }
- return $ids;
- }
- }
|