]> git.mxchange.org Git - friendica.git/commitdiff
Replace "Probe::uri" with "Contact::getByURL"
authorMichael <heluecht@pirati.ca>
Thu, 16 Jul 2020 10:22:14 +0000 (10:22 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 16 Jul 2020 10:22:14 +0000 (10:22 +0000)
mod/dfrn_request.php
mod/ostatus_subscribe.php
src/Model/GServer.php
src/Model/Mail.php
src/Module/Acctlink.php
src/Module/RemoteFollow.php
src/Worker/Notifier.php

index f5716e8ff5b3719b5883e37f41bc64ce4db09c82..f8e4c90236a8f2332068c55688af2bfaa26cea21 100644 (file)
@@ -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
index 64774eead9fc5a4ede2f612baa200457667018be..751afcc7315a085408ec859fb6b5623d7bb1fdae 100644 (file)
@@ -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 .= '<p>' . $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']) {
index 704d091a666970de4664ccaec5739e6e85998b81..fdbc7750985a3a3e2bb49635458727dcaa3de50f 100644 (file)
@@ -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;
                        }
index 405635215197f48de88b6a9473c8c802908922e2..67d5d1ddca3371a9152ccce1bffe7ae3c369410d 100644 (file)
@@ -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;
                }
index f80ea4c73c9d32e353fa9a67ac57023a096c874a..bdcc3cf6ff08c17cb92356d68b49ceb126b8f602 100644 (file)
@@ -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();
                        }
                }
index bf71b077fd01888deae74dface5203b012ded31f..274ed3d06d63a5cbc74d3bc15187bcdb8897db29 100644 (file)
@@ -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;
                }
index c7b61dacca1472c27e18fa0685294b8940b548fe..99b97adc8daff2388e27c5a4b6383dc7f83665d6 100644 (file)
@@ -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'];
                                        }
                                }