From 1aa6c1dc5bd18fd71e252bbba8ec19da18f449f9 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 25 Apr 2016 21:35:42 +0200 Subject: [PATCH 1/2] Use data from contact and gcontact prior to probe_url --- mod/item.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mod/item.php b/mod/item.php index 86940cd69..215e3bc95 100644 --- a/mod/item.php +++ b/mod/item.php @@ -1095,7 +1095,19 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo // Checking for the alias that is used for OStatus $pattern = "/@\[url\=(.*?)\](.*?)\[\/url\]/ism"; if (preg_match($pattern, $tag, $matches)) { - $data = probe_url($matches[1]); + + $r = q("SELECT `alias`, `name` FROM `contact` WHERE `nurl` = '%s' AND `alias` != '' AND `uid` = 0", + normalise_link($matches[1])); + if (!$r) + $r = q("SELECT `alias`, `name` FROM `gcontact` WHERE `nurl` = '%s' AND `alias` != ''", + normalise_link($matches[1])); + if ($r) + $data = $r[0]; + else { + $data = probe_url($matches[1]); + logger("probe_url ".$matches[1]); + } + if ($data["alias"] != "") { $newtag = '@[url='.$data["alias"].']'.$data["name"].'[/url]'; if(!stristr($str_tags,$newtag)) { From cd92521c1d74cd837fda03ba301b04bbef748d3e Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 25 Apr 2016 21:39:54 +0200 Subject: [PATCH 2/2] Remove test code --- mod/item.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mod/item.php b/mod/item.php index 215e3bc95..d0e1ffed5 100644 --- a/mod/item.php +++ b/mod/item.php @@ -1103,10 +1103,8 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo normalise_link($matches[1])); if ($r) $data = $r[0]; - else { + else $data = probe_url($matches[1]); - logger("probe_url ".$matches[1]); - } if ($data["alias"] != "") { $newtag = '@[url='.$data["alias"].']'.$data["name"].'[/url]';