diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index f5716e8ff..f8e4c9023 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -294,7 +294,7 @@ function dfrn_request_post(App $a) $hcard = ''; // Detect the network - $data = Probe::uri($url); + $data = Contact::getByURL($url); $network = $data["network"]; // Canonicalize email-style profile locator diff --git a/mod/ostatus_subscribe.php b/mod/ostatus_subscribe.php index 64774eead..751afcc73 100644 --- a/mod/ostatus_subscribe.php +++ b/mod/ostatus_subscribe.php @@ -23,7 +23,6 @@ use Friendica\App; use Friendica\Core\Protocol; use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Network\Probe; use Friendica\Util\Network; function ostatus_subscribe_content(App $a) @@ -47,7 +46,7 @@ function ostatus_subscribe_content(App $a) return $o . DI::l10n()->t('No contact provided.'); } - $contact = Probe::uri($_REQUEST['url']); + $contact = Contact::getByURL($_REQUEST['url']); if (!$contact) { DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact'); return $o . DI::l10n()->t('Couldn\'t fetch information for contact.'); @@ -88,7 +87,7 @@ function ostatus_subscribe_content(App $a) $o .= '

' . $counter . '/' . $total . ': ' . $url; - $probed = Probe::uri($url); + $probed = Contact::getByURL($url); if ($probed['network'] == Protocol::OSTATUS) { $result = Contact::createFromProbe($a->user, $probed['url'], true, Protocol::OSTATUS); if ($result['success']) { diff --git a/src/Model/GServer.php b/src/Model/GServer.php index 704d091a6..fdbc77509 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -37,7 +37,6 @@ use Friendica\Core\Logger; use Friendica\Core\System; use Friendica\Protocol\PortableContact; use Friendica\Protocol\Diaspora; -use Friendica\Network\Probe; /** * This class handles GServer related functions @@ -980,8 +979,8 @@ class GServer } foreach ($contacts as $contact) { - $probed = Probe::uri($contact); - if (in_array($probed['network'], Protocol::FEDERATED)) { + $probed = Contact::getByURL($contact); + if (!empty($probed) && in_array($probed['network'], Protocol::FEDERATED)) { $serverdata['network'] = $probed['network']; break; } diff --git a/src/Model/Mail.php b/src/Model/Mail.php index 405635215..67d5d1ddc 100644 --- a/src/Model/Mail.php +++ b/src/Model/Mail.php @@ -27,7 +27,6 @@ use Friendica\Core\Worker; use Friendica\DI; use Friendica\Database\DBA; use Friendica\Model\Notify\Type; -use Friendica\Network\Probe; use Friendica\Protocol\Activity; use Friendica\Util\DateTimeFormat; use Friendica\Worker\Delivery; @@ -267,7 +266,7 @@ class Mail $guid = System::createUUID(); $uri = Item::newURI(local_user(), $guid); - $me = Probe::uri($replyto); + $me = Contact::getByURL($replyto); if (!$me['name']) { return -2; } diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index f80ea4c73..bdcc3cf6f 100644 --- a/src/Module/Acctlink.php +++ b/src/Module/Acctlink.php @@ -22,8 +22,8 @@ namespace Friendica\Module; use Friendica\BaseModule; -use Friendica\Network\Probe; use Friendica\Core\System; +use Friendica\Model\Contact; /** * Redirects to another URL based on the parameter 'addr' @@ -35,9 +35,9 @@ class Acctlink extends BaseModule $addr = trim($_GET['addr'] ?? ''); if ($addr) { - $url = Probe::uri($addr)['url'] ?? ''; + $url = Contact::getByURL($addr)['url'] ?? ''; if ($url) { - System::externalRedirect($url); + System::externalRedirect($url['url']); exit(); } } diff --git a/src/Module/RemoteFollow.php b/src/Module/RemoteFollow.php index bf71b077f..274ed3d06 100644 --- a/src/Module/RemoteFollow.php +++ b/src/Module/RemoteFollow.php @@ -28,6 +28,7 @@ use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Search; use Friendica\Core\System; +use Friendica\Model\Contact; use Friendica\Model\Profile; use Friendica\Network\Probe; @@ -61,8 +62,8 @@ class RemoteFollow extends BaseModule } // Detect the network, make sure the provided URL is valid - $data = Probe::uri($url); - if ($data['network'] == Protocol::PHANTOM) { + $data = Contact::getByURL($url); + if (!$data) { notice(DI::l10n()->t("The provided profile link doesn't seem to be valid")); return; } diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index c7b61dacc..99b97adc8 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -354,23 +354,23 @@ class Notifier // Send a salmon to the parent author $probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]); if (DBA::isResult($probed_contact) && !empty($probed_contact["notify"])) { - Logger::log('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]); + Logger::notice('Notify parent author', ['url' => $probed_contact["url"], 'notify' => $probed_contact["notify"]]); $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"]; } // Send a salmon to the parent owner $probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]); if (DBA::isResult($probed_contact) && !empty($probed_contact["notify"])) { - Logger::log('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]); + Logger::notice('Notify parent owner', ['url' => $probed_contact["url"], 'notify' => $probed_contact["notify"]]); $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"]; } // Send a salmon notification to every person we mentioned in the post foreach (Tag::getByURIId($target_item['uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION, Tag::IMPLICIT_MENTION]) as $tag) { - $probed_contact = Probe::uri($tag['url']); - if ($probed_contact["notify"] != "") { - Logger::log('Notify mentioned user '.$probed_contact["url"].': '.$probed_contact["notify"]); - $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"]; + $probed_contact = Contact::getByURL($tag['url']); + if (!empty($probed_contact['notify'])) { + Logger::notice('Notify mentioned user', ['url' => $probed_contact["url"], 'notify' => $probed_contact["notify"]]); + $url_recipients[$probed_contact['notify']] = $probed_contact['notify']; } }