]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OpenID/OpenIDPlugin.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / OpenID / OpenIDPlugin.php
index 7568af496099f0a655b0db1c7392f81322089b02..d633b12f38a9edb085f906b00e7cb3dc15fce47d 100644 (file)
@@ -125,7 +125,7 @@ class OpenIDPlugin extends Plugin
      *
      * @return boolean hook return
      */
-    function onArgsInitialize($args)
+    function onArgsInitialize(array &$args)
     {
         if (common_config('site', 'openidonly')) {
             if (array_key_exists('action', $args)) {
@@ -154,7 +154,7 @@ class OpenIDPlugin extends Plugin
      *
      * @return boolean hook return
      */
-    function onEndPublicXRDS($action, &$xrdsOutputter)
+    function onEndPublicXRDS(Action $action, &$xrdsOutputter)
     {
         $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                                   'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
@@ -174,37 +174,6 @@ class OpenIDPlugin extends Plugin
         $xrdsOutputter->elementEnd('XRD');
     }
 
-    /**
-     * User XRDS output hook
-     *
-     * Puts the bits of code needed to discover OpenID endpoints.
-     *
-     * @param Action       $action         Action being executed
-     * @param XMLOutputter &$xrdsOutputter Output channel
-     *
-     * @return boolean hook return
-     */
-    function onEndUserXRDS($action, &$xrdsOutputter)
-    {
-        $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
-                                                  'xml:id' => 'openid',
-                                                  'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
-                                                  'version' => '2.0'));
-        $xrdsOutputter->element('Type', null, 'xri://$xrds*simple');
-
-        //consumer
-        $xrdsOutputter->showXrdsService('http://specs.openid.net/auth/2.0/return_to',
-                                        common_local_url('finishopenidlogin'));
-
-        //provider
-        $xrdsOutputter->showXrdsService('http://specs.openid.net/auth/2.0/signon',
-                                        common_local_url('openidserver'),
-                                        null,
-                                        null,
-                                        common_profile_url($action->user->nickname));
-        $xrdsOutputter->elementEnd('XRD');
-    }
-
     /**
      * If we're in OpenID-only mode, hide all the main menu except OpenID login.
      *
@@ -415,17 +384,22 @@ class OpenIDPlugin extends Plugin
      *
      * @return void
      */
-    function onEndShowHeadElements($action)
+    function onEndShowHeadElements(Action $action)
     {
         if ($action instanceof ShowstreamAction) {
             $action->element('link', array('rel' => 'openid2.provider',
                                            'href' => common_local_url('openidserver')));
             $action->element('link', array('rel' => 'openid2.local_id',
-                                           'href' => $action->profile->profileurl));
+                                           'href' => $action->getTarget()->getUrl()));
             $action->element('link', array('rel' => 'openid.server',
                                            'href' => common_local_url('openidserver')));
             $action->element('link', array('rel' => 'openid.delegate',
-                                           'href' => $action->profile->profileurl));
+                                           'href' => $action->getTarget()->getUrl()));
+        }
+
+        if ($action instanceof SitestreamAction) {
+            $action->element('meta', array('http-equiv' => 'X-XRDS-Location',
+                                         'content' => common_local_url('publicxrds')));
         }
         return true;
     }
@@ -547,13 +521,13 @@ class OpenIDPlugin extends Plugin
                              array(
                                  'fields' => array(
                                      'server_url' => array('type' => 'blob', 'not null' => true),
-                                     'handle' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'default' => ''), // character set latin1,
+                                     'handle' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'default' => ''), // character set latin1,
                                      'secret' => array('type' => 'blob'),
                                      'issued' => array('type' => 'int'),
                                      'lifetime' => array('type' => 'int'),
                                      'assoc_type' => array('type' => 'varchar', 'length' => 64),
                                  ),
-                                 'primary key' => array(array('server_url', 255), 'handle'),
+                                 'primary key' => array(array('server_url', 191), 'handle'),
                              ));
         $schema->ensureTable('oid_nonces',
                              array(
@@ -563,7 +537,7 @@ class OpenIDPlugin extends Plugin
                                      'salt' => array('type' => 'char', 'length' => 40),
                                  ),
                                  'unique keys' => array(
-                                     'oid_nonces_server_url_timestamp_salt_key' => array(array('server_url', 255), 'timestamp', 'salt'),
+                                     'oid_nonces_server_url_timestamp_salt_key' => array(array('server_url', 191), 'timestamp', 'salt'),
                                  ),
                              ));
 
@@ -592,7 +566,7 @@ class OpenIDPlugin extends Plugin
      *
      * @return boolean hook value
      */
-    function onEndAdminPanelNav($nav)
+    function onEndAdminPanelNav(Menu $nav)
     {
         if (AdminPanelAction::canAdmin('openid')) {