1
1
Fork 0

added more spaces and curely braces

killed ?> as it is discouraged

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-03-23 22:43:46 +01:00
parent d8eee2be55
commit 66366b2804
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78

View file

@ -2381,6 +2381,7 @@ class dfrn {
$item["network"] = $author["network"]; $item["network"] = $author["network"];
} }
/// @TODO maybe remove this old-lost code then?
// This code was taken from the old DFRN code // This code was taken from the old DFRN code
// When activated, forums don't work. // When activated, forums don't work.
// And: Why should we disallow commenting by followers? // And: Why should we disallow commenting by followers?
@ -2405,6 +2406,7 @@ class dfrn {
$ev = bbtoevent($item["body"]); $ev = bbtoevent($item["body"]);
if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) { if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) {
logger("Event in item ".$item["uri"]." was found.", LOGGER_DEBUG); logger("Event in item ".$item["uri"]." was found.", LOGGER_DEBUG);
/// @TODO Mixure of "/' ahead ...
$ev["cid"] = $importer["id"]; $ev["cid"] = $importer["id"];
$ev["uid"] = $importer["uid"]; $ev["uid"] = $importer["uid"];
$ev["uri"] = $item["uri"]; $ev["uri"] = $item["uri"];
@ -2671,8 +2673,9 @@ class dfrn {
*/ */
public static function import($xml,$importer, $sort_by_date = false) { public static function import($xml,$importer, $sort_by_date = false) {
if ($xml == "") if ($xml == "") {
return; return;
}
if ($importer["readonly"]) { if ($importer["readonly"]) {
// We aren't receiving stuff from this person. But we will quietly ignore them // We aren't receiving stuff from this person. But we will quietly ignore them
@ -2707,12 +2710,14 @@ class dfrn {
// Update the contact table if the data has changed // Update the contact table if the data has changed
// The "atom:author" is only present in feeds // 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); self::fetchauthor($xpath, $doc->firstChild, $importer, "atom:author", false, $xml);
}
// Only the "dfrn:owner" in the head section contains all data // 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); self::fetchauthor($xpath, $doc->firstChild, $importer, "dfrn:owner", false, $xml);
}
logger("Import DFRN message for user " . $importer["uid"] . " from contact " . $importer["id"], LOGGER_DEBUG); logger("Import DFRN message for user " . $importer["uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
@ -2720,22 +2725,25 @@ class dfrn {
if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) { if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) {
$accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()", $context)->item(0)->nodeValue); $accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()", $context)->item(0)->nodeValue);
if ($accounttype != $importer["contact-type"]) if ($accounttype != $importer["contact-type"]) {
/// @TODO this way is the norm or putting ); at the end of the line?
q("UPDATE `contact` SET `contact-type` = %d WHERE `id` = %d", q("UPDATE `contact` SET `contact-type` = %d WHERE `id` = %d",
intval($accounttype), intval($accounttype),
intval($importer["id"]) intval($importer["id"])
); );
} }
}
// is it a public forum? Private forums aren't supported with this method // is it a public forum? Private forums aren't supported with this method
// This is deprecated since 3.5.1 // This is deprecated since 3.5.1
$forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()", $context)->item(0)->nodeValue); $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", q("UPDATE `contact` SET `forum` = %d WHERE `forum` != %d AND `id` = %d",
intval($forum), intval($forum), intval($forum), intval($forum),
intval($importer["id"]) intval($importer["id"])
); );
}
$mails = $xpath->query("/atom:feed/dfrn:mail"); $mails = $xpath->query("/atom:feed/dfrn:mail");
foreach ($mails AS $mail) { foreach ($mails AS $mail) {
@ -2780,4 +2788,3 @@ class dfrn {
logger("Import done for user ".$importer["uid"]." from contact ".$importer["id"], LOGGER_DEBUG); logger("Import done for user ".$importer["uid"]." from contact ".$importer["id"], LOGGER_DEBUG);
} }
} }
?>