X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapitimelineuser.php;h=0046c462d71cc7ef5970bdd01147378aa767eb26;hb=c4a8a6776e29a8ba96eec15a3d443ca17889be8b;hp=5c4bcace47862d1c780ca2d5af1a88098f72526c;hpb=212b20e876fac3b989cd79b1b896b88f50995a37;p=quix0rs-gnu-social.git diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index 5c4bcace47..0046c462d7 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -29,6 +29,7 @@ * @author Robin Millette * @author Zach Copley * @copyright 2009 StatusNet, Inc. + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -56,10 +57,8 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiTimelineUserAction extends ApiBareAuthAction { - var $notices = null; /** @@ -68,9 +67,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -78,6 +75,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction $this->user = $this->getTargetUser($this->arg('id')); if (empty($this->user)) { + // TRANS: Client error displayed requesting most recent notices for a non-existing user. $this->clientError(_('No such user.'), 404, $this->format); return; } @@ -96,7 +94,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -108,27 +105,20 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return void */ - function showTimeline() { $profile = $this->user->getProfile(); // We'll use the shared params from the Atom stub // for other feed types. - $atom = new AtomUserNoticeFeed($this->user); + $atom = new AtomUserNoticeFeed($this->user, $this->auth_user); $link = common_local_url( 'showstream', array('nickname' => $this->user->nickname) ); - // Calculate self link - $id = $this->arg('id'); - $aargs = array('format' => $this->format); - if (!empty($id)) { - $aargs['id'] = $id; - } - $self = $this->getSelfUri('ApiTimelineUser', $aargs); + $self = $this->getSelfUri(); // FriendFeed's SUP protocol // Also added RSS and Atom feeds @@ -152,7 +142,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction ); break; case 'atom': - header('Content-Type: application/atom+xml; charset=utf-8'); $atom->setId($self); @@ -165,10 +154,10 @@ class ApiTimelineUserAction extends ApiBareAuthAction $this->showJsonTimeline($this->notices); break; default: + // TRANS: Client error displayed when trying to handle an unknown API method. $this->clientError(_('API method not found.'), $code = 404); break; } - } /** @@ -176,7 +165,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return array notices */ - function getNotices() { $notices = array(); @@ -200,7 +188,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -211,7 +198,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -229,16 +215,15 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->notices) && (count($this->notices) > 0)) { - $last = count($this->notices) - 1; return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), @@ -249,5 +234,4 @@ class ApiTimelineUserAction extends ApiBareAuthAction return null; } - }