]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/xrds.php
Merge branch '1.0.x' into testing
[quix0rs-gnu-social.git] / actions / xrds.php
index 8f09557d185ce34ca3d2a566ddffc76860961f05..818cd1032c1c0516e9005dc424cca7433af281d5 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * XRDS for OpenMicroBlogging
  *
@@ -61,13 +60,14 @@ class XrdsAction extends Action
     {
         return true;
     }
-    
+
     function prepare($args)
     {
         parent::prepare($args);
         $nickname = $this->trimmed('nickname');
         $this->user     = User::staticGet('nickname', $nickname);
         if (!$this->user) {
+            // TRANS: Client error displayed providing a non-existing nickname.
             $this->clientError(_('No such user.'));
             return;
         }
@@ -97,27 +97,23 @@ class XrdsAction extends Action
         $xrdsOutputter->element('Type', null, 'xri://$xrds*simple');
         $xrdsOutputter->showXrdsService(OAUTH_ENDPOINT_REQUEST,
                             common_local_url('requesttoken'),
-                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1));
-        $xrdsOutputter->showXrdsService( OAUTH_ENDPOINT_AUTHORIZE,
-                            common_local_url('userauthorization'),
                             array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1),
                             null,
-                            $this->user->getIdentifierURI());
+                            $this->user->uri);
+        $xrdsOutputter->showXrdsService( OAUTH_ENDPOINT_AUTHORIZE,
+                            common_local_url('userauthorization'),
+                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1));
         $xrdsOutputter->showXrdsService(OAUTH_ENDPOINT_ACCESS,
                             common_local_url('accesstoken'),
-                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1),
-                            null,
-                            $this->user->getIdentifierURI());
+                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1));
         $xrdsOutputter->showXrdsService(OAUTH_ENDPOINT_RESOURCE,
                             null,
-                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1),
-                            null,
-                            $this->user->getIdentifierURI());
+                            array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1));
         $xrdsOutputter->elementEnd('XRD');
-        
+
         //omb
         $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
-                                          'xml:id' => 'oauth',
+                                          'xml:id' => 'omb',
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
         $xrdsOutputter->element('Type', null, 'xri://$xrds*simple');
@@ -126,11 +122,11 @@ class XrdsAction extends Action
         $xrdsOutputter->showXrdsService(OMB_ENDPOINT_UPDATEPROFILE,
                             common_local_url('updateprofile'));
         $xrdsOutputter->elementEnd('XRD');
-        
+
+        Event::handle('EndUserXRDS', array($this,&$xrdsOutputter));
+
         //misc
         $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
-                                          'xml:id' => 'oauth',
-                                          'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
         $xrdsOutputter->showXrdsService(OAUTH_DISCOVERY,
                             '#oauth');
@@ -138,10 +134,6 @@ class XrdsAction extends Action
                             '#omb');
         $xrdsOutputter->elementEnd('XRD');
 
-        Event::handle('EndUserXRDS', array($this,&$xrdsOutputter));
-
         $xrdsOutputter->endXRDS();
-        
     }
 }
-?>