]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OpenID/OpenIDPlugin.php
Merge branch '1.1.x' of gitorious.org:statusnet/mainline into 1.1.x
[quix0rs-gnu-social.git] / plugins / OpenID / OpenIDPlugin.php
index 758c97b5f980f56ec5c67b7169b6ea322ef7006f..ed6d6534c09dbdaff0ebef609fabd235cee9b628 100644 (file)
@@ -135,7 +135,8 @@ class OpenIDPlugin extends Plugin
                     common_redirect(common_local_url('openidsettings'));
                     exit(0);
                 } else if ($action == 'recoverpassword') {
-                    throw new ClientException('Unavailable action.');
+                    // TRANS: Client exception thrown when an action is not available.
+                    throw new ClientException(_m('Unavailable action.'));
                 }
             }
         }
@@ -478,18 +479,24 @@ class OpenIDPlugin extends Plugin
         {
         case 'register':
             if (common_logged_in()) {
-                $instr = '(Have an [OpenID](http://openid.net/)? ' .
-                  '[Add an OpenID to your account](%%action.openidsettings%%)!';
+                // TRANS: Page notice for logged in users to try and get them to add an OpenID account to their StatusNet account.
+                // TRANS: This message contains Markdown links in the form (description)[link].
+                $instr = _m('(Have an [OpenID](http://openid.net/)? ' .
+                  '[Add an OpenID to your account](%%action.openidsettings%%)!');
             } else {
-                $instr = '(Have an [OpenID](http://openid.net/)? ' .
+                // TRANS: Page notice for anonymous users to try and get them to register with an OpenID account.
+                // TRANS: This message contains Markdown links in the form (description)[link].
+                $instr = _m('(Have an [OpenID](http://openid.net/)? ' .
                   'Try our [OpenID registration]'.
-                  '(%%action.openidlogin%%)!)';
+                  '(%%action.openidlogin%%)!)');
             }
             break;
         case 'login':
-            $instr = '(Have an [OpenID](http://openid.net/)? ' .
+            // TRANS: Page notice on the login page to try and get them to log on with an OpenID account.
+            // TRANS: This message contains Markdown links in the form (description)[link].
+            $instr = _m('(Have an [OpenID](http://openid.net/)? ' .
               'Try our [OpenID login]'.
-              '(%%action.openidlogin%%)!)';
+              '(%%action.openidlogin%%)!)');
             break;
         default:
             return true;
@@ -529,15 +536,12 @@ class OpenIDPlugin extends Plugin
      *
      * @return boolean hook value
      */
-    function onEndLoadDoc($title, &$output)
-    {
-        if ($title == 'help') {
-            // TRANS: Item on help page. This message contains Markdown links in the form [description](link).
-            $menuitem = _m('* [OpenID](%%doc.openid%%) - What OpenID is and how to use it with this service.');
-
-            $output .= common_markup_to_html($menuitem);
-        }
-
+    function onEndDocsMenu(&$items) {
+        $items[] = array('doc', 
+                         array('title' => 'openid'),
+                         _m('MENU', 'OpenID'),
+                         _('Logging in with OpenID'),
+                         'nav_doc_openid');
         return true;
     }
 
@@ -569,6 +573,33 @@ class OpenIDPlugin extends Plugin
                                    new ColumnDef('created', 'datetime',
                                                  null, false),
                                    new ColumnDef('modified', 'timestamp')));
+
+        /* These are used by JanRain OpenID library */
+
+        $schema->ensureTable('oid_associations',
+                             array(
+                                 'fields' => array(
+                                     'server_url' => array('type' => 'blob', 'not null' => true),
+                                     'handle' => array('type' => 'varchar', 'length' => 255, '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'),
+                             ));
+        $schema->ensureTable('oid_nonces',
+                             array(
+                                 'fields' => array(
+                                     'server_url' => array('type' => 'varchar', 'length' => 2047),
+                                     'timestamp' => array('type' => 'int'),
+                                     'salt' => array('type' => 'char', 'length' => 40),
+                                 ),
+                                 'unique keys' => array(
+                                     'oid_nonces_server_url_timestamp_salt_key' => array(array('server_url', 255), 'timestamp', 'salt'),
+                                 ),
+                             ));
+
         return true;
     }