// Update the public contact (contact id = 0)
if ($uid != 0) {
- $pcontact = dba::selectFirst('contact', ['id'], ['nurl' => $contact['nurl']]);
+ $pcontact = dba::selectFirst('contact', ['id'], ['nurl' => $contact['nurl'], 'uid' => 0]);
if (DBM::is_result($pcontact)) {
self::updateAvatar($avatar, 0, $pcontact['id'], $force);
}
$author["name"] = $xpath->evaluate($element."/atom:name/text()", $context)->item(0)->nodeValue;
$author["link"] = $xpath->evaluate($element."/atom:uri/text()", $context)->item(0)->nodeValue;
- $contact_old = dba::fetch_first("SELECT `id`, `uid`, `url`, `network`, `avatar-date`, `name-date`, `uri-date`, `addr`,
+ $contact_old = dba::fetch_first("SELECT `id`, `uid`, `url`, `network`, `avatar-date`, `avatar`, `name-date`, `uri-date`, `addr`,
`name`, `nick`, `about`, `location`, `keywords`, `xmpp`, `bdyear`, `bd`, `hidden`, `contact-type`
FROM `contact` WHERE `uid` = ? AND `nurl` = ? AND `network` != ?",
$importer["uid"],
$width = $attributes->textContent;
}
if ($attributes->name == "updated") {
- $contact_old["avatar-date"] = $attributes->textContent;
+ $author["avatar-date"] = $attributes->textContent;
}
}
if (($width > 0) && ($href != "")) {
unset($fields["uid"]);
unset($fields["url"]);
unset($fields["avatar-date"]);
+ unset($fields["avatar"]);
unset($fields["name-date"]);
unset($fields["uri-date"]);
}
Contact::updateAvatar(
- $author["avatar"],
- $importer["uid"],
- $contact["id"],
- (strtotime($contact["avatar-date"]) > strtotime($contact_old["avatar-date"]))
+ $author['avatar'],
+ $importer['uid'],
+ $contact['id'],
+ (strtotime($contact['avatar-date']) > strtotime($contact_old['avatar-date']) || ($author['avatar'] != $contact_old['avatar']))
);
/*
GContact::link($gcid, $importer["uid"], $contact["id"]);
}
- return($author);
+ return $author;
}
/**