X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=actions%2Fapitimelinepublic.php;h=300dd58b238f119367bcbe99020bf6f35f3689a7;hb=996345088e8d57cf39fa38129ab50ff02918a275;hp=a786aa15cca7089f243e9fc521351d62dcb49af8;hpb=0dbdcf2936a00282114f1368ead2f5edebc6ae61;p=quix0rs-gnu-social.git diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php index a786aa15cc..300dd58b23 100644 --- a/actions/apitimelinepublic.php +++ b/actions/apitimelinepublic.php @@ -38,8 +38,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apiprivateauth.php'; - /** * Returns the most recent notices (default 20) posted by everybody * @@ -156,7 +154,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * @return boolean success flag * */ - function prepare($args) + function prepare(array $args=array()) { parent::prepare($args); @@ -174,7 +172,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) + function handle(array $args=array()) { parent::handle($args); $this->showTimeline(); @@ -235,7 +233,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction $this->showJsonTimeline($this->notices); break; case 'as': - header('Content-Type: application/json; charset=utf-8'); + header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE); $doc = new ActivityStreamJSONDocument($this->auth_user); $doc->setTitle($title); $doc->addLink($link, 'alternate', 'text/html'); @@ -258,14 +256,18 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction { $notices = array(); - $notice = Notice::publicStream( - ($this->page - 1) * $this->count, $this->count, $this->since_id, - $this->max_id - ); + $profile = ($this->auth_user) ? $this->auth_user->getProfile() : null; - while ($notice->fetch()) { - $notices[] = clone($notice); - } + $stream = new PublicNoticeStream($profile); + + $notice = $stream->getNotices(($this->page - 1) * $this->count, + $this->count, + $this->since_id, + $this->max_id); + + $notices = $notice->fetchAll(); + + NoticeList::prefill($notices); return $notices; } @@ -277,7 +279,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) + function isReadOnly(array $args=array()) { return true; }