link_compare calls

implement compareLink function.
This commit is contained in:
Adam Magness 2018-11-08 10:46:50 -05:00
parent 6fc9c6de3b
commit 5276c28a78
19 changed files with 32 additions and 30 deletions

View file

@ -2256,7 +2256,7 @@ class DFRN
}
}
if ($Blink && link_compare($Blink, System::baseUrl() . "/profile/" . $importer["nickname"])) {
if ($Blink && Strings::compareLink($Blink, System::baseUrl() . "/profile/" . $importer["nickname"])) {
$author = DBA::selectFirst('contact', ['name', 'thumb', 'url'], ['id' => $item['author-id']]);
$item['id'] = $posted_id;
@ -2738,7 +2738,7 @@ class DFRN
Logger::log("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", Logger::DEBUG);
return;
}
if (!link_compare($item["owner-link"], $importer["url"])) {
if (!Strings::compareLink($item["owner-link"], $importer["url"])) {
/*
* The item owner info is not our contact. It's OK and is to be expected if this is a tgroup delivery,
* but otherwise there's a possible data mixup on the sender's system.
@ -3090,7 +3090,7 @@ class DFRN
$cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism', $item['body'], $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
if (link_compare($link, $mtch[1]) || link_compare($dlink, $mtch[1])) {
if (Strings::compareLink($link, $mtch[1]) || Strings::compareLink($dlink, $mtch[1])) {
$mention = true;
Logger::log('mention found: ' . $mtch[2]);
}

View file

@ -113,7 +113,7 @@ class Diaspora
// Now we are collecting all relay contacts
foreach ($serverlist as $server_url) {
// We don't send messages to ourselves
if (link_compare($server_url, System::baseUrl())) {
if (Strings::compareLink($server_url, System::baseUrl())) {
continue;
}
$contact = self::getRelayContact($server_url);
@ -2706,7 +2706,7 @@ class Diaspora
$parent = Item::selectFirst(['author-link'], ['id' => $item["parent"]]);
// Only delete it if the parent author really fits
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) {
if (!Strings::compareLink($parent["author-link"], $contact["url"]) && !Strings::compareLink($item["author-link"], $contact["url"])) {
Logger::log("Thread author ".$parent["author-link"]." and item author ".$item["author-link"]." don't fit to expected contact ".$contact["url"], Logger::DEBUG);
continue;
}