123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <?php
- if (!defined('STATUSNET')) {
-
-
- exit(1);
- }
- require_once INSTALLDIR . '/lib/notices/noticelist.php';
- class SpamAction extends Action
- {
- var $page = null;
- var $notices = null;
- function title()
- {
- return _("Latest Spam");
- }
-
- function prepare(array $args = [])
- {
- parent::prepare($args);
- $this->page = ($this->arg('page')) ? ($this->arg('page') + 0) : 1;
-
- if (!$this->scoped instanceof Profile) {
- throw new ClientException(_("You must be logged in to review."), 403);
- }
-
- if (!$this->scoped->hasRight(ActivitySpamPlugin::REVIEWSPAM)) {
- throw new ClientException(_('You cannot review spam on this site.'), 403);
- }
- $stream = new SpamNoticeStream($this->scoped);
- $this->notices = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE,
- NOTICES_PER_PAGE + 1);
- if ($this->page > 1 && $this->notices->N == 0) {
- throw new ClientException(_('No such page.'), 404);
- }
- return true;
- }
-
- function handle()
- {
- parent::handle();
- $this->showPage();
- }
-
- function showContent()
- {
- $nl = new NoticeList($this->notices, $this);
- $cnt = $nl->show();
- if ($cnt == 0) {
- $this->showEmptyList();
- }
- $this->pagination($this->page > 1,
- $cnt > NOTICES_PER_PAGE,
- $this->page,
- 'spam');
- }
- function showEmptyList()
- {
-
- $message = _('This is the timeline of spam messages for %%site.name%% but none have been detected yet.');
- $this->elementStart('div', 'guide');
- $this->raw(common_markup_to_html($message));
- $this->elementEnd('div');
- }
-
- function isReadOnly($args)
- {
- return true;
- }
- }
|