- if (!$r)
- q("UPDATE `unique_contacts` SET `name` = '%s', `avatar` = '%s' WHERE `url` = '%s'",
- dbesc($item["author-name"]), dbesc($item["author-avatar"]),
- dbesc(normalise_link($item["author-link"])));
- }
-
- $owner = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
- dbesc(normalise_link($item['owner-link'])));
-
- if (count($owner) == 0) {
- q("INSERT INTO `unique_contacts` (`url`, `name`, `avatar`) VALUES ('%s', '%s', '%s')",
- dbesc(normalise_link($item["owner-link"])), dbesc($item["owner-name"]), dbesc($item["owner-avatar"]));
-
- $owner = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
- dbesc(normalise_link($item['owner-link'])));
- } else if ($item["owner-link"].$item["owner-name"] != $owner[0]["url"].$owner[0]["name"]) {
- $r = q("SELECT `id` FROM `unique_contacts` WHERE `name` = '%s' AND `avatar` = '%s' AND url = '%s'",
- dbesc($item["owner-name"]), dbesc($item["owner-avatar"]),
- dbesc(normalise_link($item["owner-link"])));
-
- if (!$r)
- q("UPDATE `unique_contacts` SET `name` = '%s', `avatar` = '%s' WHERE `url` = '%s'",
- dbesc($item["owner-name"]), dbesc($item["owner-avatar"]),
- dbesc(normalise_link($item["owner-link"])));
- }