From aeaafb5d71cfa72d85bcd04cb333afd6c9b41c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 7 Feb 2017 09:36:16 +0100 Subject: [PATCH] Continued: - added curly braces - added TODO - removed TODO (no change needed, is fine) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- include/dfrn.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/include/dfrn.php b/include/dfrn.php index 7d5020425b..7e3533233c 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -1608,8 +1608,9 @@ class dfrn { dbesc(normalise_link($suggest["url"])), intval($suggest["uid"]) ); - /// @TODO Really abort on valid result??? Maybe missed ! here? + if (dbm::is_result($r)) { + // Has already friend matching description return false; } @@ -1730,6 +1731,7 @@ class dfrn { intval($importer["importer_uid"])); if (!dbm::is_result($r)) { + /// @todo Don't die quietly killme(); } @@ -1809,8 +1811,10 @@ class dfrn { $n, dbesc($f[1]), $n, dbesc($f[0]), intval($importer["importer_uid"])); - if ($x === false) - return false; + + if ($x === false) { + return false; + } } } @@ -2692,12 +2696,14 @@ class dfrn { // Update the contact table if the data has changed // The "atom:author" is only present in feeds - if ($xpath->query("/atom:feed/atom:author")->length > 0) + if ($xpath->query("/atom:feed/atom:author")->length > 0) { self::fetchauthor($xpath, $doc->firstChild, $importer, "atom:author", false, $xml); + } // Only the "dfrn:owner" in the head section contains all data - if ($xpath->query("/atom:feed/dfrn:owner")->length > 0) + if ($xpath->query("/atom:feed/dfrn:owner")->length > 0) { self::fetchauthor($xpath, $doc->firstChild, $importer, "dfrn:owner", false, $xml); + } logger("Import DFRN message for user ".$importer["uid"]." from contact ".$importer["id"], LOGGER_DEBUG); @@ -2705,22 +2711,24 @@ class dfrn { if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) { $accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()", $context)->item(0)->nodeValue); - if ($accounttype != $importer["contact-type"]) + if ($accounttype != $importer["contact-type"]) { q("UPDATE `contact` SET `contact-type` = %d WHERE `id` = %d", intval($accounttype), intval($importer["id"]) ); + } } // is it a public forum? Private forums aren't supported with this method // This is deprecated since 3.5.1 $forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()", $context)->item(0)->nodeValue); - if ($forum != $importer["forum"]) + if ($forum != $importer["forum"]) { q("UPDATE `contact` SET `forum` = %d WHERE `forum` != %d AND `id` = %d", intval($forum), intval($forum), intval($importer["id"]) ); + } $mails = $xpath->query("/atom:feed/dfrn:mail"); foreach ($mails AS $mail) {