]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OpenID/actions/finishopenidlogin.php
Improved type-hint for following methods:
[quix0rs-gnu-social.git] / plugins / OpenID / actions / finishopenidlogin.php
index 372c1e12b5d961eeda2ab07c8e31339b91b2fe40..090ef8d45054963ba3de0019ff63c1047a4fe356 100644 (file)
@@ -29,7 +29,7 @@ class FinishopenidloginAction extends Action
     var $username = null;
     var $message = null;
 
-    function handle($args)
+    function handle(array $args=array())
     {
         parent::handle($args);
         if (common_is_real_login()) {
@@ -271,16 +271,18 @@ class FinishopenidloginAction extends Action
 
             $user = oid_get_user($canonical);
 
-            if ($user) {
+            if ($user instanceof User) {
                 oid_set_last($display);
                 // XXX: commented out at @edd's request until better
                 // control over how data flows from OpenID provider.
                 // oid_update_user($user, $sreg);
                 common_set_user($user);
                 common_real_login(true);
+
                 if (isset($_SESSION['openid_rememberme']) && $_SESSION['openid_rememberme']) {
                     common_rememberme($user);
                 }
+
                 unset($_SESSION['openid_rememberme']);
                 $this->goHome($user->nickname);
             } else {
@@ -322,7 +324,6 @@ class FinishopenidloginAction extends Action
         if (common_config('site', 'closed')) {
             // TRANS: OpenID plugin message. No new user registration is allowed on the site.
             $this->clientError(_m('Registration not allowed.'));
-            return;
         }
 
         $invite = null;
@@ -332,7 +333,6 @@ class FinishopenidloginAction extends Action
             if (empty($code)) {
                 // TRANS: OpenID plugin message. No new user registration is allowed on the site without an invitation code, and none was provided.
                 $this->clientError(_m('Registration not allowed.'));
-                return;
             }
 
             $invite = Invitation::getKV($code);
@@ -340,7 +340,6 @@ class FinishopenidloginAction extends Action
             if (empty($invite)) {
                 // TRANS: OpenID plugin message. No new user registration is allowed on the site without an invitation code, and the one provided was not valid.
                 $this->clientError(_m('Not a valid invitation code.'));
-                return;
             }
         }
 
@@ -356,7 +355,6 @@ class FinishopenidloginAction extends Action
         if (!$display || !$canonical) {
             // TRANS: OpenID plugin server error. A stored OpenID cannot be retrieved.
             $this->serverError(_m('Stored OpenID not found.'));
-            return;
         }
 
         // Possible race condition... let's be paranoid
@@ -366,7 +364,6 @@ class FinishopenidloginAction extends Action
         if ($other) {
             // TRANS: OpenID plugin server error.
             $this->serverError(_m('Creating new account for OpenID that already has a user.'));
-            return;
         }
 
         Event::handle('StartOpenIDCreateNewUser', array($canonical, &$sreg));
@@ -418,8 +415,7 @@ class FinishopenidloginAction extends Action
 
         Event::handle('EndRegistrationTry', array($this));
 
-        common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)),
-                        303);
+        common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)), 303);
     }
 
     function connectUser()
@@ -442,7 +438,6 @@ class FinishopenidloginAction extends Action
         if (!$display || !$canonical) {
             // TRANS: OpenID plugin server error. A stored OpenID cannot be found.
             $this->serverError(_m('Stored OpenID not found.'));
-            return;
         }
 
         $result = oid_link_user($user->id, $canonical, $display);
@@ -450,7 +445,6 @@ class FinishopenidloginAction extends Action
         if (!$result) {
             // TRANS: OpenID plugin server error. The user or user profile could not be saved.
             $this->serverError(_m('Error connecting user to OpenID.'));
-            return;
         }
 
         if (Event::handle('StartOpenIDUpdateUser', array($user, $canonical, &$sreg))) {