]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OpenID/openidsettings.php
better handling of null responses from geonames.org
[quix0rs-gnu-social.git] / plugins / OpenID / openidsettings.php
index 26bf6483660823175c87367fe44ad9d08aa0f16f..3fc3d61289bc5f9164b3e05bf981d7469a7fe9f6 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * Settings for OpenID
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Settings
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @copyright 2008-2009 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2008-2009 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -40,10 +40,10 @@ require_once INSTALLDIR.'/plugins/OpenID/openid.php';
  * Lets users add, edit and delete OpenIDs from their account
  *
  * @category Settings
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  */
 
 class OpenidsettingsAction extends AccountSettingsAction
@@ -56,7 +56,7 @@ class OpenidsettingsAction extends AccountSettingsAction
 
     function title()
     {
-        return _('OpenID settings');
+        return _m('OpenID settings');
     }
 
     /**
@@ -67,11 +67,17 @@ class OpenidsettingsAction extends AccountSettingsAction
 
     function getInstructions()
     {
-        return _('[OpenID](%%doc.openid%%) lets you log into many sites' .
+        return _m('[OpenID](%%doc.openid%%) lets you log into many sites' .
                  ' with the same user account.'.
                  ' Manage your associated OpenIDs from here.');
     }
 
+    function showScripts()
+    {
+        parent::showScripts();
+        $this->autofocus('openid_url');
+    }
+
     /**
      * Show the form for OpenID management
      *
@@ -90,15 +96,15 @@ class OpenidsettingsAction extends AccountSettingsAction
                                           'action' =>
                                           common_local_url('openidsettings')));
         $this->elementStart('fieldset', array('id' => 'settings_openid_add'));
-        $this->element('legend', null, _('Add OpenID'));
+        $this->element('legend', null, _m('Add OpenID'));
         $this->hidden('token', common_session_token());
         $this->element('p', 'form_guide',
-                       _('If you want to add an OpenID to your account, ' .
+                       _m('If you want to add an OpenID to your account, ' .
                          'enter it in the box below and click "Add".'));
         $this->elementStart('ul', 'form_data');
         $this->elementStart('li');
         $this->element('label', array('for' => 'openid_url'),
-                       _('OpenID URL'));
+                       _m('OpenID URL'));
         $this->element('input', array('name' => 'openid_url',
                                       'type' => 'text',
                                       'id' => 'openid_url'));
@@ -108,7 +114,7 @@ class OpenidsettingsAction extends AccountSettingsAction
                                       'id' => 'settings_openid_add_action-submit',
                                       'name' => 'add',
                                       'class' => 'submit',
-                                      'value' => _('Add')));
+                                      'value' => _m('Add')));
         $this->elementEnd('fieldset');
         $this->elementEnd('form');
 
@@ -120,12 +126,12 @@ class OpenidsettingsAction extends AccountSettingsAction
 
         if ($cnt > 0) {
 
-            $this->element('h2', null, _('Remove OpenID'));
+            $this->element('h2', null, _m('Remove OpenID'));
 
             if ($cnt == 1 && !$user->password) {
 
                 $this->element('p', 'form_guide',
-                               _('Removing your only OpenID '.
+                               _m('Removing your only OpenID '.
                                  'would make it impossible to log in! ' .
                                  'If you need to remove it, '.
                                  'add another OpenID first.'));
@@ -140,7 +146,7 @@ class OpenidsettingsAction extends AccountSettingsAction
             } else {
 
                 $this->element('p', 'form_guide',
-                               _('You can remove an OpenID from your account '.
+                               _m('You can remove an OpenID from your account '.
                                  'by clicking the button marked "Remove".'));
                 $idx = 0;
 
@@ -163,7 +169,7 @@ class OpenidsettingsAction extends AccountSettingsAction
                                                   'id' => 'remove'.$idx,
                                                   'name' => 'remove',
                                                   'class' => 'submit remove',
-                                                  'value' => _('Remove')));
+                                                  'value' => _m('Remove')));
                     $this->elementEnd('fieldset');
                     $this->elementEnd('form');
                     $idx++;
@@ -185,7 +191,7 @@ class OpenidsettingsAction extends AccountSettingsAction
         // CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->showForm(_('There was a problem with your session token. '.
+            $this->showForm(_m('There was a problem with your session token. '.
                               'Try again, please.'));
             return;
         }
@@ -199,7 +205,7 @@ class OpenidsettingsAction extends AccountSettingsAction
         } else if ($this->arg('remove')) {
             $this->removeOpenid();
         } else {
-            $this->showForm(_('Something weird happened.'));
+            $this->showForm(_m('Something weird happened.'));
         }
     }
 
@@ -219,16 +225,16 @@ class OpenidsettingsAction extends AccountSettingsAction
         $oid = User_openid::staticGet('canonical', $openid_url);
 
         if (!$oid) {
-            $this->showForm(_('No such OpenID.'));
+            $this->showForm(_m('No such OpenID.'));
             return;
         }
         $cur = common_current_user();
         if (!$cur || $oid->user_id != $cur->id) {
-            $this->showForm(_('That OpenID does not belong to you.'));
+            $this->showForm(_m('That OpenID does not belong to you.'));
             return;
         }
         $oid->delete();
-        $this->showForm(_('OpenID removed.'), true);
+        $this->showForm(_m('OpenID removed.'), true);
         return;
     }
 }