gcontact update script, rebuilt follow page, query speedup for community and network groups
This commit is contained in:
parent
6703ba468a
commit
885dc1df81
13 changed files with 287 additions and 102 deletions
|
@ -154,49 +154,48 @@ function display_fetchauthor($a, $item) {
|
|||
$profiledata["about"] = "";
|
||||
}
|
||||
|
||||
// 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`, `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"]));
|
||||
|
||||
$r = q("SELECT `uid`, `network`, `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($item["uid"]), 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` = %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"])));
|
||||
$r = q("SELECT `uid`, `network`, `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($item["uid"]),
|
||||
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["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"];
|
||||
|
||||
if (($r[0]["uid"] != 0) OR $showdetails) {
|
||||
$showdetails = true;
|
||||
$profiledata["address"] = $r[0]["location"];
|
||||
$profiledata["about"] = $r[0]["about"];
|
||||
$profiledata["gender"] = $r[0]["gender"];
|
||||
}
|
||||
}
|
||||
|
||||
// Fetching profile data from global contacts
|
||||
if ($profiledata["network"] != NETWORK_FEED) {
|
||||
$r = q("SELECT `photo`, `nick`, `addr`, `location`, `about`, `gender` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
|
||||
$r = q("SELECT `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
|
||||
if (count($r)) {
|
||||
if ($r[0]["avatar"] != "")
|
||||
$profiledata["photo"] = $r[0]["avatar"];
|
||||
if (($r[0]["location"] != "") AND ($profiledata["network"] != NETWORK_DIASPORA))
|
||||
$profiledata["photo"] = $r[0]["photo"];
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
$profiledata["addr"] = $r[0]["addr"];
|
||||
$profiledata["keywords"] = $r[0]["keywords"];
|
||||
|
||||
if ($showdetails) {
|
||||
$profiledata["address"] = $r[0]["location"];
|
||||
if (($r[0]["about"] != "") AND ($profiledata["network"] != NETWORK_DIASPORA))
|
||||
$profiledata["about"] = $r[0]["about"];
|
||||
if (($r[0]["nick"] != "") AND ($r[0]["nick"] != ""))
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
if ($r[0]["gender"] != "")
|
||||
$profiledata["gender"] = $r[0]["gender"];
|
||||
if ($r[0]["addr"] != "")
|
||||
$profiledata["addr"] = $r[0]["addr"];
|
||||
if ($r[0]["keywords"] != "")
|
||||
$profiledata["keywords"] = $r[0]["keywords"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue