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 Haeder 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"];
}
/// @TODO maybe remove this old-lost code then?
// This code was taken from the old DFRN code
// When activated, forums don't work.
// And: Why should we disallow commenting by followers?
@ -2405,6 +2406,7 @@ class dfrn {
$ev = bbtoevent($item["body"]);
if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) {
logger("Event in item ".$item["uri"]." was found.", LOGGER_DEBUG);
/// @TODO Mixure of "/' ahead ...
$ev["cid"] = $importer["id"];
$ev["uid"] = $importer["uid"];
$ev["uri"] = $item["uri"];
@ -2671,8 +2673,9 @@ class dfrn {
*/
public static function import($xml,$importer, $sort_by_date = false) {
if ($xml == "")
if ($xml == "") {
return;
}
if ($importer["readonly"]) {
// 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
// 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);
@ -2720,22 +2725,25 @@ 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"]) {
/// @TODO this way is the norm or putting ); at the end of the line?
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) {
@ -2780,4 +2788,3 @@ class dfrn {
logger("Import done for user ".$importer["uid"]." from contact ".$importer["id"], LOGGER_DEBUG);
}
}
?>