]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/api.php
Merge branch 'forward' into 0.9.x
[quix0rs-gnu-social.git] / lib / api.php
index 12e3ba5314c564fb499d2be3e755540462fae906..b7ab407a1a58734f46b8adaf627cdc369452702c 100644 (file)
@@ -134,17 +134,19 @@ class ApiAction extends Action
         $twitter_user['protected'] = false; # not supported by StatusNet yet
         $twitter_user['followers_count'] = $profile->subscriberCount();
 
-        $user          = $profile->getUser();
         $design        = null;
+        $user          = $profile->getUser();
 
         // Note: some profiles don't have an associated user
 
-        $defaultDesign = Design::siteDesign();
-
         if (!empty($user)) {
             $design = $user->getDesign();
         }
 
+        if (empty($design)) {
+            $design = Design::siteDesign();
+        }
+
         $color = Design::toWebColor(empty($design->backgroundcolor) ? $defaultDesign->backgroundcolor : $design->backgroundcolor);
         $twitter_user['profile_background_color'] = ($color == null) ? '' : '#'.$color->hexValue();
         $color = Design::toWebColor(empty($design->textcolor) ? $defaultDesign->textcolor : $design->textcolor);
@@ -163,7 +165,7 @@ class ApiAction extends Action
 
         $timezone = 'UTC';
 
-        if (!empty($user) && !empty($user->timezone)) {
+        if ($user->timezone) {
             $timezone = $user->timezone;
         }
 
@@ -603,7 +605,7 @@ class ApiAction extends Action
         $this->endDocument('xml');
     }
 
-    function showRssTimeline($notice, $title, $link, $subtitle, $suplink=null)
+    function showRssTimeline($notice, $title, $link, $subtitle, $suplink=null, $logo=null)
     {
 
         $this->initDocument('rss');
@@ -617,6 +619,15 @@ class ApiAction extends Action
                                          'href' => $suplink,
                                          'type' => 'application/json'));
         }
+
+        if (!is_null($logo)) {
+            $this->elementStart('image');
+            $this->element('link', null, $link);
+            $this->element('title', null, $title);
+            $this->element('url', null, $logo);
+            $this->elementEnd('image');
+        }
+
         $this->element('description', null, $subtitle);
         $this->element('language', null, 'en-us');
         $this->element('ttl', null, '40');
@@ -636,7 +647,7 @@ class ApiAction extends Action
         $this->endTwitterRss();
     }
 
-    function showAtomTimeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null)
+    function showAtomTimeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null, $logo=null)
     {
 
         $this->initDocument('atom');
@@ -645,6 +656,10 @@ class ApiAction extends Action
         $this->element('id', null, $id);
         $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
 
+        if (!is_null($logo)) {
+            $this->element('logo',null,$logo);
+        }
+
         if (!is_null($suplink)) {
             # For FriendFeed's SUP protocol
             $this->element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',