Code simplified
This commit is contained in:
parent
da06416426
commit
c507cdf946
|
@ -1528,10 +1528,10 @@ class Diaspora
|
|||
*/
|
||||
private static function plink($addr, $guid, $parent_guid = '')
|
||||
{
|
||||
$r = q("SELECT `url`, `nick`, `network` FROM `fcontact` WHERE `addr`='%s' LIMIT 1", dbesc($addr));
|
||||
$contact = Contact::getDetailsByAddr($addr);
|
||||
|
||||
// Fallback
|
||||
if (!DBM::is_result($r)) {
|
||||
if (!$contact) {
|
||||
if ($parent_guid != '') {
|
||||
return "https://" . substr($addr, strpos($addr, "@") + 1) . "/posts/" . $parent_guid . "#" . $guid;
|
||||
} else {
|
||||
|
@ -1539,19 +1539,12 @@ class Diaspora
|
|||
}
|
||||
}
|
||||
|
||||
// Friendica contacts are often detected as Diaspora contacts in the "fcontact" table
|
||||
// So we try another way as well.
|
||||
$s = q("SELECT `network` FROM `gcontact` WHERE `nurl`='%s' LIMIT 1", dbesc(normalise_link($r[0]["url"])));
|
||||
if (DBM::is_result($s)) {
|
||||
$r[0]["network"] = $s[0]["network"];
|
||||
if ($contact["network"] == NETWORK_DFRN) {
|
||||
return str_replace("/profile/" . $contact["nick"] . "/", "/display/" . $guid, $contact["url"] . "/");
|
||||
}
|
||||
|
||||
if ($r[0]["network"] == NETWORK_DFRN) {
|
||||
return str_replace("/profile/".$r[0]["nick"]."/", "/display/".$guid, $r[0]["url"]."/");
|
||||
}
|
||||
|
||||
if (self::isRedmatrix($r[0]["url"])) {
|
||||
return $r[0]["url"]."/?f=&mid=".$guid;
|
||||
if (self::isRedmatrix($contact["url"])) {
|
||||
return $contact["url"] . "/?f=&mid=" . $guid;
|
||||
}
|
||||
|
||||
if ($parent_guid != '') {
|
||||
|
|
Loading…
Reference in a new issue