]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/noticestreamaction.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / lib / noticestreamaction.php
1 <?php
2
3 if (!defined('GNUSOCIAL')) { exit(1); }
4
5 abstract class NoticestreamAction extends ProfileAction
6 {
7     protected $notice = null;   // holds the stream result
8
9     protected function prepare(array $args=array()) {
10         parent::prepare($args);
11
12         // In case we need more info than ProfileAction->doPreparation() gives us
13         $this->doStreamPreparation();
14
15         // fetch the actual stream stuff
16         $stream = $this->getStream();
17         $this->notice = $stream->getNotices(($this->page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
18
19         if ($this->page > 1 && $this->notice->N == 0) {
20             // TRANS: Client error when page not found (404).
21             $this->clientError(_('No such page.'), 404);
22         }
23
24         return true;
25     }
26
27     protected function doStreamPreparation()
28     {
29         // pass by default
30     }
31
32     // this fetches the NoticeStream
33     abstract public function getStream();
34 }