]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apifriendshipsdestroy.php
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / actions / apifriendshipsdestroy.php
index d97c5aa6db04a822d169a2caf28384c833505b63..3d9b7e001cd304aae1986e792aa928fcb6b84e43 100644 (file)
@@ -21,6 +21,8 @@
  *
  * @category  API
  * @package   StatusNet
+ * @author    Dan Moore <dan@moore.cx>
+ * @author    Evan Prodromou <evan@status.net>
  * @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 +33,7 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR.'/lib/apiauth.php';
+require_once INSTALLDIR . '/lib/apiauth.php';
 
 /**
  * Allows the authenticating users to unfollow (unsubscribe) the user specified in
@@ -40,6 +42,8 @@ require_once INSTALLDIR.'/lib/apiauth.php';
  *
  * @category API
  * @package  StatusNet
+ * @author   Dan Moore <dan@moore.cx>
+ * @author   Evan Prodromou <evan@status.net>
  * @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/
@@ -47,9 +51,6 @@ require_once INSTALLDIR.'/lib/apiauth.php';
 
 class ApiFriendshipsDestroyAction extends ApiAuthAction
 {
-
-    var $format = null;
-    var $user   = null;
     var $other  = null;
 
     /**
@@ -65,13 +66,6 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
     {
         parent::prepare($args);
 
-        if ($this->requiresAuth()) {
-            if ($this->checkBasicAuthUser() == false) {
-                return;
-            }
-        }
-
-        $this->format = $this->arg('format');
         $this->user   = $this->auth_user;
         $this->other  = $this->getTargetUser($id);
 
@@ -101,6 +95,15 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
             return;
         }
 
+        if (!in_array($this->format, array('xml', 'json'))) {
+            $this->clientError(
+                _('API method not found!'),
+                404,
+                $this->format
+            );
+            return;
+        }
+
         if (empty($this->other)) {
             $this->clientError(
                 _('Could not unfollow user: User not found.'),
@@ -128,9 +131,9 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
             return;
         }
 
-        $this->init_document($this->format);
-        $this->show_profile($this->other, $this->format);
-        $this->end_document($this->format);
+        $this->initDocument($this->format);
+        $this->showProfile($this->other, $this->format);
+        $this->endDocument($this->format);
     }
 
 }