]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_request.php
Merge branch 'rewrites/dbm_is_result' of github.com:Quix0r/friendica into rewrites...
[friendica.git] / mod / dfrn_request.php
index 66c891ef089cdf711e92eae1f4ca89225d8a7598..8bca431dd234f9110839abb5b76efe072f3d24e5 100644 (file)
@@ -273,7 +273,7 @@ function dfrn_request_post(&$a) {
                                dbesc(datetime_convert('UTC','UTC','now - 24 hours')),
                                intval($uid)
                        );
-                       if(dbm::is_result($r) > $maxreq) {
+                       if(dbm::is_result($r) && count($r) > $maxreq) {
                                notice( sprintf( t('%s has received too many connection requests today.'),  $a->profile['name']) . EOL);
                                notice( t('Spam protection measures have been invoked.') . EOL);
                                notice( t('Friends are advised to please try again in 24 hours.') . EOL);
@@ -370,8 +370,8 @@ function dfrn_request_post(&$a) {
                                $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
                                        intval($uid)
                                );
-                               if(! dbm::is_result($r)) {
 
+                               if(! dbm::is_result($r)) {
                                        notice( t('This account has not been configured for email. Request failed.') . EOL);
                                        return;
                                }
@@ -431,8 +431,8 @@ function dfrn_request_post(&$a) {
 
                        $hash = random_string();
 
-                       $r = q("insert into intro ( uid, `contact-id`, knowyou, note, hash, datetime, blocked )
-                               values( %d , %d, %d, '%s', '%s', '%s', %d ) ",
+                       $r = q("INSERT INTO intro ( uid, `contact-id`, knowyou, note, hash, datetime, blocked )
+                               VALUES( %d , %d, %d, '%s', '%s', '%s', %d ) ",
                                intval($uid),
                                intval($contact_id),
                                ((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
@@ -449,9 +449,13 @@ function dfrn_request_post(&$a) {
                        $data = probe_url($url);
                        $network = $data["network"];
 
+                       logger('dfrn_request: url=' . $url . ',network=' . $network . ',hcard=' . $hcard . ' - BEFORE!', LOGGER_DEBUG);
+
                        // Canonicalise email-style profile locator
                        $url = Probe::webfinger_dfrn($url,$hcard);
 
+                       logger('dfrn_request: url=' . $url . ',network=' . $network . ',hcard=' . $hcard . ' - AFTER!', LOGGER_DEBUG);
+
                        if (substr($url,0,5) === 'stat:') {
 
                                // Every time we detect the remote subscription we define this as OStatus.
@@ -473,7 +477,7 @@ function dfrn_request_post(&$a) {
                                dbesc($url)
                        );
 
-                       if(count($ret)) {
+                       if(dbm::is_result($ret)) {
                                if(strlen($ret[0]['issued-id'])) {
                                        notice( t('You have already introduced yourself here.') . EOL );
                                        return;
@@ -720,7 +724,9 @@ function dfrn_request_content(&$a) {
                        dbesc($_GET['confirm_key'])
                );
 
-               if(count($intro)) {
+               if(dbm::is_result($intro)) {
+
+                       $auto_confirm = false;
 
                        $r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
                                WHERE `contact`.`id` = %d LIMIT 1",