]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/atompubsubscriptionfeed.php
Merge commit 'refs/merge-requests/5' of git://gitorious.org/social/mainline into...
[quix0rs-gnu-social.git] / actions / atompubsubscriptionfeed.php
index 1b9f4b98a573be7fe9b4545b4159eac01df3ef7f..15e49c9f7c857dca2500d556586a284fd2b247d2 100644 (file)
@@ -105,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;
@@ -134,6 +133,9 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
         $feed->addNamespace('media',
                             'http://purl.org/syndication/atommedia');
 
+        $feed->addNamespace('georss',
+                            'http://www.georss.org/georss');
+
         $feed->id = $url;
 
         $feed->setUpdated('now');
@@ -232,7 +234,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);
@@ -244,7 +245,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];
@@ -252,18 +252,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)) {
@@ -273,7 +270,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
                 $this->clientError(sprintf(_('Already subscribed to %s.'),
                                            $person->id),
                                    409);
-                return;
             }
 
             if (Subscription::start($this->_profile, $profile)) {