X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fdisplay.php;h=c53e92d05b39829e7c37aae838340cee72ca4433;hb=954e4f2754e4e497a313d0b80ce528318df52731;hp=c173c5a9124152f430c78462599604e3cf878bf3;hpb=5ab2786c00b84b3546d6c6c820c0f278baf6fb33;p=friendica.git diff --git a/mod/display.php b/mod/display.php index c173c5a912..c53e92d05b 100644 --- a/mod/display.php +++ b/mod/display.php @@ -154,46 +154,53 @@ function display_fetchauthor($a, $item) { $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"])); + // Don't show details from Diaspora contacts if you don't follow the contact + $showdetails = ($profiledata["network"] != NETWORK_DIASPORA); + // Fetching further contact data from the contact table + $r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords` + FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)", + dbesc(normalise_link($profiledata["url"])), intval(local_user()), dbesc($item["network"]), + intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND)); 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"]))); + $r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords` + FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `rel` IN (%d, %d)", + dbesc(normalise_link($profiledata["url"])), intval(local_user()), + intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND)); if (count($r)) { - if ((($r[0]["uid"] != local_user()) OR !local_user()) AND ($profiledata["network"] == NETWORK_DIASPORA)) { - $r[0]["location"] = ""; - $r[0]["about"] = ""; - } - + $profiledata["name"] = $r[0]["name"]; $profiledata["photo"] = $r[0]["photo"]; - $profiledata["address"] = $r[0]["location"]; - $profiledata["about"] = $r[0]["about"]; - if ($r[0]["nick"] != "") - $profiledata["nickname"] = $r[0]["nick"]; - } + $profiledata["nickname"] = $r[0]["nick"]; + $profiledata["addr"] = $r[0]["addr"]; + $profiledata["keywords"] = $r[0]["keywords"]; + $profiledata["network"] = $r[0]["network"]; - // Fetching profile data from global contacts - $r = q("SELECT `photo`, `nick`, `addr`, `location`, `about`, `gender` FROM `gcontact` WHERE `nurl` = '%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)) + if (local_user() OR $showdetails) { + $showdetails = true; $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"]; - if ($profiledata["gender"] == "") $profiledata["gender"] = $r[0]["gender"]; - if ($profiledata["addr"] == "") + } + } + + // Fetching profile data from global contacts + if ($profiledata["network"] != NETWORK_FEED) { + $r = q("SELECT `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`, `network` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"]))); + if (count($r)) { + $profiledata["name"] = $r[0]["name"]; + $profiledata["photo"] = $r[0]["photo"]; + $profiledata["nickname"] = $r[0]["nick"]; $profiledata["addr"] = $r[0]["addr"]; + $profiledata["keywords"] = $r[0]["keywords"]; + $profiledata["network"] = $r[0]["network"]; + + if ($showdetails) { + $profiledata["address"] = $r[0]["location"]; + $profiledata["about"] = $r[0]["about"]; + $profiledata["gender"] = $r[0]["gender"]; + } + } } if (local_user()) {