]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/atompubsubscriptionfeed.php
Minor changes in Salmon lib for Magicsig retrieval.
[quix0rs-gnu-social.git] / actions / atompubsubscriptionfeed.php
index 744a970d602a6dd5c0bc70a8c34f9723d88da8bb..c0f695dc42cc7603db9c89ea21cb3e9721723254 100644 (file)
@@ -34,8 +34,6 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR . '/lib/apiauth.php';
-
 /**
  * Subscription feed class for AtomPub
  *
@@ -107,7 +105,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
         default:
             // TRANS: Client exception thrown when using an unsupported HTTP method.
             $this->clientError(_('HTTP method not supported.'), 405);
-            return;
         }
 
         return;
@@ -234,7 +231,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
             $dom->documentElement->localName != 'entry') {
             // TRANS: Client error displayed when not using an Atom entry.
             $this->clientError(_('Atom post must be an Atom entry.'));
-            return;
         }
 
         $activity = new Activity($dom->documentElement);
@@ -246,7 +242,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
             if ($activity->verb != ActivityVerb::FOLLOW) {
                 // TRANS: Client error displayed when not using the follow verb.
                 $this->clientError(_('Can only handle Follow activities.'));
-                return;
             }
 
             $person = $activity->objects[0];
@@ -254,18 +249,15 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
             if ($person->type != ActivityObject::PERSON) {
                 // TRANS: Client exception thrown when subscribing to an object that is not a person.
                 $this->clientError(_('Can only follow people.'));
-                return;
             }
 
             // XXX: OStatus discovery (maybe)
-
-            $profile = Profile::fromURI($person->id);
-
-            if (empty($profile)) {
+            try {
+                $profile = Profile::fromUri($person->id);
+            } catch (UnknownUriException $e) {
                 // TRANS: Client exception thrown when subscribing to a non-existing profile.
                 // TRANS: %s is the unknown profile ID.
                 $this->clientError(sprintf(_('Unknown profile %s.'), $person->id));
-                return;
             }
 
             if (Subscription::exists($this->_profile, $profile)) {
@@ -275,7 +267,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
                 $this->clientError(sprintf(_('Already subscribed to %s.'),
                                            $person->id),
                                    409);
-                return;
             }
 
             if (Subscription::start($this->_profile, $profile)) {