mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:21:30 +01:00
Replace "Probe::uri" with "Contact::getByURL"
This commit is contained in:
parent
c352af8eda
commit
d6bf7f2cda
7 changed files with 18 additions and 20 deletions
|
@ -294,7 +294,7 @@ function dfrn_request_post(App $a)
|
||||||
$hcard = '';
|
$hcard = '';
|
||||||
|
|
||||||
// Detect the network
|
// Detect the network
|
||||||
$data = Probe::uri($url);
|
$data = Contact::getByURL($url);
|
||||||
$network = $data["network"];
|
$network = $data["network"];
|
||||||
|
|
||||||
// Canonicalize email-style profile locator
|
// Canonicalize email-style profile locator
|
||||||
|
|
|
@ -23,7 +23,6 @@ use Friendica\App;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Network\Probe;
|
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
function ostatus_subscribe_content(App $a)
|
function ostatus_subscribe_content(App $a)
|
||||||
|
@ -47,7 +46,7 @@ function ostatus_subscribe_content(App $a)
|
||||||
return $o . DI::l10n()->t('No contact provided.');
|
return $o . DI::l10n()->t('No contact provided.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact = Probe::uri($_REQUEST['url']);
|
$contact = Contact::getByURL($_REQUEST['url']);
|
||||||
if (!$contact) {
|
if (!$contact) {
|
||||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||||
return $o . DI::l10n()->t('Couldn\'t fetch information for 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;
|
$o .= '<p>' . $counter . '/' . $total . ': ' . $url;
|
||||||
|
|
||||||
$probed = Probe::uri($url);
|
$probed = Contact::getByURL($url);
|
||||||
if ($probed['network'] == Protocol::OSTATUS) {
|
if ($probed['network'] == Protocol::OSTATUS) {
|
||||||
$result = Contact::createFromProbe($a->user, $probed['url'], true, Protocol::OSTATUS);
|
$result = Contact::createFromProbe($a->user, $probed['url'], true, Protocol::OSTATUS);
|
||||||
if ($result['success']) {
|
if ($result['success']) {
|
||||||
|
|
|
@ -37,7 +37,6 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Network\Probe;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class handles GServer related functions
|
* This class handles GServer related functions
|
||||||
|
@ -980,8 +979,8 @@ class GServer
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
$probed = Probe::uri($contact);
|
$probed = Contact::getByURL($contact);
|
||||||
if (in_array($probed['network'], Protocol::FEDERATED)) {
|
if (!empty($probed) && in_array($probed['network'], Protocol::FEDERATED)) {
|
||||||
$serverdata['network'] = $probed['network'];
|
$serverdata['network'] = $probed['network'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ use Friendica\Core\Worker;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Notify\Type;
|
use Friendica\Model\Notify\Type;
|
||||||
use Friendica\Network\Probe;
|
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Worker\Delivery;
|
use Friendica\Worker\Delivery;
|
||||||
|
@ -267,7 +266,7 @@ class Mail
|
||||||
$guid = System::createUUID();
|
$guid = System::createUUID();
|
||||||
$uri = Item::newURI(local_user(), $guid);
|
$uri = Item::newURI(local_user(), $guid);
|
||||||
|
|
||||||
$me = Probe::uri($replyto);
|
$me = Contact::getByURL($replyto);
|
||||||
if (!$me['name']) {
|
if (!$me['name']) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
namespace Friendica\Module;
|
namespace Friendica\Module;
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Network\Probe;
|
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirects to another URL based on the parameter 'addr'
|
* Redirects to another URL based on the parameter 'addr'
|
||||||
|
@ -35,9 +35,9 @@ class Acctlink extends BaseModule
|
||||||
$addr = trim($_GET['addr'] ?? '');
|
$addr = trim($_GET['addr'] ?? '');
|
||||||
|
|
||||||
if ($addr) {
|
if ($addr) {
|
||||||
$url = Probe::uri($addr)['url'] ?? '';
|
$url = Contact::getByURL($addr)['url'] ?? '';
|
||||||
if ($url) {
|
if ($url) {
|
||||||
System::externalRedirect($url);
|
System::externalRedirect($url['url']);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Search;
|
use Friendica\Core\Search;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
|
|
||||||
|
@ -61,8 +62,8 @@ class RemoteFollow extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect the network, make sure the provided URL is valid
|
// Detect the network, make sure the provided URL is valid
|
||||||
$data = Probe::uri($url);
|
$data = Contact::getByURL($url);
|
||||||
if ($data['network'] == Protocol::PHANTOM) {
|
if (!$data) {
|
||||||
notice(DI::l10n()->t("The provided profile link doesn't seem to be valid"));
|
notice(DI::l10n()->t("The provided profile link doesn't seem to be valid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,23 +354,23 @@ class Notifier
|
||||||
// Send a salmon to the parent author
|
// Send a salmon to the parent author
|
||||||
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
|
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
|
||||||
if (DBA::isResult($probed_contact) && !empty($probed_contact["notify"])) {
|
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"];
|
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a salmon to the parent owner
|
// Send a salmon to the parent owner
|
||||||
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
|
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
|
||||||
if (DBA::isResult($probed_contact) && !empty($probed_contact["notify"])) {
|
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"];
|
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a salmon notification to every person we mentioned in the post
|
// 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) {
|
foreach (Tag::getByURIId($target_item['uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION, Tag::IMPLICIT_MENTION]) as $tag) {
|
||||||
$probed_contact = Probe::uri($tag['url']);
|
$probed_contact = Contact::getByURL($tag['url']);
|
||||||
if ($probed_contact["notify"] != "") {
|
if (!empty($probed_contact['notify'])) {
|
||||||
Logger::log('Notify mentioned user '.$probed_contact["url"].': '.$probed_contact["notify"]);
|
Logger::notice('Notify mentioned user', ['url' => $probed_contact["url"], 'notify' => $probed_contact["notify"]]);
|
||||||
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
|
$url_recipients[$probed_contact['notify']] = $probed_contact['notify'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue