- // Fetching further contact data from the contact table
- $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s'",
- dbesc(normalise_link($profiledata["url"])), intval($item["uid"]), dbesc($item["network"]));
-
- if (!count($r))
- $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
- dbesc(normalise_link($profiledata["url"])), intval($item["uid"]));
-
- if (!count($r))
- $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0",
- dbesc(normalise_link($profiledata["url"])));
-
- if (count($r)) {
- $profiledata["photo"] = proxy_url($r[0]["photo"]);
- $profiledata["address"] = bbcode($r[0]["location"]);
- $profiledata["about"] = bbcode($r[0]["about"]);
- if ($r[0]["nick"] != "")
- $profiledata["nickname"] = $r[0]["nick"];
- }
-
- // Fetching profile data from unique contacts
- $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"])));
- if (count($r)) {
- if ($profiledata["photo"] == "")
- $profiledata["photo"] = proxy_url($r[0]["avatar"]);
- if ($profiledata["address"] == "")
- $profiledata["address"] = bbcode($r[0]["location"]);
- if ($profiledata["about"] == "")
- $profiledata["about"] = bbcode($r[0]["about"]);
- if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != ""))
- $profiledata["nickname"] = $r[0]["nick"];
- }
-