use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
AND `contact`.`notify` != ""',
$gid,
local_user(),
- NETWORK_OSTATUS
+ Protocol::OSTATUS
);
$return = $contacts['count'];
}
*/
public static function terminateFriendship(array $user, array $contact)
{
- if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DFRN])) {
+ if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DFRN])) {
// create an unfollow slap
$item = [];
$item['verb'] = NAMESPACE_OSTATUS . "/unfollow";
if (!empty($contact['notify'])) {
Salmon::slapper($user, $contact['notify'], $slap);
}
- } elseif ($contact['network'] == NETWORK_DIASPORA) {
+ } elseif ($contact['network'] == Protocol::DIASPORA) {
Diaspora::sendUnshare($user, $contact);
}
}
// If there is more than one entry we filter out the connector networks
if (count($r) > 1) {
foreach ($r as $id => $result) {
- if ($result["network"] == NETWORK_STATUSNET) {
+ if ($result["network"] == Protocol::STATUSNET) {
unset($r[$id]);
}
}
}
if ((empty($profile["addr"]) || empty($profile["name"])) && (defaults($profile, "gid", 0) != 0)
- && in_array($profile["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])
+ && in_array($profile["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])
) {
Worker::add(PRIORITY_LOW, "UpdateGContact", $profile["gid"]);
}
// Show contact details of Diaspora contacts only if connected
- if ((defaults($profile, "cid", 0) == 0) && (defaults($profile, "network", "") == NETWORK_DIASPORA)) {
+ if ((defaults($profile, "cid", 0) == 0) && (defaults($profile, "network", "") == Protocol::DIASPORA)) {
$profile["location"] = "";
$profile["about"] = "";
$profile["gender"] = "";
}
$sparkle = false;
- if (($contact['network'] === NETWORK_DFRN) && !$contact['self']) {
+ if (($contact['network'] === Protocol::DFRN) && !$contact['self']) {
$sparkle = true;
$profile_link = System::baseUrl() . '/redir/' . $contact['id'];
} else {
$profile_link = $profile_link . '?url=profile';
}
- if (in_array($contact['network'], [NETWORK_DFRN, NETWORK_DIASPORA]) && !$contact['self']) {
+ if (in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA]) && !$contact['self']) {
$pm_url = System::baseUrl() . '/message/new/' . $contact['id'];
}
- if (($contact['network'] == NETWORK_DFRN) && !$contact['self']) {
+ if (($contact['network'] == Protocol::DFRN) && !$contact['self']) {
$poke_link = System::baseUrl() . '/poke/?f=&c=' . $contact['id'];
}
}
// Last try in gcontact for unsupported networks
- if (!in_array($data["network"], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_PUMPIO, NETWORK_MAIL, NETWORK_FEED])) {
+ if (!in_array($data["network"], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::PUMPIO, Protocol::MAIL, Protocol::FEED])) {
if ($uid != 0) {
return 0;
}
return '';
}
- if (in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""])) {
+ if (in_array($r[0]["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
$sql = "(`item`.`uid` = 0 OR (`item`.`uid` = ? AND NOT `item`.`global`))";
} else {
$sql = "`item`.`uid` = ?";
);
}
- if (($ret['network'] === NETWORK_DFRN) && !DBA::isResult($r)) {
+ if (($ret['network'] === Protocol::DFRN) && !DBA::isResult($r)) {
if ($interactive) {
if (strlen($a->urlpath)) {
$myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']);
// NOTREACHED
}
- } elseif (Config::get('system', 'dfrn_only') && ($ret['network'] != NETWORK_DFRN)) {
+ } elseif (Config::get('system', 'dfrn_only') && ($ret['network'] != Protocol::DFRN)) {
$result['message'] = L10n::t('This site is not configured to allow communications with other networks.') . EOL;
$result['message'] != L10n::t('No compatible communication protocols or feeds were discovered.') . EOL;
return $result;
}
// This extra param just confuses things, remove it
- if ($ret['network'] === NETWORK_DIASPORA) {
+ if ($ret['network'] === Protocol::DIASPORA) {
$ret['url'] = str_replace('?absolute=true', '', $ret['url']);
}
return $result;
}
- if ($ret['network'] === NETWORK_OSTATUS && Config::get('system', 'ostatus_disabled')) {
+ if ($ret['network'] === Protocol::OSTATUS && Config::get('system', 'ostatus_disabled')) {
$result['message'] .= L10n::t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
$ret['notify'] = '';
}
$result['message'] .= L10n::t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
}
- $writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0);
+ $writeable = ((($ret['network'] === Protocol::OSTATUS) && ($ret['notify'])) ? 1 : 0);
- $subhub = (($ret['network'] === NETWORK_OSTATUS) ? true : false);
+ $subhub = (($ret['network'] === Protocol::OSTATUS) ? true : false);
- $hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
+ $hidden = (($ret['network'] === Protocol::MAIL) ? 1 : 0);
- if (in_array($ret['network'], [NETWORK_MAIL, NETWORK_DIASPORA])) {
+ if (in_array($ret['network'], [Protocol::MAIL, Protocol::DIASPORA])) {
$writeable = 1;
}
$fields = ['rel' => $new_relation, 'subhub' => $subhub, 'readonly' => false];
DBA::update('contact', $fields, ['id' => $r[0]['id']]);
} else {
- $new_relation = ((in_array($ret['network'], [NETWORK_MAIL])) ? self::FRIEND : self::SHARING);
+ $new_relation = ((in_array($ret['network'], [Protocol::MAIL])) ? self::FRIEND : self::SHARING);
// create contact record
DBA::insert('contact', [
);
if (DBA::isResult($r)) {
- if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DFRN])) {
+ if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DFRN])) {
// create a follow slap
$item = [];
$item['verb'] = ACTIVITY_FOLLOW;
if (!empty($contact['notify'])) {
Salmon::slapper($r[0], $contact['notify'], $slap);
}
- } elseif ($contact['network'] == NETWORK_DIASPORA) {
+ } elseif ($contact['network'] == Protocol::DIASPORA) {
$ret = Diaspora::sendShare($a->user, $contact);
logger('share returns: ' . $ret);
}
*/
public static function magicLinkbyContact($contact, $url = '')
{
- if ($contact['network'] != NETWORK_DFRN) {
+ if ($contact['network'] != Protocol::DFRN) {
return $url ?: $contact['url']; // Equivalent to ($url != '') ? $url : $contact['url'];
}