if (!DBA::isResult($contact)) {
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0]);
}
+
+ // Don't display contacts that are about to be deleted
+ if ($contact['network'] == Protocol::PHANTOM) {
+ $contact = false;
+ }
}
if (DBA::isResult($contact)) {
$relation_text = '';
}
- if (!in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
+ if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
$relation_text = "";
}
}
$lblsuggest = (($contact['network'] === Protocol::DFRN) ? L10n::t('Suggest friends') : '');
- $poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
+ $poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
$nettype = L10n::t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact["url"]));
$sql_extra = " AND `blocked` = 0 ";
}
+ $sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
+
$search = x($_GET, 'search') ? notags(trim($_GET['search'])) : '';
$nets = x($_GET, 'nets' ) ? notags(trim($_GET['nets'])) : '';
$profiledata = Contact::getDetailsByURL($contact["url"]);
if (local_user()) {
- if (in_array($profiledata["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+ if (in_array($profiledata["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
$profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
}
}
$profiledata = Contact::getDetailsByURL($contact["url"]);
if (local_user()) {
- if (in_array($profiledata["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+ if (in_array($profiledata["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
$profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
}
}
*/
function contact_actions($contact)
{
- $poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
+ $poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
$contact_actions = [];
// Provide friend suggestion only for Friendica contacts
use Friendica\Model\Profile;
use Friendica\Protocol\Email;
use Friendica\Protocol\Feed;
+use Friendica\Protocol\ActivityPub;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
$uid = local_user();
}
- $data = self::detect($uri, $network, $uid);
+ if ($network != Protocol::ACTIVITYPUB) {
+ $data = self::detect($uri, $network, $uid);
+ } else {
+ $data = null;
+ }
+
+ if (in_array(defaults($data, 'network', ''), ['', Protocol::PHANTOM])) {
+ $ap_profile = ActivityPub::fetchProfile($uri);
+ if (!empty($ap_profile) && ($ap_profile['network'] == Protocol::ACTIVITYPUB)) {
+ $data = $ap_profile;
+ }
+ }
if (!isset($data["url"])) {
$data["url"] = $uri;
$hcard_url = "";
$data = [];
foreach ($webfinger["links"] as $link) {
- if (($link["rel"] == NAMESPACE_DFRN) && ($link["href"] != "")) {
+ if (($link["rel"] == NAMESPACE_DFRN) && !empty($link["href"])) {
$data["network"] = Protocol::DFRN;
- } elseif (($link["rel"] == NAMESPACE_FEED) && ($link["href"] != "")) {
+ } elseif (($link["rel"] == NAMESPACE_FEED) && !empty($link["href"])) {
$data["poll"] = $link["href"];
- } elseif (($link["rel"] == "http://webfinger.net/rel/profile-page") && ($link["type"] == "text/html") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "http://webfinger.net/rel/profile-page") && (defaults($link, "type", "") == "text/html") && !empty($link["href"])) {
$data["url"] = $link["href"];
- } elseif (($link["rel"] == "http://microformats.org/profile/hcard") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "http://microformats.org/profile/hcard") && !empty($link["href"])) {
$hcard_url = $link["href"];
- } elseif (($link["rel"] == NAMESPACE_POCO) && ($link["href"] != "")) {
+ } elseif (($link["rel"] == NAMESPACE_POCO) && !empty($link["href"])) {
$data["poco"] = $link["href"];
- } elseif (($link["rel"] == "http://webfinger.net/rel/avatar") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "http://webfinger.net/rel/avatar") && !empty($link["href"])) {
$data["photo"] = $link["href"];
- } elseif (($link["rel"] == "http://joindiaspora.com/seed_location") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "http://joindiaspora.com/seed_location") && !empty($link["href"])) {
$data["baseurl"] = trim($link["href"], '/');
- } elseif (($link["rel"] == "http://joindiaspora.com/guid") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "http://joindiaspora.com/guid") && !empty($link["href"])) {
$data["guid"] = $link["href"];
- } elseif (($link["rel"] == "diaspora-public-key") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "diaspora-public-key") && !empty($link["href"])) {
$data["pubkey"] = base64_decode($link["href"]);
//if (strstr($data["pubkey"], 'RSA ') || ($link["type"] == "RSA"))
$hcard_url = "";
$data = [];
foreach ($webfinger["links"] as $link) {
- if (($link["rel"] == "http://microformats.org/profile/hcard") && ($link["href"] != "")) {
+ if (($link["rel"] == "http://microformats.org/profile/hcard") && !empty($link["href"])) {
$hcard_url = $link["href"];
- } elseif (($link["rel"] == "http://joindiaspora.com/seed_location") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "http://joindiaspora.com/seed_location") && !empty($link["href"])) {
$data["baseurl"] = trim($link["href"], '/');
- } elseif (($link["rel"] == "http://joindiaspora.com/guid") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "http://joindiaspora.com/guid") && !empty($link["href"])) {
$data["guid"] = $link["href"];
- } elseif (($link["rel"] == "http://webfinger.net/rel/profile-page") && ($link["type"] == "text/html") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "http://webfinger.net/rel/profile-page") && (defaults($link, "type", "") == "text/html") && !empty($link["href"])) {
$data["url"] = $link["href"];
- } elseif (($link["rel"] == NAMESPACE_FEED) && ($link["href"] != "")) {
+ } elseif (($link["rel"] == NAMESPACE_FEED) && !empty($link["href"])) {
$data["poll"] = $link["href"];
- } elseif (($link["rel"] == NAMESPACE_POCO) && ($link["href"] != "")) {
+ } elseif (($link["rel"] == NAMESPACE_POCO) && !empty($link["href"])) {
$data["poco"] = $link["href"];
- } elseif (($link["rel"] == "salmon") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "salmon") && !empty($link["href"])) {
$data["notify"] = $link["href"];
- } elseif (($link["rel"] == "diaspora-public-key") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "diaspora-public-key") && !empty($link["href"])) {
$data["pubkey"] = base64_decode($link["href"]);
//if (strstr($data["pubkey"], 'RSA ') || ($link["type"] == "RSA"))
if (is_array($webfinger["links"])) {
foreach ($webfinger["links"] as $link) {
if (($link["rel"] == "http://webfinger.net/rel/profile-page")
- && ($link["type"] == "text/html")
+ && (defaults($link, "type", "") == "text/html")
&& ($link["href"] != "")
) {
$data["url"] = $link["href"];
- } elseif (($link["rel"] == "salmon") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "salmon") && !empty($link["href"])) {
$data["notify"] = $link["href"];
- } elseif (($link["rel"] == NAMESPACE_FEED) && ($link["href"] != "")) {
+ } elseif (($link["rel"] == NAMESPACE_FEED) && !empty($link["href"])) {
$data["poll"] = $link["href"];
- } elseif (($link["rel"] == "magic-public-key") && ($link["href"] != "")) {
+ } elseif (($link["rel"] == "magic-public-key") && !empty($link["href"])) {
$pubkey = $link["href"];
if (substr($pubkey, 0, 5) === 'data:') {
$data = [];
foreach ($webfinger["links"] as $link) {
if (($link["rel"] == "http://webfinger.net/rel/profile-page")
- && ($link["type"] == "text/html")
+ && (defaults($link, "type", "") == "text/html")
&& ($link["href"] != "")
) {
$data["url"] = $link["href"];