]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Facebook/FBConnectAuth.php
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 1.0.x
[quix0rs-gnu-social.git] / plugins / Facebook / FBConnectAuth.php
index 51bfc3865700c323921cbfac49eecd6f26c4ef59..f06dffaaabbd789a71b6f4ee535fc48ffba0cd85 100644 (file)
@@ -60,12 +60,10 @@ class FBConnectauthAction extends Action
         parent::handle($args);
 
         if (common_is_real_login()) {
-
             // User is already logged in.  Does she already have a linked Facebook acct?
             $flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE);
 
             if (!empty($flink)) {
-
                 // User already has a linked Facebook account and shouldn't be here
                 common_debug('Facebook Connect Plugin - ' .
                              'There is already a local user (' . $flink->user_id .
@@ -74,8 +72,7 @@ class FBConnectauthAction extends Action
                 // We don't want these cookies
                 getFacebook()->clear_cookie_state();
 
-                $this->clientError(_m('There is already a local user linked with this Facebook.'));
-
+                $this->clientError(_m('There is already a local user linked with this Facebook account.'));
             } else {
 
                 // User came from the Facebook connect settings tab, and
@@ -102,7 +99,7 @@ class FBConnectauthAction extends Action
             } else {
                 common_debug('Facebook Connect Plugin - ' .
                              print_r($this->args, true));
-                $this->showForm(_m('Something weird happened.'),
+                $this->showForm(_m('An unknown error has occured.'),
                                 $this->trimmed('newname'));
             }
         } else {
@@ -116,12 +113,14 @@ class FBConnectauthAction extends Action
             $this->element('div', array('class' => 'error'), $this->error);
         } else {
             $this->element('div', 'instructions',
+                           // TRANS: %s is the site name.
                            sprintf(_m('This is the first time you\'ve logged into %s so we must connect your Facebook to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
         }
     }
 
     function title()
     {
+        // TRANS: Page title.
         return _m('Facebook Account Setup');
     }
 
@@ -138,6 +137,11 @@ class FBConnectauthAction extends Action
         parent::showPage();
     }
 
+    /**
+     * @fixme much of this duplicates core code, which is very fragile.
+     * Should probably be replaced with an extensible mini version of
+     * the core registration form.
+     */
     function showContent()
     {
         if (!empty($this->message_text)) {
@@ -150,6 +154,7 @@ class FBConnectauthAction extends Action
                                           'class' => 'form_settings',
                                           'action' => common_local_url('FBConnectAuth')));
         $this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options'));
+        // TRANS: Legend.
         $this->element('legend', null, _m('Connection options'));
         $this->elementStart('ul', 'form_data');
         $this->elementStart('li');
@@ -159,10 +164,16 @@ class FBConnectauthAction extends Action
                                       'name' => 'license',
                                       'value' => 'true'));
         $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
-        $this->text(_m('My text and files are available under '));
-        $this->element('a', array('href' => common_config('license', 'url')),
-                       common_config('license', 'title'));
-        $this->text(_m(' except this private data: password, email address, IM address, phone number.'));
+        // TRANS: %s is the name of the license used by the user for their status updates.
+        $message = _m('My text and files are available under %s ' .
+                     'except this private data: password, ' .
+                     'email address, IM address, and phone number.');
+        $link = '<a href="' .
+                htmlspecialchars(common_config('license', 'url')) .
+                '">' .
+                htmlspecialchars(common_config('license', 'title')) .
+                '</a>';
+        $this->raw(sprintf(htmlspecialchars($message), $link));
         $this->elementEnd('label');
         $this->elementEnd('li');
         $this->elementEnd('ul');
@@ -170,33 +181,39 @@ class FBConnectauthAction extends Action
         $this->elementStart('fieldset');
         $this->hidden('token', common_session_token());
         $this->element('legend', null,
+                       // TRANS: Legend.
                        _m('Create new account'));
         $this->element('p', null,
                        _m('Create a new user with this nickname.'));
         $this->elementStart('ul', 'form_data');
         $this->elementStart('li');
+        // TRANS: Field label.
         $this->input('newname', _m('New nickname'),
                      ($this->username) ? $this->username : '',
                      _m('1-64 lowercase letters or numbers, no punctuation or spaces'));
         $this->elementEnd('li');
         $this->elementEnd('ul');
-        $this->submit('create', _m('Create'));
+        // TRANS: Submit button.
+        $this->submit('create', _m('BUTTON','Create'));
         $this->elementEnd('fieldset');
 
         $this->elementStart('fieldset');
+        // TRANS: Legend.
         $this->element('legend', null,
                        _m('Connect existing account'));
         $this->element('p', null,
                        _m('If you already have an account, login with your username and password to connect it to your Facebook.'));
         $this->elementStart('ul', 'form_data');
         $this->elementStart('li');
+        // TRANS: Field label.
         $this->input('nickname', _m('Existing nickname'));
         $this->elementEnd('li');
         $this->elementStart('li');
         $this->password('password', _m('Password'));
         $this->elementEnd('li');
         $this->elementEnd('ul');
-        $this->submit('connect', _m('Connect'));
+        // TRANS: Submit button.
+        $this->submit('connect', _m('BUTTON','Connect'));
         $this->elementEnd('fieldset');
 
         $this->elementEnd('fieldset');
@@ -212,6 +229,7 @@ class FBConnectauthAction extends Action
     function createNewUser()
     {
         if (common_config('site', 'closed')) {
+            // TRANS: Client error trying to register with registrations not allowed.
             $this->clientError(_m('Registration not allowed.'));
             return;
         }
@@ -221,6 +239,7 @@ class FBConnectauthAction extends Action
         if (common_config('site', 'inviteonly')) {
             $code = $_SESSION['invitecode'];
             if (empty($code)) {
+                // TRANS: Client error trying to register with registrations 'invite only'.
                 $this->clientError(_m('Registration not allowed.'));
                 return;
             }
@@ -228,6 +247,7 @@ class FBConnectauthAction extends Action
             $invite = Invitation::staticGet($code);
 
             if (empty($invite)) {
+                // TRANS: Client error trying to register with an invalid invitation code.
                 $this->clientError(_m('Not a valid invitation code.'));
                 return;
             }
@@ -412,8 +432,9 @@ class FBConnectauthAction extends Action
         return null;
     }
 
-     // Given a string, try to make it work as a nickname
-
+     /**
+      * Given a string, try to make it work as a nickname
+      */
      function nicknamize($str)
      {
          $str = preg_replace('/\W/', '', $str);
@@ -457,5 +478,4 @@ class FBConnectauthAction extends Action
             return null;
         }
     }
-
 }