]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_request.php
Fix potential bugs without expected behavior change
[friendica.git] / mod / dfrn_request.php
index 6142257e77fd0083f9b80205450580452c67be56..780e0afeeb7feb146129ca660887d50a415a96b5 100644 (file)
@@ -34,9 +34,9 @@ function dfrn_request_init(App $a)
 {
        if ($a->argc > 1) {
                $which = $a->argv[1];
+               Profile::load($a, $which);
        }
 
-       Profile::load($a, $which);
        return;
 }
 
@@ -168,7 +168,7 @@ function dfrn_request_post(App $a)
                                $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `site-pubkey` = '%s' LIMIT 1",
                                        intval(local_user()),
                                        DBA::escape($dfrn_url),
-                                       $parms['key'] // this was already escaped
+                                       defaults($parms, 'key', '') // Potentially missing
                                );
                                if (DBA::isResult($r)) {
                                        Group::addMember(User::getDefaultGroup(local_user(), $r[0]["network"]), $r[0]['id']);
@@ -187,7 +187,7 @@ function dfrn_request_post(App $a)
                                        $dfrn_request = $contact_record['request'];
                                }
 
-                               if (strlen($dfrn_request) && strlen($confirm_key)) {
+                               if (!empty($dfrn_request) && strlen($confirm_key)) {
                                        Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
                                }