+
+ $profiledata["address"] = "";
+ $profiledata["about"] = "";
+ }
+
+ // Fetching further contact data from the contact table
+ $r = q("SELECT `uid`, `network`, `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 `uid`, `network`, `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 `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0",
+ dbesc(normalise_link($profiledata["url"])));
+
+ if (count($r)) {
+ if ((($r[0]["uid"] != local_user()) OR !local_user()) AND ($profiledata["network"] == NETWORK_DIASPORA)) {
+ $r[0]["location"] = "";
+ $r[0]["about"] = "";
+ }
+
+ $profiledata["photo"] = $r[0]["photo"];
+ $profiledata["address"] = $r[0]["location"];
+ $profiledata["about"] = $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"] = $r[0]["avatar"];
+ if (($profiledata["address"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA))
+ $profiledata["address"] = $r[0]["location"];
+ if (($profiledata["about"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA))
+ $profiledata["about"] = $r[0]["about"];
+ if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != ""))
+ $profiledata["nickname"] = $r[0]["nick"];