if (in_array($mode, ['community', 'contacts'])) {
$writable = true;
} else {
- $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
+ $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], Protocol::FEDERATED);
}
if (!local_user()) {
foreach ($items as $index => $item) {
if ($item['uid'] == 0) {
- $items[$index]['writable'] = in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
+ $items[$index]['writable'] = in_array($item['network'], Protocol::FEDERATED);
}
}
$contact_url = 'contact/' . $cid;
$posts_link = 'contact/' . $cid . '/posts';
- if (in_array($network, [Protocol::DFRN, Protocol::DIASPORA])) {
+ if (in_array($network, [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA])) {
$pm_url = 'message/new/' . $cid;
}
}
}
if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
- in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
+ in_array($item['network'], Protocol::FEDERATED)) {
$menu[L10n::t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
}
} else {
$remote_self_options = ['0' => L10n::t('No mirroring'), '2' => L10n::t('Mirror as my own posting')];
}
- $update_profile = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]);
+ $update_profile = in_array($contact['network'], Protocol::FEDERATED);
$tab_str = Module\Contact::getTabsHTML($a, $contact, 5);
}
// Allow commenting if it is an answer to a public post
- $allow_comment = local_user() && ($profile_uid == 0) && $toplevel_item_id && in_array($toplevel_item['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
+ $allow_comment = local_user() && ($profile_uid == 0) && $toplevel_item_id && in_array($toplevel_item['network'], Protocol::FEDERATED);
// Now check that valid personal details have been provided
if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) {
$networkname = str_replace($search, $replace, $network);
- if ((in_array($network, [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) && ($profile != "")) {
+ if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) {
// Create the server url out of the profile url
$parts = parse_url($profile);
unset($parts['path']);
'hidden' => false,
'archive' => false,
'rel' => $rel,
- 'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA],
+ 'network' => Protocol::FEDERATED,
], ['limit' => $shown]);
if (DBA::isResult($contact_ids_stmt)) {
const NATIVE_SUPPORT = [self::DFRN, self::DIASPORA, self::OSTATUS, self::FEED, self::MAIL, self::ACTIVITYPUB];
+ const FEDERATED = [self::DFRN, self::DIASPORA, self::OSTATUS, self::ACTIVITYPUB];
+
// Supported through a connector
const DIASPORA2 = 'dspc'; // Diaspora connector
const LINKEDIN = 'lnkd'; // LinkedIn
return $emptyResultList;
}
- if (!(in_array($user_data["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA]))) {
+ if (!(in_array($user_data["network"], Protocol::FEDERATED))) {
return $emptyResultList;
}
}
if ((empty($profile["addr"]) || empty($profile["name"])) && (defaults($profile, "gid", 0) != 0)
- && in_array($profile["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])
+ && in_array($profile["network"], Protocol::FEDERATED)
) {
Worker::add(PRIORITY_LOW, "UpdateGContact", $profile["gid"]);
}
return '';
}
- if (in_array($contact["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
+ if (in_array($contact["network"], array_merge(Protocol::FEDERATED ,['']))) {
$sql = "(`item`.`uid` = 0 OR (`item`.`uid` = ? AND NOT `item`.`global`))";
} else {
$sql = "`item`.`uid` = ?";
self::markForArchival($contact);
}
- $condition = ['self' => false, 'nurl' => Strings::normaliseLink($url),
- 'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]];
+ $condition = ['self' => false, 'nurl' => Strings::normaliseLink($url), 'network' => Protocol::FEDERATED];
// These contacts are sharing with us, we don't poll them.
// This means that we don't set the update fields in "OnePoll.php".
self::updateContact($id, $uid, $ret['url'], $ret);
// Update the corresponding gcontact entry
- PortableContact::lastUpdated($ret["url"]);
+// PortableContact::lastUpdated($ret["url"]);
+ GContact::updateFromProbe($ret['url']);
return true;
}
// We can always comment on posts from these networks
if (array_key_exists('writable', $row) &&
- in_array($row['internal-network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+ in_array($row['internal-network'], Protocol::FEDERATED)) {
$row['writable'] = true;
}
* We have to check several networks since Friendica posts could be repeated
* via OStatus (maybe Diasporsa as well)
*/
- if (in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DIASPORA, Protocol::DFRN, Protocol::OSTATUS, ""])) {
+ if (in_array($item['network'], array_merge(Protocol::FEDERATED ,['']))) {
$condition = ["`uri` = ? AND `uid` = ? AND `network` IN (?, ?, ?)",
trim($item['uri']), $item['uid'],
Protocol::DIASPORA, Protocol::DFRN, Protocol::OSTATUS];
// Only distribute public items from native networks
$condition = ['id' => $itemid, 'uid' => 0,
- 'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""],
+ 'network' => array_merge(Protocol::FEDERATED ,['']),
'visible' => true, 'deleted' => false, 'moderated' => false, 'private' => false];
$item = self::selectFirst(self::ITEM_FIELDLIST, $condition);
if (!DBA::isResult($item)) {
}
// is it an entry from a connector? Only add an entry for natively connected networks
- if (!in_array($item["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
+ if (!in_array($item["network"], array_merge(Protocol::FEDERATED ,['']))) {
return;
}
'pending' => false,
'hidden' => false,
'archive' => false,
- 'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA],
+ 'network' => Protocol::FEDERATED,
]);
}
}
$relation_text = '';
}
- if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
+ if (!in_array($contact['network'], Protocol::FEDERATED)) {
$relation_text = '';
}
$profiledata = Model\Contact::getDetailsByURL($contact['url']);
- if (local_user() && in_array($profiledata['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+ if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) {
$profiledata['remoteconnect'] = System::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);
}
// Check if the potential receiver is following the actor
// Exception: The receiver is targetted via "to" or this is a comment
if ((($element != 'as:to') && empty($replyto)) || ($contact['contact-type'] == Contact::TYPE_COMMUNITY)) {
- $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
+ $networks = Protocol::FEDERATED;
$condition = ['nurl' => Strings::normaliseLink($actor), 'rel' => [Contact::SHARING, Contact::FRIEND],
'network' => $networks, 'archive' => false, 'pending' => false, 'uid' => $contact['uid']];
public static function getReceiverForActor($actor, $tags)
{
$receivers = [];
- $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
+ $networks = Protocol::FEDERATED;
$condition = ['nurl' => Strings::normaliseLink($actor), 'rel' => [Contact::SHARING, Contact::FRIEND, Contact::FOLLOWER],
'network' => $networks, 'archive' => false, 'pending' => false];
$contacts = DBA::select('contact', ['uid', 'rel'], $condition);
if (Config::get('debug', 'total_ap_delivery')) {
// Will be activated in a later step
- $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
+ $networks = Protocol::FEDERATED;
} else {
// For now only send to these contacts:
$networks = [Protocol::ACTIVITYPUB, Protocol::OSTATUS];
if (Config::get('debug', 'total_ap_delivery')) {
// Will be activated in a later step
- $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
+ $networks = Protocol::FEDERATED;
} else {
// For now only send to these contacts:
$networks = [Protocol::ACTIVITYPUB, Protocol::OSTATUS];
return;
}
- if (!in_array($r[0]["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+ if (!in_array($r[0]["network"], Protocol::FEDERATED)) {
return;
}
$data = Probe::uri($r[0]["url"]);
- if (!in_array($data["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+ if (!in_array($data["network"], Protocol::FEDERATED)) {
if ($r[0]["server_url"] != "") {
PortableContact::checkServer($r[0]["server_url"], $r[0]["network"]);
}