]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apitimelinefavorites.php
OAuth related syntax fixes, nothing big
[quix0rs-gnu-social.git] / actions / apitimelinefavorites.php
index 36fc3089f52d968ac6cd5edc9710fd4849133428..85f22d910bf514102183683d72ae1b5d7c4b6c35 100644 (file)
@@ -34,8 +34,6 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR.'/lib/apibareauth.php';
-
 /**
  * Returns the 20 most recent favorite notices for the authenticating user or user
  * specified by the ID parameter in the requested format.
@@ -99,7 +97,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
     function showTimeline()
     {
         $profile  = $this->user->getProfile();
-        $avatar   = $profile->getAvatar(AVATAR_PROFILE_SIZE);
 
         $sitename = common_config('site', 'name');
         $title    = sprintf(
@@ -122,15 +119,10 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
             $profile->getBestName(),
             $this->user->nickname
         );
-        $logo = !empty($avatar)
-            ? $avatar->displayUrl()
-            : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
-
-        $link = common_local_url(
-            'showfavorites',
-            array('nickname' => $this->user->nickname)
-        );
 
+        $logo = $profile->avatarUrl(AVATAR_PROFILE_SIZE);
+        $link = common_local_url('showfavorites',
+                    array('nickname' => $this->user->nickname));
         $self = $this->getSelfUri();
 
         switch($this->format) {
@@ -170,7 +162,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
             $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');
@@ -178,7 +170,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
             $this->raw($doc->asString());
             break;
         default:
-            // TRANS: Client error displayed when trying to handle an unknown API method.
+            // TRANS: Client error displayed when coming across a non-supported API method.
             $this->clientError(_('API method not found.'), $code = 404);
             break;
         }