Code simplified
This commit is contained in:
parent
da06416426
commit
c507cdf946
1 changed files with 10 additions and 17 deletions
|
@ -1528,10 +1528,10 @@ class Diaspora
|
||||||
*/
|
*/
|
||||||
private static function plink($addr, $guid, $parent_guid = '')
|
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
|
// Fallback
|
||||||
if (!DBM::is_result($r)) {
|
if (!$contact) {
|
||||||
if ($parent_guid != '') {
|
if ($parent_guid != '') {
|
||||||
return "https://" . substr($addr, strpos($addr, "@") + 1) . "/posts/" . $parent_guid . "#" . $guid;
|
return "https://" . substr($addr, strpos($addr, "@") + 1) . "/posts/" . $parent_guid . "#" . $guid;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1539,19 +1539,12 @@ class Diaspora
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Friendica contacts are often detected as Diaspora contacts in the "fcontact" table
|
if ($contact["network"] == NETWORK_DFRN) {
|
||||||
// So we try another way as well.
|
return str_replace("/profile/" . $contact["nick"] . "/", "/display/" . $guid, $contact["url"] . "/");
|
||||||
$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 ($r[0]["network"] == NETWORK_DFRN) {
|
if (self::isRedmatrix($contact["url"])) {
|
||||||
return str_replace("/profile/".$r[0]["nick"]."/", "/display/".$guid, $r[0]["url"]."/");
|
return $contact["url"] . "/?f=&mid=" . $guid;
|
||||||
}
|
|
||||||
|
|
||||||
if (self::isRedmatrix($r[0]["url"])) {
|
|
||||||
return $r[0]["url"]."/?f=&mid=".$guid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($parent_guid != '') {
|
if ($parent_guid != '') {
|
||||||
|
|
Loading…
Reference in a new issue