]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apitimelineuser.php
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / actions / apitimelineuser.php
index 652a1b0d955896d2bfaacee42335778c3810b1b3..ed9104905de1f316c1066df4a9fdbf3332e5836f 100644 (file)
  *
  * @category  API
  * @package   StatusNet
+ * @author    Craig Andrews <candrews@integralblue.com>
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Jeffery To <jeffery.to@gmail.com>
+ * @author    mac65 <mac65@mac65.com>
+ * @author    Mike Cochrane <mikec@mikenz.geek.nz>
+ * @author    Robin Millette <robin@millette.info>
  * @author    Zach Copley <zach@status.net>
  * @copyright 2009 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
@@ -31,7 +37,7 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR.'/lib/apibareauth.php';
+require_once INSTALLDIR . '/lib/apibareauth.php';
 
 /**
  * Returns the most recent notices (default 20) posted by the authenticating
@@ -40,6 +46,12 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
  *
  * @category API
  * @package  StatusNet
+ * @author   Craig Andrews <candrews@integralblue.com>
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Jeffery To <jeffery.to@gmail.com>
+ * @author   mac65 <mac65@mac65.com>
+ * @author   Mike Cochrane <mikec@mikenz.geek.nz>
+ * @author   Robin Millette <robin@millette.info>
  * @author   Zach Copley <zach@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
@@ -48,7 +60,6 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
 class ApiTimelineUserAction extends ApiBareAuthAction
 {
 
-    var $user    = null;
     var $notices = null;
 
     /**
@@ -67,7 +78,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
         $this->user = $this->getTargetUser($this->arg('id'));
 
         if (empty($this->user)) {
-            $this->clientError(_('No such user!'), 404, $this->format);
+            $this->clientError(_('No such user.'), 404, $this->format);
             return;
         }
 
@@ -101,6 +112,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
     function showTimeline()
     {
         $profile = $this->user->getProfile();
+        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
 
         $sitename   = common_config('site', 'name');
         $title      = sprintf(_("%s timeline"), $this->user->nickname);
@@ -114,6 +126,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
             _('Updates from %1$s on %2$s!'),
             $this->user->nickname, $sitename
         );
+        $logo = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
 
         // FriendFeed's SUP protocol
         // Also added RSS and Atom feeds
@@ -123,33 +136,34 @@ class ApiTimelineUserAction extends ApiBareAuthAction
 
         switch($this->format) {
         case 'xml':
-            $this->show_xml_timeline($this->notices);
+            $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
-            $this->show_rss_timeline(
+            $this->showRssTimeline(
                 $this->notices, $title, $link,
-                $subtitle, $suplink
+                $subtitle, $suplink, $logo
             );
             break;
         case 'atom':
-            if (isset($apidata['api_arg'])) {
+            $id = $this->arg('id');
+            if ($id) {
                 $selfuri = common_root_url() .
                     'api/statuses/user_timeline/' .
-                    $apidata['api_arg'] . '.atom';
+                    rawurlencode($id) . '.atom';
             } else {
                 $selfuri = common_root_url() .
                     'api/statuses/user_timeline.atom';
             }
-            $this->show_atom_timeline(
+            $this->showAtomTimeline(
                 $this->notices, $title, $id, $link,
-                $subtitle, $suplink, $selfuri
+                $subtitle, $suplink, $selfuri, $logo
             );
             break;
         case 'json':
-            $this->show_json_timeline($this->notices);
+            $this->showJsonTimeline($this->notices);
             break;
         default:
-            $this->clientError(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found.'), $code = 404);
             break;
         }