. /** * Spam notice stream * * @category Spam * @package GNUsocial * @author Evan Prodromou * @copyright 2012 StatusNet, Inc. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ defined('GNUSOCIAL') || die(); /** * Spam notice stream * * @copyright 2012 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 */ class SpamNoticeStream extends ScopingNoticeStream { public function __construct(Profile $scoped = null) { parent::__construct( new CachingNoticeStream(new RawSpamNoticeStream(), 'spam_score:notice_ids'), $scoped ); } } /** * Raw stream of spammy notices * * @category Stream * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 */ class RawSpamNoticeStream extends NoticeStream { public function getNoticeIds($offset, $limit, $since_id, $max_id) { $ss = new Spam_score(); $ss->is_spam = true; $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; } }