]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/twitapifriendships.php
Twitter-compatible API - moved show() to the right file
[quix0rs-gnu-social.git] / actions / twitapifriendships.php
index 19617a071bf07f96a5ec420dc53bc6324d96ee81..ae15d171e7c95e0233b2f26a0bc5484f477934b8 100644 (file)
@@ -23,6 +23,20 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 
 class TwitapifriendshipsAction extends TwitterapiAction {
 
+       function is_readonly() {
+               
+               static $write_methods = array(  'create',
+                                                                               'destroy');
+               
+               $cmdtext = explode('.', $this->arg('method'));          
+               
+               if (in_array($cmdtext[0], $write_methods)) {                    
+                       return false;
+               }
+                               
+               return true;
+       }
+
        function create($args, $apidata) {
                parent::handle($args);
 
@@ -38,7 +52,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
                $user = $apidata['user'];
                
                if ($user->isSubscribed($other)) {
-                       $this->client_error("Could not follow user: $other->nickname is already on your list.", 403, $apidata['content-type']);
+                       $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
+                       $this->client_error($errmsg, 403, $apidata['content-type']);
                        exit();
                }
                
@@ -53,7 +68,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
                $result = $sub->insert();
 
                if (!$result) {
-                       $this->client_error("Could not follow user: $other->nickname.", 400, $apidata['content-type']);                 
+                       $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
+                       $this->client_error($errmsg, 400, $apidata['content-type']);                    
                        exit();
                }
                
@@ -129,8 +145,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
                $user_a_id = $this->trimmed('user_a');
                $user_b_id = $this->trimmed('user_b');
                
-               $user_a = $this->get_profile($user_a_id);
-               $user_b = $this->get_profile($user_b_id);
+               $user_a = $this->get_user($user_a_id);
+               $user_b = $this->get_user($user_b_id);
                
                if (!$user_a || !$user_b) {
                        $this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);