3 if (!defined('GNUSOCIAL')) { exit(1); }
5 abstract class NoticestreamAction extends ProfileAction
7 protected $notice = null; // holds the stream result
9 protected function prepare(array $args=array()) {
10 parent::prepare($args);
12 // In case we need more info than ProfileAction->doPreparation() gives us
13 $this->doStreamPreparation();
15 // fetch the actual stream stuff
17 $stream = $this->getStream();
18 $this->notice = $stream->getNotices(($this->page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
19 } catch (PrivateStreamException $e) {
20 $this->notice = new Notice();
21 $this->notice->whereAdd('FALSE');
24 if ($this->page > 1 && $this->notice->N == 0) {
25 // TRANS: Client error when page not found (404).
26 $this->clientError(_('No such page.'), 404);
32 protected function doStreamPreparation()
37 public function extraHeaders()
39 parent::extraHeaders();
40 foreach ($this->getFeeds() as $feed) {
41 header('Link: <'.htmlspecialchars($feed->getUrl()).'>;' .
42 ' rel="'.htmlspecialchars($feed->rel()).'";' .
43 ' type="'.htmlspecialchars($feed->mimeType()).'"',
44 false // don't overwrite previous headers of this sort
49 // this fetches the NoticeStream
50 abstract public function getStream();