]> git.mxchange.org Git - friendica.git/blobdiff - mod/openid.php
Merge pull request #3500 from AndyHee/3.5.2rc
[friendica.git] / mod / openid.php
index 09905198c971f6c554fa5b2ccf04aba4d4e7c30d..5707b1b72891cc7e28874869aeabc48110a15a8f 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 
+use Friendica\App;
 
 require_once('library/openid.php');
 
-
-function openid_content(&$a) {
+function openid_content(App $a) {
 
        $noid = get_config('system','no_openid');
        if($noid)
@@ -30,7 +30,7 @@ function openid_content(&$a) {
                        //       mod/settings.php in 8367cad so it might have left mixed
                        //       records in the user table
                        //
-                       $r = q("SELECT * FROM `user`
+                       $r = q("SELECT *, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey` FROM `user`
                                WHERE ( `openid` = '%s' OR `openid` = '%s' )
                                AND `blocked` = 0 AND `account_expired` = 0
                                AND `account_removed` = 0 AND `verified` = 1
@@ -47,7 +47,7 @@ function openid_content(&$a) {
                                require_once('include/security.php');
                                authenticate_success($r[0],true,true);
 
-                               // just in case there was no return url set 
+                               // just in case there was no return url set
                                // and we fell through
 
                                goaway(z_root());
@@ -73,10 +73,10 @@ function openid_content(&$a) {
                                                $first = notags(trim($v));
                                        }
                                        if($k === 'namePerson') {
-                                               $args .= '&username=' . notags(trim($v));
+                                               $args .= '&username=' . urlencode(notags(trim($v)));
                                        }
                                        if ($k === 'contact/email') {
-                                               $args .= '&email=' . notags(trim($v));
+                                               $args .= '&email=' . urlencode(notags(trim($v)));
                                        }
                                        if ($k === 'media/image/aspect11') {
                                                $photosq = bin2hex(trim($v));
@@ -87,22 +87,22 @@ function openid_content(&$a) {
                                }
                        }
                        if ($nick) {
-                               $args .= '&nickname=' . $nick;
+                               $args .= '&nickname=' . urlencode($nick);
                        }
                        elseif ($first) {
-                               $args .= '&nickname=' . $first;
+                               $args .= '&nickname=' . urlencode($first);
                        }
 
                        if ($photosq) {
-                               $args .= '&photo=' . $photosq;
+                               $args .= '&photo=' . urlencode($photosq);
                        }
                        elseif ($photo) {
-                               $args .= '&photo=' . $photo;
+                               $args .= '&photo=' . urlencode($photo);
                        }
 
-                       $args .= '&openid_url=' . notags(trim($authid));
+                       $args .= '&openid_url=' . urlencode(notags(trim($authid)));
 
-                       goaway(App::get_baseurl() . '/register' . $args);
+                       goaway(App::get_baseurl() . '/register?' . $args);
 
                        // NOTREACHED
                }