]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticestreamaction.php
I had some inheritance the wrong way around.
[quix0rs-gnu-social.git] / lib / noticestreamaction.php
index e064b2801d207659519d37b8e504e96f660b63ac..39c19d551f0500110f8c8d1520eb1a6233694d12 100644 (file)
@@ -2,8 +2,24 @@
 
 if (!defined('GNUSOCIAL')) { exit(1); }
 
-interface NoticestreamAction
+abstract class NoticestreamAction extends ProfileAction
 {
+
+    protected function prepare(array $args=array()) {
+        parent::prepare($args);
+
+        // fetch the actual stream stuff
+        $stream = $this->getStream();
+        $this->notice = $stream->getNotices(($this->page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+
+        if ($this->page > 1 && $this->notice->N == 0) {
+            // TRANS: Client error when page not found (404).
+            $this->clientError(_('No such page.'), 404);
+        }
+
+        return true;
+    }
+
     // this fetches the NoticeStream
-    public function getStream();
+    abstract public function getStream();
 }