From: Mikael Nordfeldth Date: Sat, 4 Jul 2015 17:48:35 +0000 (+0200) Subject: I had some inheritance the wrong way around. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9054bb69e9cc9cf0c3788a1dad4a75e8b9a9ce7e;p=quix0rs-gnu-social.git I had some inheritance the wrong way around. --- diff --git a/actions/showstream.php b/actions/showstream.php index 254e4f43da..6eccbd06bf 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -45,7 +45,7 @@ if (!defined('GNUSOCIAL')) { exit(1); } * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ -class ShowstreamAction extends ProfileAction +class ShowstreamAction extends NoticestreamAction { var $notice; diff --git a/lib/noticestreamaction.php b/lib/noticestreamaction.php index e064b2801d..39c19d551f 100644 --- a/lib/noticestreamaction.php +++ b/lib/noticestreamaction.php @@ -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(); } diff --git a/lib/profileaction.php b/lib/profileaction.php index 7161f0d4a3..d98bcd7f74 100644 --- a/lib/profileaction.php +++ b/lib/profileaction.php @@ -41,7 +41,7 @@ if (!defined('GNUSOCIAL')) { exit(1); } * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ -abstract class ProfileAction extends ManagedAction implements NoticestreamAction +abstract class ProfileAction extends ManagedAction { var $page = null; var $tag = null; @@ -65,16 +65,6 @@ abstract class ProfileAction extends ManagedAction implements NoticestreamAction $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; common_set_returnto($this->selfUrl()); - // 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; }