]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/apiaction.php
Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
[quix0rs-gnu-social.git] / lib / apiaction.php
index 5d70425720bfb21f2e9eb308607cd3d62b8614d5..1dfeea998af12b6a90ab62b6db6f70545935e488 100644 (file)
@@ -98,6 +98,8 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
+class ApiValidationException extends Exception { }
+
 /**
  * Contains most of the Twitter-compatible API output functions.
  *
@@ -200,6 +202,8 @@ class ApiAction extends Action
     {
         $twitter_user = array();
 
+        $user = $profile->getUser();
+
         $twitter_user['id'] = intval($profile->id);
         $twitter_user['name'] = $profile->getBestName();
         $twitter_user['screen_name'] = $profile->nickname;
@@ -211,11 +215,10 @@ class ApiAction extends Action
             Avatar::defaultImage(AVATAR_STREAM_SIZE);
 
         $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null;
-        $twitter_user['protected'] = false; # not supported by StatusNet yet
+        $twitter_user['protected'] = ($user->private_stream) ? true : false;
         $twitter_user['followers_count'] = $profile->subscriberCount();
 
-        $design        = null;
-        $user          = $profile->getUser();
+        $design = null;
 
         // Note: some profiles don't have an associated user
 
@@ -290,7 +293,7 @@ class ApiAction extends Action
         if ($get_notice) {
             $notice = $profile->getCurrentNotice();
             if ($notice) {
-                # don't get user!
+                // don't get user!
                 $twitter_user['status'] = $this->twitterStatusArray($notice, false);
             }
         }
@@ -395,7 +398,7 @@ class ApiAction extends Action
         }
 
         if ($include_user && $profile) {
-            # Don't get notice (recursive!)
+            // Don't get notice (recursive!)
             $twitter_user = $this->twitterUserArray($profile, false);
             $twitter_status['user'] = $twitter_user;
         }
@@ -696,7 +699,7 @@ class ApiAction extends Action
         $this->element('guid', null, $entry['guid']);
         $this->element('link', null, $entry['link']);
 
-        # RSS only supports 1 enclosure per item
+        // RSS only supports 1 enclosure per item
         if(array_key_exists('enclosures', $entry) and !empty($entry['enclosures'])){
             $enclosure = $entry['enclosures'][0];
             $this->element('enclosure', array('url'=>$enclosure['url'],'type'=>$enclosure['mimetype'],'length'=>$enclosure['size']), null);
@@ -831,7 +834,7 @@ class ApiAction extends Action
         }
 
         if (!is_null($suplink)) {
-            # For FriendFeed's SUP protocol
+            // For FriendFeed's SUP protocol
             $this->element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',
                                          'href' => $suplink,
                                          'type' => 'application/json'));